|
Contents | Previous | Next | Subchapters |
| Syntax |
svd(x)x, u, v)u, s, v] = svd(x)u, s, v] = svd(x, full)
|
| See Also | eigen , eigsym , schur , qred , lu , cholesky |
svd(x)
if this syntax is used, the return value is a column vector containing
the singular vectors in descending magnitude order.
It has the same type as x and its length
is equal to the minimum of the row and column dimension of x.
svd(x, u, v)
if this syntax is used, the return value is the same as described above.
In addition, the columns of u are set to the left singular vectors
and the columns of v are set to the right singular vectors.
The input values of u and v have no effect
and their output values have the same type as x.
[u, s, v] = svd(x)
[u, s, v] = svd(x, full)
if this syntax is used, the matrices u, and v
are as described above. In addition, the diagonal matrix s
has the singular values along its diagonal and
in descending magnitude order.
If the argument full is the logical value true,
or if it is not present,
the full decomposition is computed.
Otherwise the economy decomposition is computed.
If m and n are the row and column dimensions
of x,
there is an m by m
unitary matrix
U,
an m by n
diagonal matrix
S,
and an n by n unitary matrix V
such that
x = U S conj(V)'
where conj(V)' is the complex conjugate transpose of V.
In addition, the matrix S can be chosen so that its diagonal
elements are
monotone decreasing
in absolute value; i.e.,
| S | > | S |
i, i i+1, i+1
In the full decomposition case,
if the arguments u and v are present,
they are set to the matrices U and V respectively.
If the argument s is present, it is set to the matrix S,
otherwise the return value of svd is equal to the diagonal of
S.
In the economy decomposition case,
the matrix u is set to the first
min(m, n) columns of U,
the matrix s is set to the submatrix defined by the
intersection of the first
min(m, n) rows and columns of S,
and the matrix v is set to the first
min(m, n) columns of V.
Thus it still holds that
'
x = u s conj(v)
/ 2 1 \
\ 1 2 /
enter
x = {[2., 1.], [1., 2.]}
u = novalue
v = novalue
[u, s, v] = svd(x, u, v)
print s, u
which returns
{
[ 3 , 0 ]
[ 0 , 1 ]
}
{
[ -0.707107 , -0.707107 ]
[ -0.707107 , 0.707107 ]
}
If you continue this example by entering
u * s * v'
O-Matrix will respond
{
[ 2 , 1 ]
[ 1 , 2 ]
}
(Note that because x is not complex,
v is not complex and it is not necessary to take the
complex conjugate of v in the example above.)