用ndarray:
https://docs.rs/ndarray/0.15.3/ndarray/
Rust
多维数组 ndarray
例子:
use ndarray::Array2;
fn main() {
let mut a = Array2::<usize>::zeros((2, 3));
println!("{:?}", a.dim());
for i in 0..2 {
for j in 0..3 {
, j]] = i + j;
a[[i}
}
for i in 0..a.dim().0 {
for j in 0..a.dim().1 {
print!("{}", a[[i, j]]);
}
print!("\n");
}
}