I have a two dimensional array Array2
, i'd like to be able of selecting rows
use ndarray::{Array2, Axis};
let subarray: Array2 = my_array.select(Axis(0), &[0,2,5]);
With that simple code i can select first, third and sixth row, but what about when the target indexes are built at run time, i mean i'd like to select from a Vector
or any iterable that could be the input of a function, for example.
You can get the slice by simply borrowing on a Vector
let index = vec![0, 2, 4];
let subarray = my_array.select(Axis(0), &index);