Skip to content

order by which the eigenvalues are presented

2 messages · Luis Borda de Agua, William Dunlap

#
I?m using R 3.1.3 in OS X 10.10.3 (Yosemite)

I use the function ?eigen? to calculate the eigenvalues of matrix where each element is sampled from a given distribution (normal, beta, etc.). 
According to the information provided: 
"values	
a vector containing the p eigenvalues of x, sorted in decreasing order, according to Mod(values)"


However, for my purposes it would be important to ?fix? the order by which the eigenvalues are presented. To be more specific, I would like to know each time I calculated the eigenvalues from a set of sampled matrix elements which is the eigenvalue that provides the largest (or the smallest) real part.

Is there an easy way to enforce this? (I could not find an option in "eigen".)

Is there another function in R that calculates the eigenvalues and shows their values without sorting them?

Thank you in advance,

Lu?s Borda de ?gua
#
You can sort the eigenvalues in the order you want with
    o <- order(Re(e$values), decreasing = TRUE)
or
    o <- order(abs(Re(e$values)), decreasing = TRUE)
followed by
    e$values[o]
where 'e' is the object that eigen returns.

The main argument to order() is what you want to sort by and the subscript
expression e$values[o] does the rearranging.  You can subscript e$vectors
to rearrange them as well.




Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Tue, May 5, 2015 at 10:49 AM, Luis Borda de Agua <lbagua at gmail.com>
wrote: