27#ifndef G2O_SPARSE_BLOCK_MATRIX_
28#define G2O_SPARSE_BLOCK_MATRIX_
39#include "g2o/config.h"
63template <
class MatrixType = MatrixX>
95 bool hasStorage =
true);
103 void clear(
bool dealloc =
false);
150 bool alloc =
true)
const;
154 template <
class MatrixTransposedType>
157 template <
class MatrixTransposedType>
158 std::unique_ptr<SparseBlockMatrix<MatrixTransposedType>>
transposed()
const;
162 std::unique_ptr<SparseBlockMatrix<MatrixType>>
added()
const;
165 template <
class MatrixResultType,
class MatrixFactorType>
170 void multiply(
double*& dest,
const double* src)
const;
183 void scale(
double a);
190 bool onlyUpper =
false)
const;
195 int fillCCS(
int* Cp,
int* Ci,
double* Cx,
bool upperTriangle =
false)
const;
202 int fillCCS(
double* Cx,
bool upperTriangle =
false)
const;
227 bool writeOctave(
const char* filename,
bool upperTriangle =
true)
const;
261 template <
class MatrixTransposedType>
267template <
class MatrixType>
representing the structure of a matrix in column compressed structure (only the upper triangular part...
Sparse matrix which uses blocks.
Sparse matrix which uses blocks based on hash structures.
Sparse matrix which uses blocks.
size_t nonZeros() const
number of non-zero elements
void takePatternFromHash(SparseBlockMatrixHashMap< MatrixType > &hashMatrix)
bool symmPermutation(SparseBlockMatrix< MatrixType > *&dest, const int *pinv, bool onlyUpper=false) const
bool add(SparseBlockMatrix< MatrixType > &dest) const
adds the current matrix to the destination
bool transpose(SparseBlockMatrix< MatrixTransposedType > &dest) const
bool writeOctave(const char *filename, bool upperTriangle=true) const
std::vector< IntBlockMap > & blockCols()
int fillSparseBlockMatrixCCSTransposed(SparseBlockMatrixCCS< MatrixType > &blockCCS) const
size_t nonZeroBlocks() const
number of allocated blocks
int colBaseOfBlock(int c) const
where does the col at block-col r starts?
int fillCCS(int *Cp, int *Ci, double *Cx, bool upperTriangle=false) const
int rowsOfBlock(int r) const
how many rows does the block at block-row r has?
const std::vector< IntBlockMap > & blockCols() const
the block matrices per block-column
int fillSparseBlockMatrixCCS(SparseBlockMatrixCCS< MatrixType > &blockCCS) const
std::unique_ptr< SparseBlockMatrix< MatrixType > > added() const
SparseBlockMatrix * slice(int rmin, int rmax, int cmin, int cmax, bool alloc=true) const
void rightMultiply(double *&dest, const double *src) const
dest = M * (*this)
void multiplySymmetricUpperTriangle(double *&dest, const double *src) const
const std::vector< int > & colBlockIndices() const
indices of the column blocks
std::unique_ptr< SparseBlockMatrix< MatrixTransposedType > > transposed() const
std::map< int, SparseMatrixBlock * > IntBlockMap
int rows() const
rows of the matrix
SparseMatrixBlock * block(int r, int c, bool alloc=false)
SparseBlockMatrix * clone() const
deep copy of a sparse-block-matrix;
std::vector< int > _rowBlockIndices
MatrixType SparseMatrixBlock
this is the type of the elementary block, it is an Eigen::Matrix.
bool multiply(SparseBlockMatrix< MatrixResultType > *&dest, const SparseBlockMatrix< MatrixFactorType > *M) const
dest = (*this) * M
int cols() const
columns of the matrix
std::vector< int > _colBlockIndices
std::vector< int > & colBlockIndices()
void add_internal(SparseBlockMatrix< MatrixType > &dest) const
std::vector< int > & rowBlockIndices()
void fillBlockStructure(MatrixStructure &ms) const
exports the non zero blocks in the structure matrix ms
std::vector< IntBlockMap > _blockCols
const std::vector< int > & rowBlockIndices() const
indices of the row blocks
void clear(bool dealloc=false)
void transpose_internal(SparseBlockMatrix< MatrixTransposedType > &dest) const
int rowBaseOfBlock(int r) const
where does the row at block-row r starts?
void scale(double a)
*this *= a
int colsOfBlock(int c) const
how many cols does the block at block-col c has?
some general case utility functions
SparseBlockMatrix< MatrixX > SparseBlockMatrixX
std::ostream & operator<<(std::ostream &os, const G2OBatchStatistics &st)