It seems that array dimensions is not included in the type definition (which is really reasonable). I was wondering if there was a mechanism in Julia to force method specialisation based on array dimensions.
Typically, the code would be fed with matrices of dimension (n, M) where n can be any number but M is a fixed integer my code is constantly looping over.
I could create my own type (or something similar) but:
- Julia is not supporting inheritance and implementing proxy methods myself would be ludicrous (not a fan of introducing boilerplate and checking the Array interface hasn’t changed in each release).
- I really don’t want to hardcode things. It would be a bit of a shame to manually create
Matrix3D, etc. when the JIT can do it itself, especially if it involves manually creating methods with the only difference being the upper range in a single for loop.
The motivation for this is performance: my code involves a lot of looping over 1:M and knowing M from the start allows LLVM to perform more aggressive optimisations.