pub trait Pow { type Output; fn powi(&self, rhs: i32) -> Self::Output; } impl Pow for ndarray::ArrayBase where S: ndarray::Data, T: num::Float, D: ndarray::Dimension, { type Output = ndarray::Array; fn powi(&self, rhs: i32) -> Self::Output { self.mapv(|x| x.powi(rhs)) } }