|
gtsam 4.2
gtsam
|
JacobianFactor for Schur complement that uses the "Nullspace Trick" by Mourikis et al.
This trick is equivalent to the Schur complement, but can be faster. In essence, the linear factor |E*dp + F*dX - b|, where p is point and X are poses, is multiplied by Enull, a matrix that spans the left nullspace of E, i.e., The mx3 matrix is analyzed with SVD as E = [Erange Enull]*S*V (mxm * mx3 * 3x3) where Enull is an m x (m-3) matrix Then Enull'*E*dp = 0, and |Enull'*E*dp + Enull'*F*dX - Enull'*b| == |Enull'*F*dX - Enull'*b| Normally F is m x 6*numKeys, and Enull'*F yields an (m-3) x 6*numKeys matrix.
The code below assumes that F is block diagonal and is given as a vector of ZDim*D blocks. Example: m = 4 (2 measurements), Enull = 4*1, F = 4*12 (for D=6) Then Enull'*F = 1*4 * 4*12 = 1*12, but each 1*6 piece can be computed as a 1x2 * 2x6 multiplication.
Public Member Functions | |
| JacobianFactorSVD () | |
| Default constructor. | |
| JacobianFactorSVD (const KeyVector &keys, const SharedDiagonal &model=SharedDiagonal()) | |
| Empty constructor with keys. | |
| JacobianFactorSVD (const KeyVector &keys, const std::vector< MatrixZD, Eigen::aligned_allocator< MatrixZD > > &Fblocks, const Matrix &Enull, const Vector &b, const SharedDiagonal &model=SharedDiagonal()) | |
| Construct a new JacobianFactorSVD object, createing a reduced-rank Jacobian factor on the CameraSet. | |
| Public Member Functions inherited from gtsam::RegularJacobianFactor< D > | |
| RegularJacobianFactor () | |
| Default constructor. | |
| template<typename TERMS> | |
| RegularJacobianFactor (const TERMS &terms, const Vector &b, const SharedDiagonal &model=SharedDiagonal()) | |
| Construct an n-ary factor. | |
| template<typename KEYS> | |
| RegularJacobianFactor (const KEYS &keys, const VerticalBlockMatrix &augmentedMatrix, const SharedDiagonal &sigmas=SharedDiagonal()) | |
| Constructor with arbitrary number keys, and where the augmented matrix is given all together instead of in block terms. | |
| void | multiplyHessianAdd (double alpha, const VectorValues &x, VectorValues &y) const override |
| y += alpha * A'*A*x | |
| void | multiplyHessianAdd (double alpha, const double *x, double *y) const |
| double* Hessian-vector multiply, i.e. | |
| void | hessianDiagonal (double *d) const override |
| Raw memory access version of hessianDiagonal. | |
| VectorValues | gradientAtZero () const override |
| Expose base class gradientAtZero. | |
| void | gradientAtZero (double *d) const override |
| Raw memory access version of gradientAtZero. | |
| void | transposeMultiplyAdd (double alpha, const Vector &e, double *x) const |
| double* Transpose Matrix-vector multiply, i.e. | |
| Vector | operator* (const double *x) const |
| double* Matrix-vector multiply, i.e. | |
| void | multiplyHessianAdd (double alpha, const double *x, double *y, const std::vector< size_t > &accumulatedDims) const |
| 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! | |
| VectorValues | hessianDiagonal () const |
| Using the base method. | |
| Public Member Functions inherited from gtsam::JacobianFactor | |
| JacobianFactor (const GaussianFactor &gf) | |
| Convert from other GaussianFactor. | |
| JacobianFactor (const JacobianFactor &jf) | |
| Copy constructor. | |
| JacobianFactor (const HessianFactor &hf) | |
| Conversion from HessianFactor (does Cholesky to obtain Jacobian matrix). | |
| JacobianFactor () | |
| default constructor for I/O | |
| JacobianFactor (const Vector &b_in) | |
| Construct Null factor. | |
| JacobianFactor (Key i1, const Matrix &A1, const Vector &b, const SharedDiagonal &model=SharedDiagonal()) | |
| Construct unary factor. | |
| JacobianFactor (Key i1, const Matrix &A1, Key i2, const Matrix &A2, const Vector &b, const SharedDiagonal &model=SharedDiagonal()) | |
| Construct binary factor. | |
| JacobianFactor (Key i1, const Matrix &A1, Key i2, const Matrix &A2, Key i3, const Matrix &A3, const Vector &b, const SharedDiagonal &model=SharedDiagonal()) | |
| Construct ternary factor. | |
| template<typename TERMS> | |
| JacobianFactor (const TERMS &terms, const Vector &b, const SharedDiagonal &model=SharedDiagonal()) | |
| Construct an n-ary factor. | |
| template<typename KEYS> | |
| JacobianFactor (const KEYS &keys, const VerticalBlockMatrix &augmentedMatrix, const SharedDiagonal &sigmas=SharedDiagonal()) | |
| Constructor with arbitrary number keys, and where the augmented matrix is given all together instead of in block terms. | |
| JacobianFactor (const GaussianFactorGraph &graph) | |
| Build a dense joint factor from all the factors in a factor graph. | |
| JacobianFactor (const GaussianFactorGraph &graph, const VariableSlots &p_variableSlots) | |
| Build a dense joint factor from all the factors in a factor graph. | |
| JacobianFactor (const GaussianFactorGraph &graph, const Ordering &ordering) | |
| Build a dense joint factor from all the factors in a factor graph. | |
| JacobianFactor (const GaussianFactorGraph &graph, const Ordering &ordering, const VariableSlots &p_variableSlots) | |
| Build a dense joint factor from all the factors in a factor graph. | |
| ~JacobianFactor () override | |
| Virtual destructor. | |
| GaussianFactor::shared_ptr | clone () const override |
| Clone this JacobianFactor. | |
| void | print (const std::string &s="", const KeyFormatter &formatter=DefaultKeyFormatter) const override |
| print | |
| bool | equals (const GaussianFactor &lf, double tol=1e-9) const override |
| Equals for testable. | |
| Vector | unweighted_error (const VectorValues &c) const |
| Vector | error_vector (const VectorValues &c) const |
| (A*x-b) | |
| double | error (const VectorValues &c) const override |
| Matrix | augmentedInformation () const override |
| Return the augmented information matrix represented by this GaussianFactor. | |
| Matrix | information () const override |
| Return the non-augmented information matrix represented by this GaussianFactor. | |
| void | hessianDiagonalAdd (VectorValues &d) const override |
| Add the current diagonal to a VectorValues instance. | |
| std::map< Key, Matrix > | hessianBlockDiagonal () const override |
| Return the block diagonal of the Hessian for this factor. | |
| std::pair< Matrix, Vector > | jacobian () const override |
| Returns (dense) A,b pair associated with factor, bakes in the weights. | |
| std::pair< Matrix, Vector > | jacobianUnweighted () const |
| Returns (dense) A,b pair associated with factor, does not bake in weights. | |
| Matrix | augmentedJacobian () const override |
| Return (dense) matrix associated with factor. | |
| Matrix | augmentedJacobianUnweighted () const |
| Return (dense) matrix associated with factor. | |
| const VerticalBlockMatrix & | matrixObject () const |
| Return the full augmented Jacobian matrix of this factor as a VerticalBlockMatrix object. | |
| VerticalBlockMatrix & | matrixObject () |
| Mutable access to the full augmented Jacobian matrix of this factor as a VerticalBlockMatrix object. | |
| GaussianFactor::shared_ptr | negate () const override |
| Construct the corresponding anti-factor to negate information stored stored in this factor. | |
| bool | isConstrained () const |
| is noise model constrained ? | |
| DenseIndex | getDim (const_iterator variable) const override |
| Return the dimension of the variable pointed to by the given key iterator todo: Remove this in favor of keeping track of dimensions with variables? | |
| size_t | rows () const |
| return the number of rows in the corresponding linear system | |
| size_t | cols () const |
| return the number of columns in the corresponding linear system | |
| const SharedDiagonal & | get_model () const |
| get a copy of model | |
| SharedDiagonal & | get_model () |
| get a copy of model (non-const version) | |
| const constBVector | getb () const |
| Get a view of the r.h.s. | |
| constABlock | getA (const_iterator variable) const |
| Get a view of the A matrix for the variable pointed to by the given key iterator. | |
| constABlock | getA () const |
| Get a view of the A matrix, not weighted by noise. | |
| BVector | getb () |
| Get a view of the r.h.s. | |
| ABlock | getA (iterator variable) |
| Get a view of the A matrix for the variable pointed to by the given key iterator (non-const version). | |
| ABlock | getA () |
| Get a view of the A matrix. | |
| void | updateHessian (const KeyVector &keys, SymmetricBlockMatrix *info) const override |
| Update an information matrix by adding the information corresponding to this factor (used internally during elimination). | |
| Vector | operator* (const VectorValues &x) const |
| Return A*x. | |
| void | transposeMultiplyAdd (double alpha, const Vector &e, VectorValues &x) const |
| x += alpha * A'*e. | |
| void | multiplyHessianAdd (double alpha, const double *x, double *y, const std::vector< size_t > &accumulatedDims) const |
| 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! | |
| Vector | gradient (Key key, const VectorValues &x) const override |
| Compute the gradient wrt a key at any values. | |
| JacobianFactor | whiten () const |
| Return a whitened version of the factor, i.e. | |
| std::pair< boost::shared_ptr< GaussianConditional >, shared_ptr > | eliminate (const Ordering &keys) |
| Eliminate the requested variables. | |
| void | setModel (bool anyConstrained, const Vector &sigmas) |
| set noiseModel correctly | |
| boost::shared_ptr< GaussianConditional > | splitConditional (size_t nrFrontals) |
| splits a pre-factorized factor into a conditional, and changes the current factor to be the remaining component. | |
| double | error (const HybridValues &c) const override |
| All factor types need to implement an error function. | |
| VectorValues | hessianDiagonal () const |
| Using the base method. | |
| Public Member Functions inherited from gtsam::GaussianFactor | |
| GaussianFactor () | |
| Default constructor creates empty factor. | |
| template<typename CONTAINER> | |
| GaussianFactor (const CONTAINER &keys) | |
| Construct from container of keys. | |
| virtual | ~GaussianFactor () |
| Destructor. | |
| VectorValues | hessianDiagonal () const |
| Return the diagonal of the Hessian for this factor. | |
| 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. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from gtsam::GaussianFactor | |
| template<typename CONTAINER> | |
| static DenseIndex | Slot (const CONTAINER &keys, Key key) |
| Public Types inherited from gtsam::JacobianFactor | |
| typedef JacobianFactor | This |
| Typedef to this class. | |
| typedef GaussianFactor | Base |
| Typedef to base class. | |
| typedef boost::shared_ptr< This > | shared_ptr |
| shared_ptr to this class | |
| typedef VerticalBlockMatrix::Block | ABlock |
| typedef VerticalBlockMatrix::constBlock | constABlock |
| typedef ABlock::ColXpr | BVector |
| typedef constABlock::ConstColXpr | constBVector |
| Public Types inherited from gtsam::GaussianFactor | |
| typedef GaussianFactor | This |
| This class. | |
| typedef boost::shared_ptr< This > | shared_ptr |
| shared_ptr to this class | |
| typedef Factor | Base |
| Our base class. | |
| Public Types inherited from gtsam::Factor | |
| typedef KeyVector::iterator | iterator |
| Iterator over keys. | |
| typedef KeyVector::const_iterator | const_iterator |
| Const iterator over keys. | |
| 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. | |
| 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::JacobianFactor | |
| VerticalBlockMatrix | Ab_ |
| noiseModel::Diagonal::shared_ptr | model_ |
| Protected Attributes inherited from gtsam::Factor | |
| KeyVector | keys_ |
| The keys involved in this factor. | |
|
inline |
Construct a new JacobianFactorSVD object, createing a reduced-rank Jacobian factor on the CameraSet.