diff --git a/fixed_wide_vectors/src/macros/matrix.rs b/fixed_wide_vectors/src/macros/matrix.rs index 1964dff..bba1e65 100644 --- a/fixed_wide_vectors/src/macros/matrix.rs +++ b/fixed_wide_vectors/src/macros/matrix.rs @@ -20,6 +20,18 @@ macro_rules! impl_matrix { array:self.array.map(|inner|inner.map(&f)), } } + #[inline] + pub fn transpose(self)->Matrix{ + //how did I think of this + let mut array_of_iterators=self.array.map(|axis|axis.into_iter()); + Matrix{ + array:core::array::from_fn(|_| + array_of_iterators.each_mut().map(|iter| + iter.next().unwrap() + ) + ) + } + } } impl Matrix where