Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Types | Private Member Functions | 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 std::shared_ptr< ExpressionFactor< T > > shared_ptr
 
- Public Types inherited from gtsam::NoiseModelFactor
typedef std::shared_ptr< Thisshared_ptr
 
- Public Types inherited from gtsam::NonlinearFactor
typedef std::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)
 
std::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, OptionalMatrixVecType H=nullptr) 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
 
std::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
 
Vector unwhitenedError (const Values &x, std::vector< Matrix > &H) 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)
 
double error (const HybridValues &c) const override
 
virtual bool active (const Values &) const
 
virtual shared_ptr rekey (const std::map< Key, Key > &rekey_mapping) const
 
virtual shared_ptr rekey (const KeyVector &new_keys) const
 
virtual bool sendable () const
 
- Public Member Functions inherited from gtsam::Factor
virtual ~Factor ()=default
 Default destructor. More...
 
bool empty () const
 Whether the factor is empty (involves zero variables). 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
 
virtual void printKeys (const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
 print only keys More...
 
bool equals (const This &other, double tol=1e-9) const
 check equality More...
 
KeyVectorkeys ()
 
iterator begin ()
 
iterator end ()
 

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)
 

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

 GTSAM_CONCEPT_ASSERT (IsTestable< T >)
 

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 36 of file Expression.h.

Member Typedef Documentation

◆ shared_ptr

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

Definition at line 63 of file ExpressionFactor.h.

◆ This

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

Definition at line 51 of file ExpressionFactor.h.

Member Enumeration Documentation

◆ anonymous enum

template<typename T>
anonymous enum
private
Enumerator
NeedsToAlign 

Definition at line 227 of file ExpressionFactor.h.

Constructor & Destructor Documentation

◆ ExpressionFactor() [1/3]

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 72 of file ExpressionFactor.h.

◆ ~ExpressionFactor()

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

Destructor.

Definition at line 79 of file ExpressionFactor.h.

◆ ExpressionFactor() [2/3]

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

Definition at line 162 of file ExpressionFactor.h.

◆ ExpressionFactor() [3/3]

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 166 of file ExpressionFactor.h.

Member Function Documentation

◆ clone()

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 156 of file ExpressionFactor.h.

◆ equals()

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 92 of file ExpressionFactor.h.

◆ expression()

template<typename T>
virtual Expression<T> gtsam::ExpressionFactor< T >::expression ( ) const
inlineprotectedvirtual

◆ GTSAM_CONCEPT_ASSERT()

template<typename T>
gtsam::ExpressionFactor< T >::GTSAM_CONCEPT_ASSERT ( IsTestable< T )
private

◆ initialize()

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

Initialize with constructor arguments.

Definition at line 172 of file ExpressionFactor.h.

◆ linearize()

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

linearize to a GaussianFactor

Implements gtsam::NonlinearFactor.

Definition at line 117 of file ExpressionFactor.h.

◆ measured()

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

return the measurement

Definition at line 82 of file ExpressionFactor.h.

◆ print()

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 85 of file ExpressionFactor.h.

◆ unwhitenedError()

template<typename T>
Vector gtsam::ExpressionFactor< T >::unwhitenedError ( const Values x,
OptionalMatrixVecType  H = nullptr 
) 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 104 of file ExpressionFactor.h.

Member Data Documentation

◆ Dim

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

Definition at line 52 of file ExpressionFactor.h.

◆ dims_

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

dimensions of the Jacobian matrices

Definition at line 56 of file ExpressionFactor.h.

◆ expression_

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

the expression that is AD enabled

Definition at line 55 of file ExpressionFactor.h.

◆ measured_

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

the measurement to be compared with the expression

Definition at line 54 of file ExpressionFactor.h.


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


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:46:18