Re: [R] Odp: fast way to compare two matrices

From: peter dalgaard <PDalgd_at_gmail.com>
Date: Wed, 27 Apr 2011 16:21:49 +0200

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

> That was great :)
> REgards

You may need to turn your sarcasm detector back on. Beware:

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

[1] FALSE
> all.equal(x,y)
[1] TRUE
> summary(c(x-y))

      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

> 
> 
> --- On Wed, 4/27/11, Petr PIKAL <petr.pikal_at_precheza.cz> wrote:
> 

>> From: Petr PIKAL <petr.pikal@precheza.cz>
>> Subject: Odp: [R] fast way to compare two matrices
>> To: "Alaios" <alaios_at_yahoo.com>
>> Cc: R-help_at_r-project.org, r-help-bounces_at_r-project.org
>> Date: Wednesday, April 27, 2011, 12:18 PM
>> 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:
>>
>>> 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
>>> 
>>> ______________________________________________
>>> 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.
>>
>>
> 
> ______________________________________________
> 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.

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes_at_cbs.dk  Priv: PDalgd_at_gmail.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 Wed 27 Apr 2011 - 14:41:18 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 27 Apr 2011 - 15:10:33 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