简体   繁体   中英

Schur decomposition of a complex matrix

I don't understand why the Schur's decomposition doesn't work on a complex matrix. My program for testing is :

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))

Results are :

> 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

So that Q*T*Q^{-1} does not give M back in its true complex form... What code/instructions am I missing, please ?

As said in @Eldioo's comment, Matrix::Schur deals only with real matrices. For complex matrices, you can use the QZ package:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM