m = u $ d $ v
T
u is a column-orthogonal matrix with dimensions a x b. d is an a x a diagonal matrix with positive or
zero elements (these are the singular values), and v is an a x a orthogonal matrix. The call for Rivera's
svd() is
svd(m,"u","d","v")
where m is the matrix to decompose, and "u", "d" and "v" are the names of the variables (as strings) to
store the output.
svd(aa,á,é,í)
Prgm
© sdv(m,"u","d","v") m = u*d*v
© Hernan Rivera
Local st,i,k,n,m,ut,sc
Define sc(st1,n)=Prgm
Local st2,i
seq(i,i,1,n)→st2
SortD st1,st2
newMat(n,n)→e1
1→i
While i≤n
1→e1[st2[i],i]
i+1→i
EndWhile
EndPrgm
eigVl(aa*aa)→st
eigVc(aa*aa)→uu
colDim(uu)→n
sc(st,n)
round(uu*e1,11)→uu
eigVl(aa*aa)→st
eigVc(aa*aa)→vv
colDim(vv)→m
sc(st,m)
round(vv*e1,11)→vv
min(m,n)→k
1→i
While i≤k
If (aa*vv)[1,i]*uu[1,i]<0 Then
mRow(⁻1,uu,i)→ut
ut→uu
EndIf
i+1→i
EndWhile
SortD st
newMat(n,m)→dd
1→i
While i≤k
If st[i]<1⁻011
0→st[i]
√(st[i])→dd[i,i]
i+1→i
EndWhile
uu→#á
vv→#í
3 - 37