GTSAM  4.0.2
C++ library for smoothing and mapping (SAM)
Public Types | Static Public Member Functions | Protected Types | Protected Attributes | List of all members
gtsam::WhiteNoiseFactor Class Reference

Binary factor to estimate parameters of zero-mean Gaussian white noise. More...

#include <WhiteNoiseFactor.h>

Inheritance diagram for gtsam::WhiteNoiseFactor:
Inheritance graph
[legend]
Collaboration diagram for gtsam::WhiteNoiseFactor:
Collaboration graph
[legend]

Public Types

typedef std::shared_ptr< Thisshared_ptr
 
typedef KeyVector::iterator iterator
 Iterator over keys.
 
typedef KeyVector::const_iterator const_iterator
 Const iterator over keys.
 

Static Public Member Functions

static double f (double z, double u, double p)
 negative log likelihood as a function of mean \( \mu \) and precision \( \tau \)

\[ f(z, \tau, \mu) = -\log \left( \frac{\sqrt{\tau}}{\sqrt{2\pi}} \exp(-0.5\tau(z-\mu)^2) \right) = \log(\sqrt{2\pi}) - 0.5* \log(\tau) + 0.5\tau(z-\mu)^2 \]


 
static HessianFactor::shared_ptr linearize (double z, double u, double p, Key j1, Key j2)
 linearize returns a Hessianfactor that approximates error Hessian is

\[ 0.5f - x^T g + 0.5*x^T G x \]

Taylor expansion is

\[ f(x+dx) = f(x) + df(x) dx + 0.5 ddf(x) dx^2 \]

So f = 2 f(x), g = -df(x), G = ddf(x)

 

Protected Types

typedef NonlinearFactor This
 

Protected Attributes

KeyVector keys_
 The keys involved in this factor.
 

Standard Constructors

template<typename CONTAINER >
static Factor FromKeys (const CONTAINER &keys)
 
template<typename ITERATOR >
static Factor FromIterators (ITERATOR first, ITERATOR last)
 

Standard Interface

bool empty () const
 Whether the factor is empty (involves zero variables).
 
Key front () const
 First key.
 
Key back () const
 Last key.
 
const_iterator find (Key key) const
 find
 
const KeyVectorkeys () const
 Access the factor's involved variable keys.
 
const_iterator begin () const
 
const_iterator end () const
 
size_t size () const
 

Testable

bool equals (const This &other, double tol=1e-9) const
 check equality
 
virtual void printKeys (const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
 print only keys
 

Advanced Interface

KeyVectorkeys ()
 
iterator begin ()
 
iterator end ()
 

Testable

virtual bool equals (const NonlinearFactor &f, double tol=1e-9) const
 

Standard Interface

double error (const HybridValues &c) const override
 
virtual bool active (const Values &) const
 
virtual shared_ptr clone () const
 
virtual shared_ptr rekey (const std::map< Key, Key > &rekey_mapping) const
 
virtual shared_ptr rekey (const KeyVector &new_keys) const
 
virtual bool sendable () const
 

Standard Constructors

 WhiteNoiseFactor (double z, Key meanKey, Key precisionKey)
 

Advanced Constructors

 ~WhiteNoiseFactor () override
 Destructor.
 

Testable

void print (const std::string &p="WhiteNoiseFactor", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
 Print.
 

Standard Interface

size_t dim () const override
 get the dimension of the factor (number of rows on linearization)
 
double error (const Values &x) const override
 Calculate the error of the factor, typically equal to log-likelihood.
 
virtual Vector unwhitenedError (const Values &x) const
 

Advanced Interface

std::shared_ptr< GaussianFactorlinearize (const Values &x) const override
 linearize returns a Hessianfactor that is an approximation of error(p)
 

Detailed Description

Binary factor to estimate parameters of zero-mean Gaussian white noise.

This factor uses the mean-precision parameterization.

Takes three template arguments: Key: key type to use for mean Key: key type to use for precision Values: Values type for optimization

Constructor & Destructor Documentation

◆ WhiteNoiseFactor()

gtsam::WhiteNoiseFactor::WhiteNoiseFactor ( double  z,
Key  meanKey,
Key  precisionKey 
)
inline

Construct from measurement

Parameters
zMeasurment value
meanKeyKey for mean variable
precisionKeyKey for precision variable

Member Function Documentation

◆ active()

virtual bool gtsam::NonlinearFactor::active ( const Values ) const
inlinevirtualinherited

Checks whether a factor should be used based on a set of values. This is primarily used to implement inequality constraints that require a variable active set. For all others, the default implementation returning true solves this problem.

In an inequality/bounding constraint, this active() returns true when the constraint is NOT fulfilled.

Returns
true if the constraint is active

Reimplemented in gtsam::BoundingConstraint2< VALUE1, VALUE2 >, gtsam::AntiFactor, and gtsam::BoundingConstraint1< VALUE >.

◆ begin() [1/2]

const_iterator gtsam::Factor::begin ( ) const
inlineinherited

Iterator at beginning of involved variable keys

◆ begin() [2/2]

iterator gtsam::Factor::begin ( )
inlineinherited

Iterator at beginning of involved variable keys

◆ clone()

virtual shared_ptr gtsam::NonlinearFactor::clone ( ) const
inlinevirtualinherited

Creates a shared_ptr clone of the factor - needs to be specialized to allow for subclasses

By default, throws exception if subclass does not implement the function.

Reimplemented in gtsam::EssentialMatrixFactor4< CALIBRATION >, gtsam::NonlinearEquality2< T >, gtsam::CombinedImuFactor, gtsam::ImuFactor2, gtsam::EssentialMatrixFactor3, gtsam::NonlinearEquality1< VALUE >, gtsam::GeneralSFMFactor2< CALIBRATION >, gtsam::ImuFactor, gtsam::LinearizedHessianFactor, gtsam::PendulumFactorPk1, gtsam::FunctorizedFactor2< R, T1, T2 >, gtsam::MagFactor3, gtsam::Pose3AttitudeFactor, gtsam::SmartRangeFactor, gtsam::NonlinearEquality< VALUE >, gtsam::AHRSFactor, gtsam::EssentialMatrixFactor2, gtsam::ExpressionFactor< T >, gtsam::ExpressionFactor< BearingRange< A1, A2 > >, gtsam::ExpressionFactor< double >, gtsam::MagFactor2, gtsam::PendulumFactorPk, gtsam::GPSFactor2, gtsam::ProjectionFactorRollingShutter, gtsam::RangeFactorWithTransform< A1, A2, T >, gtsam::LinearContainerFactor, gtsam::LinearizedJacobianFactor, gtsam::Rot3AttitudeFactor, gtsam::MagFactor1, gtsam::GenericProjectionFactor< POSE, LANDMARK, CALIBRATION >, gtsam::DiscreteEulerPoincareHelicopter, gtsam::MultiProjectionFactor< POSE, LANDMARK, CALIBRATION >, gtsam::GeneralSFMFactor< CAMERA, LANDMARK >, gtsam::ProjectionFactorPPP< POSE, LANDMARK, CALIBRATION >, gtsam::TransformBtwRobotsUnaryFactorEM< VALUE >, gtsam::GenericStereoFactor< POSE, LANDMARK >, gtsam::TriangulationFactor< CAMERA >, gtsam::RotateDirectionsFactor, gtsam::PendulumFactor2, gtsam::ReferenceFrameFactor< POINT, TRANSFORM >, gtsam::FunctorizedFactor< R, T >, gtsam::PartialPriorFactor< VALUE >, gtsam::FunctorizedFactor< Vector, ParameterMatrix< M > >, gtsam::FunctorizedFactor< double, BASIS::Parameters >, gtsam::FunctorizedFactor< double, Vector >, gtsam::FunctorizedFactor< T, ParameterMatrix< traits< T >::dimension > >, gtsam::FunctorizedFactor< double, ParameterMatrix< P > >, gtsam::PartialPriorFactor< PoseRTV >, gtsam::MagPoseFactor< POSE >, gtsam::ProjectionFactorPPPC< POSE, LANDMARK, CALIBRATION >, gtsam::TransformBtwRobotsUnaryFactor< VALUE >, gtsam::BetweenFactor< VALUE >, gtsam::EssentialMatrixFactor, gtsam::VelocityConstraint, gtsam::PriorFactor< VALUE >, gtsam::GPSFactor, gtsam::PoseToPointFactor< POSE, POINT >, gtsam::BarometricFactor, gtsam::EssentialMatrixConstraint, gtsam::DummyFactor, gtsam::PoseBetweenFactor< POSE >, gtsam::BearingRangeFactor< A1, A2, B, R >, gtsam::PosePriorFactor< POSE >, gtsam::MagFactor, gtsam::PoseTranslationPrior< POSE >, gtsam::PoseRotationPrior< POSE >, gtsam::FullIMUFactor< POSE >, gtsam::AntiFactor, gtsam::RangeFactor< A1, A2, T >, gtsam::IMUFactor< POSE >, gtsam::RelativeElevationFactor, gtsam::PendulumFactor1, gtsam::Reconstruction, gtsam::RotateFactor, and gtsam::VelocityConstraint3.

◆ end() [1/2]

const_iterator gtsam::Factor::end ( ) const
inlineinherited

Iterator at end of involved variable keys

◆ end() [2/2]

iterator gtsam::Factor::end ( )
inlineinherited

Iterator at end of involved variable keys

◆ equals()

virtual bool gtsam::NonlinearFactor::equals ( const NonlinearFactor f,
double  tol = 1e-9 
) const
virtualinherited

Check if two factors are equal

Reimplemented in gtsam::CombinedImuFactor, gtsam::ImuFactor2, gtsam::GeneralSFMFactor2< CALIBRATION >, gtsam::NoiseModelFactor, gtsam::SmartProjectionPoseFactorRollingShutter< CAMERA >, gtsam::FunctorizedFactor2< R, T1, T2 >, gtsam::ImuFactor, gtsam::LinearizedHessianFactor, gtsam::InvDepthFactorVariant3b, gtsam::Pose3AttitudeFactor, gtsam::SmartProjectionRigFactor< CAMERA >, gtsam::SmartFactorBase< CAMERA >, gtsam::SmartFactorBase< PinholePose< CALIBRATION > >, gtsam::SmartFactorBase< StereoCamera >, gtsam::SmartFactorBase< PinholeCamera< Cal3Bundler > >, gtsam::AHRSFactor, gtsam::ProjectionFactorRollingShutter, gtsam::GPSFactor2, gtsam::EquivInertialNavFactor_GlobalVel_NoBias< POSE, VELOCITY >, gtsam::EquivInertialNavFactor_GlobalVel< POSE, VELOCITY, IMUBIAS >, gtsam::FrobeniusBetweenFactor< Rot >, gtsam::InertialNavFactor_GlobalVelocity< POSE, VELOCITY, IMUBIAS >, gtsam::SmartStereoProjectionFactorPP, gtsam::GenericProjectionFactor< POSE, LANDMARK, CALIBRATION >, gtsam::LinearizedJacobianFactor, gtsam::Rot3AttitudeFactor, gtsam::MultiProjectionFactor< POSE, LANDMARK, CALIBRATION >, gtsam::TransformBtwRobotsUnaryFactorEM< VALUE >, gtsam::NonlinearEquality< VALUE >, gtsam::GeneralSFMFactor< CAMERA, LANDMARK >, gtsam::SmartStereoProjectionPoseFactor, gtsam::SmartStereoProjectionFactor, gtsam::GenericStereoFactor< POSE, LANDMARK >, gtsam::ProjectionFactorPPP< POSE, LANDMARK, CALIBRATION >, gtsam::TriangulationFactor< CAMERA >, gtsam::SmartProjectionFactor< CAMERA >, gtsam::SmartProjectionFactor< PinholePose< CALIBRATION > >, gtsam::FunctorizedFactor< R, T >, gtsam::FunctorizedFactor< Vector, ParameterMatrix< M > >, gtsam::FunctorizedFactor< double, BASIS::Parameters >, gtsam::FunctorizedFactor< double, Vector >, gtsam::FunctorizedFactor< T, ParameterMatrix< traits< T >::dimension > >, gtsam::FunctorizedFactor< double, ParameterMatrix< P > >, gtsam::SmartProjectionPoseFactor< CALIBRATION >, gtsam::MagPoseFactor< POSE >, gtsam::ProjectionFactorPPPC< POSE, LANDMARK, CALIBRATION >, gtsam::PartialPriorFactor< VALUE >, gtsam::TransformBtwRobotsUnaryFactor< VALUE >, gtsam::PartialPriorFactor< PoseRTV >, gtsam::BetweenFactor< VALUE >, gtsam::BetweenFactorEM< VALUE >, gtsam::ExpressionFactor< T >, gtsam::ExpressionFactor< BearingRange< A1, A2 > >, gtsam::ExpressionFactor< double >, gtsam::PriorFactor< VALUE >, gtsam::SmartRangeFactor, gtsam::GaussMarkov1stOrderFactor< VALUE >, gtsam::PoseBetweenFactor< POSE >, gtsam::InvDepthFactor3< POSE, LANDMARK, INVDEPTH >, gtsam::GPSFactor, gtsam::InvDepthFactorVariant2, gtsam::OrientedPlane3DirectionPrior, gtsam::PoseTranslationPrior< POSE >, gtsam::InvDepthFactorVariant3a, gtsam::BarometricFactor, gtsam::EssentialMatrixConstraint, gtsam::InvDepthFactorVariant1, gtsam::PosePriorFactor< POSE >, gtsam::BiasedGPSFactor, gtsam::ShonanFactor< d >, gtsam::PoseRotationPrior< POSE >, gtsam::LinearContainerFactor, gtsam::AntiFactor, gtsam::FullIMUFactor< POSE >, gtsam::PoseToPointFactor< POSE, POINT >, gtsam::RelativeElevationFactor, gtsam::IMUFactor< POSE >, and gtsam::DummyFactor.

◆ error()

double gtsam::NonlinearFactor::error ( const HybridValues c) const
overridevirtualinherited

All factor types need to implement an error function. In factor graphs, this is the negative log-likelihood.

Reimplemented from gtsam::Factor.

◆ FromIterators()

template<typename ITERATOR >
static Factor gtsam::Factor::FromIterators ( ITERATOR  first,
ITERATOR  last 
)
inlinestaticprotectedinherited

Construct factor from iterator keys. This is called internally from derived factor static factor methods, as a workaround for not being able to call the protected constructors above.

◆ FromKeys()

template<typename CONTAINER >
static Factor gtsam::Factor::FromKeys ( const CONTAINER &  keys)
inlinestaticprotectedinherited

Construct factor from container of keys. This is called internally from derived factor static factor methods, as a workaround for not being able to call the protected constructors above.

◆ keys()

KeyVector& gtsam::Factor::keys ( )
inlineinherited
Returns
keys involved in this factor

◆ rekey() [1/2]

virtual shared_ptr gtsam::NonlinearFactor::rekey ( const std::map< Key, Key > &  rekey_mapping) const
virtualinherited

Creates a shared_ptr clone of the factor with different keys using a map from old->new keys

Reimplemented in gtsam::LinearContainerFactor.

◆ rekey() [2/2]

virtual shared_ptr gtsam::NonlinearFactor::rekey ( const KeyVector new_keys) const
virtualinherited

Clones a factor and fully replaces its keys

Parameters
new_keysis the full replacement set of keys

Reimplemented in gtsam::LinearContainerFactor.

◆ sendable()

virtual bool gtsam::NonlinearFactor::sendable ( ) const
inlinevirtualinherited

Should the factor be evaluated in the same thread as the caller This is to enable factors that has shared states (like the Python GIL lock)

Reimplemented in gtsam::CustomFactor.

◆ size()

size_t gtsam::Factor::size ( ) const
inlineinherited
Returns
the number of variables involved in this factor

◆ unwhitenedError()

virtual Vector gtsam::WhiteNoiseFactor::unwhitenedError ( const Values x) const
inlinevirtual

Vector of errors "unwhitened" does not make sense for this factor What is meant typically is only "e" above Here we shoehorn sqrt(2*error(p)) TODO: Where is this used? should disappear.


The documentation for this class was generated from the following file: