diff --git a/fixed_wide_vectors/src/macros/matrix.rs b/fixed_wide_vectors/src/macros/matrix.rs index 34b7fd8..6a10406 100644 --- a/fixed_wide_vectors/src/macros/matrix.rs +++ b/fixed_wide_vectors/src/macros/matrix.rs @@ -71,6 +71,18 @@ macro_rules! impl_matrix { ) } } + impl core::ops::Mul> for Matrix + where + T:core::ops::Mul+Copy, + V:core::iter::Sum, + U:Copy, + { + type Output=Matrix; + #[inline] + fn mul(self,rhs:Matrix)->Self::Output{ + self.dot(rhs) + } + } #[cfg(feature="fixed_wide")] $crate::impl_matrix_wide_dot_8x8!(); } diff --git a/fixed_wide_vectors/src/tests/fixed_wide.rs b/fixed_wide_vectors/src/tests/fixed_wide.rs index 366240d..5701f8e 100644 --- a/fixed_wide_vectors/src/tests/fixed_wide.rs +++ b/fixed_wide_vectors/src/tests/fixed_wide.rs @@ -49,7 +49,7 @@ fn wide_matrix_dot(){ [Planar64::from(7),Planar64::from(8)], ]); // Mat3.dot(Mat4) -> Mat3 - let m_dot=lhs.dot(rhs); + let m_dot=lhs*rhs; //In[1]:= {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}} . {{1, 2}, {3, 4}, {5, 6}, {7, 8}} //Out[1]= {{50, 60}, {114, 140}, {178, 220}} assert_eq!( diff --git a/fixed_wide_vectors/src/tests/tests.rs b/fixed_wide_vectors/src/tests/tests.rs index 8883fa2..04a5d55 100644 --- a/fixed_wide_vectors/src/tests/tests.rs +++ b/fixed_wide_vectors/src/tests/tests.rs @@ -34,7 +34,7 @@ fn matrix_dot(){ [9.0,10.0,11.0,12.0],// [178.0,220.0], ]); // Mat3.dot(Mat4) -> Mat3 - let m_dot=lhs.dot(rhs); + let m_dot=lhs*rhs; //In[1]:= {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}} . {{1, 2}, {3, 4}, {5, 6}, {7, 8}} //Out[1]= {{50, 60}, {114, 140}, {178, 220}} assert_eq!(