-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Means #20
Means #20
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! I've added some comments.
A couple more things:
-
I do think we should add
.mean()
tondarray
sincendarray
already has.sum()
and.mean_axis()
. -
It's unfortunate that
harmonic_mean
andgeometric_mean
allocate 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()
(Pairwise summation 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
ndarray
exposesmean_axis
it does not providemean
, hence I have added it to the PR. Should I contribute it back tondarray
@jturner314?