From ec82745c6d6116a61cc596a4171f9af567428598 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 12 Sep 2024 12:16:44 -0700 Subject: [PATCH] matrix: from_rows --- linear_ops/src/macros/matrix.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/linear_ops/src/macros/matrix.rs b/linear_ops/src/macros/matrix.rs index 184b2c9..c04e965 100644 --- a/linear_ops/src/macros/matrix.rs +++ b/linear_ops/src/macros/matrix.rs @@ -12,6 +12,13 @@ macro_rules! impl_matrix { self.array } #[inline] + pub fn from_rows(rows:[Vector;Y])->Self + { + Matrix::new( + rows.map(|row|row.array), + ) + } + #[inline] pub fn map(self,f:F)->Matrix where F:Fn(T)->U