"Jorge Ivan Velez" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]:
> Dear kayteck, > > Function eigen (see ?eigen) will do what you want. > > HTH, He had looked, but since eigen returns both eigenvalues and eigenvectors, and does so in a list, perhaps he needs advice about how to extract his values from the list structure. x <- matrix(c(1:5, (1:5)^2, (1:5)^(1/2), 0,0,0,1,0, 0,0,0,0,1),5, 5) str(eigen(x)) #List of 2 # $ values : cplx [1:5] 7.43+0i 1.00+0i 1.00+0i ... # $ vectors: cplx [1:5, 1:5] 0.0699+0i 0.1600+0i 0.2894+0i ... d <- 3 eigen(x)$values[1:d] [1] 7.431675+0i 1.000000+0i 1.000000+0i #no need to sort since eigen does that by default. Not sure we can help him out regarding the "slight difference" btwn Matlab values and R values due to the unnecessary vagueness of his concern. -- David Winsemius > > Jorge > > > On Tue, Jun 3, 2008 at 5:42 AM, kayteck_master > <[EMAIL PROTECTED]> wrote: > >> >> Hello >> >> Does anybody know how one can compute d largest >> eigenvalues/eigenvectors in R, like in MATLAB eigs function ? eigen >> function computes all eigenvectors/eigenvalues, and they are >> slightly different than those generated by matlab eigs. >> >> Thanks in advance >> -- > ______________________________________________ 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.