Skip to content

Commit

Permalink
WIP: trying to fix Scalar broadcast
Browse files Browse the repository at this point in the history
  • Loading branch information
pablosanjose committed Dec 7, 2017
1 parent 3ea9ad1 commit 098dcbb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ if VERSION < v"0.7.0-DEV.2638"
else
## New Broadcast API ##
import Base.Broadcast:
BroadcastStyle, AbstractArrayStyle, broadcast
BroadcastStyle, AbstractArrayStyle

# Add a new BroadcastStyle for StaticArrays, derived from AbstractArrayStyle
# A constructor that changes the style parameter N (array dimension) is also required
struct StaticArrayStyle{N} <: AbstractArrayStyle{N} end
StaticArrayStyle{M}(::Val{N}) where {M,N} = StaticArrayStyle{N}()

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

# 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 098dcbb

Please sign in to comment.