[Numpy-discussion] svd

Charles Doutriaux doutriaux1@llnl....
Wed Jul 16 17:24:17 CDT 2008


doh...

Thanks Charles... I guess I've been staring at this code for too long 
now...

C.

Charles R Harris wrote:
>
>
> On Wed, Jul 16, 2008 at 3:58 PM, Charles Doutriaux 
> <doutriaux1@llnl.gov <mailto:doutriaux1@llnl.gov>> wrote:
>
>     Hello,
>
>     I'm using 1.1.0 and I have a bizarre thing happening
>
>     it seems as if:
>     doing:
>     import numpy
>     SVD = numpy.linalg.svd
>
>     if different as doing
>     import numpy.oldnumeric.linear_algebra
>     SVD = numpy.oldnumeric.linear_algebra.singular_value_decomposition
>
>     In the first case passing an array (204,1484) retuns array of shape:
>     svd: (204, 204) (204,) (1484, 1484)
>
>     in the second case I get (what i expected actually):
>     svd: (204, 204) (204,) (204, 1484)
>
>     But looking at the code, it seems like
>     numpy.oldnumeric.linear_algebra.singular_value_decomposition
>     is basicalyy numpy.linalg.svd
>
>     Any idea on what's happening here?
>
>
> There is a full_matrices flag that determines if you get the full 
> orthogonal matrices, or the the minimum size needed, i.e.
>
> In [12]: l,d,r = linalg.svd(x, full_matrices=0)
>
> In [13]: shape(r)
> Out[13]: (2, 4)
>
> In [14]: x = zeros((2,4))
>
> In [15]: l,d,r = linalg.svd(x)
>
> In [16]: shape(r)
> Out[16]: (4, 4)
>
> In [17]: l,d,r = linalg.svd(x, full_matrices=0)
>
> In [18]: shape(r)
> Out[18]: (2, 4)
>
>
> Chuck
>
>
>
>  
>
>
>     Thx,
>
>     C.
>
>
>     _______________________________________________
>     Numpy-discussion mailing list
>     Numpy-discussion@scipy.org <mailto:Numpy-discussion@scipy.org>
>     http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>   



More information about the Numpy-discussion mailing list