From e9a9689e865bda728fff91075eb639f6865a1ee8 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 3 Sep 2024 10:40:21 -0700 Subject: [PATCH] WE ARE 10 LAYERS DEEP --- fixed_wide_vectors/src/macros/fixed_wide.rs | 45 ++++++++++++++++----- fixed_wide_vectors/src/macros/matrix.rs | 2 + 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/fixed_wide_vectors/src/macros/fixed_wide.rs b/fixed_wide_vectors/src/macros/fixed_wide.rs index feaa800..6d882f9 100644 --- a/fixed_wide_vectors/src/macros/fixed_wide.rs +++ b/fixed_wide_vectors/src/macros/fixed_wide.rs @@ -91,22 +91,18 @@ macro_rules! impl_wide_vector_operations { #[doc(hidden)] #[macro_export(local_inner_macros)] -macro_rules! impl_wide_matrix_mul { +macro_rules! impl_matrix_wide_mul { ( //TODO: Fixed point impls - $lhs: expr, $rhs: expr, ($struct_outer: ident { $($field_outer: ident), + }, $vector_outer: ident { $($vector_field_outer: ident), + }, $size_outer: expr), ($struct_inner: ident { $($field_inner: ident), + }, $matrix_inner: ident { $($matrix_field_inner: ident), + }, $size_inner: expr), - ($rhs_struct_inner: ident { $($rhs_field_inner: ident), + }, $rhs_matrix_inner: ident { $($rhs_matrix_field_inner: ident), + }, $rhs_size_inner: expr) + ($rhs_struct_inner: ident { $($rhs_field_inner: ident), + }, $rhs_matrix_inner: ident { $($rhs_matrix_field_inner: ident), + }, $rhs_size_inner: expr), + ($lhs: expr, $rhs: expr) ) => { - impl fixed_wide_traits::wide::WideDot<$matrix_inner<$rhs_struct_inner>> for $struct_outer<$struct_inner> - where - $struct_inner:fixed_wide_traits::wide::WideDot<$rhs_struct_inner>, - { - type Output=$struct_outer<<$struct_inner as fixed_wide_traits::wide::WideDot<$rhs_struct_inner>::Output>; + impl $struct_outer<$struct_inner>>{ paste::item!{ #[inline] - fn [](self,rhs:$matrix_inner<$rhs_struct_inner>)->Self::Output{ + pub fn [](self,rhs:$matrix_inner<$rhs_struct_inner>>)->$struct_outer<$rhs_struct_inner>>{ //just made this up, don't trust it let tr=rhs.transpose(); //TODO: use a macro expansion instead of transpose and map @@ -120,6 +116,37 @@ macro_rules! impl_wide_matrix_mul { } } } + +#[doc(hidden)] +#[macro_export(local_inner_macros)] +macro_rules! impl_matrix_wide_mul_shim3 { + ( + ($outer_info:tt,$inner_info:tt,$rhs_info:tt), + ($lhs: expr, $rhs: expr) + ) => { + $crate::impl_matrix_wide_mul!($outer_info,$inner_info,$rhs_info,($lhs,$rhs)); + } +} +#[doc(hidden)] +#[macro_export(local_inner_macros)] +macro_rules! impl_matrix_wide_mul_shim2 { + ( + ($outer_info:tt,$inner_info:tt), + $rhs_info:tt + ) => { + $crate::do_macro_8x8!(impl_matrix_wide_mul_shim3,($outer_info,$inner_info,$rhs_info)); + } +} +#[doc(hidden)] +#[macro_export(local_inner_macros)] +macro_rules! impl_matrix_wide_mul_shim1 { + ( + ($outer_info:tt,($($rhs_info:tt),+)), + $inner_info:tt + ) => { + $crate::macro_repeated!(impl_matrix_wide_mul_shim2,($outer_info,$inner_info),$($rhs_info),+); + } +} #[doc(hidden)] #[macro_export(local_inner_macros)] macro_rules! impl_wide_matrix_operations_2arg_not_const_generic { diff --git a/fixed_wide_vectors/src/macros/matrix.rs b/fixed_wide_vectors/src/macros/matrix.rs index d442488..98d72aa 100644 --- a/fixed_wide_vectors/src/macros/matrix.rs +++ b/fixed_wide_vectors/src/macros/matrix.rs @@ -47,6 +47,8 @@ macro_rules! impl_matrix_inner_shim { $matrix_info:tt ) => { $crate::macro_repeated!(impl_matrix_inner,$matrix_info,$($vector_info),+); + #[cfg(feature="fixed_wide")] + $crate::macro_repeated!(impl_matrix_wide_mul_shim1,($matrix_info,($($vector_info),+)),$($vector_info),+); } } #[doc(hidden)]