Loading...
Searching...
No Matches
gtsam::WhiteNoiseFactor Class Reference

## 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

Inheritance diagram for gtsam::WhiteNoiseFactor:

## Standard Constructors

| WhiteNoiseFactor (double z, Key meanKey, Key precisionKey)
| Construct from measurement.

## 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
| 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?

## Advanced Interface

boost::shared_ptr< GaussianFactor > | linearize (const Values &x) const override
| linearize returns a Hessianfactor that is an approximation of error(p)

## 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 \)
static HessianFactor::shared_ptr | linearize (double z, double u, double p, Key j1, Key j2)
| linearize returns a Hessianfactor that approximates error Hessian is

## Additional Inherited Members

| NonlinearFactor ()
| Default constructor for I/O only.
template<typename CONTAINER>
| NonlinearFactor (const CONTAINER &keys)
| Constructor from a collection of the keys involved in this factor.
virtual bool | equals (const NonlinearFactor &f, double tol=1e-9) const
| Check if two factors are equal.
virtual | ~NonlinearFactor ()
| Destructor.
double | error (const HybridValues &c) const override
| All factor types need to implement an error function.
virtual bool | active (const Values &) const
| Checks whether a factor should be used based on a set of values.
virtual shared_ptr | clone () const
| Creates a shared_ptr clone of the factor - needs to be specialized to allow for subclasses.
virtual shared_ptr | rekey (const std::map< Key, Key > &rekey_mapping) const
| Creates a shared_ptr clone of the factor with different keys using a map from old->new keys.
virtual shared_ptr | rekey (const KeyVector &new_keys) const
| Clones a factor and fully replaces its keys.
virtual bool | sendable () const
| 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).
Public Member Functions inherited from gtsam::Factor
virtual | ~Factor ()=default
| Default destructor.
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 KeyVector & | keys () const
| Access the factor's involved variable keys.
const_iterator | begin () const
| Iterator at beginning of involved variable keys.
const_iterator | end () const
| Iterator at end of involved variable keys.
size_t | size () const
virtual void | printKeys (const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
| print only keys
bool | equals (const This &other, double tol=1e-9) const
| check equality
KeyVector & | keys ()
iterator | begin ()
| Iterator at beginning of involved variable keys.
iterator | end ()
| Iterator at end of involved variable keys.
Public Types inherited from gtsam::NonlinearFactor
typedef boost::shared_ptr< This > | shared_ptr
Public Types inherited from gtsam::Factor
typedef KeyVector::iterator | iterator
| Iterator over keys.
typedef KeyVector::const_iterator | const_iterator
| Const iterator over keys.
Protected Types inherited from gtsam::NonlinearFactor
typedef Factor | Base
typedef NonlinearFactor | This
| Factor ()
| Default constructor for I/O.
template<typename CONTAINER>
| Factor (const CONTAINER &keys)
| Construct factor from container of keys.
template<typename ITERATOR>
| Factor (ITERATOR first, ITERATOR last)
| Construct factor from iterator keys.
template<typename CONTAINER>
static Factor | FromKeys (const CONTAINER &keys)
| Construct factor from container of keys.
template<typename ITERATOR>
static Factor | FromIterators (ITERATOR first, ITERATOR last)
| Construct factor from iterator keys.
Protected Attributes inherited from gtsam::Factor
KeyVector | keys_
| The keys involved in this factor.

## Constructor & Destructor Documentation

## WhiteNoiseFactor()

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

inline

Construct from measurement.

Parameters

  z | Measurment value
  meanKey | Key for mean variable
  precisionKey | Key for precision variable

## Member Function Documentation

## dim()

size_t gtsam::WhiteNoiseFactor::dim | ( |  | ) | const

inline override virtual

get the dimension of the factor (number of rows on linearization)

Implements gtsam::NonlinearFactor.

## error()

double gtsam::WhiteNoiseFactor::error | ( | const Values & | x | ) | const

inline override virtual

Calculate the error of the factor, typically equal to log-likelihood.

Reimplemented from gtsam::NonlinearFactor.

## f()

double gtsam::WhiteNoiseFactor::f | ( | double | z,
|  | double | u,
|  | double | p )

inline static

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 \]

## linearize() [1/2]

boost::shared_ptr< GaussianFactor > gtsam::WhiteNoiseFactor::linearize | ( | const Values & | x | ) | const

inline override virtual

linearize returns a Hessianfactor that is an approximation of error(p)

Implements gtsam::NonlinearFactor.

## linearize() [2/2]

HessianFactor::shared_ptr gtsam::WhiteNoiseFactor::linearize | ( | double | z,
|  | double | u,
|  | double | p,
|  | Key | j1,
|  | Key | j2 )

inline static

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)

## print()

void gtsam::WhiteNoiseFactor::print | ( | const std::string & | p = "WhiteNoiseFactor",
|  | const KeyFormatter & | keyFormatter = DefaultKeyFormatter ) const

inline override virtual

Print.

Reimplemented from gtsam::NonlinearFactor.

## unwhitenedError()

virtual Vector gtsam::WhiteNoiseFactor::unwhitenedError | ( | const Values & | x | ) | const

inline virtual

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:

- /build/gtsam-Xg031d/gtsam-4.2.0+dfsg/gtsam/nonlinear/WhiteNoiseFactor.h