I've made good progress on broadcasting. I currently have a version working without any performance deficits (in fact I think it may be fractionally faster due to some other refactorings). You can check it out on my github if you want to give it a try:
https://github.com/orangeduck/numericNaturally it still requires a little more testing but it should be functional enough to give a good try.
Currently it supports broadcasting with the exception that the numer of dimensions must be equal. More specifically, unlike numpy, it will not right-align the dimensions of Arrays and fill in the left hand side with new axes. Therefore the user is responsible for manually adding any new axes required, so that the numer of dimensions match. In the future I'll look into this, but if it makes the code too difficult or messy it may be fine to leave this as it is.
I also need to adapt the "pointwise" function to allow for users to efficently create their own broadcastable pointwise functions. While I don't think this will break backward compatibility, there might be some changes required for new users to get broadcasting on their newly defined pointwise functions as it requires more than a single iterator value `i`.
I've also added a few new functions. This includes a "slice" function which is very similar to numpy's array access. You can provide it with values, ranges, and a newaxis object, for each dimension. I'm also interested in allowing indexing via boolean arrays or integer arrays such as numpy has, but I've not completed that yet.
My plan now is to look into the mapreducers and the optional "axis" argument. This one might be a bit tougher to get working.
- Dan