This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Provide Cholesky matrix for use by LLT::solve(b)?

Tags: None
(comma "," separated)
perryd
Registered Member
Posts
1
Karma
0
Say I want to use a Cholesky solver, but I need to break down the steps.

If it were a direct usage, it would be

Eigen::matrixXd A;
/* ...set up A... */
x = A.llt().solve(b)

but I need to store the Cholesky decomposition as a matrix, and how that will be used is unknown until run-time:

Eigen::matrixXd U;
U = A.llt().matrixU();

Is there a way I can create an LLT object and initialize it from the contents of U, so that I can then access the solve() method of LLT? Or some other way to use U as a Cholesky matrix to solve A x = b even though U is just a matrixXd?

I know I could store the result of A.llt() as an LLT object, but my question is, if I know for sure that the contents of a regular matrix (U) represent an upper (or lower) Cholesky matrix, can I use it as such without having created it directly via llt()? I don't see an obvious constructor for the LLT class to do so but may be missing something.

Thanks
Perry
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
EDIT: sorry, looks like I read your question too rapidly. If you already have the factor L or U, then no ,there is no such facility, but feel free to propose a patch. The easiest would be to add a setFactor() method doing a deep copy. See also: http://eigen.tuxfamily.org/bz/show_bug.cgi?id=707


Creating a LLT object is the recommended way to use matrix decompositions/solvers:

MatrixXd A;
LLT<MatrixXd> llt(A);
llt.matrixU() ...
x1 = llt.solve(b1);
x2 = llt.solve(b2);
llt.compute(C); // recompute the factorization,
etc.

See the documentation of the class LLT for more details.


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient