Hey all,
I need sqrt( *D* ) and *U* from the Eigendecomposition of a flat matrix. 
There are (at least) two ways to get it:

   1. *D*,*U* = eig( *A*' * *A* ); *S* = sqrt( *D* )
   2. *U*,*S*,*V* = svd( *A*' );

The second option is cheaper and should be more accurate, as it avoids the 
cost and undesirable conditioning effect of computing *A*' * *A*. The 
speedup is noticeable, but a negative side effect overwhelms the 
improvement in my case. Sparsity is important in my application, and I am 
using *U* to rotate a quadratic (and to reverse the rotation later on). So 
I must perform multiple matrix-matrix multiplications involving *U*. It 
turns out that the overall algorithm cost is *greater* with svd than with 
eig due to the difference in density of *U*. Here is the result of 
PyPlot.spy( [*Ueig Usvd]* ):

<https://lh3.googleusercontent.com/-o0nIwYNqlVc/VmCrigAEQeI/AAAAAAACEEg/NN_NgERgawU/s1600/eig_svd_sparsity.png>

Can someone help me understand the difference between the eig and svd 
algorithms responsible for this difference in density? It looks like the 
relevant LAPACK calls are here: eig 
<https://github.com/JuliaLang/julia/blob/cbe1bee3a8f27ba4f349556857bf4615ee5fa68f/base/linalg/eigen.jl#L53>
 
and svd 
<https://github.com/JuliaLang/julia/blob/cbe1bee3a8f27ba4f349556857bf4615ee5fa68f/base/linalg/svd.jl#L17>
.


Thanks!

Reply via email to