Skip to content

fast way to compare two matrices

4 messages · Alaios, PIKAL Petr, Peter Dalgaard

#
Dear all,
I am trying to speed up some code and I would like to check fast that it works by comparing two different matrices.

What is the fastest way to do that in R?

Best Regards
Alex
#
Hi

x <- matrix(rnorm(1e6), 1000,1000)
y <- matrix(rnorm(1e6), 1000,1000)

identical(x,y)
[1] FALSE

The response is almost instant.

In case you are not satisfied with the unspecific answer be more specific 
with your question.

Regards
Petr

r-help-bounces at r-project.org napsal dne 27.04.2011 13:04:37:
works
http://www.R-project.org/posting-guide.html
#
That was great :)
REgards
--- On Wed, 4/27/11, Petr PIKAL <petr.pikal at precheza.cz> wrote:

            
#
On Apr 27, 2011, at 13:29 , Alaios wrote:

            
You may need to turn your sarcasm detector back on. Beware:
[1] FALSE
[1] TRUE
Min.    1st Qu.     Median       Mean    3rd Qu.       Max. 
-6.442e-11 -6.204e-12  7.550e-15  2.670e-15  6.212e-12  6.722e-11