ndarray icon indicating copy to clipboard operation
ndarray copied to clipboard

ArrayD example for 7 or higher dimension

Open ungsik opened this issue 4 years ago • 2 comments

I created an 8 dimension ArrayD. I can not find how to index the ArrayD for 8 dim. Compiler raises the trait NdIndex<Dim<IxDynImpl>> is not implemented for [usize; 8] error when addressing array[[i, j, k, l, m, n, o, p]]. When tuple form is tried, the trait NdIndex<Dim<IxDynImpl>> is not implemented for (usize, usize, usize, usize, usize, usize, usize, usize) error is raised.

ungsik avatar Oct 22 '21 06:10 ungsik

See the docs for the Index implementation, which indicate that the index needs to implement NdIndex<D>. The NdIndex<D> provide a list of the implementations. The relevant ones for your case are:

For example, you could use array[&[i, j, k, l, m, n, o, p][..]].

jturner314 avatar Oct 22 '21 19:10 jturner314

It looks like #980 will implement for [usize; T] using const generics, so in 0.16.x you should be able to use array[[i, j, k, l, m, n, o, p]], and the compiler error you got should go away :)

emmatyping avatar Nov 16 '21 11:11 emmatyping