Skip to content

Commit 992de28

Browse files
committed
Fix ambiguity of broadcast!(identity, ::SparseVector, ::SparseVector)
1 parent 5b6ff4a commit 992de28

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

base/sparse/higherorderfns.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ ambiguityfunnel{Tf}(f::Tf, x, y) = _aresameshape(x, y) ? _noshapecheck_map(f, x,
148148
broadcast(::typeof(+), x::SparseVector, y::SparseVector) = ambiguityfunnel(+, x, y) # base/sparse/sparsevectors.jl:1266
149149
broadcast(::typeof(-), x::SparseVector, y::SparseVector) = ambiguityfunnel(-, x, y) # base/sparse/sparsevectors.jl:1266
150150
broadcast(::typeof(*), x::SparseVector, y::SparseVector) = ambiguityfunnel(*, x, y) # base/sparse/sparsevectors.jl:1266
151-
function broadcast!(::typeof(identity), C::SparseMatrixCSC, A::SparseMatrixCSC) # from #17623, loc?
151+
function broadcast!{T<:SparseVecOrMat}(::typeof(identity), C::T, A::T) # from #17623, base/broadcast.jl:26
152152
_checksameshape(C, A); return copy!(C, A)
153153
end
154154

test/sparse/higherorderfns.jl

+2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ end
8686
@test broadcast(sin, A) == sparse(broadcast(sin, fA))
8787
@test broadcast!(sin, copy(a), a) == sparse(broadcast!(sin, copy(fa), fa))
8888
@test broadcast!(sin, copy(A), A) == sparse(broadcast!(sin, copy(fA), fA))
89+
@test broadcast!(identity, copy(a), a) == sparse(broadcast!(identity, copy(fa), fa))
90+
@test broadcast!(identity, copy(A), A) == sparse(broadcast!(identity, copy(fA), fA))
8991
end
9092

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

0 commit comments

Comments
 (0)