SVD in Maxima and EMT

One user asked me about the differences of SVD in Euler and Maxima. For quadratic matrices, both systems return orthogonal matrices U, V, and the diagonal d of a diagonal matrix D, such that

\(U\cdot D \cdot V = A\)

In fact, Maxima returns V‘. Maxima uses the LAPACK to compute this.

An obvious discrepancy might be the order of the singular values. But for non-quadratic nxm matrices, Maxima expands U to a square nxn orthogonal matrix, while Euler returns an nxm matrix with orthogonal columns. Consequently, in Maxima D in the above formula has to be expanded  with zeros to a nxm matrix.

If we want to get the result of Maxima in Euler, we need to expand a matrix with orthogonal vectors. There are several ways to achieve this. A stable method is to use svdkernel or orthogonal. The tricks are very simple.

>A = A | svdkernel(A');
>A = A | orthogonal(kernel(A'));

A notebook, which demonstrates an example can be found here.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.