# [PYTHON MATRIX-SIG] Singular Values

**Dave Stinchcombe
**
dars@soton.ac.uk

*Thu, 5 Jun 1997 20:50:22 +0100 (BST)*

>*
*>* > can any one tell me the reason why the
*>* > LinearAlgerba.singular_value_decomposition routine returns U,S,W^T, where
*>* > the matrix being decomposed is U*S*W^T, when it seems more
*>* > conventional to return U,S,W ?
*>*
*>* The convention with respect to SVD is to return U, S, W^T, because
*>* the product of these matrices is the original matrix. Matlab, for
*>* example, does the same.
*
I don't wish to sound ungratefull, as at the moment my work is completely
dependant on NumPy, and his friends. But Matlab , Maple and Octave all
return U,V,W where the matrix is U*V*W^T. The reason I make note is not to
request a change in LinearAlgebra, but simply to discover the logic behind
the current choice. The reason for wanting U, W returned is for ease of
handling by other (in my case C) routines, but there is no great hardship
in adding another line of python to form the transpose.
Matlab online help:
>>* help svd
*
SVD Singular value decomposition.
[U,S,V] = SVD(X) produces a diagonal matrix S, of the same
dimension as X and with nonnegative diagonal elements in
decreasing order, and unitary matrices U and V so that
X = U*S*V'.
Maple online help:
Svd(X,U,V) returns the singular values and the left and right singular
vectors in U and V respectively. The singular vectors together with the
singular values satisfy U'XV = D where U' is the transpose of U and U
is n by n, V is p by p, X is n by p, and D is n by p where D[i,i] is/are
the singular value/values of X.
I hope this letter does not appear rude, it is not meant to be, as I'm very
gratefull for all the work done by this group, indeed currently NumPy is
easily the most effective language I have to hand and work would be an order
of magnitude more painfull without it. I'm just trying to
understand something that niggles me.
Yours
Dave Stinchcombe
_______________
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________