@@ -1006,6 +1006,18 @@ broadcasted(::DefaultArrayStyle{1}, ::typeof(big), r::StepRange) = big(r.start):
1006
1006
broadcasted (:: DefaultArrayStyle{1} , :: typeof (big), r:: StepRangeLen ) = StepRangeLen (big (r. ref), big (r. step), length (r), r. offset)
1007
1007
broadcasted (:: DefaultArrayStyle{1} , :: typeof (big), r:: LinRange ) = LinRange (big (r. start), big (r. stop), length (r))
1008
1008
1009
+ # # CartesianIndices
1010
+ broadcasted (:: typeof (+ ), I:: CartesianIndices{N} , j:: CartesianIndex{N} ) where N =
1011
+ CartesianIndices (map ((rng, offset)-> rng .+ offset, I. indices, Tuple (j)))
1012
+ broadcasted (:: typeof (+ ), j:: CartesianIndex{N} , I:: CartesianIndices{N} ) where N =
1013
+ I .+ j
1014
+ broadcasted (:: typeof (- ), I:: CartesianIndices{N} , j:: CartesianIndex{N} ) where N =
1015
+ CartesianIndices (map ((rng, offset)-> rng .- offset, I. indices, Tuple (j)))
1016
+ function broadcasted (:: typeof (- ), j:: CartesianIndex{N} , I:: CartesianIndices{N} ) where N
1017
+ diffrange (offset, rng) = range (offset- last (rng), length= length (rng))
1018
+ Iterators. reverse (CartesianIndices (map (diffrange, Tuple (j), I. indices)))
1019
+ end
1020
+
1009
1021
# # In specific instances, we can broadcast masked BitArrays whole chunks at a time
1010
1022
# Very intentionally do not support much functionality here: scalar indexing would be O(n)
1011
1023
struct BitMaskedBitArray{N,M}
0 commit comments