Re: Bug in Singular Value Decomposition



Did you get any feedback on this? /Anders

On onsdag, maj 14, 2003, at 14:59 Europe/Stockholm, Brian Shier wrote:

>
> There appear to be two bugs in the JAMA SVD code.
>
> 1. I noted an error with the following 2x3 test matrix.
>
>                   [ 1       2        3
>                     4       5        6 ]
>
>  I believe that the change noted in the following code snippet is 
> needed when n > m.
>
>  // If required, generate V.
>
>  if (wantv)
>    {
>    for (k = n-1; k >= 0; k--)
>      {
>      if ((k < nrt) & (e[k] != 0.0))
>        {
> //      for (j = k+1; j < nu; j++)        // Error in JAMA
>        for (j = k+1; j < n; j++)         // Correction
>
>
> 2. The need to initialize the elements of U to zero in the constructor 
> is suspicious. It suggests that some element is being accessed 
> prematurely elsewhere in the code. I suspect an error in the following 
> snippet, but have yet to locate it exactly.
>
>  // If required, generate U.
>
>  if (wantu)
>    {
>    for (j = nct; j < nu; j++)       // Error in JAMA version
>      {
>      for (i = 0; i < m; i++)
>        U[i][j] = 0.0;
>
>      U[j][j] = 1.0;
>      }
>
> Please investigate.
>
> -- Brian Shier
>
> _________________________________________________________________
> Add photos to your messages with MSN 8. Get 2 months FREE*.  
> http://join.msn.com/?page=features/featuredemail
>
>




Date Index | Thread Index | Problems or questions? Contact list-master@nist.gov