17#ifndef G2O_LINEAR_SOLVER_CHOLMOD_ONLINE
18#define G2O_LINEAR_SOLVER_CHOLMOD_ONLINE
40 virtual bool solve(
double* x,
double* b) = 0;
41 virtual cholmod_factor*
L()
const = 0;
50template <
typename MatrixType>
78 virtual bool init() {
return true; }
90 cholmod_dense bcholmod;
94 bcholmod.xtype = CHOLMOD_REAL;
95 bcholmod.dtype = CHOLMOD_DOUBLE;
99 std::cerr <<
"solve(): Cholesky failure, writing debug.txt (Hessian "
100 "loadable by Octave)"
108 cholmod_dense* xcholmod =
110 memcpy(x, xcholmod->x,
111 sizeof(
double) * bcholmod.nrow);
144 <<
"Cholesky failure, writing debug.txt (Hessian loadable by Octave)"
156 cholmod_dense bcholmod;
160 bcholmod.xtype = CHOLMOD_REAL;
161 bcholmod.dtype = CHOLMOD_DOUBLE;
163 cholmod_dense* xcholmod =
165 memcpy(x, xcholmod->x,
166 sizeof(
double) * bcholmod.nrow);
194 if (amdStatus != CAMD_OK) {
195 std::cerr <<
"Error while computing ordering" << std::endl;
204 size_t scalarIdx = 0;
229 int blockDimension = MatrixType::RowsAtCompileTime;
230 assert(blockDimension > 0);
232 size_t origN = A.
cols();
233 int additionalSpace = blockDimension *
batchEveryN;
234 size_t m = A.
rows() + additionalSpace;
235 size_t n = A.
cols() + additionalSpace;
248 size_t nzmax = A.
nonZeros() + additionalSpace;
281 for (
int i = 0; i < additionalSpace; ++i) {
generic interface for the online solver
virtual cholmod_factor * L() const =0
LinearSolverCholmodOnlineInterface()
virtual bool solve(double *x, double *b)=0
virtual int choleskyUpdate(cholmod_sparse *update)=0
virtual size_t nonZerosInL() const =0
Eigen::VectorXi * cmember
linear solver which allows to update the cholesky factor
void computeSymbolicDecomposition(const SparseBlockMatrix< MatrixType > &A)
size_t nonZerosInL() const
MatrixStructure _matrixStructure
LinearSolverCholmodOnline()
Eigen::VectorXi _blockPermutation
int choleskyUpdate(cholmod_sparse *update)
bool solve(double *x, double *b)
cholmod::CholmodExt * _cholmodSparse
Eigen::VectorXi _scalarPermutation
cholmod_factor * L() const
cholmod_factor * _cholmodFactor
bool blockOrdering() const
void fillCholmodExt(const SparseBlockMatrix< MatrixType > &A, bool onlyValues)
bool solve(const SparseBlockMatrix< MatrixType > &A, double *x, double *b)
cholmod_common _cholmodCommon
virtual ~LinearSolverCholmodOnline()
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 * Ap
column pointers for A, of size n+1
Sparse matrix which uses blocks.
size_t nonZeros() const
number of non-zero elements
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 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
int colsOfBlock(int c) const
how many cols does the block at block-col c has?
#define G2O_INCREMENTAL_API
bool writeCCSMatrix(const string &filename, int rows, int cols, const int *Ap, const int *Ai, const double *Ax, bool upperTriangleSymmetric)
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
Our extension of the CHOLMOD matrix struct.
utility functions for handling time related stuff