Trait ndarray_stats::MaybeNanExt

source ·
pub trait MaybeNanExt<A, S, D>
where A: MaybeNan, S: Data<Elem = A>, D: Dimension,
{ // Required methods fn fold_skipnan<'a, F, B>(&'a self, init: B, f: F) -> B where A: 'a, F: FnMut(B, &'a A::NotNan) -> B; fn indexed_fold_skipnan<'a, F, B>(&'a self, init: B, f: F) -> B where A: 'a, F: FnMut(B, (D::Pattern, &'a A::NotNan)) -> B; fn visit_skipnan<'a, F>(&'a self, f: F) where A: 'a, F: FnMut(&'a A::NotNan); fn fold_axis_skipnan<B, F>( &self, axis: Axis, init: B, fold: F, ) -> Array<B, D::Smaller> where D: RemoveAxis, F: FnMut(&B, &A::NotNan) -> B, B: Clone; fn map_axis_skipnan_mut<'a, B, F>( &'a mut self, axis: Axis, mapping: F, ) -> Array<B, D::Smaller> where A: 'a, S: DataMut, D: RemoveAxis, F: FnMut(ArrayViewMut1<'a, A::NotNan>) -> B; fn __private__(&self, _: PrivateMarker); }
Expand description

Extension trait for ArrayBase providing NaN-related functionality.

Required Methods§

source

fn fold_skipnan<'a, F, B>(&'a self, init: B, f: F) -> B
where A: 'a, F: FnMut(B, &'a A::NotNan) -> B,

Traverse the non-NaN array elements and apply a fold, returning the resulting value.

Elements are visited in arbitrary order.

source

fn indexed_fold_skipnan<'a, F, B>(&'a self, init: B, f: F) -> B
where A: 'a, F: FnMut(B, (D::Pattern, &'a A::NotNan)) -> B,

Traverse the non-NaN elements and their indices and apply a fold, returning the resulting value.

Elements are visited in arbitrary order.

source

fn visit_skipnan<'a, F>(&'a self, f: F)
where A: 'a, F: FnMut(&'a A::NotNan),

Visit each non-NaN element in the array by calling f on each element.

Elements are visited in arbitrary order.

source

fn fold_axis_skipnan<B, F>( &self, axis: Axis, init: B, fold: F, ) -> Array<B, D::Smaller>
where D: RemoveAxis, F: FnMut(&B, &A::NotNan) -> B, B: Clone,

Fold non-NaN values along an axis.

Combine the non-NaN elements of each subview with the previous using the fold function and initial value init.

source

fn map_axis_skipnan_mut<'a, B, F>( &'a mut self, axis: Axis, mapping: F, ) -> Array<B, D::Smaller>
where A: 'a, S: DataMut, D: RemoveAxis, F: FnMut(ArrayViewMut1<'a, A::NotNan>) -> B,

Reduce the values along an axis into just one value, producing a new array with one less dimension.

The NaN values are removed from the 1-dimensional lanes, then they are passed as mutable views to the reducer, allowing for side-effects.

Warnings:

  • The lanes are visited in arbitrary order.

  • The order of the elements within the lanes is unspecified. However, if mapping is idempotent, this method is idempotent. Additionally, given the same input data, the lane is always ordered the same way.

Panics if axis is out of bounds.

source

fn __private__(&self, _: PrivateMarker)

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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<A, S, D> MaybeNanExt<A, S, D> for ArrayBase<S, D>
where A: MaybeNan, S: Data<Elem = A>, D: Dimension,

source§

fn fold_skipnan<'a, F, B>(&'a self, init: B, f: F) -> B
where A: 'a, F: FnMut(B, &'a A::NotNan) -> B,

source§

fn indexed_fold_skipnan<'a, F, B>(&'a self, init: B, f: F) -> B
where A: 'a, F: FnMut(B, (D::Pattern, &'a A::NotNan)) -> B,

source§

fn visit_skipnan<'a, F>(&'a self, f: F)
where A: 'a, F: FnMut(&'a A::NotNan),

source§

fn fold_axis_skipnan<B, F>( &self, axis: Axis, init: B, fold: F, ) -> Array<B, D::Smaller>
where D: RemoveAxis, F: FnMut(&B, &A::NotNan) -> B, B: Clone,

source§

fn map_axis_skipnan_mut<'a, B, F>( &'a mut self, axis: Axis, mapping: F, ) -> Array<B, D::Smaller>
where A: 'a, S: DataMut, D: RemoveAxis, F: FnMut(ArrayViewMut1<'a, A::NotNan>) -> B,

source§

fn __private__(&self, _: PrivateMarker)

Implementors§