[R] matlab eigs function in R

kayteck_master kayteck_master at o2.pl
Tue Jun 3 20:21:46 CEST 2008


Dear Thomas

Yes, you're right. But I'm looking for this not only for computational cost
reasons. 
eigen function from R has identical behavior to matlab function eig, but not
to eigs.
Even in matlab you can check that those function are not giving identical
results.
Here you have a short example :
Suppose we have given a matrix M
M =

    1.2607   -3.5575    2.2968         0         0         0
   -3.5575   10.1429   -6.5855         0         0         0
    2.2968   -6.5855    4.2887         0         0         0
         0         0         0    2.6359   -4.8489    2.2130
         0         0         0   -4.8489    8.9217   -4.0728
         0         0         0    2.2130   -4.0728    1.8598

For eig (R's eigen)we have:
[V,eiggg]=eig(M);
V =

    0.5774         0         0   -0.7663         0    0.2820
    0.5774         0         0    0.1389         0   -0.8046
    0.5774         0         0    0.6273         0    0.5226
         0    0.5774   -0.6857         0    0.4432         0
         0    0.5774   -0.0410         0   -0.8155         0
         0    0.5774    0.7267         0    0.3723         0


eiggg =

   -0.0000         0         0         0         0         0
         0   -0.0000         0         0         0         0
         0         0    0.0011         0         0         0
         0         0         0    0.0252         0         0
         0         0         0         0   13.4163         0
         0         0         0         0         0   15.6671

And for matlab's eigs we have:
[Y,eigenvals] = eigs(M,4,0,options) ;
Y =

   -0.8147   -0.0106   -0.0000   -0.5774
    0.3802   -0.0143   -0.0000   -0.5774
    0.4344    0.0249    0.0000   -0.5774
   -0.0332    0.6871   -0.5774    0.0000
    0.0430    0.0379   -0.5774    0.0000
   -0.0098   -0.7250   -0.5774    0.0000


eigenvals =

    0.0331         0         0         0
         0    0.0011         0         0
         0         0    0.0000         0
         0         0         0   -0.0000

As you can see, columns of chosen eigenvectors are different. I'm looking
for function similar to eigs in R. I'll try with svd, which you have
mentioned. Thank you for that idea, maybe it will be what i'm looking for.

Kayteck
-- 
View this message in context: http://www.nabble.com/matlab-eigs-function-in-R-tp17619641p17629655.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list