summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index ccf5705..655c906 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,3 +1,5 @@
+use std::mem::MaybeUninit;
+
use mdarray::{view, tensor, Slice, Dim, Const, expr::Expression};
use mdarray as md;
@@ -45,6 +47,13 @@ fn main() {
let d = d.reshape(&[2; 7]);
let d = d.permute(&[6, 5, 4, 3, 2, 1, 0]);
+ // Working with uninitialized memory.
+ let mut e = tensor![[MaybeUninit::<f64>::uninit(); 3]; 3];
+ for (i, val) in e.iter_mut().enumerate() {
+ val.write(i as f64);
+ }
+ let _ = unsafe { e.assume_init() };
+
// Indexing
for i in 0..2 {
let index = [0, i, 0, 0, i, 0, 0];