[Numpy-discussion] numpy.linalg.svd documentation
Sturla Molden
sturla at molden.no
Mon Jan 31 12:35:11 EST 2011
Den 30.01.2011 21:40, skrev Charles R Harris:
> Well, strictly speaking, both documentations say the same thing, but
> the old version was somewhat obfuscated. Either svd returns v.H and A
> = dot(u*d, v.H) or svd returns v and A = dot(u*d,v). I think the
> second is a clearer statement of the return value and the resulting
> factorization, but I suppose some may hold a different opinion.
I agree that it is a clearer statement, since there is a difference
between A = dot(u*d, v.H) and A = dot(u*d, vH), and we actually have
the latter. Still, the common definition of SVD is
u * s * v.H = x
and not
u * s * v = x
This might be a bit confusing for those expecting the conjugate
transpose of v in the decomposition.
Be aware that Matlab's SVD is
[u,s,v] = svd(x)
so that u*s*v' = x.
Clearly Matlab and NumPy differ on the definition of v here, with Matlab
following the common convention. That is why I prefer the old notation
u, s, vH = np.linalg.svd(x)
v = vH.H
as it leaves no room for confusion.
As long as the behaviour of SVD has not changed, none of my SVD code
will break. That was what worried me most :-)
Sturla
More information about the NumPy-Discussion
mailing list