-
Notifications
You must be signed in to change notification settings - Fork 307
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
Std axis #486
Std axis #486
Conversation
…to avoid panicking if length of axis is equal to 1. Added panic if ddof is greater or equal than the length of the variance axis.
…to avoid panicking if length of axis is equal to 1. Added panic if ddof is greater or equal than the length of the variance axis.
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.
Everything looks good to me, although ideally we'd use .mapv_into
instead of .mapv
(see the comment). Will you please make that change?
src/numeric/impl_numeric.rs
Outdated
A: Float, | ||
D: RemoveAxis, | ||
{ | ||
self.var_axis(axis, ddof).mapv(|x| x.sqrt()) |
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.
I'd change the .mapv
into .mapv_into
to avoid the extra allocation.
Done @jturner314 |
I merged this PR. I squashed all the commits and fixed some minor whitespace issues. Unfortunately, GitHub doesn't understand that I merged this PR, so I have to manually close it. Thanks @LukeMathWalker! |
Adding a
std_axis
method to compute the standard deviation along an axis. Following up on rust-ndarray/ndarray-stats#1