Hi, You haven't given us much information.
You might actually have the same eigenvalues, but don't recognize that due to possibly different orderings. Complex numbers do not possess ordering. Therefore, there is no natural way to report complex eigenvalues. In R, the complex eigenvalues are ordered in decreasing order of the absolute value of "real" part, whereas in Matlab it may be that they are ordered in terms of the modulus (absolute value) of the complex number. I have used "arpack" before to obtain the first few dominant eigenvalues, and the same issue of different "ordering" of eigenvalues also applies there. Ravi. ---------------------------------------------------------------------------- ------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: rvarad...@jhmi.edu Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.h tml ---------------------------------------------------------------------------- -------- -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David Scherrer Sent: Tuesday, December 01, 2009 11:36 AM To: r-help@r-project.org Subject: [R] eigenvalues of complex matrices Dear all, I want to compute the eigenvalues of a complex matrix for some statistics. Comparing it to its matlab/octave sibling, I don't get the same eigenvalues in R computing it from the exact same matrix. In R, I used eigen() and arpack() that give different eigenvalues. In matlab/octave I used eig() and eigs() that give out the same eigenvalues but different to the R ones. For real matrices, R and matlab/octave are consistent. Does anybody know what could go on here and how I could get consistent eigenvalues in R? Since I definitely want to do the analysis in R. Many thanks, David [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list 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. ______________________________________________ R-help@r-project.org mailing list 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.