RE: [eigen] Efficient way to store symmetric matrix for use with Cholesky? |
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
Hi Gael, It seems that there is still a bug in
LDLT. I discussed this case with Benoit >Hi, > >a quick look at the code
suggests that SelfAdjoitView::ldlt() is unimplemented, unless i missed it. So
either we should implement it, or remove the declaration. > >Right now, you can do:
matrix.ldlt() but not selfadjointview.ldlt(). > >I guess the real problem is that
we used to have a little bug in ldlt that makes it use more than just one
triangular half of the matrix. >See comment in LDLT.h. Maybe the
first thing to do, is to fix this bug. > >Benoit Here is a test case typedef
Eigen::Matrix<double, Eigen::Dynamic, 1> Vector; typedef
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> Matrix; Matrix M(3, 3); Vector values(3); // Fill the Vector velues vlues = 1.0 3000.0 9000000.0 I. M.selfadjointView<Eigen::Upper>().rankUpdate(values); 40.0
63000.0 129150000.0 0.0
129150000.0 297675000000.0 0.0
0.0 731699325000000.0 II. M += values * values.transpose() 40.0
63000.0 129150000.0 63000.0
129150000.0 297675000000.0 129150000.0
297675000000.0 731699325000000.0 Eigen::LDLT<Matrix,
Eigen::Upper> ldltOfM(M); Vector rightHandSide(3); // Fill the Vector rightHandSide rightHandSide = 45.73845 93646.978500000027 215689932.67500001 ldltOfM.solveInPlace(rightHandSide); I. result rightHandSide 1.1434612500000001 0.00072510242740998852 2.9477946105116333e-007 II. result rightHandSide 0.00067356578946468231 0.00073205916040101719 -3.1608187134546198e-009 As you see in the first case strictly lower
triangular part of M is zero apart the second case with full selfajoint matrix
filled. Correct result is for the second case. So
LDLT still uses by the bug lower triangular part of a matrix. Thanks, Oleg From: Listengine
[mailto:listengine@xxxxxxxxxxxxxxxxx] On
Behalf Of Gael Guennebaud On Tue, Jun 8, 2010 at 7:02 PM, Manoj Rajagopalan Hi,
___________________________________________________________________________ This e-mail is confidential and is for the addressee only. Please refer to www.oxinst.com/email-statement for regulatory information. |
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |