matrix mul
This commit is contained in:
parent
9ad90cea2e
commit
7a9aaf9fe0
@ -118,6 +118,44 @@ macro_rules! do_macro_4_dumb{
|
||||
};
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[macro_export(local_inner_macros)]
|
||||
macro_rules! impl_matrix_wide_dot {
|
||||
(
|
||||
(),
|
||||
($lhs: expr, $rhs: expr)
|
||||
) => {
|
||||
impl<const X:usize,const Y:usize> Matrix<X,Y,fixed_wide::fixed::Fixed<{$lhs},{$lhs*32}>>{
|
||||
paste::item!{
|
||||
#[inline]
|
||||
pub fn [<wide_dot_ $lhs _ $rhs>]<const Z:usize>(self,rhs:Matrix<Z,X,fixed_wide::fixed::Fixed<{$rhs},{$rhs*32}>>)->Matrix<Z,Y,fixed_wide::fixed::Fixed<{$lhs+$rhs},{($lhs+$rhs)*32}>>{
|
||||
let mut array_of_iterators=rhs.array.map(|axis|axis.into_iter().cycle());
|
||||
Matrix{
|
||||
array:self.array.map(|axis|
|
||||
core::array::from_fn(|_|
|
||||
// axis dot product with transposed rhs array
|
||||
axis.iter().zip(
|
||||
array_of_iterators.iter_mut()
|
||||
).map(|(&lhs_value,rhs_iter)|
|
||||
lhs_value.[<wide_mul_ $lhs _ $rhs>](rhs_iter.next().unwrap())
|
||||
).sum()
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[macro_export(local_inner_macros)]
|
||||
macro_rules! impl_matrix_wide_dot_8x8 {
|
||||
() => {
|
||||
$crate::do_macro_8x8!(impl_matrix_wide_dot,());
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[macro_export(local_inner_macros)]
|
||||
macro_rules! impl_matrix_wide_3x3_det_not_const_generic {
|
||||
|
@ -73,6 +73,8 @@ macro_rules! impl_matrix {
|
||||
}
|
||||
}
|
||||
}
|
||||
#[cfg(feature="fixed_wide")]
|
||||
$crate::impl_matrix_wide_dot_8x8!();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user