template<int ErrorDim, int... BlockDims>
class gtsam::BatchJacobianFactor< ErrorDim, BlockDims >
Fixed-dimension row-sparse batch Jacobian factor.
This factor stores many small Jacobian row groups in compact form. A row group corresponds to one original nonlinear factor and has ErrorDim scalar rows. For each row group we store:
- the local key slot used by each factor variable,
- one fixed-size Jacobian block for each factor variable, and
- one fixed-size right-hand side vector.
The factor's key list is the union of all keys appearing in the batch. Unlike a dense JacobianFactor, a row group only stores blocks for the keys touched by that original factor. For example, point-first SFM batches avoid storing zero camera blocks for cameras that did not observe the point.
The template parameters require fixed dimensions so the hot loops can use Eigen fixed-size products. Dynamic-dimension factors should use the ordinary JacobianFactor fallback in BatchFactor.
Noise-model convention: if model_ is null or unit, blocks and right-hand sides are treated as already whitened. If model_ is a non-unit diagonal model, updateHessian() applies the per-row diagonal weights directly. Constrained models are intentionally rejected by updateHessian(), matching JacobianFactor's Hessian assembly behavior.
|
| | BatchJacobianFactor (const KeyVector &keys, std::vector< size_t > keyDims, const SharedDiagonal &model=SharedDiagonal()) |
| | Construct an empty compact batch factor with known key dimensions.
|
| GaussianFactor::shared_ptr | clone () const override |
| | Return a deep copy as a GaussianFactor.
|
|
void | reserve (size_t rowCount) |
| | Reserve storage for row groups before repeated addRow() calls.
|
| void | addRow (const SlotIndices &slots, const std::vector< Matrix > &blocks, const Vector &rhs) |
| | Add one row group corresponding to one original nonlinear factor.
|
|
void | addUnaryRow (DenseIndex keySlot, const typename std::tuple_element< 0, Blocks >::type::value_type &block, const RhsVector &rhs) |
| | Add one row to a unary compact batch without dynamic block containers.
|
| size_t | rows () const override |
| | Return the number of scalar rows represented by all row groups.
|
| const SharedDiagonal & | get_model () const override |
| | Return the optional diagonal model on the stored rows.
|
| DenseIndex | getDim (const_iterator variable) const override |
| | Return the dimension of the variable at the given key iterator.
|
|
const std::vector< SlotIndices > & | rowSlots () const |
| | Return the compact key slot used by each row group and factor slot.
|
|
template<size_t Slot> |
| const std::tuple_element< Slot, Blocks >::type::value_type & | block (size_t rowIndex) const |
| | Return one fixed-size Jacobian block from a compact row group.
|
|
const RhsVector & | rowRhs (size_t rowIndex) const |
| | Return the right-hand side for one compact row group.
|
| double | deltaError (const VectorValues &values, double *oldError=nullptr, double *newError=nullptr) const override |
| | Evaluate the linear-model error change directly from compact rows.
|
| void | hessianDiagonalAdd (VectorValues &diagonal) const override |
| | Accumulate the Hessian scalar diagonal directly from compact rows.
|
| void | multiplyHessianAdd (double alpha, const std::vector< size_t > &scalarOffsets, const double *x, double *y) const override |
| | Add alpha*A.transpose()*W*A*x directly to a flat output vector.
|
| void | gradientAtZeroAdd (const std::vector< size_t > &scalarOffsets, double *gradient) const override |
| | Add -A.transpose()*W*b directly to a flat gradient vector.
|
| void | hessianBlockDiagonalAdd (const std::vector< size_t > &blockSlots, std::vector< Matrix > *diagonalBlocks) const override |
| | Add compact A.transpose()*W*A diagonal blocks without keyed maps.
|
| JacobianFactor | toJacobianFactor () const override |
| | Convert compact row-block storage into a conventional JacobianFactor.
|
| void | updateHessian (const KeyVector &infoKeys, SymmetricBlockMatrix *info) const override |
| | Add this factor's augmented information matrix to info.
|
| void | updateHessian (const KeyVector &infoKeys, SymmetricBlockMatrix *info, DenseIndex beginCol, DenseIndex endCol) const override |
| | Add this factor's augmented information matrix over a block-column range.
|
| void | print (const std::string &s="", const KeyFormatter &formatter=DefaultKeyFormatter) const override |
| | Print this compact factor by converting to a JacobianFactor.
|
| bool | equals (const GaussianFactor &factor, double tol=1e-9) const override |
| | Test equality by comparing dense JacobianFactor representations.
|
| double | error (const VectorValues &values) const override |
| | Compute the factor error by delegating to the dense compatibility factor.
|
| double | deltaError (const VectorValues &values, double *oldError=nullptr, double *newError=nullptr) const override |
| | Compute the error change by delegating to the dense compatibility factor.
|
| Matrix | augmentedJacobian () const override |
| | Return the dense augmented Jacobian matrix for compatibility callers.
|
| std::pair< Matrix, Vector > | jacobian () const override |
| | Return the dense Jacobian matrix and right-hand side vector.
|
| Matrix | augmentedInformation () const override |
| | Return the dense augmented information matrix for compatibility callers.
|
| Matrix | information () const override |
| | Return the dense information matrix for compatibility callers.
|
| void | hessianDiagonalAdd (VectorValues &diagonal) const override |
| | Add this factor's Hessian diagonal into the given VectorValues.
|
| void | hessianDiagonal (double *diagonal) const override |
| | Add this factor's Hessian diagonal into a raw scalar buffer.
|
| std::map< Key, Matrix > | hessianBlockDiagonal () const override |
| | Return the Hessian diagonal blocks keyed by variable.
|
| GaussianFactor::shared_ptr | negate () const override |
| | Return a factor representing the negated linear system.
|
| void | updateHessian (const KeyVector &keys, SymmetricBlockMatrix *info) const override |
| | Update the augmented Hessian using key lookup through the dense fallback.
|
| void | updateHessian (const KeyVector &keys, SymmetricBlockMatrix *info, DenseIndex beginCol, DenseIndex endCol) const override |
| | Update a column range of the augmented Hessian using the dense fallback.
|
| void | multiplyHessianAdd (double alpha, const VectorValues &x, VectorValues &y) const override |
| | Add the Hessian-vector product into y using the dense fallback.
|
| VectorValues | gradientAtZero () const override |
| | Return the full gradient evaluated at zero.
|
| void | gradientAtZero (double *d) const override |
| | Add the gradient evaluated at zero into a raw scalar buffer.
|
| Vector | gradient (Key key, const VectorValues &x) const override |
| | Return the gradient block for one key at the given linearization point.
|
|
| GaussianFactor () |
| | Inherit GaussianFactor constructors.
|
|
template<typename CONTAINER> |
| | GaussianFactor (const CONTAINER &keys) |
| | Inherit GaussianFactor constructors.
|
|
| GaussianFactor () |
| | Default constructor creates empty factor.
|
| template<typename CONTAINER> |
| | GaussianFactor (const CONTAINER &keys) |
| | Construct from container of keys.
|
| double | error (const HybridValues &c) const override |
| | All factor types need to implement an error function.
|
|
VectorValues | hessianDiagonal () const |
| | Return the diagonal of the Hessian for this factor.
|
| virtual bool | isJacobian () const |
| | Fast check for JacobianFactor-based types.
|
|
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.
|