-
Notifications
You must be signed in to change notification settings - Fork 50
Broadcasted not (.!) giving inconsistent return type when DataArray in expression #263
Comments
Two workarounds: 0.6.0-rc3.0> .!begin isna.(x) end
3-element BitArray{1}:
true
true
true
0.6.0-rc3.0> .!(_ = isna.(x))
3-element BitArray{1}:
true
true
true |
The complex code expansion I believe is expected since this is a fusing dot operation. Note that you get something similar with As for this bug (and the fact that those workarounds work!), that is bizarre... |
I'm not sure the expansion is correct... it involves the expression-head Also, for your example, the same trick works: 0.6.0-rc3.0> expand(:(a .+ begin b .- c end))
:($(Expr(:thunk, CodeInfo(:(begin
# meta: location REPL[50] # REPL[50], line 1:
# meta: pop location
SSAValue(0) = (Base.broadcast)(-, b, c)
return (Base.broadcast)(+, a, SSAValue(0))
end))))) Reported upstream, in any case - I don't think this is specifically a |
Indeed. Thanks for the report. In the meantime I'll see if there's anything we can do here to work around the weird return type. |
No worries. In the meantime, I guess |
|
Good idea - thanks |
I think this is JuliaLang/julia#19313. The problem is that multiple operations using the dot syntax are fused into a single one by the parser, so |
Yep - looks like the same issue |
Unfortunately with fused broadcast there doesn't appear to be an easy way to specialize on a combination of functions, so we'll have to find another way to make |
I don't think there's a solution with the current system unfortunately. Except undeprecating |
In the meantime, apart from not being able to entirely control the return vector type, I'm appreciating how awesome the broadcast-dot-syntax and loop fusion is :) |
I don't think we should remove the implicitly vectorized |
I don't think undeprecating vectorized |
The broadcasted not operator
.!
(new in 0.6) is returning results with unexpected type when used directly on expressions containing aDataArray
, e.g.whereas, if the
BitArray
result is stored in an intermediate variable:Example:
Possible explanation - the code expansion looks rather more complicated than expected:
versus:
which possibly suggests it is an upstream issue, independent of DataArrays.
The text was updated successfully, but these errors were encountered: