Trait ArrayExtrema

Source
pub trait ArrayExtrema<N: Numeric>
where Self: Sized + Clone,
{ // Required methods fn maximum(&self, other: &Array<N>) -> Result<Array<N>, ArrayError>; fn max(&self, axis: Option<isize>) -> Result<Array<N>, ArrayError>; fn amax(&self, axis: Option<isize>) -> Result<Array<N>, ArrayError>; fn fmax(&self, other: &Array<N>) -> Result<Array<N>, ArrayError>; fn nanmax(&self, axis: Option<isize>) -> Result<Array<N>, ArrayError>; fn minimum(&self, other: &Array<N>) -> Result<Array<N>, ArrayError>; fn min(&self, axis: Option<isize>) -> Result<Array<N>, ArrayError>; fn amin(&self, axis: Option<isize>) -> Result<Array<N>, ArrayError>; fn fmin(&self, other: &Array<N>) -> Result<Array<N>, ArrayError>; fn nanmin(&self, axis: Option<isize>) -> Result<Array<N>, ArrayError>; }
Expand description

ArrayTrait - Array Extrema functions

Required Methods§

Source

fn maximum(&self, other: &Array<N>) -> Result<Array<N>, ArrayError>

Element-wise maximum of array elements

§Arguments
  • other - array to perform the operation with
§Examples
use arr_rs::prelude::*;

let arr = Array::flat(vec![1., 2., 3., 4.]);
assert_eq!(
format!("{:#}", Array::flat(vec![2., f64::NAN, 3., 10.]).unwrap()),
format!("{:#}", arr.maximum(&Array::flat(vec![2., f64::NAN, 2., 10.]).unwrap()).unwrap())
);
§Errors

may returns ArrayError

Source

fn max(&self, axis: Option<isize>) -> Result<Array<N>, ArrayError>

Return the maximum of an array or maximum along an axis

§Arguments
  • axis - axis along which to operate. optional, if None, input is flattened
§Examples
use arr_rs::prelude::*;

let arr = Array::flat(vec![1., 2., 3., 4.]);
assert_eq!(Array::single(4.), arr.max(None));
§Errors

may returns ArrayError

Source

fn amax(&self, axis: Option<isize>) -> Result<Array<N>, ArrayError>

Return the maximum of an array or maximum along an axis alias on max

§Arguments
  • axis - axis along which to operate. optional, if None, input is flattened
§Examples
use arr_rs::prelude::*;

let arr = Array::flat(vec![1., 2., 3., 4.]);
assert_eq!(Array::single(4.), arr.amax(None));
§Errors

may returns ArrayError

Source

fn fmax(&self, other: &Array<N>) -> Result<Array<N>, ArrayError>

Element-wise maximum of array elements

§Arguments
  • other - array to perform the operation with
§Examples
use arr_rs::prelude::*;

let arr = Array::flat(vec![1., 2., 3., 4.]);
assert_eq!(
format!("{:#}", Array::flat(vec![2., 2., 3., 10.]).unwrap()),
format!("{:#}", arr.fmax(&Array::flat(vec![2., f64::NAN, 2., 10.]).unwrap()).unwrap())
);
§Errors

may returns ArrayError

Source

fn nanmax(&self, axis: Option<isize>) -> Result<Array<N>, ArrayError>

Return the maximum of an array or maximum along an axis, ignoring NAN

§Arguments
  • axis - axis along which to operate. optional, if None, input is flattened
§Examples
use arr_rs::prelude::*;

let arr = Array::flat(vec![1., 2., 3., 4., f64::NAN]);
assert_eq!(Array::single(4.), arr.nanmax(None));
§Errors

may returns ArrayError

Source

fn minimum(&self, other: &Array<N>) -> Result<Array<N>, ArrayError>

Element-wise minimum of array elements

§Arguments
  • other - array to perform the operation with
§Examples
use arr_rs::prelude::*;

let arr = Array::flat(vec![1., 2., 3., 4.]);
assert_eq!(
format!("{:#}", Array::flat(vec![1., f64::NAN, 2., 4.]).unwrap()),
format!("{:#}", arr.minimum(&Array::flat(vec![2., f64::NAN, 2., 10.]).unwrap()).unwrap())
);
§Errors

may returns ArrayError

Source

fn min(&self, axis: Option<isize>) -> Result<Array<N>, ArrayError>

Return the minimum of an array or minimum along an axis

§Arguments
  • axis - axis along which to operate. optional, if None, input is flattened
§Examples
use arr_rs::prelude::*;

let arr = Array::flat(vec![1., 2., 3., 4.]);
assert_eq!(Array::single(1.), arr.min(None));
§Errors

may returns ArrayError

Source

fn amin(&self, axis: Option<isize>) -> Result<Array<N>, ArrayError>

Return the minimum of an array or minimum along an axis alias on min

§Arguments
  • axis - axis along which to operate. optional, if None, input is flattened
§Examples
use arr_rs::prelude::*;

let arr = Array::flat(vec![1., 2., 3., 4.]);
assert_eq!(Array::single(1.), arr.amin(None));
§Errors

may returns ArrayError

Source

fn fmin(&self, other: &Array<N>) -> Result<Array<N>, ArrayError>

Element-wise maximum of array elements

§Arguments
  • other - array to perform the operation with
§Examples
use arr_rs::prelude::*;

let arr = Array::flat(vec![1., 2., 3., 4.]);
assert_eq!(
format!("{:#}", Array::flat(vec![1., 2., 2., 4.]).unwrap()),
format!("{:#}", arr.fmin(&Array::flat(vec![2., f64::NAN, 2., 10.]).unwrap()).unwrap())
);
§Errors

may returns ArrayError

Source

fn nanmin(&self, axis: Option<isize>) -> Result<Array<N>, ArrayError>

Return the minimum of an array or minimum along an axis, ignoring NAN

§Arguments
  • axis - axis along which to operate. optional, if None, input is flattened
§Examples
use arr_rs::prelude::*;

let arr = Array::flat(vec![1., 2., 3., 4., f64::NAN]);
assert_eq!(Array::single(1.), arr.nanmin(None));
§Errors

may returns ArrayError

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<N: Numeric> ArrayExtrema<N> for Result<Array<N>, ArrayError>

Source§

fn maximum(&self, other: &Array<N>) -> Self

Source§

fn max(&self, axis: Option<isize>) -> Self

Source§

fn amax(&self, axis: Option<isize>) -> Self

Source§

fn fmax(&self, other: &Array<N>) -> Self

Source§

fn nanmax(&self, axis: Option<isize>) -> Self

Source§

fn minimum(&self, other: &Array<N>) -> Self

Source§

fn min(&self, axis: Option<isize>) -> Self

Source§

fn amin(&self, axis: Option<isize>) -> Self

Source§

fn fmin(&self, other: &Array<N>) -> Self

Source§

fn nanmin(&self, axis: Option<isize>) -> Self

Implementors§