Conversation
jturner314
left a comment
There was a problem hiding this comment.
Thanks for working on this! I've added some comments.
A couple more things:
-
I do think we should add
.mean()tondarraysincendarrayalready has.sum()and.mean_axis(). -
It's unfortunate that
harmonic_meanandgeometric_meanallocate a temporary array for the result of themap. However, for the time being, I don't see a good way to avoid this while still taking advantage of the pairwise implementation of.sum()(rust-ndarray/ndarray#577).
I agree - but the semantic of
It's exactly what I thought (and mean calculation is why I drafted the pairwise summation PR in the first place). I think it can be optimized to use less memory (we could use a lazy version of |
|
CI on Rust 1.30 is failing with |
|
Everything looks good, so I merged the PR. If
Will you please submit a PR to |
|
@jturner314 Your rule makes sense, sounds good to me to return an Option. I think it's quite frequent anyway that you want to compute a mean and if empty, get zero, and the option makes it simple to do that. |
|
I do agree with that reasoning and I still think that it's better to return I'll draft the PR for |
A basic implementation of arithmetic, harmonic and geometric mean.
Even though
ndarrayexposesmean_axisit does not providemean, hence I have added it to the PR. Should I contribute it back tondarray@jturner314?