I would like to implement a more efficient broadcast for basic arithmetic operators for the BlockDiagonal type of BlockDiagonals.jl. At the moment the broadcasting causes many allocations, I suppose because it falls back to base broadcasting.
The idea would be that when b1 and b2 have compatible block sizes, all these operations should be done block by block.
I have read the documentation on customizing overloading, but I have to say that I’m a bit lost. I have never dealt with custom types in Julia. Can someone point me to how this can be done in a neat way, or show a similar example?
Well that is expected because you put the conversion to Matrix outside of the interpolations and thus it is benchmarked by @btime, hence making it slower than my second example. In any case, my question is more about implementing the broadcasting interface.
For this kind of missing feature, I recommend opening an issue, better to discuss there since it will lead to a PR likely,
(wether by you or the maintainers)
So keeping the discussion of how to do it in one place is useful.