# Trait ndarray_stats::Quantile1dExt

``````pub trait Quantile1dExt<A, S> where    S: Data<Elem = A>, {
fn quantile_mut<I>(        &mut self,        q: N64,        interpolate: &I    ) -> Result<A, QuantileError>    where        A: Ord + Clone,        S: DataMut,        I: Interpolate<A>;
fn quantiles_mut<S2, I>(        &mut self,        qs: &ArrayBase<S2, Ix1>,        interpolate: &I    ) -> Result<Array1<A>, QuantileError>    where        A: Ord + Clone,        S: DataMut,        S2: Data<Elem = N64>,        I: Interpolate<A>;
fn __private__(&self, _: PrivateMarker);
}``````
Expand description

Quantile methods for 1-D arrays.

## Required Methods

Return the qth quantile of the data.

`q` needs to be a float between 0 and 1, bounds included. The qth quantile for a 1-dimensional array of length `N` is defined as the element that would be indexed as `(N-1)q` if the array were to be sorted in increasing order. If `(N-1)q` is not an integer the desired quantile lies between two data points: we return the lower, nearest, higher or interpolated value depending on the `interpolate` strategy.

Some examples:

• `q=0.` returns the minimum;
• `q=0.5` returns the median;
• `q=1.` returns the maximum. (`q=0` and `q=1` are considered improper quantiles)

The array is shuffled in place in order to produce the required quantile without allocating a copy. No assumptions should be made on the ordering of the array elements after this computation.

Complexity (quickselect):

• average case: O(`m`);
• worst case: O(`m`^2); where `m` is the number of elements in the array.

Returns `Err(EmptyInput)` if the array is empty.

Returns `Err(InvalidQuantile(q))` if `q` is not between `0.` and `1.` (inclusive).

A bulk version of `quantile_mut`, optimized to retrieve multiple quantiles at once.

Returns an `Array`, where the elements of the array correspond to the elements of `qs`.

Returns `Err(EmptyInput)` if the array is empty.

Returns `Err(InvalidQuantile(q))` if any `q` in `qs` is not between `0.` and `1.` (inclusive).

See `quantile_mut` for additional details on quantiles and the algorithm used to retrieve them.

This method makes this trait impossible to implement outside of `ndarray-stats` so that we can freely add new methods, etc., to this trait without breaking changes.

We don’t anticipate any other crates needing to implement this trait, but if you do have such a use-case, please let us know.

Warning This method is not considered part of the public API, and client code should not rely on it being present. It may be removed in a non-breaking release.