From e5ec825882bb1e157885b23da8357bea276a0348 Mon Sep 17 00:00:00 2001 From: Terence Date: Sun, 24 Dec 2023 10:47:37 -0500 Subject: [PATCH] Allow multiplying matrix by `Complex<>` on the left This simply inserts `Complex` and `Complex` into the `left_scalar_mul_impl!` macro alongside the primitives' trait impls. --- src/base/ops.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/base/ops.rs b/src/base/ops.rs index d5cf3a519..a743b9ea6 100644 --- a/src/base/ops.rs +++ b/src/base/ops.rs @@ -1,4 +1,5 @@ use num::{One, Zero}; +use num_complex::Complex; use std::iter; use std::ops::{ Add, AddAssign, Div, DivAssign, Index, IndexMut, Mul, MulAssign, Neg, Sub, SubAssign, @@ -545,7 +546,22 @@ macro_rules! left_scalar_mul_impl( )*} ); -left_scalar_mul_impl!(u8, u16, u32, u64, usize, i8, i16, i32, i64, isize, f32, f64); +left_scalar_mul_impl!( + u8, + u16, + u32, + u64, + usize, + i8, + i16, + i32, + i64, + isize, + f32, + f64, + Complex, + Complex +); // Matrix × Matrix impl<'a, 'b, T, R1: Dim, C1: Dim, R2: Dim, C2: Dim, SA, SB> Mul<&'b Matrix>