From 5cad8637cd9a794a0d627e2e883ffc6a252f53cc Mon Sep 17 00:00:00 2001 From: Quaternions Date: Fri, 6 Sep 2024 10:36:24 -0700 Subject: [PATCH] tweak dot --- fixed_wide_vectors/src/macros/matrix.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fixed_wide_vectors/src/macros/matrix.rs b/fixed_wide_vectors/src/macros/matrix.rs index 0c1c371..cde4330 100644 --- a/fixed_wide_vectors/src/macros/matrix.rs +++ b/fixed_wide_vectors/src/macros/matrix.rs @@ -38,7 +38,7 @@ macro_rules! impl_matrix { where T:core::ops::Mul+Copy, V:core::iter::Sum, - U:Clone, + U:Copy, { let mut array_of_iterators=rhs.array.map(|axis|axis.into_iter().cycle()); Matrix{ @@ -46,11 +46,9 @@ macro_rules! impl_matrix { core::array::from_fn(|_| // axis dot product with transposed rhs array axis.iter().zip( - array_of_iterators.each_mut().map(|iter| - iter.next().unwrap() - ) - ).map(|(&a,b)| - a*b + array_of_iterators.iter_mut() + ).map(|(&lhs_value,rhs_iter)| + lhs_value*rhs_iter.next().unwrap() ).sum() ) )