Re: [Rd] Performance issue in stats:::weighted.mean.default method

2015-03-05 Thread Tadeáš Palusga
Oops, such an amateur mistake. Thanks a lot for your quick response. Regards TP On 03/05/2015 06:49 PM, Prof Brian Ripley wrote: On 05/03/2015 14:55, Tadeáš Palusga wrote: Hi, I'm using this mailing list for the first time and I hope this is the right one. I don't think that the following

Re: [Rd] Performance issue in stats:::weighted.mean.default method

2015-03-05 Thread Henrik Bengtsson
See weightedMean() in the matrixStats package. It's optimized for data type, speed and memory and implemented in native code so it can avoid some of these intermediate copies. It's a few times faster than weighted.mean[.default](); library(matrixStats) library(microbenchmark) n - 5000 x -

Re: [Rd] Performance issue in stats:::weighted.mean.default method

2015-03-05 Thread Prof Brian Ripley
On 05/03/2015 14:55, Tadeáš Palusga wrote: Hi, I'm using this mailing list for the first time and I hope this is the right one. I don't think that the following is a bug but it can be a performance issue. By my opinion, there is no need to filter by [w != 0] in last sum of

[Rd] Performance issue in stats:::weighted.mean.default method

2015-03-05 Thread Tadeáš Palusga
Hi, I'm using this mailing list for the first time and I hope this is the right one. I don't think that the following is a bug but it can be a performance issue. By my opinion, there is no need to filter by [w != 0] in last sum of weighted.mean.default method defined in