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

Solve using in place decomposition matrix

Tags: ldlt, inplace ldlt, inplace ldlt, inplace
(comma "," separated)
xerion
Registered Member
Posts
20
Karma
0
Hello all,

I was wondering if something is possible in an easy way.
I know that I can do it for LLT which I will describe below but not sure how to do it for LDLT
Say that I have a matrix that I decomposed in place.
Code: Select all
Eigen::MatrixXd N;
Eigen::LLT<Eigen::Ref<Eigen::MatrixXd>, Eigen::Lower> in_place_llt(N);

If my LLT object goes out of scope I can use the decomposed matrix to solve by
Code: Select all
typedef Eigen::internal::LLT_Traits<Eigen::MatrixXd, Eigen::Lower> TraitsType;
TraitsType::getL(N).solveInPlace(u);
TraitsType::getU(N).solveInPlace(u);

I am not sure if this is the best way but it works.
Otherwise I am not sure how I can set my current matrix in an LLT object such that the decomposition is initialized and m_matrix is set.

In LDLT things are a bit more complicated from what I see in the solve_impl.
Is there a way to achieve what I am describing for LDLT ?

Last edited by xerion on Fri Feb 24, 2017 10:00 pm, edited 1 time in total.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
I guess you already followed this tutorial: https://eigen.tuxfamily.org/dox-devel/g ... ition.html

In LDLT you really have to keep the LDLT object alive because it also stores the permutation matrix. For LLT, it is currently not possible to initialize it with an already existing factored matrix. We would need something like:

LLT<Ref<MatrixXd> > lltwrapper(A, AlreadyFactored);
xerion
Registered Member
Posts
20
Karma
0
Thanks ggael!


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]