summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-09-14 15:25:44 +0200
committerHampusM <hampus@hampusmat.com>2026-09-14 15:25:44 +0200
commita2b7a1d8c8050847bd4bbb3272eac6fec3c78715 (patch)
treef49643ab8b225dca115b8601b6dd4e37bd051338
parenta0a7516b51c088ce416714eace3ad320ec04a5fb (diff)
feat(engine): add Matrix::from_rows fn
-rw-r--r--engine/src/data_types/matrix.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/engine/src/data_types/matrix.rs b/engine/src/data_types/matrix.rs
index b480c35..ef263a1 100644
--- a/engine/src/data_types/matrix.rs
+++ b/engine/src/data_types/matrix.rs
@@ -39,6 +39,15 @@ impl<Value, const ROWS: usize, const COLUMNS: usize> Matrix<Value, ROWS, COLUMNS
Self { items }
}
+ pub fn from_rows<Row>(rows: [Row; ROWS]) -> Self
+ where
+ Row: Into<[Value; COLUMNS]>,
+ {
+ let items = rows.map(|row| row.into());
+
+ Self { items }
+ }
+
pub fn get_column_copied(&self, column_index: usize) -> [Value; ROWS]
where
Value: Default + Copy,