[eigen] 3x3 symmetric eigenvalues Problem

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


I just stumbled over a problem in the analytic 3x3
eigenvalue/eigenvector for symmetric matrices.
I have a matrix, where all row vectors are parallel to each other and
there is a zero eigenvalue as the largest eigenvalue. What happens is that:

Vector cross01 = tmp.row (0).cross (tmp.row (1));
Vector cross02 = tmp.row (0).cross (tmp.row (2));
Scalar n01 = cross01.squaredNorm();
Scalar n02 = cross02.squaredNorm();

here, both n01 and n02 become zero and as a result, the entire
eigenvector matrix becomes nan's.

Reproducing it is easy. Its a different case, but shows the same behavior:

	Matrix3f m = Matrix3f::Zero();
	m.diagonal() = Vector3f(2000, 1, 0);
	Matrix3f evecs;
	Vector3f eivs;
	eigenSymm33(m, evecs, eivs);
	std::cout << evecs << std::endl << eivs.transpose() << std::endl;

Output is:

-nan -nan -nan
-nan -nan -nan
-nan -nan -nan
0.0110269 0.98902    2000

Now, one might think that 2000,1,0 is exploiting numerics. But in fact
its not. Test 2, 1, 1 as the diagonal. The routine will give out the
correct result, but if you look closely on what happens, both n01 and
n02 will be extremely small, like 1e-15, bot not zero. But analytically,
zero would be the correct value! So nan's are simply prevented because
of numerical errors.


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