I've been using JacobiSVD from a recent Eigen3 build to solve a system of equations that may be rank deficient.
In most cases this works fine but, in some cases, like the example matrix below-- that is very nearly a rank-2 matrix--
it does not. The singular values for this matrix are 1.41421 1.41421 3.67427e-038 I like the fact that JacobiSVD returns all singular values including the very small one. However, I don't like the fact that the solve() method returns
1 -7.19424e+018 -1 I would like to be able to specify a zero-tolerance value to solve() to exclude the third singular value but this does not seem to be possible-- at least I didn't see how to do this.
Lapack method DGELSD() includes the RCOND tolerance and if this is set to, say, 1.0e-8, returns the expected solution to this system.