summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristoph Groth <christoph.groth@cea.fr>2025-02-05 17:10:50 +0100
committerChristoph Groth <christoph.groth@cea.fr>2025-02-05 17:10:50 +0100
commit2e045badf89e7fd0f852ac012064cd811f82b790 (patch)
treeb008d3eced0ccbac724278896970312ecd0f4976 /src
parentb529b339c4033873c8967487423010370f655195 (diff)
Demonstrate rank >6
Diffstat (limited to 'src')
-rw-r--r--src/main.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 3ba7bf2..796d0e4 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,4 +1,5 @@
use mdarray::{view, array, tensor, Slice, Dim, Const, expr::Expression};
+use mdarray as md;
// Indexing convention: C_ij <- A_ik * B_kj
fn matmul<D0: Dim, D1: Dim, D2: Dim>(
@@ -39,6 +40,14 @@ fn main() {
dbg!(std::any::type_name_of_val(&e));
// permute
- let f = c.permute((1, 0));
+ let f = c.permute([1, 0]);
dbg!(std::any::type_name_of_val(&f));
+
+ // Arrays with rank > 6:
+ let x: Vec<f64> = (0..128).map(|x| x as f64).collect();
+ let x: md::DTensor<f64, 1> = x.into();
+ let x = x.into_dyn();
+ let x = x.reshape(&[2; 7]);
+ let x = x.permute(&[6, 5, 4, 3, 2, 1, 0]);
+ dbg!(std::any::type_name_of_val(&x));
}