You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the quick response @LukeMathWalker , that's annoying f32/f64 doen't impelment Ord . I made my array n64's and it works great.
It was potentially me reading the docs wrong as I had the impression that the q value needed to be noisy rather than the array which didn't make much sense to me. Thanks for clearning it up!
The quantile_axis_skipnan_mut method on the QuantileExt trait may also be useful for your application since it can work directly on f32/f64 in the presence of NaN values. We should probably add an analogous method to Quantile1dExt; @LukeMathWalker is that what you were referring to in your comment?
@jturner314 that sounds like a great idea, thanks for pointing out quantile_axis_skipnan_mut, I could add an axis to my 1d arrays and use this but I think it's cleaner to stay in 1d.
@CharlieBickerton Note that 1d arrays have a single axis (axis 0). quantile_axis_skipnan_mut returns an array with one less axis, so the result of calling it on a 1d array is a 0d array. To turn an 0d array into its element, you can use .into_scalar(). So, you could do this:
Activity
LukeMathWalker commentedon Dec 4, 2019
Rust's floats (
f64andf32) do not implement theOrdtrait because of howf64::NANandf32::NANbehave in comparisons - see this little snippet https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6190375f8d1a48bc1a885ce38981ebeaIf you remove Not a Number from the equation (using something like
noisy-floats) than you recover theOrdtrait and you can call.quantile_mut.As an action item on our side, we should probably provide a
PartialOrdversion ofquantile_mut, as we do for the other summary function.CharlieBickerton commentedon Dec 4, 2019
Thanks for the quick response @LukeMathWalker , that's annoying f32/f64 doen't impelment
Ord. I made my array n64's and it works great.It was potentially me reading the docs wrong as I had the impression that the q value needed to be noisy rather than the array which didn't make much sense to me. Thanks for clearning it up!
jturner314 commentedon Dec 4, 2019
The
quantile_axis_skipnan_mutmethod on theQuantileExttrait may also be useful for your application since it can work directly onf32/f64in the presence of NaN values. We should probably add an analogous method toQuantile1dExt; @LukeMathWalker is that what you were referring to in your comment?CharlieBickerton commentedon Dec 5, 2019
@jturner314 that sounds like a great idea, thanks for pointing out
quantile_axis_skipnan_mut, I could add an axis to my 1d arrays and use this but I think it's cleaner to stay in 1d.LukeMathWalker commentedon Dec 5, 2019
Yes, that's what I meant @jturner314.
jturner314 commentedon Dec 5, 2019
@CharlieBickerton Note that 1d arrays have a single axis (axis 0).
quantile_axis_skipnan_mutreturns an array with one less axis, so the result of calling it on a 1d array is a 0d array. To turn an 0d array into its element, you can use.into_scalar(). So, you could do this:It would be more convenient to have a
.quantile_skipnan_mut()method inQuantile1dExt, as @LukeMathWalker pointed out.