Navigation

Operators and Keywords

Function List:

C++ API

: s = svd (A)
: [U, S, V] = svd (A)
: [U, S, V] = svd (A, econ)

Compute the singular value decomposition of A

A = U*S*V'

The function svd normally returns only the vector of singular values. When called with three return values, it computes U, S, and V. For example,

svd (hilb (3))

returns

ans =

 1.4083189
 0.1223271
 0.0026873

and

[u, s, v] = svd (hilb (3))

returns

u =

 -0.82704   0.54745   0.12766
 -0.45986  -0.52829  -0.71375
 -0.32330  -0.64901   0.68867

s =

 1.40832  0.00000  0.00000
 0.00000  0.12233  0.00000
 0.00000  0.00000  0.00269

v =

 -0.82704   0.54745   0.12766
 -0.45986  -0.52829  -0.71375
 -0.32330  -0.64901   0.68867

If given a second argument, svd returns an economy-sized decomposition, eliminating the unnecessary rows or columns of U or V.

See also: svd_driver, svds, eig, lu, chol, hess, qr, qz.

Package: octave