gtsam  3.2.0
gtsam
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gtsam::GaussianFactor Class Referenceabstract

Detailed Description

An abstract virtual base class for JacobianFactor and HessianFactor.

A GaussianFactor has a quadratic error function. GaussianFactor is non-mutable (all methods const!). The factor value is exp(-0.5*||Ax-b||^2)

+ Inheritance diagram for gtsam::GaussianFactor:

Public Member Functions

 GaussianFactor ()
 Default constructor creates empty factor.
 
template<typename CONTAINER >
 GaussianFactor (const CONTAINER &keys)
 Construct from container of keys. More...
 
virtual ~GaussianFactor ()
 Destructor.
 
virtual void print (const std::string &s="", const KeyFormatter &formatter=DefaultKeyFormatter) const =0
 
virtual bool equals (const GaussianFactor &lf, double tol=1e-9) const =0
 Equals for testable.
 
virtual double error (const VectorValues &c) const =0
 Print for testable.
 
virtual DenseIndex getDim (const_iterator variable) const =0
 0.5*(A*x-b)'D(A*x-b) More...
 
virtual Matrix augmentedJacobian () const =0
 Return a dense \( [ \;A\;b\; ] \in \mathbb{R}^{m \times n+1} \) Jacobian matrix, augmented with b with the noise models baked into A and b. More...
 
virtual std::pair< Matrix, Vector > jacobian () const =0
 Return the dense Jacobian \( A \) and right-hand-side \( b \), with the noise models baked into A and b. More...
 
virtual Matrix augmentedInformation () const =0
 Return the augmented information matrix represented by this GaussianFactor. More...
 
virtual Matrix information () const =0
 Return the non-augmented information matrix represented by this GaussianFactor.
 
virtual VectorValues hessianDiagonal () const =0
 Return the diagonal of the Hessian for this factor.
 
virtual void hessianDiagonal (double *d) const =0
 Return the diagonal of the Hessian for this factor (raw memory version)
 
virtual std::map< Key, Matrix > hessianBlockDiagonal () const =0
 Return the block diagonal of the Hessian for this factor.
 
virtual GaussianFactor::shared_ptr clone () const =0
 Clone a factor (make a deep copy)
 
virtual bool empty () const =0
 Test whether the factor is empty.
 
virtual GaussianFactor::shared_ptr negate () const =0
 Construct the corresponding anti-factor to negate information stored stored in this factor. More...
 
virtual void multiplyHessianAdd (double alpha, const VectorValues &x, VectorValues &y) const =0
 y += alpha * A'*A*x
 
virtual void multiplyHessianAdd (double alpha, const double *x, double *y, std::vector< size_t > keys) const =0
 y += alpha * A'*A*x
 
virtual void multiplyHessianAdd (double alpha, const double *x, double *y) const =0
 y += alpha * A'*A*x
 
virtual VectorValues gradientAtZero () const =0
 A'*b for Jacobian, eta for Hessian.
 
virtual void gradientAtZero (double *d) const =0
 A'*b for Jacobian, eta for Hessian (raw memory version)
 
- Public Member Functions inherited from gtsam::Factor
Key front () const
 First key.
 
Key back () const
 Last key.
 
const_iterator find (Key key) const
 find
 
const FastVector< Key > & 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
 
void print (const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
 print
 
void printKeys (const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
 print only keys
 
FastVector< Key > & keys ()
 
iterator begin ()
 Iterator at beginning of involved variable keys.
 
iterator end ()
 Iterator at end of involved variable keys.
 

Public Types

typedef GaussianFactor This
 This class.
 
typedef boost::shared_ptr< Thisshared_ptr
 shared_ptr to this class
 
typedef Factor Base
 Our base class.
 
- Public Types inherited from gtsam::Factor
typedef FastVector< Key >::iterator iterator
 Iterator over keys.
 
typedef FastVector< Key >
::const_iterator 
const_iterator
 Const iterator over keys.
 

Friends

class boost::serialization::access
 Serialization function.
 

Additional Inherited Members

- Protected Member Functions inherited from gtsam::Factor
 Factor ()
 Default constructor for I/O.
 
template<typename CONTAINER >
 Factor (const CONTAINER &keys)
 Construct factor from container of keys. More...
 
template<typename ITERATOR >
 Factor (ITERATOR first, ITERATOR last)
 Construct factor from iterator keys. More...
 
bool equals (const This &other, double tol=1e-9) const
 check equality
 
- Static Protected Member Functions inherited from gtsam::Factor
template<typename CONTAINER >
static Factor FromKeys (const CONTAINER &keys)
 Construct factor from container of keys. More...
 
template<typename ITERATOR >
static Factor FromIterators (ITERATOR first, ITERATOR last)
 Construct factor from iterator keys. More...
 
- Protected Attributes inherited from gtsam::Factor
FastVector< Keykeys_
 The keys involved in this factor.
 

Constructor & Destructor Documentation

template<typename CONTAINER >
gtsam::GaussianFactor::GaussianFactor ( const CONTAINER &  keys)
inline

Construct from container of keys.

This constructor is used internally from derived factor constructors, either from a container of keys or from a boost::assign::list_of.

Member Function Documentation

virtual Matrix gtsam::GaussianFactor::augmentedInformation ( ) const
pure virtual

Return the augmented information matrix represented by this GaussianFactor.

The augmented information matrix contains the information matrix with an additional column holding the information vector, and an additional row holding the transpose of the information vector. The lower-right entry contains the constant error term (when \( \delta x = 0 \)). The augmented information matrix is described in more detail in HessianFactor, which in fact stores an augmented information matrix.

Implemented in gtsam::HessianFactor, gtsam::JacobianFactor, and gtsam::ImplicitSchurFactor< D >.

virtual Matrix gtsam::GaussianFactor::augmentedJacobian ( ) const
pure virtual

Return a dense \( [ \;A\;b\; ] \in \mathbb{R}^{m \times n+1} \) Jacobian matrix, augmented with b with the noise models baked into A and b.

The negative log-likelihood is \( \frac{1}{2} \Vert Ax-b \Vert^2 \). See also GaussianFactorGraph::jacobian and GaussianFactorGraph::sparseJacobian.

Implemented in gtsam::HessianFactor, gtsam::JacobianFactor, and gtsam::ImplicitSchurFactor< D >.

virtual DenseIndex gtsam::GaussianFactor::getDim ( const_iterator  variable) const
pure virtual

0.5*(A*x-b)'D(A*x-b)

Return the dimension of the variable pointed to by the given key iterator

Implemented in gtsam::JacobianFactor, gtsam::HessianFactor, and gtsam::ImplicitSchurFactor< D >.

virtual std::pair<Matrix,Vector> gtsam::GaussianFactor::jacobian ( ) const
pure virtual

Return the dense Jacobian \( A \) and right-hand-side \( b \), with the noise models baked into A and b.

The negative log-likelihood is \( \frac{1}{2} \Vert Ax-b \Vert^2 \). See also GaussianFactorGraph::augmentedJacobian and GaussianFactorGraph::sparseJacobian.

Implemented in gtsam::HessianFactor, gtsam::JacobianFactor, and gtsam::ImplicitSchurFactor< D >.

virtual GaussianFactor::shared_ptr gtsam::GaussianFactor::negate ( ) const
pure virtual

Construct the corresponding anti-factor to negate information stored stored in this factor.

Returns
a HessianFactor with negated Hessian matrices

Implemented in gtsam::HessianFactor, gtsam::JacobianFactor, and gtsam::ImplicitSchurFactor< D >.


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