gtsam  4.1.0
gtsam
gtsam::SymmetricBlockMatrix Class Reference

Public Member Functions

 SymmetricBlockMatrix ()
 Construct from an empty matrix (asserts that the matrix is empty)
 
template<typename CONTAINER >
 SymmetricBlockMatrix (const CONTAINER &dimensions, bool appendOneDimension=false)
 Construct from a container of the sizes of each block.
 
template<typename ITERATOR >
 SymmetricBlockMatrix (ITERATOR firstBlockDim, ITERATOR lastBlockDim, bool appendOneDimension=false)
 Construct from iterator over the sizes of each vertical block.
 
template<typename CONTAINER >
 SymmetricBlockMatrix (const CONTAINER &dimensions, const Matrix &matrix, bool appendOneDimension=false)
 Construct from a container of the sizes of each vertical block and a pre-prepared matrix.
 
DenseIndex rows () const
 Row size.
 
DenseIndex cols () const
 Column size.
 
DenseIndex nBlocks () const
 Block count.
 
DenseIndex getDim (DenseIndex block) const
 Number of dimensions for variable on this diagonal block.
 
DenseIndexblockStart ()
 Retrieve or modify the first logical block, i.e. More...
 
DenseIndex blockStart () const
 Retrieve the first logical block, i.e. More...
 
void choleskyPartial (DenseIndex nFrontals)
 Given the augmented Hessian [A1'A1 A1'A2 A1'b A2'A1 A2'A2 A2'b b'A1 b'A2 b'b] on x1 and x2, does partial Cholesky in-place to obtain [R Sd;0 L] such that R'R = A1'A1 R'Sd = [A1'A2 A1'b] L'L is the augmented Hessian on the the separator x2 R and Sd can be interpreted as a GaussianConditional |R*x1 + S*x2 - d]^2.
 
VerticalBlockMatrix split (DenseIndex nFrontals)
 After partial Cholesky, we can optionally split off R and Sd, to be interpreted as a GaussianConditional |R*x1 + S*x2 - d]^2. More...
 
Block getter methods.
Matrix block (DenseIndex I, DenseIndex J) const
 Get a copy of a block (anywhere in the matrix). More...
 
Eigen::SelfAdjointView< Block, Eigen::Upper > diagonalBlock (DenseIndex J)
 Return the J'th diagonal block as a self adjoint view.
 
Eigen::SelfAdjointView< constBlock, Eigen::Upper > diagonalBlock (DenseIndex J) const
 Return the J'th diagonal block as a self adjoint view.
 
Vector diagonal (DenseIndex J) const
 Get the diagonal of the J'th diagonal block.
 
constBlock aboveDiagonalBlock (DenseIndex I, DenseIndex J) const
 Get block above the diagonal (I, J).
 
Eigen::SelfAdjointView< constBlock, Eigen::Upper > selfadjointView (DenseIndex I, DenseIndex J) const
 Return the square sub-matrix that contains blocks(i:j, i:j).
 
Eigen::TriangularView< constBlock, Eigen::Upper > triangularView (DenseIndex I, DenseIndex J) const
 Return the square sub-matrix that contains blocks(i:j, i:j) as a triangular view.
 
constBlock aboveDiagonalRange (DenseIndex i_startBlock, DenseIndex i_endBlock, DenseIndex j_startBlock, DenseIndex j_endBlock) const
 Get a range [i,j) from the matrix. Indices are in block units.
 
Block aboveDiagonalRange (DenseIndex i_startBlock, DenseIndex i_endBlock, DenseIndex j_startBlock, DenseIndex j_endBlock)
 Get a range [i,j) from the matrix. Indices are in block units.
 
Block setter methods.
template<typename XprType >
void setDiagonalBlock (DenseIndex I, const XprType &xpr)
 Set a diagonal block. Only the upper triangular portion of xpr is evaluated.
 
template<typename XprType >
void setOffDiagonalBlock (DenseIndex I, DenseIndex J, const XprType &xpr)
 Set an off-diagonal block. Only the upper triangular portion of xpr is evaluated.
 
template<typename XprType >
void updateDiagonalBlock (DenseIndex I, const XprType &xpr)
 Increment the diagonal block by the values in xpr. Only reads the upper triangular part of xpr.
 
template<typename XprType >
void updateOffDiagonalBlock (DenseIndex I, DenseIndex J, const XprType &xpr)
 Update an off diagonal block. More...
 
Accessing the full matrix.
Eigen::SelfAdjointView< Block, Eigen::Upper > selfadjointView ()
 Get self adjoint view.
 
Eigen::SelfAdjointView< constBlock, Eigen::Upper > selfadjointView () const
 Get self adjoint view.
 
template<typename XprType >
void setFullMatrix (const XprType &xpr)
 Set the entire active matrix. Only reads the upper triangular part of xpr.
 
void setZero ()
 Set the entire active matrix zero.
 
void negate ()
 Negate the entire active matrix.
 
void invertInPlace ()
 Invert the entire active matrix in place.
 

Static Public Member Functions

static SymmetricBlockMatrix LikeActiveViewOf (const SymmetricBlockMatrix &other)
 Copy the block structure, but do not copy the matrix data. More...
 
static SymmetricBlockMatrix LikeActiveViewOf (const VerticalBlockMatrix &other)
 Copy the block structure, but do not copy the matrix data. More...
 

Public Types

typedef SymmetricBlockMatrix This
 
typedef Eigen::Block< Matrix > Block
 
typedef Eigen::Block< const Matrix > constBlock
 

Protected Member Functions

DenseIndex nOffsets () const
 Number of offsets in the full matrix.
 
DenseIndex nActualBlocks () const
 Number of actual blocks in the full matrix.
 
DenseIndex offset (DenseIndex block) const
 Get an offset for a block index (in the active view).
 
constBlock block_ (DenseIndex iBlock, DenseIndex jBlock, DenseIndex blockRows=1, DenseIndex blockCols=1) const
 Get an arbitrary block from the matrix. Indices are in block units.
 
Block block_ (DenseIndex iBlock, DenseIndex jBlock, DenseIndex blockRows=1, DenseIndex blockCols=1)
 Get an arbitrary block from the matrix. Indices are in block units.
 
constBlock full () const
 Get the full matrix as a block.
 
Block full ()
 Get the full matrix as a block.
 
std::array< DenseIndex, 4 > calcIndices (DenseIndex iBlock, DenseIndex jBlock, DenseIndex blockRows, DenseIndex blockCols) const
 Compute the indices into the underlying matrix for a given block.
 
void assertInvariants () const
 
template<typename ITERATOR >
void fillOffsets (ITERATOR firstBlockDim, ITERATOR lastBlockDim, bool appendOneDimension)
 

Protected Attributes

Matrix matrix_
 The full matrix.
 
FastVector< DenseIndexvariableColOffsets_
 the starting columns of each block (0-based)
 
DenseIndex blockStart_
 Changes apparent matrix view, see main class comment.
 

Friends

class VerticalBlockMatrix
 
template<typename SymmetricBlockMatrixType >
class SymmetricBlockMatrixBlockExpr
 
class boost::serialization::access
 Serialization function.
 

Member Function Documentation

◆ block()

Matrix gtsam::SymmetricBlockMatrix::block ( DenseIndex  I,
DenseIndex  J 
) const

Get a copy of a block (anywhere in the matrix).

This method makes a copy - use the methods below if performance is critical.

◆ blockStart() [1/2]

DenseIndex& gtsam::SymmetricBlockMatrix::blockStart ( )
inline

Retrieve or modify the first logical block, i.e.

the block referenced by block index 0. Blocks before it will be inaccessible, except by accessing the underlying matrix using matrix().

◆ blockStart() [2/2]

DenseIndex gtsam::SymmetricBlockMatrix::blockStart ( ) const
inline

Retrieve the first logical block, i.e.

the block referenced by block index 0. Blocks before it will be inaccessible, except by accessing the underlying matrix using matrix().

◆ LikeActiveViewOf() [1/2]

SymmetricBlockMatrix gtsam::SymmetricBlockMatrix::LikeActiveViewOf ( const SymmetricBlockMatrix other)
static

Copy the block structure, but do not copy the matrix data.

If blockStart() has been modified, this copies the structure of the corresponding matrix view. In the destination SymmetricBlockMatrix, blockStart() will be 0.

◆ LikeActiveViewOf() [2/2]

SymmetricBlockMatrix gtsam::SymmetricBlockMatrix::LikeActiveViewOf ( const VerticalBlockMatrix other)
static

Copy the block structure, but do not copy the matrix data.

If blockStart() has been modified, this copies the structure of the corresponding matrix view. In the destination SymmetricBlockMatrix, blockStart() will be 0.

◆ split()

VerticalBlockMatrix gtsam::SymmetricBlockMatrix::split ( DenseIndex  nFrontals)

After partial Cholesky, we can optionally split off R and Sd, to be interpreted as a GaussianConditional |R*x1 + S*x2 - d]^2.

We leave the symmetric lower block L in place, and adjust block_start so now *this refers to it.

◆ updateOffDiagonalBlock()

template<typename XprType >
void gtsam::SymmetricBlockMatrix::updateOffDiagonalBlock ( DenseIndex  I,
DenseIndex  J,
const XprType &  xpr 
)
inline

Update an off diagonal block.

NOTE(emmett): This assumes noalias().


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