From 2e045badf89e7fd0f852ac012064cd811f82b790 Mon Sep 17 00:00:00 2001 From: Christoph Groth Date: Wed, 5 Feb 2025 17:10:50 +0100 Subject: Demonstrate rank >6 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- src/main.rs | 11 ++++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a07e6fa..8bf778f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,11 +1,11 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "mdarray" version = "0.6.1" -source = "git+https://github.com/fre-hu/mdarray.git?rev=0bbaf1ab7c698c9a2903a56506b526f410c37165#0bbaf1ab7c698c9a2903a56506b526f410c37165" +source = "git+https://github.com/fre-hu/mdarray.git?rev=15e2531d1dfb6cde37b5c6770803dbdde034e6bc#15e2531d1dfb6cde37b5c6770803dbdde034e6bc" [[package]] name = "mdarray-test" diff --git a/Cargo.toml b/Cargo.toml index 1822945..97d5598 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,4 +4,4 @@ version = "0.1.0" edition = "2021" [dependencies] -mdarray = { git = "https://github.com/fre-hu/mdarray.git", rev = "0bbaf1ab7c698c9a2903a56506b526f410c37165" } +mdarray = { git = "https://github.com/fre-hu/mdarray.git", rev = "15e2531d1dfb6cde37b5c6770803dbdde034e6bc" } 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( @@ -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 = (0..128).map(|x| x as f64).collect(); + let x: md::DTensor = 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)); } -- cgit v1.2.3-74-g4815