GTSAM  4.0.2
C++ library for smoothing and mapping (SAM)
Public Types | Protected Attributes | List of all members
gtsam::GaussianFactor Class Referenceabstract

#include <GaussianFactor.h>

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

Public Types

typedef GaussianFactor This
 This class.
 
typedef std::shared_ptr< Thisshared_ptr
 shared_ptr to this class
 
typedef Factor Base
 Our base class.
 
typedef KeyVector::iterator iterator
 Iterator over keys.
 
typedef KeyVector::const_iterator const_iterator
 Const iterator over keys.
 

Public Member Functions

Standard Constructors
 GaussianFactor ()
 
template<typename CONTAINER >
 GaussianFactor (const CONTAINER &keys)
 
Testable
void print (const std::string &s="", const KeyFormatter &formatter=DefaultKeyFormatter) const override=0
 print with optional string
 
virtual bool equals (const GaussianFactor &lf, double tol=1e-9) const =0
 assert equality up to a tolerance
 
Standard Interface
virtual double error (const VectorValues &c) const
 
double error (const HybridValues &c) const override
 
virtual DenseIndex getDim (const_iterator variable) const =0
 
virtual Matrix augmentedJacobian () const =0
 
virtual std::pair< Matrix, Vector > jacobian () const =0
 
virtual Matrix augmentedInformation () const =0
 
virtual Matrix information () const =0
 
VectorValues hessianDiagonal () const
 Return the diagonal of the Hessian for this factor.
 
virtual void hessianDiagonalAdd (VectorValues &d) const =0
 Add the current diagonal to a VectorValues instance.
 
virtual void hessianDiagonal (double *d) const =0
 Raw memory access version of hessianDiagonal.
 
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
 
virtual GaussianFactor::shared_ptr negate () const =0
 
virtual void updateHessian (const KeyVector &keys, SymmetricBlockMatrix *info) const =0
 
Operator interface
virtual void multiplyHessianAdd (double alpha, const VectorValues &x, VectorValues &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
 Raw memory access version of gradientAtZero.
 
virtual Vector gradient (Key key, const VectorValues &x) const =0
 Gradient wrt a key at any values.
 
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
 
Advanced Interface
KeyVectorkeys ()
 
iterator begin ()
 
iterator end ()
 
Testable
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
 

Static Public Member Functions

Advanced Interface
template<typename CONTAINER >
static DenseIndex Slot (const CONTAINER &keys, Key key)
 

Static Protected Member Functions

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

Protected Attributes

KeyVector keys_
 The keys involved in this factor.
 

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)

Constructor & Destructor Documentation

◆ GaussianFactor() [1/2]

gtsam::GaussianFactor::GaussianFactor ( )
inline

Default constructor creates empty factor

◆ GaussianFactor() [2/2]

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

◆ augmentedInformation()

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::RegularImplicitSchurFactor< CAMERA >.

◆ augmentedJacobian()

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::RegularImplicitSchurFactor< CAMERA >.

◆ 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 GaussianFactor::shared_ptr gtsam::GaussianFactor::clone ( ) const
pure virtual

◆ 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

◆ error()

double gtsam::GaussianFactor::error ( const HybridValues c) const
overridevirtual

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.

◆ getDim()

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

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

Implemented in gtsam::JacobianFactor, gtsam::HessianFactor, and gtsam::RegularImplicitSchurFactor< CAMERA >.

◆ information()

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

Return the non-augmented information matrix represented by this GaussianFactor.

Implemented in gtsam::HessianFactor, gtsam::JacobianFactor, and gtsam::RegularImplicitSchurFactor< CAMERA >.

◆ jacobian()

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::RegularImplicitSchurFactor< CAMERA >.

◆ keys()

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

◆ negate()

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::JacobianFactor, gtsam::RegularImplicitSchurFactor< CAMERA >, and gtsam::HessianFactor.

◆ size()

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

◆ updateHessian()

virtual void gtsam::GaussianFactor::updateHessian ( const KeyVector keys,
SymmetricBlockMatrix info 
) const
pure virtual

Update an information matrix by adding the information corresponding to this factor (used internally during elimination).

Parameters
scatterA mapping from variable index to slot index in this HessianFactor
infoThe information matrix to be updated

Implemented in gtsam::HessianFactor, gtsam::JacobianFactor, gtsam::RegularImplicitSchurFactor< CAMERA >, and gtsam::BinaryJacobianFactor< M, N1, N2 >.


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