Is there a method you can implement if you want a broadcast over a custom array type to return an array of that is also of your custom array type instead of a Base.Array
?
i.e.
A::MyArray
B = A .+ 5 # Want this to return a `MyArray` too
I thought similar
might do it but seems like not
You need to overload Base.Broadcast.broadcasted
See also https://youtu.be/jS9eouMJf_Y?t=1445
it's a little dated by now (especially in regards to "put @inbounds
there"), but the talk is still the best summary of custom arrays & broadcasting that I know of
Brenhin Keller has marked this topic as resolved.
Last updated: Nov 22 2024 at 04:41 UTC