Public Member Functions | Private Types | List of all members
gtsam::RegularJacobianFactor< D > Class Template Reference

#include <RegularJacobianFactor.h>

Inheritance diagram for gtsam::RegularJacobianFactor< D >:
Inheritance graph
[legend]

Public Member Functions

VectorValues gradientAtZero () const override
 Expose base class gradientAtZero. More...
 
void gradientAtZero (double *d) const override
 Raw memory access version of gradientAtZero. More...
 
VectorValues hessianDiagonal () const
 Using the base method. More...
 
void hessianDiagonal (double *d) const override
 Raw memory access version of hessianDiagonal. More...
 
virtual void hessianDiagonal (double *d) const=0
 Using the base method. More...
 
void multiplyHessianAdd (double alpha, const double *x, double *y) const
 double* Hessian-vector multiply, i.e. y += A'*(A*x) RAW memory access! Assumes keys start at 0 and go to M-1, and x and and y are laid out that way More...
 
void multiplyHessianAdd (double alpha, const double *x, double *y, const std::vector< size_t > &accumulatedDims) const
 
void multiplyHessianAdd (double alpha, const VectorValues &x, VectorValues &y) const override
 
void multiplyHessianAdd (double alpha, const VectorValues &x, VectorValues &y) const override
 
Vector operator* (const double *x) const
 double* Matrix-vector multiply, i.e. y = A*x RAW memory access! Assumes keys start at 0 and go to M-1, and x is laid out that way More...
 
 RegularJacobianFactor ()
 Default constructor. More...
 
template<typename KEYS >
 RegularJacobianFactor (const KEYS &keys, const VerticalBlockMatrix &augmentedMatrix, const SharedDiagonal &sigmas=SharedDiagonal())
 
template<typename TERMS >
 RegularJacobianFactor (const TERMS &terms, const Vector &b, const SharedDiagonal &model=SharedDiagonal())
 
void transposeMultiplyAdd (double alpha, const Vector &e, double *x) const
 double* Transpose Matrix-vector multiply, i.e. x += A'*e RAW memory access! Assumes keys start at 0 and go to M-1, and y is laid out that way More...
 
- Public Member Functions inherited from gtsam::JacobianFactor
Matrix augmentedInformation () const override
 
Matrix augmentedJacobian () const override
 
Matrix augmentedJacobianUnweighted () const
 
GaussianFactor::shared_ptr clone () const override
 
size_t cols () const
 
std::pair< std::shared_ptr< GaussianConditional >, shared_ptreliminate (const Ordering &keys)
 
bool equals (const GaussianFactor &lf, double tol=1e-9) const override
 assert equality up to a tolerance More...
 
double error (const HybridValues &c) const override
 
virtual double error (const VectorValues &c) const
 
double error (const VectorValues &c) const override
 
Vector error_vector (const VectorValues &c) const
 
SharedDiagonalget_model ()
 
const SharedDiagonalget_model () const
 
ABlock getA ()
 
constABlock getA () const
 
ABlock getA (const Key &key)
 
constABlock getA (const_iterator variable) const
 
ABlock getA (iterator variable)
 
BVector getb ()
 
const constBVector getb () const
 
DenseIndex getDim (const_iterator variable) const override
 
Vector gradient (Key key, const VectorValues &x) const override
 Compute the gradient wrt a key at any values. More...
 
std::map< Key, MatrixhessianBlockDiagonal () const override
 Return the block diagonal of the Hessian for this factor. More...
 
void hessianDiagonalAdd (VectorValues &d) const override
 Add the current diagonal to a VectorValues instance. More...
 
Matrix information () const override
 
bool isConstrained () const
 
std::pair< Matrix, Vectorjacobian () const override
 Returns (dense) A,b pair associated with factor, bakes in the weights. More...
 
 JacobianFactor ()
 
 JacobianFactor (const GaussianFactor &gf)
 
 JacobianFactor (const GaussianFactorGraph &graph)
 
 JacobianFactor (const GaussianFactorGraph &graph, const Ordering &ordering)
 
 JacobianFactor (const GaussianFactorGraph &graph, const Ordering &ordering, const VariableSlots &p_variableSlots)
 
 JacobianFactor (const GaussianFactorGraph &graph, const VariableSlots &p_variableSlots)
 
 JacobianFactor (const HessianFactor &hf)
 
 JacobianFactor (const JacobianFactor &jf)
 
template<typename KEYS >
 JacobianFactor (const KEYS &keys, const VerticalBlockMatrix &augmentedMatrix, const SharedDiagonal &sigmas=SharedDiagonal())
 
template<typename TERMS >
 JacobianFactor (const TERMS &terms, const Vector &b, const SharedDiagonal &model=SharedDiagonal())
 
 JacobianFactor (const Vector &b_in)
 
 JacobianFactor (Key i1, const Matrix &A1, const Vector &b, const SharedDiagonal &model=SharedDiagonal())
 
 JacobianFactor (Key i1, const Matrix &A1, Key i2, const Matrix &A2, const Vector &b, const SharedDiagonal &model=SharedDiagonal())
 
 JacobianFactor (Key i1, const Matrix &A1, Key i2, const Matrix &A2, Key i3, const Matrix &A3, const Vector &b, const SharedDiagonal &model=SharedDiagonal())
 
std::pair< Matrix, VectorjacobianUnweighted () const
 Returns (dense) A,b pair associated with factor, does not bake in weights. More...
 
VerticalBlockMatrixmatrixObject ()
 
const VerticalBlockMatrixmatrixObject () const
 
void multiplyHessianAdd (double alpha, const double *x, double *y, const std::vector< size_t > &accumulatedDims) const
 
GaussianFactor::shared_ptr negate () const override
 
Vector operator* (const VectorValues &x) const
 
void print (const std::string &s="", const KeyFormatter &formatter=DefaultKeyFormatter) const override
 print with optional string More...
 
size_t rows () const
 
void setModel (bool anyConstrained, const Vector &sigmas)
 
std::shared_ptr< GaussianConditionalsplitConditional (size_t nrFrontals)
 
void transposeMultiplyAdd (double alpha, const Vector &e, VectorValues &x) const
 
Vector unweighted_error (const VectorValues &c) const
 
void updateHessian (const KeyVector &keys, SymmetricBlockMatrix *info) const override
 
JacobianFactor whiten () const
 
 ~JacobianFactor () override
 
- Public Member Functions inherited from gtsam::GaussianFactor
 GaussianFactor ()
 
template<typename CONTAINER >
 GaussianFactor (const CONTAINER &keys)
 
double error (const HybridValues &c) const override
 
VectorValues hessianDiagonal () const
 Return the diagonal of the Hessian for this factor. More...
 
- Public Member Functions inherited from gtsam::Factor
virtual ~Factor ()=default
 Default destructor. More...
 
bool empty () const
 Whether the factor is empty (involves zero variables). More...
 
Key front () const
 First key. More...
 
Key back () const
 Last key. More...
 
const_iterator find (Key key) const
 find More...
 
const KeyVectorkeys () const
 Access the factor's involved variable keys. More...
 
const_iterator begin () const
 
const_iterator end () const
 
size_t size () const
 
virtual void printKeys (const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
 print only keys More...
 
bool equals (const This &other, double tol=1e-9) const
 check equality More...
 
KeyVectorkeys ()
 
iterator begin ()
 
iterator end ()
 

Private Types

typedef Eigen::Map< const DVectorConstDMap
 
typedef Eigen::Map< DVectorDMap
 
typedef Eigen::Matrix< double, D, 1 > DVector
 

Additional Inherited Members

- Public Types inherited from gtsam::JacobianFactor
typedef VerticalBlockMatrix::Block ABlock
 
typedef GaussianFactor Base
 Typedef to base class. More...
 
typedef ABlock::ColXpr BVector
 
typedef VerticalBlockMatrix::constBlock constABlock
 
typedef constABlock::ConstColXpr constBVector
 
typedef std::shared_ptr< Thisshared_ptr
 shared_ptr to this class More...
 
typedef JacobianFactor This
 Typedef to this class. More...
 
- Public Types inherited from gtsam::GaussianFactor
typedef Factor Base
 Our base class. More...
 
typedef std::shared_ptr< Thisshared_ptr
 shared_ptr to this class More...
 
typedef GaussianFactor This
 This class. More...
 
- Public Types inherited from gtsam::Factor
typedef KeyVector::const_iterator const_iterator
 Const iterator over keys. More...
 
typedef KeyVector::iterator iterator
 Iterator over keys. More...
 
- Static Public Member Functions inherited from gtsam::GaussianFactor
template<typename CONTAINER >
static DenseIndex Slot (const CONTAINER &keys, Key key)
 
- Protected Member Functions inherited from gtsam::JacobianFactor
template<typename TERMS >
void fillTerms (const TERMS &terms, const Vector &b, const SharedDiagonal &noiseModel)
 Internal function to fill blocks and set dimensions. More...
 
- Protected Member Functions inherited from gtsam::Factor
 Factor ()
 
template<typename CONTAINER >
 Factor (const CONTAINER &keys)
 
template<typename ITERATOR >
 Factor (ITERATOR first, ITERATOR last)
 
- Static Protected Member Functions inherited from gtsam::Factor
template<typename CONTAINER >
static Factor FromKeys (const CONTAINER &keys)
 
template<typename ITERATOR >
static Factor FromIterators (ITERATOR first, ITERATOR last)
 
- Protected Attributes inherited from gtsam::JacobianFactor
VerticalBlockMatrix Ab_
 
noiseModel::Diagonal::shared_ptr model_
 
- Protected Attributes inherited from gtsam::Factor
KeyVector keys_
 The keys involved in this factor. More...
 

Detailed Description

template<size_t D>
class gtsam::RegularJacobianFactor< D >

JacobianFactor with constant sized blocks Provides raw memory access versions of linear operator. Is base class for JacobianQFactor, JacobianFactorQR, and JacobianFactorSVD

Definition at line 32 of file RegularJacobianFactor.h.

Member Typedef Documentation

◆ ConstDMap

template<size_t D>
typedef Eigen::Map<const DVector> gtsam::RegularJacobianFactor< D >::ConstDMap
private

Definition at line 39 of file RegularJacobianFactor.h.

◆ DMap

template<size_t D>
typedef Eigen::Map<DVector> gtsam::RegularJacobianFactor< D >::DMap
private

Definition at line 38 of file RegularJacobianFactor.h.

◆ DVector

template<size_t D>
typedef Eigen::Matrix<double, D, 1> gtsam::RegularJacobianFactor< D >::DVector
private

Definition at line 37 of file RegularJacobianFactor.h.

Constructor & Destructor Documentation

◆ RegularJacobianFactor() [1/3]

template<size_t D>
gtsam::RegularJacobianFactor< D >::RegularJacobianFactor ( )
inline

Default constructor.

Definition at line 44 of file RegularJacobianFactor.h.

◆ RegularJacobianFactor() [2/3]

template<size_t D>
template<typename TERMS >
gtsam::RegularJacobianFactor< D >::RegularJacobianFactor ( const TERMS &  terms,
const Vector b,
const SharedDiagonal model = SharedDiagonal() 
)
inline

Construct an n-ary factor

Template Parameters
TERMSA container whose value type is std::pair<Key, Matrix>, specifying the collection of keys and matrices making up the factor. TODO Verify terms are regular

Definition at line 52 of file RegularJacobianFactor.h.

◆ RegularJacobianFactor() [3/3]

template<size_t D>
template<typename KEYS >
gtsam::RegularJacobianFactor< D >::RegularJacobianFactor ( const KEYS &  keys,
const VerticalBlockMatrix augmentedMatrix,
const SharedDiagonal sigmas = SharedDiagonal() 
)
inline

Constructor with arbitrary number keys, and where the augmented matrix is given all together instead of in block terms. Note that only the active view of the provided augmented matrix is used, and that the matrix data is copied into a newly-allocated matrix in the constructed factor. TODO Verify complies to regular

Definition at line 64 of file RegularJacobianFactor.h.

Member Function Documentation

◆ gradientAtZero() [1/2]

template<size_t D>
VectorValues gtsam::RegularJacobianFactor< D >::gradientAtZero ( ) const
inlineoverridevirtual

Expose base class gradientAtZero.

Reimplemented from gtsam::JacobianFactor.

Definition at line 128 of file RegularJacobianFactor.h.

◆ gradientAtZero() [2/2]

template<size_t D>
void gtsam::RegularJacobianFactor< D >::gradientAtZero ( double *  d) const
inlineoverridevirtual

Raw memory access version of gradientAtZero.

Reimplemented from gtsam::JacobianFactor.

Definition at line 133 of file RegularJacobianFactor.h.

◆ hessianDiagonal() [1/3]

template<size_t D>
VectorValues GaussianFactor::hessianDiagonal

Using the base method.

Definition at line 35 of file GaussianFactor.cpp.

◆ hessianDiagonal() [2/3]

template<size_t D>
void gtsam::RegularJacobianFactor< D >::hessianDiagonal ( double *  d) const
inlineoverridevirtual

Raw memory access version of hessianDiagonal.

Reimplemented from gtsam::JacobianFactor.

Definition at line 109 of file RegularJacobianFactor.h.

◆ hessianDiagonal() [3/3]

template<size_t D>
virtual void gtsam::GaussianFactor::hessianDiagonal

Using the base method.

◆ multiplyHessianAdd() [1/4]

template<size_t D>
void gtsam::RegularJacobianFactor< D >::multiplyHessianAdd ( double  alpha,
const double *  x,
double *  y 
) const
inline

double* Hessian-vector multiply, i.e. y += A'*(A*x) RAW memory access! Assumes keys start at 0 and go to M-1, and x and and y are laid out that way

Definition at line 82 of file RegularJacobianFactor.h.

◆ multiplyHessianAdd() [2/4]

template<size_t D>
void JacobianFactor::multiplyHessianAdd

Raw memory access version of multiplyHessianAdd y += alpha * A'*A*x Requires the vector accumulatedDims to tell the dimension of each variable: e.g.: x0 has dim 3, x2 has dim 6, x3 has dim 2, then accumulatedDims is [0 3 9 11 13] NOTE: size of accumulatedDims is size of keys + 1!! TODO(frank): we should probably kill this if no longer needed

Raw memory access version of multiplyHessianAdd y += alpha * A'*A*x Note: this is not assuming a fixed dimension for the variables, but requires the vector accumulatedDims to tell the dimension of each variable: e.g.: x0 has dim 3, x2 has dim 6, x3 has dim 2, then accumulatedDims is [0 3 9 11 13] NOTE: size of accumulatedDims is size of keys + 1!! TODO Frank asks: why is this here if not regular ????

Use Eigen magic to access raw memory

Just iterate over all A matrices and multiply in correct config part (looping over keys) E.g.: Jacobian A = [A0 A1 A2] multiplies x = [x0 x1 x2]' Hence: Ax = A0 x0 + A1 x1 + A2 x2 (hence we loop over the keys and accumulate)

Deal with noise properly, need to Double* whiten as we are dividing by variance

multiply with alpha

Again iterate over all A matrices and insert Ai^T into y

Definition at line 654 of file JacobianFactor.cpp.

◆ multiplyHessianAdd() [3/4]

template<size_t D>
void JacobianFactor::multiplyHessianAdd
override

y += alpha * A'*A*x

Definition at line 639 of file JacobianFactor.cpp.

◆ multiplyHessianAdd() [4/4]

template<size_t D>
void gtsam::RegularJacobianFactor< D >::multiplyHessianAdd ( double  alpha,
const VectorValues x,
VectorValues y 
) const
inlineoverridevirtual

y += alpha * A'*A*x

Reimplemented from gtsam::JacobianFactor.

Definition at line 73 of file RegularJacobianFactor.h.

◆ operator*()

template<size_t D>
Vector gtsam::RegularJacobianFactor< D >::operator* ( const double *  x) const
inline

double* Matrix-vector multiply, i.e. y = A*x RAW memory access! Assumes keys start at 0 and go to M-1, and x is laid out that way

Definition at line 172 of file RegularJacobianFactor.h.

◆ transposeMultiplyAdd()

template<size_t D>
void gtsam::RegularJacobianFactor< D >::transposeMultiplyAdd ( double  alpha,
const Vector e,
double *  x 
) const
inline

double* Transpose Matrix-vector multiply, i.e. x += A'*e RAW memory access! Assumes keys start at 0 and go to M-1, and y is laid out that way

Definition at line 161 of file RegularJacobianFactor.h.


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


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:24:43