我不明白为什么Schur的分解对复杂矩阵不起作用。 我的测试程序是:
M <- matrix(data=c(2-1i,0+1i,3-1i,0+1i,1+0i,0+1i,1+0i,1+1i,2+0i), nrow=3, ncol=3, byrow=FALSE)
M
S <- Schur(M)
S
(S$Q)%*%(S$T)%*%(solve(S$Q))
结果是:
> M
[,1] [,2] [,3]
[1,] 2-1i 0+1i 1+0i
[2,] 0+1i 1+0i 1+1i
[3,] 3-1i 0+1i 2+0i
>
> S <- Schur(M)
Warning message:
In Schur(M) : imaginary parts discarded in coercion
>
> S
$Q
[,1] [,2] [,3]
[1,] 0 0.500 -0.866
[2,] 1 0.000 0.000
[3,] 0 0.866 0.500
$T
[,1] [,2] [,3]
[1,] 1 0.866 0.5000
[2,] 0 3.732 -2.0000
[3,] 0 0.000 0.2679
$EValues
[1] 1.0000 3.7321 0.2679
>
> (S$Q)%*%(S$T)%*%(solve(S$Q))
[,1] [,2] [,3]
[1,] 2 0 1
[2,] 0 1 1
[3,] 3 0 2
因此Q*T*Q^{-1}
不会以真正复杂的形式回复......我缺少哪些代码/说明?
答案 0 :(得分:0)
如@ Eldioo的评论所述,Matrix::Schur
只涉及真实的矩阵。对于复杂矩阵,您可以使用QZ
包:
library(QZ)
M <- matrix(data=c(2-1i,0+1i,3-1i,0+1i,1+0i,0+1i,1+0i,1+1i,2+0i),
nrow=3, ncol=3, byrow=FALSE)
schur <- qz(M)
> all.equal(M, schur$Q %*% schur$T %*% solve(schur$Q))
[1] TRUE
> all.equal(M, schur$Q %*% schur$T %*% t(Conj(schur$Q)))
[1] TRUE