diff --git a/fixed_wide_vectors/src/macros/matrix.rs b/fixed_wide_vectors/src/macros/matrix.rs index fedf100..ecd0d85 100644 --- a/fixed_wide_vectors/src/macros/matrix.rs +++ b/fixed_wide_vectors/src/macros/matrix.rs @@ -54,6 +54,20 @@ macro_rules! impl_matrix { ) ) } + #[inline] + // MatY.VecX = VecY + pub fn transform_vector(self,rhs:Vector)->Vector + where + T:core::ops::Mul, + V:core::iter::Sum, + U:Copy, + { + Vector::new( + self.array.map(|axis| + Vector::new(axis).dot(rhs) + ) + ) + } } impl Matrix where @@ -85,6 +99,18 @@ macro_rules! impl_matrix { self.dot(rhs) } } + impl core::ops::Mul> for Matrix + where + T:core::ops::Mul, + V:core::iter::Sum, + U:Copy, + { + type Output=Vector; + #[inline] + fn mul(self,rhs:Vector)->Self::Output{ + self.transform_vector(rhs) + } + } #[cfg(feature="fixed_wide")] $crate::impl_matrix_wide_dot_8x8!(); }