From 85d0b3d1ac4c35c1b6d39e5b196f99d3ff38a931 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Fri, 30 Aug 2024 14:48:36 -0700 Subject: [PATCH] wip --- fixed_wide_vectors/src/lib.rs | 1 + fixed_wide_vectors/src/macros/wide.rs | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/fixed_wide_vectors/src/lib.rs b/fixed_wide_vectors/src/lib.rs index 94bd058..69891e3 100644 --- a/fixed_wide_vectors/src/lib.rs +++ b/fixed_wide_vectors/src/lib.rs @@ -12,6 +12,7 @@ pub use matrix::Matrix4; //internal trait for matrix wide_dot trait Transpose{ + type Inner; type Output; fn transpose(self)->Self::Output; } diff --git a/fixed_wide_vectors/src/macros/wide.rs b/fixed_wide_vectors/src/macros/wide.rs index b81f06c..74b967d 100644 --- a/fixed_wide_vectors/src/macros/wide.rs +++ b/fixed_wide_vectors/src/macros/wide.rs @@ -2,6 +2,7 @@ #[macro_export(local_inner_macros)] macro_rules! impl_wide_vector_operations { ( $struct: ident { $($field: ident), + }, $size: expr ) => { + //this one is shared between vec and mat impl> fixed_wide_traits::wide::WideMul for $struct { type Output=$struct; #[inline] @@ -11,6 +12,7 @@ macro_rules! impl_wide_vector_operations { } } } + //these ones are vec only impl,U,T:fixed_wide_traits::wide::WideMul> fixed_wide_traits::wide::WideDot<$struct> for $struct { type Output=V; #[inline] @@ -39,19 +41,14 @@ macro_rules! impl_wide_vector_operations { #[macro_export(local_inner_macros)] macro_rules! impl_wide_matrix_operations { ( - ($struct_outer: ident { $($field_outer: ident), + }, $size_outer: expr), - ($struct_inner: ident, $size_inner: expr), $fields_inner:tt + ($struct_outer: ident { $($field_outer: ident), + }, $vector_outer: ident, $size_outer: expr), + ($struct_inner: ident { $($field_inner: ident), + }, $matrix_inner: ident, $size_inner: expr) ) => { - impl> fixed_wide_traits::wide::WideMul for $struct { - type Output=$struct; - #[inline] - fn wide_mul(self, rhs: Self) -> Self::Output { - $struct{ - $( $field_outer: self.$field_outer.wide_mul(rhs.$field_outer) ), + - } - } - } - impl> fixed_wide_traits::wide::WideDot<$struct> for $struct { + /* Hide this + impl fixed_wide_traits::wide::WideDot<$struct> for $struct + where + U:$crate::Transpose + { type Output=V; #[inline] fn wide_dot(self, rhs: $struct) -> Self::Output { @@ -60,6 +57,7 @@ macro_rules! impl_wide_matrix_operations { ) } } + */ /* TODO: nasty determinant macro impl,T:Copy+fixed_wide_traits::wide::WideMul> $struct { #[inline]