[ https://issues.apache.org/jira/browse/MATH297?page=com.atlassian.jira.plugin.system.issuetabpanels:commenttabpanel&focusedCommentId=12772913#action_12772913 ]
Jake Mannix commented on MATH297:

Doing the most trivial fix possible (dividing by the SAFE_MIN if diPl == 0) on the line which leads to NaN appears to correctly fix this for the particular case of decomposing diagonal matrices (at least for 2x2 and 3x3 cases I checked with a unit test).
I'm not sure if this "fixes" the problem, because I'm not sure if I really grok the algorithm's implementation in this code.
We could see better if I knew how often this pops up (any matrix whose tridiagonal form is actually diagonal?)...
> Eigenvector computation incorrectly returning vectors of NaNs
> 
>
> Key: MATH297
> URL: https://issues.apache.org/jira/browse/MATH297
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 2.0
> Reporter: Phil Steitz
> Fix For: 2.1
>
>
> As reported by Axel Kramer on commonsdev, the following test case succeeds, but should fail:
> {code}
> public void testEigenDecomposition() {
> double[][] m = { { 0.0, 1.0, 1.0 }, { 1.0, 1.0, 0.0 }, { 1.0,0.0, 1.0 } };
> RealMatrix rm = new Array2DRowRealMatrix(m);
> assertEquals(rm.toString(),
> "Array2DRowRealMatrix{{0.0,1.0,1.0},{1.0,1.0,0.0},{1.0,0.0,1.0}}");
> EigenDecompositionImpl ed = new EigenDecompositionImpl(rm,
> MathUtils.SAFE_MIN);
> RealVector rv0 = ed.getEigenvector(0);
> assertEquals(rv0.toString(), "{(NaN); (NaN); (NaN)}");
> }
> {code}
> ed.getRealEigenvalues() returns the correct eigenvalues (2, 1, 1), but all three eigenvectors contain only NaNs.

This message is automatically generated by JIRA.

You can reply to this email to add a comment to the issue online.