diff options
| author | Christoph Groth <christoph.groth@cea.fr> | 2025-01-09 22:18:21 +0100 |
|---|---|---|
| committer | Christoph Groth <christoph.groth@cea.fr> | 2025-01-09 22:24:30 +0100 |
| commit | b529b339c4033873c8967487423010370f655195 (patch) | |
| tree | f6a7914f1c35c3a2211f859ea75a305e72effac1 | |
| parent | 2ec9bbe18b57d0673a7065c23ca5d40184bf55ce (diff) | |
Take advantage of upstream improvements
| -rw-r--r-- | Cargo.lock | 2 | ||||
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | src/main.rs | 9 |
3 files changed, 6 insertions, 7 deletions
@@ -5,7 +5,7 @@ version = 3 [[package]] name = "mdarray" version = "0.6.1" -source = "git+https://github.com/fre-hu/mdarray.git?rev=06cb5e371326e674c0e9eebe0db5c4e7e200b800#06cb5e371326e674c0e9eebe0db5c4e7e200b800" +source = "git+https://github.com/fre-hu/mdarray.git?rev=0bbaf1ab7c698c9a2903a56506b526f410c37165#0bbaf1ab7c698c9a2903a56506b526f410c37165" [[package]] name = "mdarray-test" @@ -4,4 +4,4 @@ version = "0.1.0" edition = "2021" [dependencies] -mdarray = { git = "https://github.com/fre-hu/mdarray.git", rev = "06cb5e371326e674c0e9eebe0db5c4e7e200b800" } +mdarray = { git = "https://github.com/fre-hu/mdarray.git", rev = "0bbaf1ab7c698c9a2903a56506b526f410c37165" } diff --git a/src/main.rs b/src/main.rs index 021e799..3ba7bf2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use mdarray::{view, array, tensor, Slice, Dim, Const, Dyn, Rank, expr::Expression, Dense}; +use mdarray::{view, array, tensor, Slice, Dim, Const, expr::Expression}; // Indexing convention: C_ij <- A_ik * B_kj fn matmul<D0: Dim, D1: Dim, D2: Dim>( @@ -17,7 +17,7 @@ fn matmul<D0: Dim, D1: Dim, D2: Dim>( fn main() { let a = view![[1.0, 4.0], [2.0, 5.0], [3.0, 6.0]]; let b = array![[0.0, 1.0], [1.0, 1.0]]; - let b = b.reshape((Const::<2>, Dyn(!0))); + let b = b.reshape((Const::<2>, !0)); // .into_dyn() replaces .reshape(DynRank::from_dims(&[2, 3])).into(): let mut c: mdarray::Tensor<f64> = tensor![[0.0; 2]; 3].into_dyn(); @@ -26,7 +26,7 @@ fn main() { dbg!(std::any::type_name_of_val(&b)); dbg!(std::any::type_name_of_val(&c)); - matmul(&a.reshape((Dyn(3), Const::<2>)), &b, &mut c.remap_mut()); + matmul(&a.reshape((3, Const::<2>)), &b, &mut c.remap_mut()); assert_eq!(c, view![[4.0, 5.0], [5.0, 7.0], [6.0, 9.0]]); @@ -39,7 +39,6 @@ fn main() { dbg!(std::any::type_name_of_val(&e)); // permute - let f = c.remap::<Rank<2>, Dense>(); - let f = f.permute::<1, 0>(); + let f = c.permute((1, 0)); dbg!(std::any::type_name_of_val(&f)); } |
