pub trait ArraySearch<T: ArrayElement>{
// Required methods
fn argmax(
&self,
axis: Option<isize>,
keepdims: Option<bool>,
) -> Result<Array<usize>, ArrayError>;
fn argmin(
&self,
axis: Option<isize>,
keepdims: Option<bool>,
) -> Result<Array<usize>, ArrayError>;
}
Expand description
ArrayTrait
- Array Search functions
Required Methods§
Sourcefn argmax(
&self,
axis: Option<isize>,
keepdims: Option<bool>,
) -> Result<Array<usize>, ArrayError>
fn argmax( &self, axis: Option<isize>, keepdims: Option<bool>, ) -> Result<Array<usize>, ArrayError>
Returns the indices of the maximum values along an axis.
§Arguments
axis
- axis along which to search. if None, array is flattenedkeepdims
- if true, the result will broadcast correctly against the input
§Examples
use arr_rs::prelude::*;
let arr = array!(i32, [[10, 11, 12], [13, 14, 15]]);
assert_eq!(array!(usize, [5]), arr.argmax(None, None));
let arr = array!(f64, [[f64::NAN, 4.], [2., 3.]]);
assert_eq!(array!(usize, [0]), arr.argmax(None, None));
§Errors
may returns ArrayError
Sourcefn argmin(
&self,
axis: Option<isize>,
keepdims: Option<bool>,
) -> Result<Array<usize>, ArrayError>
fn argmin( &self, axis: Option<isize>, keepdims: Option<bool>, ) -> Result<Array<usize>, ArrayError>
Returns the indices of the minimum values along an axis.
§Arguments
axis
- axis along which to search. if None, array is flattenedkeepdims
- if true, the result will broadcast correctly against the input
§Examples
use arr_rs::prelude::*;
let arr = array!(i32, [[10, 11, 12], [13, 14, 15]]);
assert_eq!(array!(usize, [0]), arr.argmin(None, None));
assert_eq!(array!(usize, [0, 0, 0]), arr.argmin(Some(0), None));
assert_eq!(array!(usize, [0, 0]), arr.argmin(Some(1), None));
let arr = array!(f64, [[f64::NAN, 4.], [2., 3.]]);
assert_eq!(array!(usize, [0]), arr.argmin(None, None));
assert_eq!(array!(usize, [0, 1]), arr.argmin(Some(0), None));
assert_eq!(array!(usize, [0, 0]), arr.argmin(Some(1), 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.