mat mul brain blasting

This commit is contained in:
2024-08-30 15:07:10 -07:00
parent 0c41d3182e
commit 8a89fcefc6

@ -34,30 +34,31 @@ macro_rules! impl_wide_vector_operations {
} }
// Notes: // Notes:
// Mat3<Vec2>.dot(Vec3) -> Vec2 // Mat3<Vec2>.dot(Vec2) -> Vec3
// Mat3<Vec4>.dot(Mat4<Vec2>) -> Mat3<Vec2>
// mat.mat can be implemented off the back of mat.vec // mat.mat can be implemented off the back of mat.vec
#[doc(hidden)] #[doc(hidden)]
#[macro_export(local_inner_macros)] #[macro_export(local_inner_macros)]
macro_rules! impl_wide_matrix_operations { macro_rules! impl_wide_matrix_operations {
( (
($struct_outer: ident { $($field_outer: ident), + }, $vector_outer: ident, $size_outer: 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, $size_inner: expr) ($struct_inner: ident { $($field_inner: ident), + }, $matrix_inner: ident { $($matrix_field_inner: ident), + }, $size_inner: expr)
) => { ) => {
/* Hide this // U is a vec type
impl<T,U> fixed_wide_traits::wide::WideDot<$struct<U>> for $struct<T> impl<T,U> fixed_wide_traits::wide::WideDot<$matrix_inner<U>> for $struct_outer<$struct_inner<T>>
where where
U:$crate::Transpose $matrix_inner<U>:$crate::Transpose,
$struct_inner<T>:fixed_wide_traits::wide::WideDot<U>,
{ {
type Output=V; type Output=$struct_outer<<$struct_inner<T> as fixed_wide_traits::wide::WideDot<U>>::Output>;
#[inline] #[inline]
fn wide_dot(self, rhs: $struct<U>) -> Self::Output { fn wide_dot(self, rhs: $matrix_inner<U>) -> Self::Output {
$crate::sum_repeating!( //just made this up, don't trust it
$( + (self.$field.wide_mul(rhs.$field)) ) + let tr=rhs.transpose();
) self.map(|axis|tr.wide_dot(axis))
} }
} }
*/
/* TODO: nasty determinant macro /* TODO: nasty determinant macro
impl<U:std::ops::Add<Output=U>,T:Copy+fixed_wide_traits::wide::WideMul<Output=U>> $struct<T> { impl<U:std::ops::Add<Output=U>,T:Copy+fixed_wide_traits::wide::WideMul<Output=U>> $struct<T> {
#[inline] #[inline]