# [Numpy-discussion] svd

Charles R Harris charlesr.harris@gmail....
Wed Jul 16 17:09:02 CDT 2008

```On Wed, Jul 16, 2008 at 3:58 PM, Charles Doutriaux <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
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080716/c696f850/attachment.html
```