rjd {JADE} | R Documentation |
This is an R version of Cardoso's rjd matlab function for joint diagonalization of k real-valued square matrices.
rjd(X, eps = 1e-06, maxiter = 100, na.action = na.fail)
X |
A matrix of k stacked pxp matrices with dimension c(kp,p) or an array with dimension c(p,p,k). |
eps |
Convergence tolerance. |
maxiter |
Maximum number of iterations. |
na.action |
A function which indicates what should happen when the data contain 'NA's. Default is to fail. |
Denote the square matrices as A_i, i=1,...,k. This algorithm searches then an orthogonal matrix V so that D_i=V'A_iV is diagonal for all i. If the A_i commute then there is an exact solution. If not, the function will perform an approximate joint diagonalization by trying to make the D_i as diagonal as possible.
Cardoso points out that notion of approximate joint diagonalization
is ad hoc and very small values of eps
make in that case not much sense since the diagonality
criterion is ad hoc itself.
A list with the components
V |
An orthogonal matrix. |
D |
A stacked matrix with the diagonal matrices or an array with the diagonal matrices. The form of the output depends on the form of the input. |
Jean-Francois Cardoso. Ported to R by Klaus Nordhausen, klaus.nordhausen@uta.fi
Cardoso, J.-F. and Souloumiac, A., (1996), Jacobi angles for simultaneous diagonalization, SIAM J. Mat. Anal. Appl., 17, 161–164.
Z <- matrix(runif(9), ncol = 3) U <- eigen(Z %*% t(Z))$vectors D1 <- diag(runif(3)) D2 <- diag(runif(3)) D3 <- diag(runif(3)) D4 <- diag(runif(3)) X.matrix <- rbind(t(U) %*% D1 %*% U, t(U) %*% D2 %*% U, t(U) %*% D3 %*% U, t(U) %*% D4 %*% U) res.matrix <- rjd(X.matrix) res.matrix$V round(U %*% res.matrix$V, 4) # should be a signed permutation matrix if V is correct. round(res.matrix$D, 4) X.array <- aperm(array(t(X.matrix), dim = c(3,3,4)), c(2,1,3)) res.array <- rjd(X.array) round(res.array$D, 4)