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())
);
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));
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));
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())
);
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));
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())
);
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));
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));
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())
);
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));

Implementations on Foreign Types§

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

Implementors§