27#ifndef G2O_SPARSE_BLOCK_MATRIX_DIAGONAL_H
28#define G2O_SPARSE_BLOCK_MATRIX_DIAGONAL_H
33#include "g2o/config.h"
45template <
class MatrixType>
76 void multiply(
double*& dest,
const double* src)
const {
77 int destSize =
cols();
79 dest =
new double[destSize];
80 memset(dest, 0, destSize *
sizeof(
double));
84 Eigen::Map<VectorX> destVec(dest, destSize);
85 Eigen::Map<const VectorX> srcVec(src,
rows());
88#pragma omp parallel for default(shared) schedule(dynamic, 10)
90 for (
int i = 0; i < static_cast<int>(
_diagonal.size()); ++i) {
92 int srcOffset = destOffset;
95 internal::template axpy<SparseMatrixBlock>(A, srcVec, srcOffset, destVec,
Sparse matrix which uses blocks on the diagonal.
int dimOfBlock(int r) const
how many rows/cols does the block at block-row / block-column r has?
SparseBlockMatrixDiagonal(const std::vector< int > &blockIndices)
const std::vector< int > & _blockIndices
DiagonalVector & diagonal()
int baseOfBlock(int r) const
where does the row /col at block-row / block-column r starts?
const std::vector< int > & blockIndices() const
indices of the row blocks
int cols() const
columns of the matrix
std::vector< MatrixType > DiagonalVector
MatrixType SparseMatrixBlock
this is the type of the elementary block, it is an Eigen::Matrix.
const DiagonalVector & diagonal() const
the block matrices per block-column
void multiply(double *&dest, const double *src) const
int rows() const
rows of the matrix