# [Maxima] matrix SVD

Robert Dodier robert.dodier at gmail.com
Sat Oct 20 20:50:16 CDT 2007

```On 10/19/07, Ruben Henner Zilibowitz <rzilibowitz at yahoo.com.au> wrote:

> I was wondering if there's a built in maxima function to compute the
> SVD of a matrix (ie the Singular Value Decomposition). Is there one?

There is dgesvd in the lapack package which computes SVD
for numerical arguments. There is no symbolic SVD.

dgesvd is not mentioned in the Maxima reference manual;
that's just an oversight. But (describe '\$dgesvd) yields some
helpful text. I'll copy it to the ref manual.

By the way you have to load lapack via load(lapack)
since the lapack functions are not loaded by default.
Maxima will try to compile the files -- you'll probably
need to run Maxima as root if on a Unix-like system
or copy the lapack directory tree to some user-writable
location and load it from there. (We talked about a way
to make load(lapack) simpler for the end-user but didn't
get around to implementing anything yet ....)

best

Robert Dodier

PS. :lisp (describe '\$dgesvd) =>

DGESVD computes the singular value decomposition (SVD) of a real
M-by-N matrix A, optionally computing the left and/or right singular
vectors. The SVD is written

A = U * SIGMA * transpose(V)

where SIGMA is an M-by-N matrix which is zero except for its
min(m,n) diagonal elements, U is an M-by-M orthogonal matrix, and
V is an N-by-N orthogonal matrix.  The diagonal elements of SIGMA
are the singular values of A; they are real and non-negative, and
are returned in descending order.  The first min(m,n) columns of
U and V are the left and right singular vectors of A.

Note that the routine returns V**T, not V.

A list of three items is returned.  The first is a list containing the
non-zero elements of SIGMA.  The second is the matrix U.  The third is
V**T.
```

More information about the Maxima mailing list