Unlike NumPy ndarrays in Python, the arrays provided by the rust ndarray crate do not seem to have max method (or min, argmax or argmin) for that matter. What is the best way to get the maximum value from such an array (assuming it can be f32 and f64 rather than just integer types)?
use ndarray::Array
pub fn main() {
let x = Array::from(vec![-3.4, 1.2, 8.9, 2.0]);
// get max?
}
The ndarray-stats crate provides the
QuantileExttraits for ndarray's, which provides amaxmethod (andmin,argmaxandargmin), e.g.,