feat: Added ndarray_15 feature

This commit is contained in:
uttarayan21
2025-06-23 15:38:28 +05:30
parent b490c806c1
commit 5e8a004b1f
6 changed files with 43 additions and 2 deletions

15
src/ndarray_15_extra.rs Normal file
View File

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