StatsBase.jl icon indicating copy to clipboard operation
StatsBase.jl copied to clipboard

rewrite _momentX methods in more functional style

Open kalmarek opened this issue 2 years ago • 3 comments

depending on the width of vector instruction this is up to 4× faster (N=100), the old implementation matches for k = 6;

@devmotion

kalmarek avatar Oct 23 '23 13:10 kalmarek

I think this is a good change. It requires the minimum Julia version to be 1.6 but I think that is okay.

andreasnoack avatar May 26 '24 19:05 andreasnoack

Since it's unspecified whether init is used at all for non-empty collections, an alternative might be to use the suggested init values only for empty collections and use sum without init keyword argument for non-empty collections (as a side effect this would not even require to bump the Julia version it seems).

devmotion avatar May 26 '24 21:05 devmotion

Since it's unspecified whether init is used at all for non-empty collections, an alternative might be to use the suggested init values only for empty collections and use sum without init keyword argument for non-empty collections (as a side effect this would not even require to bump the Julia version it seems).

I'd proceed with this version then. let me know what do you think about the suggestion I made above

kalmarek avatar May 27 '24 15:05 kalmarek