Re: [eigen] Pivoting for LDLT |

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] Pivoting for LDLT*From*: Keir Mierle <mierle@xxxxxxxxx>*Date*: Mon, 2 Feb 2009 20:49:44 -0800*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=CDYogv43xmPuctWRfRaZrVvpyVThh2t292rusVcunJc=; b=QNwTOg4qDBFm++c+8Evw7XNt1r4hV9o4vjpRFkYAtC/Qda2BJjDvMFGH5qvzaD6NOK j+j8QK1dRRKFDO5uqAbfvW99Eg6di51KfCEDJ3DAh7JHykzw76RBNDXPecMik7pnuWYT h/Gb84vFJaz5E2QTdrqU+0Gf2Wl8duQnycn+A=*Domainkey-signature*: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=d64tIjpvE6tYHCwBcXPB9ZYkXYncp+rs01deAoEMxxYhV5L0MeF5dgw7cpwfFY1mkg kd4eVQq8Sy8lsgDZeIHYxzQcIhtONpGXODrcurI+pGdwppbBoNMZ020FFMVrx6F8uF6F xW7vXtry3cokwYh6EPy7E4v1w5vnXGZ1ojmyI=

On Mon, Feb 2, 2009 at 6:03 AM, Jitse Niesen <jitse@xxxxxxxxxxxxxxxxx> wrote:

I did some more experiments, and I'm convinced. Not only does the example you give here fail badly with nopivot, the nopivot version is not rank-revealing in the semidefinite case. What's left is the API decision; should I make pivoting a template option (enabled by default)? Since I doubt many LDLT objects get instantiated this is probably ok.

However, now the matrix L is not meaningful without the permutation matrix. This is not an issue for solving, but could be for users of .matrixL().. On the other hand, this is currently the case for LU.

Thoughts?

Keir

p.s. the blocked LDLT which can deal with indefinite matrices is a different algorithm (D is block-diagonal with 1x1 and 2x2 blocks), and I am not targetting it because I only need to solve semidefinite systems stably.

On Mon, 2 Feb 2009, Keir Mierle wrote:That surprises me.

I implemented a simple pivoting strategy for LDLT, but am not convinced it's better.

It looks for the largest diagonal element during each iteration, then pivots it to become the next processed row. Attached is a simple test that compares the old LDLT vs the pivoting one; it shows that the results are not fantastic. I find that there is consistently 30% or more residual in the pivoting version.

When I try it out on 100 random matrices of size 100 x 100, I get:

Average residual: nopiv 4.45718e-14 piv 4.07206e-14

Std.dev.: nopiv 1.43516e-15 piv 1.01811e-15

Minimum: nopiv 4.09651e-14 piv 3.77983e-14

Maximum: nopiv 4.83319e-14 piv 4.28309e-14

So pivoting is slightly better, but the residual matrix LDL^T - A is even without pivoting so small that it's not clear whether it's worth the effort for random matrices. However, random matrices often work surprisingly well.

I attach my code, which is the same as Keir but with some parts commented out that I did not understand or found unnecessary (please let me know if I commented out any essential parts).

Here is one example in which pivoting does vastly better:

A << 1e-5*MatrixXd::Identity(s/2,s/2), MatrixXd::Identity(s/2,s/2),

MatrixXd::Identity(s/2,s/2), 1e+5*MatrixXd::Identity(s/2,s/2);

A += 1e-5*MatrixXd::Random(s,s);

A *= A.transpose();

// and remove all the bits with SelfAdjointEigenSolver

I did some more experiments, and I'm convinced. Not only does the example you give here fail badly with nopivot, the nopivot version is not rank-revealing in the semidefinite case. What's left is the API decision; should I make pivoting a template option (enabled by default)? Since I doubt many LDLT objects get instantiated this is probably ok.

However, now the matrix L is not meaningful without the permutation matrix. This is not an issue for solving, but could be for users of .matrixL().. On the other hand, this is currently the case for LU.

Thoughts?

Keir

p.s. the blocked LDLT which can deal with indefinite matrices is a different algorithm (D is block-diagonal with 1x1 and 2x2 blocks), and I am not targetting it because I only need to solve semidefinite systems stably.

Incidentally, the documentation for setRandom() can be improved. It should mention what distribution is used and also something about setting the seed..

Cheers,

Jitse

**Follow-Ups**:**Re: [eigen] Pivoting for LDLT***From:*Benoit Jacob

**References**:**[eigen] Pivoting for LDLT***From:*Keir Mierle

**Re: [eigen] Pivoting for LDLT***From:*Jitse Niesen

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] [RFC] symbolic computations using eigen** - Next by Date:
**[eigen] [RFC] Full pivoting LDLT** - Previous by thread:
**Re: [eigen] Pivoting for LDLT** - Next by thread:
**Re: [eigen] Pivoting for LDLT**

Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |