GTSAM  4.0.2
C++ library for smoothing and mapping (SAM)
Public Types | Public Member Functions | Protected Attributes | List of all members
gtsam::LinearizedHessianFactor Class Reference

#include <LinearizedFactor.h>

Inheritance diagram for gtsam::LinearizedHessianFactor:
Inheritance graph
[legend]
Collaboration diagram for gtsam::LinearizedHessianFactor:
Collaboration graph
[legend]

Public Types

typedef LinearizedGaussianFactor Base
 
typedef LinearizedHessianFactor This
 
typedef std::shared_ptr< LinearizedHessianFactorshared_ptr
 
typedef SymmetricBlockMatrix::Block Block
 A block from the Hessian matrix. More...
 
typedef SymmetricBlockMatrix::constBlock constBlock
 A block from the Hessian matrix (const version)
 
typedef SymmetricBlockMatrix::Block::ColXpr Column
 A column containing the linear term h.
 
typedef SymmetricBlockMatrix::constBlock::ColXpr constColumn
 A column containing the linear term h (const version)
 
typedef KeyVector::iterator iterator
 Iterator over keys.
 
typedef KeyVector::const_iterator const_iterator
 Const iterator over keys.
 

Public Member Functions

 LinearizedHessianFactor ()
 
 LinearizedHessianFactor (const HessianFactor::shared_ptr &hessian, const Values &lin_points)
 
gtsam::NonlinearFactor::shared_ptr clone () const override
 
void print (const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
 
bool equals (const NonlinearFactor &expected, double tol=1e-9) const override
 
double constantTerm () const
 
constColumn linearTerm (const_iterator j) const
 
constColumn linearTerm () const
 
Matrix squaredTerm (const_iterator j1, const_iterator j2) const
 
Eigen::SelfAdjointView< constBlock, Eigen::Upper > squaredTerm () const
 
size_t dim () const override
 
double error (const Values &c) const override
 
std::shared_ptr< GaussianFactorlinearize (const Values &c) const override
 
const ValueslinearizationPoint () 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 shared_ptr rekey (const std::map< Key, Key > &rekey_mapping) const
 
virtual shared_ptr rekey (const KeyVector &new_keys) 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 KeyVectorkeys () const
 Access the factor's involved variable keys.
 
const_iterator begin () const
 
const_iterator end () const
 
size_t size () const
 
Advanced Interface
KeyVectorkeys ()
 
iterator begin ()
 
iterator end ()
 

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

SymmetricBlockMatrix info_
 
Values lin_points_
 
KeyVector keys_
 The keys involved in this factor.
 

Detailed Description

A factor that takes a linear, Hessian factor and inserts it into a nonlinear graph.

Member Typedef Documentation

◆ Base

base type

◆ Block

typedef SymmetricBlockMatrix::Block gtsam::LinearizedHessianFactor::Block

A block from the Hessian matrix.

hessian block data types

◆ shared_ptr

shared pointer for convenience

Constructor & Destructor Documentation

◆ LinearizedHessianFactor() [1/2]

gtsam::LinearizedHessianFactor::LinearizedHessianFactor ( )

default constructor for serialization

◆ LinearizedHessianFactor() [2/2]

gtsam::LinearizedHessianFactor::LinearizedHessianFactor ( const HessianFactor::shared_ptr hessian,
const Values lin_points 
)

Use this constructor with the ordering used to linearize the graph

Parameters
hessianA hessian factor
lin_pointsThe linearization points for, at least, the variables used by this factor

Member Function Documentation

◆ active()

virtual bool gtsam::NonlinearFactor::active ( const Values ) const
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.

Returns
true if the constraint is active

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

◆ begin() [1/2]

const_iterator gtsam::Factor::begin ( ) const
inlineinherited

Iterator at beginning of involved variable keys

◆ begin() [2/2]

iterator gtsam::Factor::begin ( )
inlineinherited

Iterator at beginning of involved variable keys

◆ clone()

gtsam::NonlinearFactor::shared_ptr gtsam::LinearizedHessianFactor::clone ( ) const
inlineoverridevirtual
Returns
a deep copy of this factor

Reimplemented from gtsam::NonlinearFactor.

◆ constantTerm()

double gtsam::LinearizedHessianFactor::constantTerm ( ) const
inline

Return the constant term \( f \) as described above

Returns
The constant term \( f \)

◆ dim()

size_t gtsam::LinearizedHessianFactor::dim ( ) const
inlineoverridevirtual

get the dimension of the factor (number of rows on linearization)

Implements gtsam::NonlinearFactor.

◆ end() [1/2]

const_iterator gtsam::Factor::end ( ) const
inlineinherited

Iterator at end of involved variable keys

◆ end() [2/2]

iterator gtsam::Factor::end ( )
inlineinherited

Iterator at end of involved variable keys

◆ equals()

bool gtsam::LinearizedHessianFactor::equals ( const NonlinearFactor expected,
double  tol = 1e-9 
) const
overridevirtual

equals function with optional tolerance

Reimplemented from gtsam::NonlinearFactor.

◆ error() [1/2]

double gtsam::NonlinearFactor::error ( const HybridValues c) const
overridevirtualinherited

All factor types need to implement an error function. In factor graphs, this is the negative log-likelihood.

Reimplemented from gtsam::Factor.

◆ error() [2/2]

double gtsam::LinearizedHessianFactor::error ( const Values c) const
overridevirtual

Calculate the error of the factor

Reimplemented from gtsam::NonlinearFactor.

◆ FromIterators()

template<typename ITERATOR >
static Factor gtsam::Factor::FromIterators ( ITERATOR  first,
ITERATOR  last 
)
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.

◆ FromKeys()

template<typename CONTAINER >
static Factor gtsam::Factor::FromKeys ( const CONTAINER &  keys)
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.

◆ keys()

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

◆ linearize()

std::shared_ptr<GaussianFactor> gtsam::LinearizedHessianFactor::linearize ( const Values c) const
overridevirtual

linearize to a GaussianFactor Reimplemented from NoiseModelFactor to directly copy out the matrices and only update the RHS b with an updated residual

Implements gtsam::NonlinearFactor.

◆ linearTerm() [1/2]

constColumn gtsam::LinearizedHessianFactor::linearTerm ( const_iterator  j) const
inline

Return the part of linear term \( g \) as described above corresponding to the requested variable.

Parameters
jWhich block row to get, as an iterator pointing to the slot in this factor. You can use, for example, begin() + 2 to get the 3rd variable in this factor.
Returns
The linear term \( g \)

◆ linearTerm() [2/2]

constColumn gtsam::LinearizedHessianFactor::linearTerm ( ) const
inline

Return the complete linear term \( g \) as described above.

Returns
The linear term \( g \)

◆ print()

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

print function

Reimplemented from gtsam::NonlinearFactor.

◆ rekey() [1/2]

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

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

Reimplemented in gtsam::LinearContainerFactor.

◆ rekey() [2/2]

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

Clones a factor and fully replaces its keys

Parameters
new_keysis the full replacement set of keys

Reimplemented in gtsam::LinearContainerFactor.

◆ sendable()

virtual bool gtsam::NonlinearFactor::sendable ( ) const
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.

◆ size()

size_t gtsam::Factor::size ( ) const
inlineinherited
Returns
the number of variables involved in this factor

◆ squaredTerm() [1/2]

Matrix gtsam::LinearizedHessianFactor::squaredTerm ( const_iterator  j1,
const_iterator  j2 
) const
inline

Return a copy of the block at (j1,j2) of the upper-triangular part of the squared term \( H \), no data is copied. See HessianFactor class documentation above to explain that only the upper-triangular part of the information matrix is stored and returned by this function.

Parameters
j1Which block row to get, as an iterator pointing to the slot in this factor. You can use, for example, begin() + 2 to get the 3rd variable in this factor.
j2Which block column to get, as an iterator pointing to the slot in this factor. You can use, for example, begin() + 2 to get the 3rd variable in this factor.
Returns
A copy of the requested block.

◆ squaredTerm() [2/2]

Eigen::SelfAdjointView<constBlock, Eigen::Upper> gtsam::LinearizedHessianFactor::squaredTerm ( ) const
inline

Return the upper-triangular part of the full squared term, as described above. See HessianFactor class documentation above to explain that only the upper-triangular part of the information matrix is stored and returned by this function.

Member Data Documentation

◆ info_

SymmetricBlockMatrix gtsam::LinearizedHessianFactor::info_
protected

The block view of the full information matrix, s.t. the quadratic error is 0.5*[x -1]'H[x -1]

◆ lin_points_

Values gtsam::LinearizedGaussianFactor::lin_points_
protectedinherited

linearization points for error calculation


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