Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference book for math principles in BlockCholeskyLinearSystemSolver.cpp #672

Open
wushichatong opened this issue Feb 19, 2024 · 1 comment
Labels
question Theory or implementation question

Comments

@wushichatong
Copy link

I want to multithreading BlockCholeskyLinearSystemSolver to accelarate and could you provide some math reference for BlockCholeskyLinearSystemSolver

@goldbattle
Copy link
Collaborator

I am not sure of any reference, but likely searching block cholesky is a good starting point. I believe also the sparse matrix library is based on the g2o paper, which discusses about the "special structure" when we have SLAM with landmarks.
http://ais.informatik.uni-freiburg.de/publications/papers/kuemmerle11icra.pdf

image
image

I believe the current code uses this function by default:

bool solve(const SparseBlockMatrix<MatrixType>& A, double* x, double* b)
{
//cerr << __PRETTY_FUNCTION__ << " using cholmod" << endl;
fillCholmodExt(A, _cholmodFactor); // _cholmodFactor used as bool, if not existing will copy the whole structure, otherwise only the values
if (! _cholmodFactor) {
computeSymbolicDecomposition(A);
assert(_cholmodFactor && "Symbolic cholesky failed");
}
//double t=get_time();
// setting up b for calling cholmod
cholmod_dense bcholmod;
bcholmod.nrow = bcholmod.d = _cholmodSparse->nrow;
bcholmod.ncol = 1;
bcholmod.x = b;
bcholmod.xtype = CHOLMOD_REAL;
bcholmod.dtype = CHOLMOD_DOUBLE;
cholmod_factorize(_cholmodSparse, _cholmodFactor, &_cholmodCommon);
if (_cholmodCommon.status == CHOLMOD_NOT_POSDEF) {
if (_cholmodFactor) {
cholmod_free_factor(&_cholmodFactor, &_cholmodCommon);
_cholmodFactor = 0;
}
//std::cerr << "Cholesky failure\n";//, writing debug.txt (Hessian loadable by Octave)" << std::endl;
//writeCCSMatrix("debug.txt", _cholmodSparse->nrow, _cholmodSparse->ncol, (int*)_cholmodSparse->p, (int*)_cholmodSparse->i, (double*)_cholmodSparse->x, true);
return false;
}
cholmod_dense* xcholmod = cholmod_solve(CHOLMOD_A, _cholmodFactor, &bcholmod, &_cholmodCommon);
memcpy(x, xcholmod->x, sizeof(double) * bcholmod.nrow); // copy back to our array
cholmod_free_dense(&xcholmod, &_cholmodCommon);
//if (globalStats){
// globalStats->timeNumericDecomposition = get_time() - t;
// globalStats->choleskyNNZ = _cholmodCommon.method[0].lnz;
//}
return true;
}

@goldbattle goldbattle added the question Theory or implementation question label Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Theory or implementation question
Projects
None yet
Development

No branches or pull requests

2 participants