27 #ifndef G2O_SPARSE_BLOCK_MATRIX_ 28 #define G2O_SPARSE_BLOCK_MATRIX_ 41 #include "g2o/config.h" 60 template <
class MatrixType = MatrixXD >
85 SparseBlockMatrix(
const int * rbi,
const int* cbi,
int rb,
int cb,
bool hasStorage=
true);
93 void clear(
bool dealloc=
false) ;
96 SparseMatrixBlock*
block(
int r,
int c,
bool alloc=
false);
98 const SparseMatrixBlock*
block(
int r,
int c)
const;
131 template <
class MatrixTransposedType>
138 template <
class MatrixResultType,
class MatrixFactorType>
142 void multiply(
double*& dest,
const double* src)
const;
154 void scale(
double a);
165 int fillCCS(
int* Cp,
int* Ci,
double* Cx,
bool upperTriangle =
false)
const;
171 int fillCCS(
double* Cx,
bool upperTriangle =
false)
const;
192 bool writeOctave(
const char* filename,
bool upperTriangle =
true)
const;
221 template <
class MatrixType >
222 std::ostream& operator << (std::ostream&, const SparseBlockMatrix<MatrixType>& m);
const std::vector< int > & rowBlockIndices() const
indices of the row blocks
std::vector< int > _rowBlockIndices
vector of the indices of the blocks along the rows.
std::vector< int > _colBlockIndices
int fillSparseBlockMatrixCCS(SparseBlockMatrixCCS< MatrixType > &blockCCS) const
bool transpose(SparseBlockMatrix< MatrixTransposedType > *&dest) const
transposes a block matrix, The transposed type should match the argument false on failure ...
int rowsOfBlock(int r) const
how many rows does the block at block-row r has?
int cols() const
columns of the matrix
bool writeOctave(const char *filename, bool upperTriangle=true) const
int rows() const
rows of the matrix
SparseMatrixBlock * block(int r, int c, bool alloc=false)
returns the block at location r,c. if alloc=true he block is created if it does not exist ...
representing the structure of a matrix in column compressed structure (only the upper triangular part...
size_t nonZeroBlocks() const
number of allocated blocks
int colsOfBlock(int c) const
how many cols does the block at block-col c has?
void clear(bool dealloc=false)
this zeroes all the blocks. If dealloc=true the blocks are removed from memory
MatrixType SparseMatrixBlock
this is the type of the elementary block, it is an Eigen::Matrix.
size_t nonZeros() const
number of non-zero elements
void fillBlockStructure(MatrixStructure &ms) const
exports the non zero blocks in the structure matrix ms
std::vector< IntBlockMap > _blockCols
const std::vector< int > & colBlockIndices() const
indices of the column blocks
SparseBlockMatrix * slice(int rmin, int rmax, int cmin, int cmax, bool alloc=true) const
std::vector< IntBlockMap > & blockCols()
void takePatternFromHash(SparseBlockMatrixHashMap< MatrixType > &hashMatrix)
std::vector< int > & colBlockIndices()
void multiplySymmetricUpperTriangle(double *&dest, const double *src) const
Sparse matrix which uses blocks.
int fillSparseBlockMatrixCCSTransposed(SparseBlockMatrixCCS< MatrixType > &blockCCS) const
void rightMultiply(double *&dest, const double *src) const
dest = M * (*this)
std::vector< int > & rowBlockIndices()
bool symmPermutation(SparseBlockMatrix< MatrixType > *&dest, const int *pinv, bool onlyUpper=false) const
std::map< int, SparseMatrixBlock * > IntBlockMap
int colBaseOfBlock(int c) const
where does the col at block-col r starts?
const std::vector< IntBlockMap > & blockCols() const
the block matrices per block-column
bool multiply(SparseBlockMatrix< MatrixResultType > *&dest, const SparseBlockMatrix< MatrixFactorType > *M) const
dest = (*this) * M
void scale(double a)
*this *= a
SparseBlockMatrix * clone() const
deep copy of a sparse-block-matrix;
SparseBlockMatrix< MatrixXD > SparseBlockMatrixXd
Sparse matrix which uses blocks based on hash structures.
bool add(SparseBlockMatrix< MatrixType > *&dest) const
adds the current matrix to the destination
int rowBaseOfBlock(int r) const
where does the row at block-row r starts?
Sparse matrix which uses blocks.
int fillCCS(int *Cp, int *Ci, double *Cx, bool upperTriangle=false) const