Hello,

many thanks for your replies. The code I've posted was simplified and depicted my problem basically. Of course my intention was not to add 0-columns to a matrix, the problem resulted from my approach to add only eigenvectors to a matrix if the corresponding eigenvalue is element of real numbers, otherwise 0. So now I've learned that following code does it:

A is the matrix with the eigenvalues and -vectors of my interest
M <- matrix(ncol=8,nrow=8)
for(i in 1:8) {
     M[,i] <- if(Im(eigen(A)$val[i]) == 0) eigen(A)$vec[,i] else 0
}

Many thanks again!

Uwe

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to