Registered Member
|
Hey there,
I'm currently having a problem with LLT and LDLT decomposition: I use an algorithm (from viewtopic.php?f=74&t=92393) that uses a LLT decomposition to compute L^{-T}
This works and the algorithm continues working fine with the solution of X However it is stated in the docs that LLT is unstable for semi-definite matrices, and I'm having the problem that for some matrices I can not compute the LLT. For those matrices however I can compute the LDLT decomposition. My idea was to exchange the LLT in the algorithm by a LDLT. However if I compute the matrix X as written above (and using Eigen::LDLT<EMatrix,Eigen::Lower> chol(G.cols()); instead) I get a different solution of X and the algorithm fails in subsequent steps. My question is now, how to compute the same matrix X as in the LLT case, but using a LDLT decomposition... I understand the the L in the LLT and LDLT case are different. But is there a way to compute the L from the LLT case by using the L from the LDLT case? Hope that was not too cryptic Regards... |
Registered Member
|
A = LDL* = LD^{1/2} D^{1/2} L* = LD^{1/2} (LD^{1/2)* = "L" "L"*,
So the "L" that you want is actually L D^{1/2}, from the LDLT decomposition. Be careful with negative and zero values in D, though, in the case of negative and semi-definite matrices. |
Registered Member
|
Hey, thx for the answer!
This totally makes sense. However I made a small demo, that shows that there are still significant differences of both L's computed this way. However both L's fulfill A = L*Lt. It would we really helpful to know, how the matrix is decomposed internally in LDLT. Appearantly, Eigen uses some sort of pivoting for the LDLT decomposition, which I also included. The demo code is as follows
The output is:
The error |L*L^t - G| is in both cases zero, however L (from LLT) and LS (from LDLT) are totally different. What I want is to be LS exactly the same as L. Would be very nice if someone could tell me what I'm doing wrong here... Regards |
Moderator
|
you cannot because of the permutation. If you need to apply the inverse of L (or more generally need the triangular structure of L) then you have to keep it as a product (P^T * L) and, e.g., replace L^1* M by L^-1 * P * M in your code.
|
Registered Member
|
Hi,
seems to be an old topic however i was wondering if one can provide the correction to obtain triangular structure of L matrix using LDLT i see the note "replace L^1* M by L^-1 * P * M in your code." but i can not see what is M in the provided code.
Please let me know the correct steps Thanx |
Moderator
|
You cannot. What my comment says, is that when you want to apply L or L^-1 to some matrix vector M, then you need to apply P^T * L or L^-1 * P. But you cannot get a true triangular form that takes the permutation P into account as P^T * L is not triangular. The diagonal is the vector D.
|
Registered Member
|
I see, now its clear.
regarding diagonal D, does it have the same property as diagonal of L from LLT? in my computation i use L.diagonal().array().log().sum() during optimizing hyper parameters for Gaussian Processes... so i was wondering if D holds similar properties as L? Thank you |
Moderator
|
D is the square of L.diagonal(). But why do you compute LDLT instead of directly computing LLT if that's what you need?
|
Registered Member
|
the issue i have is that besides getting the Diagonal values of L i also use LLT/LDLT decomposition later for solving 1-2 linear systems.
and it seems like in some cases LLT failing to solve during optimization loop. Thats why i wanted to use LDLT decomposition to test if it will be more robust |
Moderator
|
oh, I missed the point that you only need L.diagonal().array().log().sum(), that is half the log determinant of the matrix, so you can simply use D.array().log().sum()/2.0
|
Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]