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

are decompositions(ldlt, LU) persistent?

Tags: None
(comma "," separated)
luckyone
Registered Member
Posts
2
Karma
0
I've got a problem that is calculating Ax = b 18 times per iteration of a loop with different b's. If I do A.ldlt().solve(b) each time, is Eigen recalculating the decomposition each time or does it calculate it the first time and stores it for the next 17 times? If it isn't persistent for the 18 calls, is there a way to make it persistent(something = a.ldlt()?)?
jitseniesen
Registered Member
Posts
204
Karma
2
luckyone wrote:I've got a problem that is calculating Ax = b 18 times per iteration of a loop with different b's. If I do A.ldlt().solve(b) each time, is Eigen recalculating the decomposition each time or does it calculate it the first time and stores it for the next 17 times?
In this case, Eigen will calculate the decomposition each time.

If it isn't persistent for the 18 calls, is there a way to make it persistent(something = a.ldlt()?)?
You can do something like
Code: Select all
LDLT<MatrixType> ldltOfA(A);   // compute decomposition (replace MatrixType by type of A, e.g., MatrixXd)
for (...) {
    ldltOfA.solve(b);   // use decomposition to solve
}
Now the decomposition is computed only once. See http://eigen.tuxfamily.org/dox/Tutorial ... gebra.html for more information, in the section "Separating the computation from the construction"
luckyone
Registered Member
Posts
2
Karma
0
Awesome! My interns, my advisor's vien on his forehead, and I thank you.


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot]