I’m trying to write some code which involves arrays of arbitrary rank and as it’s extremely difficult to avoid splatting (especially with the way many functions in
Base are currently written) I’m getting concerned about splatting.
Roughly speaking, each time my program runs, I expect to use arrays of a consistent rank so that the splatted functions will only be called in a certain way. I’m still concerned however about the compilers ability to determine the input of splatted functions ahead of time.
My question is whether I need to worry about this sort of thing. As a simple example, if I have
is this going to be inefficient even if
A is of a consistent rank for a single run of the program? My hope is that if
idx is a tuple it actually is possible for the compiler to determine which
getindex it would have to call and I don’t have to worry.
Base makes this sort of thing really difficult to avoid. I thought it would be nice to deal only with rank-1 indices using
Base.sub2ind but the latter actually takes splatted arguments. It seems to me that this can be easily avoided, and one possibility is to simply rewrite them.