Re: [eigen] Checking if a dense linear system is solvable?

[ Thread Index | Date Index | More Archives ]

On 05.10.2012 14:36, Helmut Jarausch wrote:

unfortunately, the dense linear solvers don't have an .info() method.
Invoked with a singular matrix I just get "+-inf".
Checking the determinant isn't an option since, e.g.,
0.1*IdentyMatrix(100,100) has a determinant of  1E-100 although it has
only a condition number of 100.

It should have a condition of 1, if you define cond(A) = norm(A)*norm(A^-1), shouldn't it?

I suggest one either adds an info-method or one returns a vector
(matrix) with zero rows.

What do think about that.

Probably, the solve method should have an additional parameter with a
sensible default,
giving a (relative) tolerance for deciding if a pivot element has to be
considered as zero.

FullPivLU, ColPivHouseholderQR and FullPivHouseholderQR have a setThreshold() and a rank() method, which might be what you need.

Another thing you can always do is
SomeDecomposition D(A);
VectorXd x = D.solve(b);
double error = (b-A*x).norm()/b.norm(); // or squaredNorm


Dipl.-Inf. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: +49 (421) 218-64252

Mail converted by MHonArc 2.6.19+