[−][src]Trait ndarray_stats::QuantileExt
Quantile methods for ArrayBase.
Required Methods
fn min(&self) -> Option<&A> where
A: PartialOrd,
A: PartialOrd,
Finds the elementwise minimum of the array.
Returns None if any of the pairwise orderings tested by the function
are undefined. (For example, this occurs if there are any
floating-point NaN values in the array.)
Additionally, returns None if the array is empty.
fn min_skipnan(&self) -> &A where
A: MaybeNan,
A::NotNan: Ord,
A: MaybeNan,
A::NotNan: Ord,
Finds the elementwise minimum of the array, skipping NaN values.
Warning This method will return a NaN value if none of the values in the array are non-NaN values. Note that the NaN value might not be in the array.
fn max(&self) -> Option<&A> where
A: PartialOrd,
A: PartialOrd,
Finds the elementwise maximum of the array.
Returns None if any of the pairwise orderings tested by the function
are undefined. (For example, this occurs if there are any
floating-point NaN values in the array.)
Additionally, returns None if the array is empty.
fn max_skipnan(&self) -> &A where
A: MaybeNan,
A::NotNan: Ord,
A: MaybeNan,
A::NotNan: Ord,
Finds the elementwise maximum of the array, skipping NaN values.
Warning This method will return a NaN value if none of the values in the array are non-NaN values. Note that the NaN value might not be in the array.
fn quantile_axis_mut<I>(&mut self, axis: Axis, q: f64) -> Array<A, D::Smaller> where
D: RemoveAxis,
A: Ord + Clone,
S: DataMut,
I: Interpolate<A>,
D: RemoveAxis,
A: Ord + Clone,
S: DataMut,
I: Interpolate<A>,
Return the qth quantile of the data along the specified axis.
q needs to be a float between 0 and 1, bounds included.
The qth quantile for a 1-dimensional lane of length N is defined
as the element that would be indexed as (N-1)q if the lane 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 type Interpolate bound I.
Some examples:
q=0.returns the minimum along each 1-dimensional lane;q=0.5returns the median along each 1-dimensional lane;q=1.returns the maximum along each 1-dimensional lane. (q=0andq=1are considered improper quantiles)
The array is shuffled in place along each 1-dimensional lane in order to produce the required quantile without allocating a copy of the original array. Each 1-dimensional lane is shuffled independently from the others. 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); wheremis the number of elements in the array.
Panics if axis is out of bounds, if the axis has length 0, or if
q is not between 0. and 1. (inclusive).
fn quantile_axis_skipnan_mut<I>(
&mut self,
axis: Axis,
q: f64
) -> Array<A, D::Smaller> where
D: RemoveAxis,
A: MaybeNan,
A::NotNan: Clone + Ord,
S: DataMut,
I: Interpolate<A::NotNan>,
&mut self,
axis: Axis,
q: f64
) -> Array<A, D::Smaller> where
D: RemoveAxis,
A: MaybeNan,
A::NotNan: Clone + Ord,
S: DataMut,
I: Interpolate<A::NotNan>,
Return the qth quantile of the data along the specified axis, skipping NaN values.
See quantile_axis_mut for details.
Implementations on Foreign Types
impl<A, S, D> QuantileExt<A, S, D> for ArrayBase<S, D> where
S: Data<Elem = A>,
D: Dimension, [src]
impl<A, S, D> QuantileExt<A, S, D> for ArrayBase<S, D> where
S: Data<Elem = A>,
D: Dimension, fn min(&self) -> Option<&A> where
A: PartialOrd, [src]
fn min(&self) -> Option<&A> where
A: PartialOrd, fn min_skipnan(&self) -> &A where
A: MaybeNan,
A::NotNan: Ord, [src]
fn min_skipnan(&self) -> &A where
A: MaybeNan,
A::NotNan: Ord, fn max(&self) -> Option<&A> where
A: PartialOrd, [src]
fn max(&self) -> Option<&A> where
A: PartialOrd, fn max_skipnan(&self) -> &A where
A: MaybeNan,
A::NotNan: Ord, [src]
fn max_skipnan(&self) -> &A where
A: MaybeNan,
A::NotNan: Ord, fn quantile_axis_mut<I>(&mut self, axis: Axis, q: f64) -> Array<A, D::Smaller> where
D: RemoveAxis,
A: Ord + Clone,
S: DataMut,
I: Interpolate<A>, [src]
fn quantile_axis_mut<I>(&mut self, axis: Axis, q: f64) -> Array<A, D::Smaller> where
D: RemoveAxis,
A: Ord + Clone,
S: DataMut,
I: Interpolate<A>, fn quantile_axis_skipnan_mut<I>(
&mut self,
axis: Axis,
q: f64
) -> Array<A, D::Smaller> where
D: RemoveAxis,
A: MaybeNan,
A::NotNan: Clone + Ord,
S: DataMut,
I: Interpolate<A::NotNan>, [src]
fn quantile_axis_skipnan_mut<I>(
&mut self,
axis: Axis,
q: f64
) -> Array<A, D::Smaller> where
D: RemoveAxis,
A: MaybeNan,
A::NotNan: Clone + Ord,
S: DataMut,
I: Interpolate<A::NotNan>,