Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Types | Private Member Functions | Friends | List of all members
gtsam::ExpressionFactor< T > Class Template Reference

#include <Expression.h>

Inheritance diagram for gtsam::ExpressionFactor< T >:
Inheritance graph
[legend]

Public Types

typedef boost::shared_ptr< ExpressionFactor< T > > shared_ptr
 
- Public Types inherited from gtsam::NoiseModelFactor
typedef boost::shared_ptr< Thisshared_ptr
 
- Public Types inherited from gtsam::NonlinearFactor
typedef boost::shared_ptr< Thisshared_ptr
 
- Public Types inherited from gtsam::Factor
typedef KeyVector::const_iterator const_iterator
 Const iterator over keys. More...
 
typedef KeyVector::iterator iterator
 Iterator over keys. More...
 

Public Member Functions

gtsam::NonlinearFactor::shared_ptr clone () const override
 
bool equals (const NonlinearFactor &f, double tol) const override
 equals relies on Testable traits being defined for T More...
 
 ExpressionFactor (const SharedNoiseModel &noiseModel, const T &measurement, const Expression< T > &expression)
 
boost::shared_ptr< GaussianFactorlinearize (const Values &x) const override
 
const Tmeasured () const
 
void print (const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
 print relies on Testable traits being defined for T More...
 
Vector unwhitenedError (const Values &x, boost::optional< std::vector< Matrix > & > H=boost::none) const override
 
 ~ExpressionFactor () override
 Destructor. More...
 
- Public Member Functions inherited from gtsam::NoiseModelFactor
shared_ptr cloneWithNewNoiseModel (const SharedNoiseModel newNoise) const
 
size_t dim () const override
 
bool equals (const NonlinearFactor &f, double tol=1e-9) const override
 
double error (const Values &c) const override
 
boost::shared_ptr< GaussianFactorlinearize (const Values &x) const override
 
const SharedNoiseModelnoiseModel () const
 access to the noise model More...
 
 NoiseModelFactor ()
 
template<typename CONTAINER >
 NoiseModelFactor (const SharedNoiseModel &noiseModel, const CONTAINER &keys)
 
void print (const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
 
Vector unweightedWhitenedError (const Values &c) const
 
double weight (const Values &c) const
 
Vector whitenedError (const Values &c) const
 
 ~NoiseModelFactor () override
 
- Public Member Functions inherited from gtsam::NonlinearFactor
 NonlinearFactor ()
 
template<typename CONTAINER >
 NonlinearFactor (const CONTAINER &keys)
 
virtual ~NonlinearFactor ()
 
virtual bool active (const Values &) const
 
shared_ptr rekey (const std::map< Key, Key > &rekey_mapping) const
 
shared_ptr rekey (const KeyVector &new_keys) const
 
- Public Member Functions inherited from gtsam::Factor
virtual ~Factor ()=default
 Default destructor. More...
 
KeyVectorkeys ()
 
iterator begin ()
 
iterator end ()
 
virtual void printKeys (const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
 print only keys More...
 
Key front () const
 First key. More...
 
Key back () const
 Last key. More...
 
const_iterator find (Key key) const
 find More...
 
const KeyVectorkeys () const
 Access the factor's involved variable keys. More...
 
const_iterator begin () const
 
const_iterator end () const
 
size_t size () const
 

Protected Types

typedef ExpressionFactor< TThis
 
- Protected Types inherited from gtsam::NoiseModelFactor
typedef NonlinearFactor Base
 
typedef NoiseModelFactor This
 
- Protected Types inherited from gtsam::NonlinearFactor
typedef Factor Base
 
typedef NonlinearFactor This
 

Protected Member Functions

virtual Expression< Texpression () const
 
 ExpressionFactor ()
 
 ExpressionFactor (const SharedNoiseModel &noiseModel, const T &measurement)
 Default constructor, for serialization. More...
 
void initialize (const Expression< T > &expression)
 Initialize with constructor arguments. More...
 
- Protected Member Functions inherited from gtsam::NoiseModelFactor
 NoiseModelFactor (const SharedNoiseModel &noiseModel)
 
- Protected Member Functions inherited from gtsam::Factor
 Factor ()
 
template<typename CONTAINER >
 Factor (const CONTAINER &keys)
 
template<typename ITERATOR >
 Factor (ITERATOR first, ITERATOR last)
 
bool equals (const This &other, double tol=1e-9) const
 check equality More...
 

Protected Attributes

FastVector< intdims_
 dimensions of the Jacobian matrices More...
 
Expression< Texpression_
 the expression that is AD enabled More...
 
T measured_
 the measurement to be compared with the expression More...
 
- Protected Attributes inherited from gtsam::NoiseModelFactor
SharedNoiseModel noiseModel_
 
- Protected Attributes inherited from gtsam::Factor
KeyVector keys_
 The keys involved in this factor. More...
 

Static Protected Attributes

static const int Dim = traits<T>::dimension
 

Private Types

enum  { NeedsToAlign = (sizeof(T) % 16) == 0 }
 

Private Member Functions

 BOOST_CONCEPT_ASSERT ((IsTestable< T >))
 
template<class Archive >
void load (Archive &ar, const unsigned int)
 
template<class Archive >
void save (Archive &ar, const unsigned int) const
 Save to an archive: just saves the base class. More...
 

Friends

class boost::serialization::access
 

Additional Inherited Members

- Static Protected Member Functions inherited from gtsam::Factor
template<typename CONTAINER >
static Factor FromKeys (const CONTAINER &keys)
 
template<typename ITERATOR >
static Factor FromIterators (ITERATOR first, ITERATOR last)
 

Detailed Description

template<typename T>
class gtsam::ExpressionFactor< T >

Factor that supports arbitrary expressions via AD.

Arbitrary instances of this template can be directly inserted into a factor graph for optimization. However, to enable the correct (de)serialization of such instances, the user should declare derived classes from this template, implementing expresion(), serialize(), clone(), print(), and defining the corresponding struct traits<NewFactor> : public Testable<NewFactor> {}.

Template Parameters
TType for measurements.

Definition at line 38 of file Expression.h.

Member Typedef Documentation

template<typename T>
typedef boost::shared_ptr<ExpressionFactor<T> > gtsam::ExpressionFactor< T >::shared_ptr

Definition at line 58 of file ExpressionFactor.h.

template<typename T>
typedef ExpressionFactor<T> gtsam::ExpressionFactor< T >::This
protected

Definition at line 49 of file ExpressionFactor.h.

Member Enumeration Documentation

template<typename T>
anonymous enum
private
Enumerator
NeedsToAlign 

Definition at line 220 of file ExpressionFactor.h.

Constructor & Destructor Documentation

template<typename T>
gtsam::ExpressionFactor< T >::ExpressionFactor ( const SharedNoiseModel noiseModel,
const T measurement,
const Expression< T > &  expression 
)
inline

Constructor: creates a factor from a measurement and measurement function

Parameters
noiseModelthe noise model associated with a measurement
measurementactual value of the measurement, of type T
expressionpredicts the measurement from Values The keys associated with the factor, returned by keys(), are sorted.

Definition at line 67 of file ExpressionFactor.h.

template<typename T>
gtsam::ExpressionFactor< T >::~ExpressionFactor ( )
inlineoverride

Destructor.

Definition at line 74 of file ExpressionFactor.h.

template<typename T>
gtsam::ExpressionFactor< T >::ExpressionFactor ( )
inlineprotected

Definition at line 157 of file ExpressionFactor.h.

template<typename T>
gtsam::ExpressionFactor< T >::ExpressionFactor ( const SharedNoiseModel noiseModel,
const T measurement 
)
inlineprotected

Default constructor, for serialization.

Constructor for serializable derived classes

Definition at line 161 of file ExpressionFactor.h.

Member Function Documentation

template<typename T>
gtsam::ExpressionFactor< T >::BOOST_CONCEPT_ASSERT ( (IsTestable< T >)  )
private
template<typename T>
gtsam::NonlinearFactor::shared_ptr gtsam::ExpressionFactor< T >::clone ( ) const
inlineoverridevirtual
Returns
a deep copy of this factor

Reimplemented from gtsam::NonlinearFactor.

Reimplemented in gtsam::RangeFactorWithTransform< A1, A2, T >, and gtsam::RangeFactor< A1, A2, T >.

Definition at line 151 of file ExpressionFactor.h.

template<typename T>
bool gtsam::ExpressionFactor< T >::equals ( const NonlinearFactor f,
double  tol 
) const
inlineoverridevirtual

equals relies on Testable traits being defined for T

Reimplemented from gtsam::NonlinearFactor.

Definition at line 87 of file ExpressionFactor.h.

template<typename T>
virtual Expression<T> gtsam::ExpressionFactor< T >::expression ( ) const
inlineprotectedvirtual
template<typename T>
void gtsam::ExpressionFactor< T >::initialize ( const Expression< T > &  expression)
inlineprotected

Initialize with constructor arguments.

Definition at line 167 of file ExpressionFactor.h.

template<typename T>
boost::shared_ptr<GaussianFactor> gtsam::ExpressionFactor< T >::linearize ( const Values c) const
inlineoverridevirtual

linearize to a GaussianFactor

Implements gtsam::NonlinearFactor.

Definition at line 112 of file ExpressionFactor.h.

template<typename T>
template<class Archive >
void gtsam::ExpressionFactor< T >::load ( Archive &  ar,
const unsigned  int 
)
inlineprivate

Load from an archive, creating a valid expression using the overloaded [expression] method

Definition at line 208 of file ExpressionFactor.h.

template<typename T>
const T& gtsam::ExpressionFactor< T >::measured ( ) const
inline

return the measurement

Definition at line 77 of file ExpressionFactor.h.

template<typename T>
void gtsam::ExpressionFactor< T >::print ( const std::string &  s = "",
const KeyFormatter keyFormatter = DefaultKeyFormatter 
) const
inlineoverridevirtual

print relies on Testable traits being defined for T

Reimplemented from gtsam::Factor.

Reimplemented in gtsam::RangeFactorWithTransform< A1, A2, T >, gtsam::RangeFactor< A1, A2, T >, and gtsam::BearingFactor< A1, A2, T >.

Definition at line 80 of file ExpressionFactor.h.

template<typename T>
template<class Archive >
void gtsam::ExpressionFactor< T >::save ( Archive &  ar,
const unsigned  int 
) const
inlineprivate

Save to an archive: just saves the base class.

Definition at line 200 of file ExpressionFactor.h.

template<typename T>
Vector gtsam::ExpressionFactor< T >::unwhitenedError ( const Values x,
boost::optional< std::vector< Matrix > & >  H = boost::none 
) const
inlineoverridevirtual

Error function without the NoiseModel, $ z-h(x) -> Local(h(x),z) $. We override this method to provide both the function evaluation and its derivative(s) in H.

Implements gtsam::NoiseModelFactor.

Definition at line 99 of file ExpressionFactor.h.

Friends And Related Function Documentation

template<typename T>
friend class boost::serialization::access
friend

Definition at line 217 of file ExpressionFactor.h.

Member Data Documentation

template<typename T>
const int gtsam::ExpressionFactor< T >::Dim = traits<T>::dimension
staticprotected

Definition at line 50 of file ExpressionFactor.h.

template<typename T>
FastVector<int> gtsam::ExpressionFactor< T >::dims_
protected

dimensions of the Jacobian matrices

Definition at line 54 of file ExpressionFactor.h.

template<typename T>
Expression<T> gtsam::ExpressionFactor< T >::expression_
protected

the expression that is AD enabled

Definition at line 53 of file ExpressionFactor.h.

template<typename T>
T gtsam::ExpressionFactor< T >::measured_
protected

the measurement to be compared with the expression

Definition at line 52 of file ExpressionFactor.h.


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


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:58:09