I would appreciate advise how to best implement the following:
I have an N^d array A, where the dimension d depends on the
application (d \in \{1, 2, 3\}). Somewhere else I have a list L which is a
d x M array or integers corresponding to points/elements in this array,
e.g. if
You can do a lot better by dispatching on the dimension of A. Something like
this:
mygetindex{T}(A::AbstractArray{T,2}, L, Lcol) = A[L[1,Lcol], L[2,Lcol]]
mygetindex{T}(A::AbstractArray{T,3}, L, Lcol) = A[L[1,Lcol], L[2,Lcol],
L[3,Lcol]]
Put your timing loops in a function so you take