If Sigma is the m by n matrix whose (i,i) entry is the i th entry of S, and zero elsewhere, then M = U Sigma Vt. This is the singular value decomposition of M. Note that the entries of S are (up to roundoff error) the eigenvalues of the Hermitian matrix M * (conjugate transpose M)
M may also be a
MutableMatrix in which case the returned values S, U, Vt are also
mutable matrices.
If M is over CC, then U and Vt are unitary matrices over CC. If M is over RR, U and Vt are orthogonal over RR.
i1 : M = map(RR^3, RR^5, (i,j) -> (i+1)^j * 1.0)
o1 = | 1 1 1 1 1 |
| 1 2.000000 4.000000 8.000000 16.000000 |
| 1 3.000000 9.000000 27.000000 81.000000 |
3 5
o1 : Matrix RR <--- RR
|
i2 : (S,U,V) = SVD(M)
o2 = (| 87.813396 |, | -0.016192 -0.401463 -0.915732 |, | -0.013677 -0.038310
| 3.895099 | | -0.206478 -0.894769 0.395923 | | -0.282597 -0.411936
| 0.797285 | | -0.978317 0.195490 -0.068405 | | -0.737771 -0.412778
| 0.083862 0.332631
| -0.607135 0.740143
------------------------------------------------------------------------
-0.109857 -0.319798 -0.940216 |)
-0.570238 -0.585709 0.286743 |
0.065613 0.507606 -0.152769 |
-0.807831 0.472401 -0.081063 |
0.076583 -0.271748 0.062156 |
o2 : Sequence
|
i3 : (transpose U) * M * (transpose V)
o3 = | 87.813396 0.000000 0.000000 0.000000 0.000000 |
| -0.000000 3.895099 -0.000000 0.000000 -0.000000 |
| -0.000000 -0.000000 0.797285 0.000000 0.000000 |
3 5
o3 : Matrix RR <--- RR
|
i4 : U^-1 == transpose U
o4 = true
|
i5 : (S1,U1,V1) = SVD(M, DivideConquer => true)
o5 = (| 87.813396 |, | -0.016192 -0.401463 -0.915732 |, | -0.013677 -0.038310
| 3.895099 | | -0.206478 -0.894769 0.395923 | | -0.282597 -0.411936
| 0.797285 | | -0.978317 0.195490 -0.068405 | | -0.737771 -0.412778
| 0.083862 0.332631
| -0.607135 0.740143
------------------------------------------------------------------------
-0.109857 -0.319798 -0.940216 |)
-0.570238 -0.585709 0.286743 |
0.065613 0.507606 -0.152769 |
-0.807831 0.472401 -0.081063 |
0.076583 -0.271748 0.062156 |
o5 : Sequence
|
i6 : S1 == S, U1==U, V1==V
o6 = (true, true, true)
o6 : Sequence
|
The SVD routine calls on the SVD algorithms in the lapack library.