GTSAM
4.0.2
C++ library for smoothing and mapping (SAM)
|
#include <LinearContainerFactor.h>
Public Types | |
typedef std::shared_ptr< This > | shared_ptr |
typedef KeyVector::iterator | iterator |
Iterator over keys. | |
typedef KeyVector::const_iterator | const_iterator |
Const iterator over keys. | |
Public Member Functions | |
LinearContainerFactor () | |
LinearContainerFactor (const JacobianFactor &factor, const Values &linearizationPoint=Values()) | |
LinearContainerFactor (const HessianFactor &factor, const Values &linearizationPoint=Values()) | |
LinearContainerFactor (const GaussianFactor::shared_ptr &factor, const Values &linearizationPoint=Values()) | |
const GaussianFactor::shared_ptr & | factor () const |
void | print (const std::string &s="", const KeyFormatter &keyFormatter=gtsam::DefaultKeyFormatter) const override |
bool | equals (const NonlinearFactor &f, double tol=1e-9) const override |
double | error (const Values &c) const override |
size_t | dim () const override |
const std::optional< Values > & | linearizationPoint () const |
GaussianFactor::shared_ptr | linearize (const Values &c) const override |
GaussianFactor::shared_ptr | negateToGaussian () const |
NonlinearFactor::shared_ptr | negateToNonlinear () const |
NonlinearFactor::shared_ptr | clone () const override |
NonlinearFactor::shared_ptr | rekey (const std::map< Key, Key > &rekey_mapping) const override |
NonlinearFactor::shared_ptr | rekey (const KeyVector &new_keys) const override |
bool | hasLinearizationPoint () const |
Casting syntactic sugar. | |
bool | isJacobian () const |
bool | isHessian () const |
std::shared_ptr< JacobianFactor > | toJacobian () const |
std::shared_ptr< HessianFactor > | toHessian () const |
Testable | |
bool | equals (const This &other, double tol=1e-9) const |
check equality | |
virtual void | printKeys (const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const |
print only keys | |
Standard Interface | |
double | error (const HybridValues &c) const override |
virtual bool | active (const Values &) const |
virtual bool | sendable () const |
Standard Interface | |
bool | empty () const |
Whether the factor is empty (involves zero variables). | |
Key | front () const |
First key. | |
Key | back () const |
Last key. | |
const_iterator | find (Key key) const |
find | |
const KeyVector & | keys () const |
Access the factor's involved variable keys. | |
const_iterator | begin () const |
const_iterator | end () const |
size_t | size () const |
Advanced Interface | |
KeyVector & | keys () |
iterator | begin () |
iterator | end () |
Static Public Member Functions | |
static NonlinearFactorGraph | ConvertLinearGraph (const GaussianFactorGraph &linear_graph, const Values &linearizationPoint=Values()) |
Protected Types | |
typedef NonlinearFactor | Base |
typedef LinearContainerFactor | This |
Protected Member Functions | |
LinearContainerFactor (const GaussianFactor::shared_ptr &factor, const std::optional< Values > &linearizationPoint) | |
void | initializeLinearizationPoint (const Values &linearizationPoint) |
Static Protected Member Functions | |
Standard Constructors | |
template<typename CONTAINER > | |
static Factor | FromKeys (const CONTAINER &keys) |
template<typename ITERATOR > | |
static Factor | FromIterators (ITERATOR first, ITERATOR last) |
Protected Attributes | |
GaussianFactor::shared_ptr | factor_ |
std::optional< Values > | linearizationPoint_ |
KeyVector | keys_ |
The keys involved in this factor. | |
Dummy version of a generic linear factor to be injected into a nonlinear factor graph
This factor does have the ability to perform relinearization under small-angle and linearity assumptions if a linearization point is added.
|
protected |
direct copy constructor
|
inline |
Default constructor - necessary for serialization
gtsam::LinearContainerFactor::LinearContainerFactor | ( | const JacobianFactor & | factor, |
const Values & | linearizationPoint = Values() |
||
) |
Primary constructor: store a linear factor with optional linearization point
gtsam::LinearContainerFactor::LinearContainerFactor | ( | const HessianFactor & | factor, |
const Values & | linearizationPoint = Values() |
||
) |
Primary constructor: store a linear factor with optional linearization point
gtsam::LinearContainerFactor::LinearContainerFactor | ( | const GaussianFactor::shared_ptr & | factor, |
const Values & | linearizationPoint = Values() |
||
) |
Constructor from shared_ptr
|
inlinevirtualinherited |
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.
Reimplemented in gtsam::BoundingConstraint2< VALUE1, VALUE2 >, gtsam::AntiFactor, and gtsam::BoundingConstraint1< VALUE >.
|
inlineinherited |
Iterator at beginning of involved variable keys
|
inlineinherited |
Iterator at beginning of involved variable keys
|
inlineoverridevirtual |
Creates a shared_ptr clone of the factor - needs to be specialized to allow for subclasses
Clones the underlying linear factor
Reimplemented from gtsam::NonlinearFactor.
|
static |
Utility function for converting linear graphs to nonlinear graphs consisting of LinearContainerFactors.
|
overridevirtual |
get the dimension of the factor: rows of linear factor
Implements gtsam::NonlinearFactor.
|
inlineinherited |
Iterator at end of involved variable keys
|
inlineinherited |
Iterator at end of involved variable keys
|
overridevirtual |
Check if two factors are equal
Reimplemented from gtsam::NonlinearFactor.
|
overridevirtual |
Calculate the nonlinear error for the factor, where the error is computed by passing the delta between linearization point and c, where delta = linearizationPoint_.localCoordinates(c), into the error function of the stored linear factor.
Reimplemented from gtsam::NonlinearFactor.
|
overridevirtualinherited |
All factor types need to implement an error function. In factor graphs, this is the negative log-likelihood.
Reimplemented from gtsam::Factor.
|
inlinestaticprotectedinherited |
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.
|
inlinestaticprotectedinherited |
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.
bool gtsam::LinearContainerFactor::isJacobian | ( | ) | const |
Simple checks whether this is a Jacobian or Hessian factor
|
inlineinherited |
|
inline |
Extract the linearization point used in recalculating error
|
overridevirtual |
Linearize to a GaussianFactor, with method depending on the presence of a linearizationPoint
The relinearization approach used computes a linear delta between the original linearization point and the new values c, where delta = linearizationPoint_.localCoordinates(c), and substitutes this change into the system. This substitution is only really valid for linear variable manifolds, and for any variables based on a non-commutative manifold (such as Pose2, Pose3), the relinearized version will be effective for only small angles.
TODO: better approximation of relinearization TODO: switchable modes for approximation technique
Implements gtsam::NonlinearFactor.
GaussianFactor::shared_ptr gtsam::LinearContainerFactor::negateToGaussian | ( | ) | const |
Creates an anti-factor directly
NonlinearFactor::shared_ptr gtsam::LinearContainerFactor::negateToNonlinear | ( | ) | const |
Creates the equivalent anti-factor as another LinearContainerFactor.
|
overridevirtual |
Reimplemented from gtsam::Factor.
|
overridevirtual |
Creates a shared_ptr clone of the factor with different keys using a map from old->new keys
Reimplemented from gtsam::NonlinearFactor.
|
overridevirtual |
Clones a factor and fully replaces its keys
new_keys | is the full replacement set of keys |
Reimplemented from gtsam::NonlinearFactor.
|
inlinevirtualinherited |
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.
|
inlineinherited |
std::shared_ptr<HessianFactor> gtsam::LinearContainerFactor::toHessian | ( | ) | const |
Casts to HessianFactor
std::shared_ptr<JacobianFactor> gtsam::LinearContainerFactor::toJacobian | ( | ) | const |
Casts to JacobianFactor