Re: [R] More simple implementation is slow.

2012-06-09 Thread peter dalgaard
On Jun 9, 2012, at 13:16 , wl2776 wrote: > > $sample.interval > [1] 0.02 > > $sampling.time > [1] 0.02 > > Apparently, it is about twise faster. Too fast to measure, I'd say. Try system.time, and/or multiple replications. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Busi

Re: [R] More simple implementation is slow.

2012-06-09 Thread wl2776
Sorry, here are the profiles: summaryRprof("get_tau") $by.self self.time self.pct total.time total.pct "cbind" 0.02 50 0.04 100 "unlist" 0.02 50 0.0250 $by.total total.time total.pct self.time self.pct "cbind" 0.04

Re: [R] More simple implementation is slow.

2012-06-09 Thread wl2776
I've created another get_tau implementation, using sapply and apply. http://pastebin.com/3FaHAL1i However, the second variant, with expand.grid still appeals me most. I don't undestand, why it is so slow. -- View this message in context: http://r.789695.n4.nabble.com/More-simple-implementation

Re: [R] More simple implementation is slow.

2012-06-09 Thread peter dalgaard
On Jun 9, 2012, at 11:08 , wl2776 wrote: > Hi all. > I'm developing a function, which must return a square matrix. > > Here is the code: > http://pastebin.com/THzEW9N7 > > These functions implement an analog of two embedded for cycles. > > The first variant creates the resulting matrix by colu

[R] More simple implementation is slow.

2012-06-09 Thread wl2776
Hi all. I'm developing a function, which must return a square matrix. Here is the code: http://pastebin.com/THzEW9N7 These functions implement an analog of two embedded for cycles. The first variant creates the resulting matrix by columns, cbind()-ing them one by one. The second variant creates