[Numpy-discussion] curious problem with SVD
Frank Lagor
dfranci at seas.upenn.edu
Fri Jul 25 15:32:56 EDT 2008
Perhaps I do not understand something properly, if so could someone please
explain the behavior I notice with numpy.linalg.svd when acting on arrays.
It gives the incorrect answer, but works fine with matrices. My numpy is
1.1.0.
>>> R = n.array([[3.6,.35],[.35,1.8]])
>>> V,D,W = n.linalg.svd(R)
>>> V*n.diag(D)*W.transpose()
array([[ 3.5410365 , 0. ],
[ 0. , 1.67537611]])
>>> R = n.matrix([[3.6,.35],[.35,1.8]])
>>> V,D,W = n.linalg.svd(R)
>>> V*n.diag(D)*W.transpose()
matrix([[ 3.6 , 0.35],
[ 0.35, 1.8 ]])
Thanks in advance,
Frank
--
Frank Lagor
Ph.D. Candidate
Mechanical Engineering and Applied Mechanics
University of Pennsylvania
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080725/ca59840a/attachment.html>
More information about the NumPy-Discussion
mailing list