Replace min/max, make quantile_mut return None for empty arrays, and fix docs#13
Conversation
The problem with the old methods was that they panicked when the array was empty, which was very problematic. (See rust-ndarray/ndarray#512 for discussion.) The old `min_partialord` and `max_partialord` have been renamed to `min`/`max`.
|
For empty arrays, I think the right thing to do is to have For constant arrays, I think the right thing to do is have For Freedman Diaconis with IQR=0, I'm not sure; that requires some thought. Panicking definitely isn't the right thing, because IMO panics shouldn't be a function of the data in the array. I think I'd return an By the way, in a future version, I'm thinking about replacing impl<A: Ord> Grid<A> {
fn fit_array<S, B>(array: &ArrayBase<S, Ix2>, strategy: &B) -> Result<Self, Error>
where
S: Data<Elem = A>,
B: BinsBuildingStrategy<A>,
{
// ...
}
}
pub trait BinsBuildingStrategy<A: Ord> {
fn fit_array<S>(&self, array: &ArrayBase<S, Ix1>) -> Result<Bins<A>, Error>
where
S: Data<Elem = A>;
}The |

This PR does a few things:
min/maxmethods with the oldmin_partialord/max_partialord. (Renamemin_partialord/max_partialordtomin/max.) See this comment for more explanation. The primary issue with the oldmin/maxmethods is that they panicked on empty arrays.quantile_mutreturnNonefor empty arrays. It's easy to forget about the possibility of empty arrays, so it's important to remind the user of the possibility and force them to handle it. See this comment for more justification.quantile_mut.Edit: I'm uncomfortable with the histogram strategies panicking in so many cases, but we can fix that in a later version.