From 91882899908ed62ff37636d1670e8e46df48a9d4 Mon Sep 17 00:00:00 2001 From: Christoph Groth Date: Thu, 24 Oct 2024 12:52:52 +0200 Subject: Adapt to new API and the switch to row major --- src/main.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index c0ee447..31d810b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ -use mdarray::{expr, grid, DSpan, Expression}; +use mdarray::{view, tensor, DSlice, Expression}; -fn matmul(a: &DSpan, b: &DSpan, c: &mut DSpan) { +fn matmul(a: &DSlice, b: &DSlice, c: &mut DSlice) { for (mut cj, bj) in c.cols_mut().zip(b.cols()) { for (ak, bkj) in a.cols().zip(bj) { for (cij, aik) in cj.expr_mut().zip(ak) { @@ -11,10 +11,10 @@ fn matmul(a: &DSpan, b: &DSpan, c: &mut DSpan) { } fn main() { - let a = expr![[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]; - let b = expr![[0.0, 1.0], [1.0, 1.0]]; + let a = view![[1.0, 4.0], [2.0, 5.0], [3.0, 6.0]]; + let b = view![[0.0, 1.0], [1.0, 1.0]]; - let mut c = grid![[0.0; 3]; 2]; + let mut c = tensor![[0.0; 2]; 3]; dbg!(std::any::type_name_of_val(&a)); dbg!(std::any::type_name_of_val(&b)); @@ -22,7 +22,7 @@ fn main() { matmul(&a, &b, &mut c); - assert_eq!(c, expr![[4.0, 5.0, 6.0], [5.0, 7.0, 9.0]]); + assert_eq!(c, view![[4.0, 5.0], [5.0, 7.0], [6.0, 9.0]]); // slice let d = a.view(1, ..); -- cgit v1.2.3-74-g4815