make jacobi SVD more robust after experimenting with very nasty matrices...

it turns out to be better to repeat the jacobi steps on a given (p,q) pair until it
is diagonal to machine precision, before going to the next (p,q) pair. it's also
an optimization as experiments show that in a majority of cases this allows to find out
that the (p,q) pair is already diagonal to machine precision.
This commit is contained in:
Benoit Jacob
2009-08-12 18:23:39 -04:00
parent 309d540d4a
commit 2b618a2c16
2 changed files with 26 additions and 17 deletions

View File

@@ -50,7 +50,7 @@ void MatrixBase<Derived>::applyJacobiOnTheRight(int p, int q, Scalar c, Scalar s
template<typename Scalar>
bool ei_makeJacobi(Scalar x, Scalar y, Scalar z, Scalar *c, Scalar *s)
{
if(ei_abs(y) < ei_abs(z-x) * 0.5 * machine_epsilon<Scalar>())
if(ei_abs(y) <= ei_abs(z-x) * 0.5 * machine_epsilon<Scalar>())
{
*c = Scalar(1);
*s = Scalar(0);