简体   繁体   中英

How can I find an orthogonal matrix in R?

I want to find an orthogonal matrix ( G ) in R such that G'CG=L=diag(l1,l2,...lp) where l1>l2>...>lp>0 are the eigen values of known matrix C . I find a matrix with using code eigen(C)$vectors but the result matrix ( L ) is not a diagonal one. Is there anyone who can help me? thanks in advance

Your only restriction on C shown is that all eigenvalues are positive. However, this is equivalent to saying that C is positive definite.

In that case, given e <- eigen(C) , we have the following:

Q = e$vectors
l = e$values

Conj(t(Q)) = Q^-1

Q %*% diag(l) %*% Conj(t(Q)) = C

Equivalently:

diag(l) = Conj(t(Q)) %*% C %*% Q

As the eigenvalues in l are stored in decreasing order, you are done.

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