Re: [R] matlab eigs function in R

From: kayteck_master <kayteck_master_at_o2.pl>
Date: Tue, 03 Jun 2008 11:21:46 -0700 (PDT)

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.

______________________________________________
R-help_at_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.
Received on Tue 03 Jun 2008 - 21:06:26 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 04 Jun 2008 - 10:30:40 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive