Skip to content

Commit

Permalink
Remove specialized broadcast!{T,S,N}(::typeof(identity), ::AbstractAr…
Browse files Browse the repository at this point in the history
…ray{T,N}, ::AbstractArray{S,N})
  • Loading branch information
martinholters committed Jan 9, 2017
1 parent dbff9fd commit b0ae001
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
4 changes: 0 additions & 4 deletions base/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ typealias ScalarType Union{Type{Any}, Type{Nullable}}
# special cases for "X .= ..." (broadcast!) assignments
broadcast!(::typeof(identity), X::AbstractArray, x::Number) = fill!(X, x)
broadcast!(f, X::AbstractArray, x::Number...) = (@inbounds for I in eachindex(X); X[I] = f(x...); end; X)
function broadcast!{T,S,N}(::typeof(identity), x::AbstractArray{T,N}, y::AbstractArray{S,N})
@boundscheck check_broadcast_shape(broadcast_indices(x), broadcast_indices(y))
copy!(x, y)
end

# logic for deciding the resulting container type
containertype(x) = containertype(typeof(x))
Expand Down
3 changes: 0 additions & 3 deletions base/sparse/higherorderfns.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@ ambiguityfunnel{Tf}(f::Tf, x, y) = _aresameshape(x, y) ? _noshapecheck_map(f, x,
broadcast(::typeof(+), x::SparseVector, y::SparseVector) = ambiguityfunnel(+, x, y) # base/sparse/sparsevectors.jl:1266
broadcast(::typeof(-), x::SparseVector, y::SparseVector) = ambiguityfunnel(-, x, y) # base/sparse/sparsevectors.jl:1266
broadcast(::typeof(*), x::SparseVector, y::SparseVector) = ambiguityfunnel(*, x, y) # base/sparse/sparsevectors.jl:1266
function broadcast!(::typeof(identity), C::SparseMatrixCSC, A::SparseMatrixCSC) # from #17623, loc?
_checksameshape(C, A); return copy!(C, A)
end


# (4) _map_zeropres!/_map_notzeropres! specialized for a single sparse vector/matrix
Expand Down
2 changes: 2 additions & 0 deletions test/sparse/higherorderfns.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ end
@test broadcast(sin, A) == sparse(broadcast(sin, fA))
@test broadcast!(sin, copy(a), a) == sparse(broadcast!(sin, copy(fa), fa))
@test broadcast!(sin, copy(A), A) == sparse(broadcast!(sin, copy(fA), fA))
@test broadcast!(identity, copy(a), a) == sparse(broadcast!(identity, copy(fa), fa))
@test broadcast!(identity, copy(A), A) == sparse(broadcast!(identity, copy(fA), fA))
end

@testset "broadcast[!] implementation specialized for pairs of (input) sparse vectors/matrices" begin
Expand Down

0 comments on commit b0ae001

Please sign in to comment.