Hi Jared

The short answer is yes. Different algorithms are used in `svdvals` and 
`svd`/`svdfact`. In both cases, we are using the divide and conquer routine 
xGESDD from LAPACK, but internally in the routine uses two different 
algorithms depending on the choice for the vectors. Are requested or not? 
When the vectors are asked for the algorithm is an implementation of

http://www.netlib.org/lapack/lug/node151.html#gueisenstat3

and when only the values are requested the algorithm is no longer divide 
and conquer but

http://www.netlib.org/lapack/lug/node151.html#fernandoparlett

I think your matrix shows very well the shortcomings for the divide and 
conquer algorithm since the small values are very inaccurate here. We have 
wrapped the older QR based routine xGESVD where you can get the vectors 
without getting inaccurate small values.

julia> LAPACK.gesvd!('A', 'A', copy(A))[2] |> t -> t[1]/t[end]
1.1607083109062826e84

For some time, I've wanted to make it easier to choose the algorithm from 
`svd`/`svdfact` so at some point, when time allows, it should be possible 
to do so, which will make it much more transparent what is happening.

Den tirsdag den 7. juli 2015 kl. 16.33.52 UTC-4 skrev Jared Crean:
>
> Hello,
>     I am working with some poorly conditioned matrices, and I computed the 
> condition number using the cond() function and by comparing the maximum and 
> minimum singular values from svd(), and got very different answers.  The 
> matrix is attached.
>
> From svdvals, used by cond(), the max and min are  8.488228999798525e18, 
> 2.3929633941941788e-61,
> From svd, the are 8.488228999798525e18, 169.86022318633755
>
> Except for the first three, all the singular values reported by svd and 
> svdvals are different.  Are the two functions using different methods to 
> calculate the singular values?
>
>   Jared Crean
>

Reply via email to