Skip to content

Commit

Permalink
Fix ambiguity of broadcast!(identity, ::SparseVector, ::SparseVector)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholters committed Jan 6, 2017
1 parent 5b6ff4a commit 992de28
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/sparse/higherorderfns.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ 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?
function broadcast!{T<:SparseVecOrMat}(::typeof(identity), C::T, A::T) # from #17623, base/broadcast.jl:26
_checksameshape(C, A); return copy!(C, A)
end

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 992de28

Please sign in to comment.