From c0922efdf70ce2e830178e41b39d7424ed727d84 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 13 Sep 2026 17:10:52 +0200 Subject: feat(engine): add naive matrix multiplication by ref fns --- engine/src/data_types/matrix.rs | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'engine') diff --git a/engine/src/data_types/matrix.rs b/engine/src/data_types/matrix.rs index e28c73f..a1e9bb6 100644 --- a/engine/src/data_types/matrix.rs +++ b/engine/src/data_types/matrix.rs @@ -292,6 +292,45 @@ where type Output = Matrix; fn mul(self, rhs: Matrix) -> Self::Output + { + &self * &rhs + } +} + +impl + Mul<&Matrix> for Matrix +where + Value: Mul + Add + Default + Copy, +{ + type Output = Matrix; + + fn mul(self, rhs: &Matrix) -> Self::Output + { + &self * rhs + } +} + +impl + Mul> for &Matrix +where + Value: Mul + Add + Default + Copy, +{ + type Output = Matrix; + + fn mul(self, rhs: Matrix) -> Self::Output + { + self * &rhs + } +} + +impl + Mul<&Matrix> for &Matrix +where + Value: Mul + Add + Default + Copy, +{ + type Output = Matrix; + + fn mul(self, rhs: &Matrix) -> Self::Output { // https://en.wikipedia.org/wiki/Matrix_multiplication -- cgit v1.2.3-18-g5258