Loading...
Searching...
No Matches
gtsam::AntiFactor Class Reference
SLAM

## Detailed Description

A class for downdating an existing factor from a graph.

The AntiFactor returns the same linearized Hessian matrices of the original factor, but with the opposite sign. This effectively cancels out any affects of the original factor during optimization."

Inheritance diagram for gtsam::AntiFactor:

## Public Member Functions

| AntiFactor ()
| default constructor - only use for serialization
| AntiFactor (NonlinearFactor::shared_ptr factor)
| constructor - Creates the equivalent AntiFactor from an existing factor
gtsam::NonlinearFactor::shared_ptr | clone () const override
void | print (const std::string &s, const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
| implement functions needed for Testable
bool | equals (const NonlinearFactor &expected, double tol=1e-9) const override
| equals
double | error (const Values &c) const override
| implement functions needed to derive from Factor
size_t | dim () const override
| get the dimension of the factor (same as the original factor)
bool | active (const Values &c) const override
| Checks whether this factor should be used based on a set of values.
boost::shared_ptr< GaussianFactor > | linearize (const Values &c) const override
| Linearize to a GaussianFactor.
| 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.
void | print (const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
| print
virtual | ~NonlinearFactor ()
| Destructor.
double | error (const HybridValues &c) const override
| All factor types need to implement an error function.
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.
virtual shared_ptr | rekey (const KeyVector &new_keys) const
| Clones a factor and fully replaces its keys.
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).
Public Member Functions inherited from gtsam::Factor
virtual | ~Factor ()=default
| Default destructor.
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
| Iterator at beginning of involved variable keys.
const_iterator | end () const
| Iterator at end of involved variable keys.
size_t | size () const
virtual void | printKeys (const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
| print only keys
bool | equals (const This &other, double tol=1e-9) const
| check equality
KeyVector & | keys ()
iterator | begin ()
| Iterator at beginning of involved variable keys.
iterator | end ()
| Iterator at end of involved variable keys.

## Public Types

typedef boost::shared_ptr< AntiFactor > | shared_ptr
Public Types inherited from gtsam::NonlinearFactor
typedef boost::shared_ptr< This > | shared_ptr
Public Types inherited from gtsam::Factor
typedef KeyVector::iterator | iterator
| Iterator over keys.
typedef KeyVector::const_iterator | const_iterator
| Const iterator over keys.

## Friends

class | boost::serialization::access
| Serialization function.

## Additional Inherited Members

Protected Types inherited from gtsam::NonlinearFactor
typedef Factor | Base
typedef NonlinearFactor | This
| Factor ()
| Default constructor for I/O.
template<typename CONTAINER>
| Factor (const CONTAINER &keys)
| Construct factor from container of keys.
template<typename ITERATOR>
| Factor (ITERATOR first, ITERATOR last)
| Construct factor from iterator keys.
template<typename CONTAINER>
static Factor | FromKeys (const CONTAINER &keys)
| Construct factor from container of keys.
template<typename ITERATOR>
static Factor | FromIterators (ITERATOR first, ITERATOR last)
| Construct factor from iterator keys.
Protected Attributes inherited from gtsam::Factor
KeyVector | keys_
| The keys involved in this factor.

## Member Function Documentation

## active()

bool gtsam::AntiFactor::active | ( | const Values & | c | ) | const

inline override virtual

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

The AntiFactor will have the same 'active' profile as the original factor.

Reimplemented from gtsam::NonlinearFactor.

## clone()

gtsam::NonlinearFactor::shared_ptr gtsam::AntiFactor::clone | ( |  | ) | const

inline override virtual

Returns
  a deep copy of this factor

Reimplemented from gtsam::NonlinearFactor.

## dim()

size_t gtsam::AntiFactor::dim | ( |  | ) | const

inline override virtual

get the dimension of the factor (same as the original factor)

Implements gtsam::NonlinearFactor.

## equals()

bool gtsam::AntiFactor::equals | ( | const NonlinearFactor & | expected,
|  | double | tol = 1e-9 ) const

inline override virtual

equals

Reimplemented from gtsam::NonlinearFactor.

## error()

double gtsam::AntiFactor::error | ( | const Values & | c | ) | const

inline override virtual

implement functions needed to derive from Factor

Calculate the error of the factor For the AntiFactor, this will have the same magnitude of the original factor, but the opposite sign.

Reimplemented from gtsam::NonlinearFactor.

## linearize()

boost::shared_ptr< GaussianFactor > gtsam::AntiFactor::linearize | ( | const Values & | c | ) | const

inline override virtual

Linearize to a GaussianFactor.

The AntiFactor always returns a Hessian Factor with the same Hessian matrices as the original factor (even if the original factor returns a Jacobian instead of a full Hessian), but with the opposite sign. This effectively cancels the effect of the original factor on the factor graph.

Implements gtsam::NonlinearFactor.

## print()

void gtsam::AntiFactor::print | ( | const std::string & | s,
|  | const KeyFormatter & | keyFormatter = DefaultKeyFormatter ) const

inline override virtual

implement functions needed for Testable

print

Reimplemented from gtsam::Factor.

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

- /build/gtsam-gchP9J/gtsam-4.2.2+dfsg/gtsam/slam/AntiFactor.h