MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: sporadic failure of SingularValueDecomposition[] in Mathematica 5.2

John Sidles wrote:

>Dear Mathgroup folks
>Has anyone else encountered sporadic failure of  
>Running Mathematica 5.2 under OS X, our UW Quantum System Engineering (QSE)  
>is finding that SVD fails completely, for well-conditioned Hermitian  
>matrices, about one time in 1000.
>A test matrix for which SingularValueDecomposition[] fails completely
>can be found in this directory:
>The directory contains the following files:
>     mma_svd_matrix.m  (* a 90x90 Hermitian matrix for which SVD  
>fails *)
>     mma_svd_failure_example.pdf   (* notebook demonstrating the  
>failure *)
>     mma_svd_failure_example.pdf   (* PDF of above *)
>It would be a big help if someone running Unix or Windows would
>report on whether this matrix fails for them.
>Thanks in advance !!!  John Sidles
"For later use, compute the eigenvalues of the m; these should equal the 
SVD values."

That is not exactly true (in all cases), the SVD eigenvalues are 
calculated from the matrix Transpose[m].m and the eigenvalues I think 
and hope come by finding the root of  the characteristic equation 
foundby Det[ IdentityMatrix[Length[m]]*lamba-m ]

For example:
matx = {{0.7,
  1.1, 2.0, 1.7}, {-2., -4., -8.6, -7.4}, {0, -0.5, -1., -1.}, {1.,
      2.8, 6., 5.3}}
Map[MatrixForm, {u, w, v} = SingularValueDecomposition[matx]];

Eigenvalues[matx] // MatrixForm
 >>{0.20000000000000004 + 0.5000000000000002*I, 0.20000000000000004 - 
 0.2999999999999996 + 0.09999999999999676*I, 0.2999999999999996 - 

w // MatrixForm
 >>{{15.2386, 0., 0., 0.}, {0., 0.506341, 0., 0.}, {0., 0., 0.138565, 
0.}, {0.,
    0., 0., 0.0271242}}

As you can see they are not the same. It has always been a curiosity for 
me as to what algorithm Mathematica   uses to calculate the eigenvalues. 
I know for the other off the counter Matrix based package (starts with 
M) the algorithm it uses is a variant of the QZ algorithm. As to the 
eigenvectors, you can make your own conclusions

SVD, in my opinion is used when one has rectangular matrices, If your 
matrix is square and  normal, why not try ShurDecomposition or even 
better JordanDecomposition.

As to your matrix I got remarkable better results by including this 
innocuous line in the begining of each eigenvalue analysis code

Clear[u,w,v]    :)

Best regards

Hope this helps

Pratik Desai
Graduate Student
Department of Mechanical Engineering
Phone: 410 455 8134

  • Prev by Date: Re: Set of strings reducing problem (Again!)
  • Next by Date: Re: Simplify and Noncommutativity
  • Previous by thread: sporadic failure of SingularValueDecomposition[] in Mathematica 5.2
  • Next by thread: Re: sporadic failure of SingularValueDecomposition[] in Mathematica 5.2