-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broadcasting breakage for non-1 indices #20569
Comments
Hi Tim, this is a problem with On master I'm not sure if this has to be fixed in master or in |
That's interesting. For reference, the Base method is similar(f, shape::Tuple) = f(to_shape(shape)) and the one in OffsetArrays is Base.similar{T}(f::Union{Function,DataType}, shape::Tuple{UnitRange,Vararg{UnitRange}}) = OffsetArray(f(map(length, shape)), map(indexoffset, shape)) To me it seems the one in OffsetArrays is unambiguously more specific. So why isn't it called? I'm going to classify this as a type system bug. |
I can confirm that splitting the Union fixes the problem: Base.similar{T}(::Type{T}, shape::Tuple{UnitRange,Vararg{UnitRange}}) = _similar(T, shape)
Base.similar(f::Function, shape::Tuple{UnitRange,Vararg{UnitRange}}) = _similar(f, shape)
_similar(f, shape) = OffsetArray(f(map(length, shape)), map(indexoffset, shape)) |
The problem is that |
Works in Julia 0.5.
AFAICT broken in #18642, d16d994. CC @pabloferz.
The text was updated successfully, but these errors were encountered: