Re: [R] extracting the first few eigenvectors

2014-05-02 Thread Mike Miller
Thank you, and thanks for writing that code! That is the perfect answer to my question. I hope the R development team will consider expanding the functionality of eigen() to include the option to retain only the first few eigenvectors and/or eigenvalues. To me it seems very common in statist

Re: [R] extracting the first few eigenvectors

2014-05-02 Thread Yixuan Qiu
Exactly. The syntax is intended to mimic eigs() in Matlab and Octave. library(rARPACK) eigs(X, 10) # If your X is of class "dsyMatrix" eigs_sym(X, 10) # If X is of class "matrix" Best, Yixuan 2014-05-02 4:48 GMT-04:00 Berend Hasselman : > > On 02-05-2014, at 09:17, Mike Miller wrot

Re: [R] extracting the first few eigenvectors

2014-05-02 Thread Berend Hasselman
On 02-05-2014, at 09:17, Mike Miller wrote: > I have a symmetric matrix, X, and I just want the first K eigenvectors (those > associated with the K largest eigenvalues). Clearly, this works: > > eigs <- eigen( X, symmetric=TRUE ) > > K_eigenvectors <- eigs$vectors[ , 1:K ] > K_eigenvalues <-

[R] extracting the first few eigenvectors

2014-05-02 Thread Mike Miller
I have a symmetric matrix, X, and I just want the first K eigenvectors (those associated with the K largest eigenvalues). Clearly, this works: eigs <- eigen( X, symmetric=TRUE ) K_eigenvectors <- eigs$vectors[ , 1:K ] K_eigenvalues <- eigs$values[ 1:K ] rm(eigs) In order to do that, I have t