27#ifndef G2O_LINEAR_SOLVERCSPARSE_H
28#define G2O_LINEAR_SOLVERCSPARSE_H
46template <
typename MatrixType>
69 "Cholesky failure, writing debug.txt (Hessian loadable by Octave)");
106 double* structureX =
nullptr;
133 assert(m > 0 && n > 0 &&
"Hessian has 0 rows/cols");
146 if (ccsA.
nzmax < nzmax) {
148 ccsA.
nzmax = ccsA.
nzmax == 0 ? nzmax : 2 * nzmax;
151 ccsA.
i =
new int[ccsA.
nzmax];
152 ccsA.
x =
new double[ccsA.
nzmax];
161 int nz = this->
_ccsMatrix->fillCCS(ccsA.
p, ccsA.
i, ccsA.
x,
true);
163 assert(nz <= ccsA.
nzmax);
184 G2O_WARN(
"inverse fail (numeric decomposition)");
Solver with faster iterating structure for the linear matrix.
void initMatrixStructure(const SparseBlockMatrix< MatrixType > &A)
SparseBlockMatrixCCS< MatrixType > * _ccsMatrix
bool blockOrdering() const
do the AMD ordering on the blocks or on the scalar matrix
linear solver which uses CSparse
void computeSymbolicDecomposition(const SparseBlockMatrix< MatrixType > &A)
LinearSolverCSparse(LinearSolverCSparse< MatrixType > const &)=delete
virtual ~LinearSolverCSparse()=default
void prepareSolve(const SparseBlockMatrix< MatrixType > &A)
MatrixStructure _matrixStructure
bool solve(const SparseBlockMatrix< MatrixType > &A, double *x, double *b)
LinearSolverCSparse & operator=(LinearSolverCSparse< MatrixType > const &)=delete
void fillCSparse(const SparseBlockMatrix< MatrixType > &A, bool onlyValues)
bool solveBlocks_impl(const SparseBlockMatrix< MatrixType > &A, std::function< void(MarginalCovarianceCholesky &)> compute)
bool writeDebug() const
write a debug dump of the system matrix if it is not PSD in solve
static void blockToScalarPermutation(const SparseBlockMatrix< MatrixType > &A, const Eigen::MatrixBase< BlockDerived > &p, const Eigen::MatrixBase< ScalarDerived > &scalar)
computing the marginal covariance given a cholesky factor (lower triangle of the factor)
void setCholeskyFactor(int n, int *Lp, int *Li, double *Lx, int *permInv)
representing the structure of a matrix in column compressed structure (only the upper triangular part...
int * Aii
row indices of A, of size nz = Ap [n]
int n
A is m-by-n. n must be >= 0.
int nzMax() const
max number of non-zeros blocks
int * Ap
column pointers for A, of size n+1
Sparse matrix which uses blocks.
size_t nonZeros() const
number of non-zero elements
int rows() const
rows of the matrix
int cols() const
columns of the matrix
void fillBlockStructure(MatrixStructure &ms) const
exports the non zero blocks in the structure matrix ms
bool amd(const SparseView &sparseView, VectorXI &result)
compute AMD ordering on the given SparseView, store into result
bool solve(double *x, double *b) const
bool analyze_p(int *permutation)
bool writeSparse(const std::string &filename) const
Eigen::Matrix< int, Eigen::Dynamic, 1, Eigen::ColMajor > VectorXI
double get_monotonic_time()
statistics about the optimization
static G2OBatchStatistics * globalStats()
double timeNumericDecomposition
numeric decomposition (0 if not done)
double timeSymbolicDecomposition
symbolic decomposition (0 if not done)
size_t choleskyNNZ
number of non-zeros in the cholesky factor
View onto the cholesky factor.
View onto the sparse matrix structure of CSparse using CCS storage.
utility functions for handling time related stuff