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

Detailed Description

This is the base class for all factor types.

It is templated on a KEY type, which will be the type used to label variables. Key types currently in use in gtsam are Index with symbolic (IndexFactor, SymbolicFactorGraph) and Gaussian factors (GaussianFactor, JacobianFactor, HessianFactor, GaussianFactorGraph), and Key with nonlinear factors (NonlinearFactor, NonlinearFactorGraph). though currently only IndexFactor and IndexConditional derive from this class, using Index keys. This class does not store any data other than its keys. Derived classes store data such as matrices and probability tables.

Note that derived classes must redefine the ConditionalType and shared_ptr typedefs to refer to the associated conditional and shared_ptr types of the derived class. See IndexFactor, JacobianFactor, etc. for examples.

This class is not virtual for performance reasons - derived symbolic classes, IndexFactor and IndexConditional, need to be created and destroyed quickly during symbolic elimination. GaussianFactor and NonlinearFactor are virtual.

+ Inheritance diagram for gtsam::Factor:

Standard Constructors

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

Standard Interface

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
 

Testable

bool equals (const This &other, double tol=1e-9) const
 check equality
 
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
 

Advanced Interface

class boost::serialization::access
 Serialization function.
 
FastVector< Key > & keys ()
 
iterator begin ()
 Iterator at beginning of involved variable keys.
 
iterator end ()
 Iterator at end of involved variable keys.
 

Public Types

typedef FastVector< Key >::iterator iterator
 Iterator over keys.
 
typedef FastVector< Key >
::const_iterator 
const_iterator
 Const iterator over keys.
 

Protected Attributes

FastVector< Keykeys_
 The keys involved in this factor.
 

Constructor & Destructor Documentation

template<typename CONTAINER >
gtsam::Factor::Factor ( const CONTAINER &  keys)
inlineexplicitprotected

Construct factor 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.

template<typename ITERATOR >
gtsam::Factor::Factor ( ITERATOR  first,
ITERATOR  last 
)
inlineprotected

Construct factor from iterator keys.

This constructor may be used internally from derived factor constructors, although our code currently does not use this.

Member Function Documentation

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

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.

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

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.

FastVector<Key>& gtsam::Factor::keys ( )
inline
Returns
keys involved in this factor
size_t gtsam::Factor::size ( ) const
inline
Returns
the number of variables involved in this factor

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