You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Dimitri Pourbaix (JIRA)" <ji...@apache.org> on 2010/07/26 16:52:51 UTC

[jira] Commented: (MATH-383) MaxIterationsExceededException in SVD (EigenDecompositionImpl.findEigenVectors ) caused by NaN

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

Dimitri Pourbaix commented on MATH-383:
---------------------------------------

Could you supply with a matrix which causes the problem?  The present unit tests are not helpful enough.

> MaxIterationsExceededException in SVD (EigenDecompositionImpl.findEigenVectors ) caused by NaN
> ----------------------------------------------------------------------------------------------
>
>                 Key: MATH-383
>                 URL: https://issues.apache.org/jira/browse/MATH-383
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 2.1
>         Environment: Java 6
>            Reporter: Alexander Kushkuley
>            Assignee: Dimitri Pourbaix
>             Fix For: 2.2
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> In the following code fragment from EigenDecompositionImpl.findEigenVectors 
> ....................................................................
>     for (int j = 0; j < n; j++) {
>             int its = 0;
>             int m;
>             do {
>                 for (m = j; m < n - 1; m++) {
>                     double delta = Math.abs(realEigenvalues[m]) + Math.abs(realEigenvalues[m + 1]);
>                     if (Math.abs(e[m]) + delta == delta) {
>                         break;
>                     }
>                 }
>           
>                 if (m != j) {
>                     .........................................
> the test for "(Math.abs(e[m]) + delta == delta)" is not executed  when m is equal to n -1.
> As a result  e[m]  == 0 (does happen!) causes variables q and realEigenvalues[m] to become NaN that in turn causes   "Math.abs(e[m]) + delta == delta)" to become always false.
> My guess (seems to work) is that another test for e[m] == 0 is needed, so that the code becomes
>    for (int j = 0; j < n; j++) {
>             int its = 0;
>             int m;
>             do {
>                 for (m = j; m < n - 1; m++) {
>                     double delta = Math.abs(realEigenvalues[m]) + Math.abs(realEigenvalues[m + 1]);
>                     if (Math.abs(e[m]) + delta == delta) {
>                         break;
>                     }
>                 }
>           
>                // begin patch 
>                if ( m == n - 1 && e[m-1] == 0 )
>                        break;
>                // end patch
>                 
>                if (m != j) {
>                     ......................................... 
> or something like that

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.