gtsam 4.1.1
gtsam
gtsam::NonlinearFactor Class Referenceabstract

Detailed Description

Nonlinear factor base class.

+ Inheritance diagram for gtsam::NonlinearFactor:

Standard Constructors

 NonlinearFactor ()
 Default constructor for I/O only.
 
template<typename CONTAINER >
 NonlinearFactor (const CONTAINER &keys)
 Constructor from a collection of the keys involved in this factor.
 

Testable

void print (const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
 print More...
 
virtual bool equals (const NonlinearFactor &f, double tol=1e-9) const
 Check if two factors are equal. More...
 

Standard Interface

virtual ~NonlinearFactor ()
 Destructor.
 
virtual double error (const Values &c) const =0
 Calculate the error of the factor This is typically equal to log-likelihood, e.g. More...
 
virtual size_t dim () const =0
 get the dimension of the factor (number of rows on linearization) More...
 
virtual bool active (const Values &) const
 Checks whether a factor should be used based on a set of values. More...
 
virtual boost::shared_ptr< GaussianFactorlinearize (const Values &c) const =0
 linearize to a GaussianFactor More...
 
virtual shared_ptr clone () const
 Creates a shared_ptr clone of the factor - needs to be specialized to allow for subclasses. More...
 
virtual shared_ptr rekey (const std::map< Key, Key > &rekey_mapping) const
 Creates a shared_ptr clone of the factor with different keys using a map from old->new keys. More...
 
virtual shared_ptr rekey (const KeyVector &new_keys) const
 Clones a factor and fully replaces its keys. More...
 
virtual bool sendable () const
 Should the factor be evaluated in the same thread as the caller This is to enable factors that has shared states (like the Python GIL lock) More...
 

Public Types

typedef boost::shared_ptr< Thisshared_ptr
 
- Public Types inherited from gtsam::Factor
typedef KeyVector::iterator iterator
 Iterator over keys.
 
typedef KeyVector::const_iterator const_iterator
 Const iterator over keys.
 

Protected Types

typedef Factor Base
 
typedef NonlinearFactor This
 

Additional Inherited Members

- Public Member Functions inherited from gtsam::Factor
virtual ~Factor ()=default
 Default destructor.
 
KeyVectorkeys ()
 
iterator begin ()
 Iterator at beginning of involved variable keys.
 
iterator end ()
 Iterator at end of involved variable keys.
 
virtual void printKeys (const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
 print only keys More...
 
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
 
- Protected Member Functions inherited from gtsam::Factor
 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...
 
bool equals (const This &other, double tol=1e-9) const
 check equality
 
- Static Protected Member Functions inherited from gtsam::Factor
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...
 
- Protected Attributes inherited from gtsam::Factor
KeyVector keys_
 The keys involved in this factor.
 

Member Function Documentation

◆ active()

virtual bool gtsam::NonlinearFactor::active ( const Values ) const
inlinevirtual

Checks whether a factor should be used based on a set of values.

This is primarily used to implement inequality constraints that require a variable active set. For all others, the default implementation returning true solves this problem.

In an inequality/bounding constraint, this active() returns true when the constraint is NOT fulfilled.

Returns
true if the constraint is active

Reimplemented in gtsam::AntiFactor, gtsam::BoundingConstraint1< VALUE >, and gtsam::BoundingConstraint2< VALUE1, VALUE2 >.

◆ clone()

virtual shared_ptr gtsam::NonlinearFactor::clone ( ) const
inlinevirtual

Creates a shared_ptr clone of the factor - needs to be specialized to allow for subclasses.

By default, throws exception if subclass does not implement the function.

Reimplemented in gtsam::AHRSFactor, gtsam::Rot3AttitudeFactor, gtsam::Pose3AttitudeFactor, gtsam::CombinedImuFactor, gtsam::GPSFactor, gtsam::GPSFactor2, gtsam::ImuFactor, gtsam::ImuFactor2, gtsam::MagFactor, gtsam::MagFactor1, gtsam::MagFactor2, gtsam::MagFactor3, 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::LinearContainerFactor, gtsam::NonlinearEquality< VALUE >, gtsam::NonlinearEquality1< VALUE >, gtsam::NonlinearEquality2< T >, gtsam::PriorFactor< VALUE >, gtsam::BearingRangeFactor< A1, A2, B, R >, gtsam::RangeFactor< A1, A2, T >, gtsam::RangeFactorWithTransform< A1, A2, T >, gtsam::AntiFactor, gtsam::BetweenFactor< VALUE >, gtsam::EssentialMatrixConstraint, gtsam::EssentialMatrixFactor, gtsam::EssentialMatrixFactor2, gtsam::EssentialMatrixFactor3, gtsam::EssentialMatrixFactor4< CALIBRATION >, gtsam::GeneralSFMFactor< CAMERA, LANDMARK >, gtsam::GeneralSFMFactor2< CALIBRATION >, gtsam::PoseRotationPrior< POSE >, gtsam::PoseTranslationPrior< POSE >, gtsam::GenericProjectionFactor< POSE, LANDMARK, CALIBRATION >, gtsam::ReferenceFrameFactor< POINT, TRANSFORM >, gtsam::RotateFactor, gtsam::RotateDirectionsFactor, gtsam::GenericStereoFactor< POSE, LANDMARK >, gtsam::TriangulationFactor< CAMERA >, gtsam::FullIMUFactor< POSE >, gtsam::IMUFactor< POSE >, gtsam::PendulumFactor1, gtsam::PendulumFactor2, gtsam::PendulumFactorPk, gtsam::PendulumFactorPk1, gtsam::Reconstruction, gtsam::DiscreteEulerPoincareHelicopter, gtsam::VelocityConstraint, gtsam::VelocityConstraint3, gtsam::LinearizedJacobianFactor, gtsam::LinearizedHessianFactor, gtsam::DummyFactor, gtsam::MultiProjectionFactor< POSE, LANDMARK, CALIBRATION >, gtsam::PartialPriorFactor< VALUE >, gtsam::PartialPriorFactor< PoseRTV >, gtsam::PoseBetweenFactor< POSE >, gtsam::PosePriorFactor< POSE >, gtsam::ProjectionFactorPPP< POSE, LANDMARK, CALIBRATION >, gtsam::ProjectionFactorPPPC< POSE, LANDMARK, CALIBRATION >, gtsam::ProjectionFactorRollingShutter, gtsam::RelativeElevationFactor, gtsam::SmartRangeFactor, gtsam::TransformBtwRobotsUnaryFactor< VALUE >, and gtsam::TransformBtwRobotsUnaryFactorEM< VALUE >.

◆ dim()

◆ equals()

bool gtsam::NonlinearFactor::equals ( const NonlinearFactor f,
double  tol = 1e-9 
) const
virtual

Check if two factors are equal.

Reimplemented in gtsam::AHRSFactor, gtsam::FullIMUFactor< POSE >, gtsam::IMUFactor< POSE >, gtsam::PoseToPointFactor, gtsam::Rot3AttitudeFactor, gtsam::Pose3AttitudeFactor, gtsam::CombinedImuFactor, gtsam::GPSFactor, gtsam::GPSFactor2, gtsam::ImuFactor, gtsam::ImuFactor2, gtsam::MagPoseFactor< POSE >, gtsam::PriorFactor< VALUE >, gtsam::ShonanFactor< d >, gtsam::AntiFactor, gtsam::BetweenFactor< VALUE >, gtsam::EssentialMatrixConstraint, gtsam::FrobeniusBetweenFactor< Rot >, gtsam::OrientedPlane3DirectionPrior, gtsam::PoseRotationPrior< POSE >, gtsam::PoseTranslationPrior< POSE >, gtsam::LinearizedJacobianFactor, gtsam::LinearizedHessianFactor, gtsam::BiasedGPSFactor, gtsam::EquivInertialNavFactor_GlobalVel< POSE, VELOCITY, IMUBIAS >, gtsam::EquivInertialNavFactor_GlobalVel_NoBias< POSE, VELOCITY >, gtsam::GaussMarkov1stOrderFactor< VALUE >, gtsam::InertialNavFactor_GlobalVelocity< POSE, VELOCITY, IMUBIAS >, gtsam::PartialPriorFactor< VALUE >, gtsam::PartialPriorFactor< PoseRTV >, gtsam::PoseBetweenFactor< POSE >, gtsam::PosePriorFactor< POSE >, gtsam::RelativeElevationFactor, 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::LinearContainerFactor, gtsam::NonlinearEquality< VALUE >, gtsam::NoiseModelFactor, gtsam::GenericStereoFactor< POSE, LANDMARK >, gtsam::BetweenFactorEM< VALUE >, gtsam::DummyFactor, gtsam::SmartRangeFactor, gtsam::TransformBtwRobotsUnaryFactor< VALUE >, gtsam::TransformBtwRobotsUnaryFactorEM< VALUE >, 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::GeneralSFMFactor< CAMERA, LANDMARK >, gtsam::GeneralSFMFactor2< CALIBRATION >, gtsam::GenericProjectionFactor< POSE, LANDMARK, CALIBRATION >, gtsam::SmartFactorBase< CAMERA >, gtsam::SmartFactorBase< PinholePose< CALIBRATION > >, gtsam::SmartFactorBase< StereoCamera >, gtsam::SmartProjectionFactor< CAMERA >, gtsam::SmartProjectionFactor< PinholePose< CALIBRATION > >, gtsam::SmartProjectionPoseFactor< CALIBRATION >, gtsam::SmartProjectionRigFactor< CAMERA >, gtsam::TriangulationFactor< CAMERA >, gtsam::InvDepthFactor3< POSE, LANDMARK, INVDEPTH >, gtsam::InvDepthFactorVariant1, gtsam::InvDepthFactorVariant2, gtsam::InvDepthFactorVariant3a, gtsam::InvDepthFactorVariant3b, gtsam::MultiProjectionFactor< POSE, LANDMARK, CALIBRATION >, gtsam::ProjectionFactorPPP< POSE, LANDMARK, CALIBRATION >, gtsam::ProjectionFactorPPPC< POSE, LANDMARK, CALIBRATION >, gtsam::ProjectionFactorRollingShutter, gtsam::SmartProjectionPoseFactorRollingShutter< CAMERA >, gtsam::SmartStereoProjectionFactor, gtsam::SmartStereoProjectionFactorPP, and gtsam::SmartStereoProjectionPoseFactor.

◆ error()

◆ linearize()

◆ print()

void gtsam::NonlinearFactor::print ( const std::string &  s = "",
const KeyFormatter keyFormatter = DefaultKeyFormatter 
) const
overridevirtual

print

Reimplemented from gtsam::Factor.

Reimplemented in gtsam::WhiteNoiseFactor, gtsam::PoseToPointFactor, gtsam::PriorFactor< VALUE >, 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::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< 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::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::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::BearingFactor< A1, A2, T >, gtsam::BearingRangeFactor< A1, A2, B, R >, gtsam::RangeFactor< A1, A2, T >, 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 >, and gtsam::GeneralSFMFactor2< CALIBRATION >.

◆ rekey() [1/2]

NonlinearFactor::shared_ptr gtsam::NonlinearFactor::rekey ( const KeyVector new_keys) const
virtual

Clones a factor and fully replaces its keys.

Parameters
new_keysis the full replacement set of keys

Reimplemented in gtsam::LinearContainerFactor.

◆ rekey() [2/2]

NonlinearFactor::shared_ptr gtsam::NonlinearFactor::rekey ( const std::map< Key, Key > &  rekey_mapping) const
virtual

Creates a shared_ptr clone of the factor with different keys using a map from old->new keys.

Reimplemented in gtsam::LinearContainerFactor.

◆ sendable()

virtual bool gtsam::NonlinearFactor::sendable ( ) const
inlinevirtual

Should the factor be evaluated in the same thread as the caller This is to enable factors that has shared states (like the Python GIL lock)

Reimplemented in gtsam::CustomFactor.


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