使用矩阵的特征向量计算 svd * (matrix')
calculating svd using eigen-vectors of matrix * (matrix')
我读到了 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∗
我写了这个八度代码(控制台输出显示在这里):
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
出错了...符号问题。
需要什么额外的步骤才能获得正确的值?
您已经有了正确的价值观。
特征向量被定义为乘法常数。从 their definition 可以明显看出这一点。所以在你的情况下 [-0.70711; -0.70711]
和 [0.70711; 0.70711]
是等价的。
并且在这两种情况下,[-1; 1]
特征向量对应于 sqrt(4) = 2 特征值,而 [1; 1]
特征向量对应于 sqrt(16) = 4 特征值。
我读到了 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∗
我写了这个八度代码(控制台输出显示在这里):
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
出错了...符号问题。
需要什么额外的步骤才能获得正确的值?
您已经有了正确的价值观。
特征向量被定义为乘法常数。从 their definition 可以明显看出这一点。所以在你的情况下 [-0.70711; -0.70711]
和 [0.70711; 0.70711]
是等价的。
并且在这两种情况下,[-1; 1]
特征向量对应于 sqrt(4) = 2 特征值,而 [1; 1]
特征向量对应于 sqrt(16) = 4 特征值。