pub trait ArrayExtrema<N: Numeric>{
// 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§
Sourcefn maximum(&self, other: &Array<N>) -> Result<Array<N>, ArrayError>
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
Sourcefn amax(&self, axis: Option<isize>) -> Result<Array<N>, ArrayError>
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
Sourcefn fmax(&self, other: &Array<N>) -> Result<Array<N>, ArrayError>
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
Sourcefn nanmax(&self, axis: Option<isize>) -> Result<Array<N>, ArrayError>
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
Sourcefn minimum(&self, other: &Array<N>) -> Result<Array<N>, ArrayError>
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
Sourcefn amin(&self, axis: Option<isize>) -> Result<Array<N>, ArrayError>
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
Sourcefn fmin(&self, other: &Array<N>) -> Result<Array<N>, ArrayError>
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
Sourcefn nanmin(&self, axis: Option<isize>) -> Result<Array<N>, ArrayError>
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.