Rust ndarray: how to select many columns that are not continous?

I create a ndarray as below:
let a = arr2(&[[-1.0, 2.0, -3.0], [4.0, -5.0, 6.0], [-7.0, 8.0, -9.0], ...]);

I want to select columns : [1, 4, 5, 8, 12, 98]; I just know i can select such as a.slice(s![.., ..3]), but what if the columns are not continous?

That's not a single logical slice of n-dimentional array. The ndarray crate can't represent it efficiently. You can either have a vector of slices or concatenate them into a new allocation.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.