Skip to content

Commit

Permalink
fix Scalar broadcast, array precedence
Browse files Browse the repository at this point in the history
  • Loading branch information
pablosanjose committed Dec 7, 2017
1 parent 1a00c3f commit 75dc71e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ else
StaticArrayStyle{M}(::Val{N}) where {M,N} = StaticArrayStyle{N}()

BroadcastStyle(::Type{<:StaticArray{D, T, N}}) where {D, T, N} = StaticArrayStyle{N}()

# Precedence: Make StaticArray - Array -> Array
BroadcastStyle(A::AbstractArrayStyle{N}, ::StaticArrayStyle{M}) where {N,M} = A
BroadcastStyle(::StaticArrayStyle{M}, ::AbstractArrayStyle{N}) where {N,M} = Broadcast.Unknown()
BroadcastStyle(::StaticArrayStyle{M}, ::Broadcast.VectorStyle) where {N,M} = Broadcast.Unknown()
BroadcastStyle(::StaticArrayStyle{M}, ::Broadcast.MatrixStyle) where {N,M} = Broadcast.Unknown()

# Add a broadcast method that calls the old @generated routine
@inline function broadcast(f, ::StaticArrayStyle{N}, ::Type{ElType}, inds::Tuple{Vararg{AbstractUnitRange, M}} where M, As...) where {N, ElType}
Expand Down

0 comments on commit 75dc71e

Please sign in to comment.