mdarray 0.1.0

Multidimensional array for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use mdarray::Array;

#[test]
fn test_array() {
    let mut a = Array::new();

    a.resize([3, 4], 0);

    for i in 0..3 {
        for j in 0..4 {
            a[[i, j]] = i + j;
        }
    }

    a.iter_mut().for_each(|x| *x *= 2);

    assert_eq!(a[..].iter().sum::<usize>(), 60);
}