gtsam 4.1.1
gtsam
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:

Advanced Interface

class boost::serialization::access
 Serialization function.
 
KeyVectorkeys ()
 
iterator begin ()
 Iterator at beginning of involved variable keys.
 
iterator end ()
 Iterator at end of involved variable keys.
 

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

Testable

bool equals (const This &other, double tol=1e-9) const
 check equality
 
virtual void print (const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
 print More...
 
virtual void printKeys (const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
 print only keys More...
 

Standard Interface

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
 Iterator at beginning of involved variable keys.
 
const_iterator end () const
 Iterator at end of involved variable keys.
 
size_t size () const
 

Public Member Functions

virtual ~Factor ()=default
 Default destructor.
 

Public Types

typedef KeyVector::iterator iterator
 Iterator over keys.
 
typedef KeyVector::const_iterator const_iterator
 Const iterator over keys.
 

Protected Attributes

KeyVector keys_
 The keys involved in this factor.
 

Constructor & Destructor Documentation

◆ Factor() [1/2]

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.

◆ Factor() [2/2]

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

◆ FromIterators()

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.

◆ FromKeys()

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.

◆ keys()

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

◆ print()

void gtsam::Factor::print ( const std::string &  s = "Factor",
const KeyFormatter formatter = DefaultKeyFormatter 
) const
virtual

print

Reimplemented in gtsam::GaussianConditional, gtsam::GaussianDensity, gtsam::WhiteNoiseFactor, gtsam::PoseToPointFactor, gtsam::AHRSFactor, gtsam::CustomFactor, gtsam::PriorFactor< VALUE >, gtsam::BinaryMeasurement< T >, gtsam::BinaryMeasurement< Rot >, gtsam::BinaryMeasurement< Unit3 >, gtsam::ShonanFactor< d >, gtsam::AntiFactor, gtsam::BetweenFactor< VALUE >, gtsam::FrobeniusBetweenFactor< Rot >, gtsam::BetweenFactorEM< VALUE >, gtsam::BiasedGPSFactor, gtsam::GaussMarkov1stOrderFactor< VALUE >, gtsam::PartialPriorFactor< VALUE >, gtsam::PartialPriorFactor< PoseRTV >, gtsam::PoseBetweenFactor< POSE >, gtsam::PosePriorFactor< POSE >, gtsam::TransformBtwRobotsUnaryFactor< VALUE >, gtsam::TransformBtwRobotsUnaryFactorEM< VALUE >, gtsam::FullIMUFactor< POSE >, gtsam::IMUFactor< POSE >, gtsam::VelocityConstraint, gtsam::ReferenceFrameFactor< POINT, TRANSFORM >, gtsam::HessianFactor, gtsam::JacobianFactor, gtsam::AllDiff, gtsam::BinaryAllDiff, gtsam::Domain, gtsam::SingleValue, gtsam::LinearCost, gtsam::LinearEquality, gtsam::LinearInequality, gtsam::GaussianFactor, gtsam::Rot3AttitudeFactor, gtsam::Pose3AttitudeFactor, gtsam::CombinedImuFactor, gtsam::GPSFactor, gtsam::GPSFactor2, gtsam::ImuFactor, gtsam::ImuFactor2, gtsam::MagPoseFactor< POSE >, gtsam::ExpressionFactor< T >, gtsam::ExpressionFactor< typename Bearing< A1, A2 >::result_type >, gtsam::ExpressionFactor< BearingRange< A1, A2 > >, gtsam::ExpressionFactor< double >, gtsam::ExpressionFactor< typename Range< A1, A1 >::result_type >, gtsam::FunctorizedFactor< R, T >, gtsam::FunctorizedFactor< double, ParameterMatrix< P > >, gtsam::FunctorizedFactor< double, BASIS::Parameters >, gtsam::FunctorizedFactor< double, Vector >, gtsam::FunctorizedFactor< T, ParameterMatrix< traits< T >::dimension > >, gtsam::FunctorizedFactor< Vector, ParameterMatrix< M > >, gtsam::FunctorizedFactor2< R, T1, T2 >, gtsam::NonlinearEquality< VALUE >, gtsam::NonlinearEquality1< VALUE >, gtsam::NonlinearFactor, gtsam::NoiseModelFactor, gtsam::RangeFactorWithTransform< A1, A2, T >, gtsam::EssentialMatrixConstraint, gtsam::EssentialMatrixFactor, gtsam::EssentialMatrixFactor2, gtsam::EssentialMatrixFactor3, gtsam::EssentialMatrixFactor4< CALIBRATION >, gtsam::PoseRotationPrior< POSE >, gtsam::PoseTranslationPrior< POSE >, gtsam::GenericProjectionFactor< POSE, LANDMARK, CALIBRATION >, gtsam::RegularImplicitSchurFactor< CAMERA >, gtsam::RotateFactor, gtsam::RotateDirectionsFactor, gtsam::SmartFactorBase< CAMERA >, gtsam::SmartFactorBase< PinholePose< CALIBRATION > >, gtsam::SmartFactorBase< StereoCamera >, gtsam::SmartProjectionFactor< CAMERA >, gtsam::SmartProjectionFactor< PinholePose< CALIBRATION > >, gtsam::SmartProjectionPoseFactor< CALIBRATION >, gtsam::SmartProjectionRigFactor< CAMERA >, gtsam::GenericStereoFactor< POSE, LANDMARK >, gtsam::TriangulationFactor< CAMERA >, gtsam::LinearizedJacobianFactor, gtsam::LinearizedHessianFactor, gtsam::DummyFactor, gtsam::MultiProjectionFactor< POSE, LANDMARK, CALIBRATION >, gtsam::ProjectionFactorPPP< POSE, LANDMARK, CALIBRATION >, gtsam::ProjectionFactorPPPC< POSE, LANDMARK, CALIBRATION >, gtsam::ProjectionFactorRollingShutter, gtsam::RelativeElevationFactor, gtsam::SmartProjectionPoseFactorRollingShutter< CAMERA >, gtsam::SmartRangeFactor, gtsam::SmartStereoProjectionFactor, gtsam::SmartStereoProjectionFactorPP, gtsam::SmartStereoProjectionPoseFactor, gtsam::LinearContainerFactor, gtsam::BearingFactor< A1, A2, T >, gtsam::BearingRangeFactor< A1, A2, B, R >, gtsam::RangeFactor< A1, A2, T >, gtsam::DecisionTreeFactor, gtsam::DiscreteConditional, gtsam::DiscreteFactor, gtsam::EquivInertialNavFactor_GlobalVel< POSE, VELOCITY, IMUBIAS >, gtsam::EquivInertialNavFactor_GlobalVel_NoBias< POSE, VELOCITY >, gtsam::InertialNavFactor_GlobalVelocity< POSE, VELOCITY, IMUBIAS >, gtsam::InvDepthFactor3< POSE, LANDMARK, INVDEPTH >, gtsam::InvDepthFactorVariant1, gtsam::InvDepthFactorVariant2, gtsam::InvDepthFactorVariant3b, gtsam::InvDepthFactorVariant3a, gtsam::LocalOrientedPlane3Factor, gtsam::OrientedPlane3DirectionPrior, gtsam::OrientedPlane3Factor, gtsam::GeneralSFMFactor< CAMERA, LANDMARK >, gtsam::GeneralSFMFactor2< CALIBRATION >, gtsam::SymbolicFactor, and gtsam::SymbolicConditional.

◆ printKeys()

void gtsam::Factor::printKeys ( const std::string &  s = "Factor",
const KeyFormatter formatter = DefaultKeyFormatter 
) const
virtual

print only keys

Reimplemented in gtsam::SymbolicFactor.

◆ size()

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: