commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Axel Kramer (JIRA)" <j...@apache.org>
Subject [jira] Commented: (MATH-297) Eigenvector computation incorrectly returning vectors of NaNs
Date Mon, 19 Oct 2009 18:15:59 GMT

    [ https://issues.apache.org/jira/browse/MATH-297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12767433#action_12767433
] 

Axel Kramer commented on MATH-297:
----------------------------------

If I'm expanding my testcase to the snippet below, I'm  now getting an eigenvector with all
"negative values" at index 1.
I think this should be avoided. 
See also the solution computed by Ted Dunning on the mailing list: 
http://www.mail-archive.com/dev@commons.apache.org/msg12038.html

    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);
    RealVector rv1 = ed.getEigenvector(1);
    RealVector rv2 = ed.getEigenvector(2);
    assertEquals(rv0.toString(), "{0,58; 0,58; -0,58}");
    assertEquals(rv1.toString(), "{-0; -0,71; -0,71}");
    assertEquals(rv2.toString(), "{0,82; -0,41; 0,41}");


> 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