【发布时间】:2015-04-17 12:54:07
【问题描述】:
我读到了Singular Value Decomposition。引用维基百科:
The left-singular vectors of M are eigenvectors of MM∗.
The right-singular vectors of M are eigenvectors of M∗M.
The non-zero singular values of M (found on the diagonal entries of Σ)
are the square roots of the non-zero eigenvalues of both M∗M and MM∗
我写了这个 octave 代码(控制台输出显示在这里):
a 是正在计算其 svd 的矩阵。
octave:1> a = [1,3;3,1]
a =
1 3
3 1
octave:3> [U,S,V] = svd(a)
U =
-0.70711 -0.70711
-0.70711 0.70711
S =
Diagonal Matrix
4 0
0 2
V =
-0.70711 0.70711
-0.70711 -0.70711
检查 svd 是否真的有效..
octave:4> U*S*V
ans =
3.00000 -1.00000
1.00000 -3.00000
octave:5> U*S*V'
ans =
1.00000 3.00000
3.00000 1.00000
现在尝试第一原则(维基百科)风格:
octave:6> b = a*a'
b =
10 6
6 10
octave:7> c = a'*a
c =
10 6
6 10
octave:8> [E1,L1] = eig(b)
E1 =
-0.70711 0.70711
0.70711 0.70711
L1 =
Diagonal Matrix
4 0
0 16
octave:9> [E2,L2] = eig(c)
E2 =
-0.70711 0.70711
0.70711 0.70711
L2 =
Diagonal Matrix
4 0
0 16
我可以看到b 和c 的特征值是a 的奇异值的平方。这很酷。但是left-singular-vectors 和right-singular-vectors 出错了……签名问题。
需要什么额外的步骤才能获得正确的值?
【问题讨论】:
标签: octave svd eigenvector eigenvalue