Elementwise operations .* and ./ are not broadcasting for all argument types #3171
Closed
5 tasks done
Labels
sparse
Sparse arrays
I've added broadcasting methods for
.*
and./
in #3100 (forStridedArray
arguments), but since there are other methods lying about that do not broadcast, they do not use broadcasting in all cases yet (and also since broadcasting does not yet work for anyAbstractArray
arguments yet). I've created this issue to track and discuss the cases that need to be taken care of.Methods that don't broadcast:
range.jl
:.*
and./
between twoRanges
(applies when one of the ranges is length one)array.jl
:.*
and./
between oneRanges
and oneStridedArray
bitarray.jl
:.*
betweenBitArray
andBitArray
orArray{Bool}
argumentssparse.jl
:.*
betweenSparseMatrixCSC
arguments (fixes #8416 (and duplicated issue #9664) #10106)array.jl
:./
betweenStridedArray
arguments of (possibly complex) integer element types.Except for the last one, these all deal with non-
StridedArray
arguments, and are cases where a specialized implementation will probably beat a genericAbstractArray
fallback. One option would be to teach the broadcast machinery how to do code those special cases with broadcasting once and for all. Or perhaps it might be better to handle them case by case.The last case deals purely with
StridedArray
arguments; the issue here is with the result type. I'm thinking that we might want to introducequotient_type(S, T)
to compute the type ofx::S / y::T
. (The fallback could bequotient_type(S, T) = promote_type(S, T)
.) Then, it should be straightforward to write a broadcasting./
that produces the right result type.Thoughts?
The text was updated successfully, but these errors were encountered: