# commons-issues mailing list archives

##### Site index · List index
Message view
Top
From "Jake Mannix (JIRA)" <j...@apache.org>
Subject [jira] Commented: (MATH-297) Eigenvector computation incorrectly returning vectors of NaNs
Date Tue, 03 Nov 2009 07:43:59 GMT
```
[ https://issues.apache.org/jira/browse/MATH-297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12772924#action_12772924
]

Jake Mannix commented on MATH-297:
----------------------------------

Ok, well sadly it's easy to find an example which *isn't* fixed by just removing that one
divide-by-zero:
{code} { {0, 1, 0}, {1, 0, 0}, {0, 0, 1} } {code} leads to perfectly reasonable eigenvalues
(1, 1, -1), but NaN again rears its ugly head because findEigenVectors() assumes that, among
other things, that the main diagonal does not start with a zero, and then divides by it.

Not sure what the proper solution is to this, but a non-shifted LDL^t decomposition is a lot
easier to understand to me than the other place where the NaN pops up, so maybe I can figure
this one out on the plane ride down to ApacheCon tomorrow.

> Eigenvector computation incorrectly returning vectors of NaNs
> -------------------------------------------------------------
>
>                 Key: MATH-297
>                 URL: https://issues.apache.org/jira/browse/MATH-297
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Phil Steitz
>             Fix For: 2.1
>
>
> As reported by Axel Kramer on commons-dev, 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.

```
Mime
View raw message