rewrite _momentX methods in more functional style
depending on the width of vector instruction this is up to 4× faster (N=100), the old implementation matches for k = 6;
@devmotion
I think this is a good change. It requires the minimum Julia version to be 1.6 but I think that is okay.
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).
Since it's unspecified whether
initis used at all for non-empty collections, an alternative might be to use the suggestedinitvalues only for empty collections and usesumwithoutinitkeyword 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