pub fn vectorize_nd<T, U, F, D>( f: F, ) -> impl Fn(&Array<T, D>) -> FerrayResult<Array<U, D>>where T: Element + Copy, U: Element, D: Dimension, F: Fn(T) -> U,
Wrap a scalar function to operate elementwise on arrays of any dimension.
Like vectorize, but works with any dimension type D.
vectorize
D
let square = vectorize_nd(|x: f64| x * x); let result = square(&input_2d_array)?;