Skip to content

Commit 9ade765

Browse files
committed
fix stack overflow for .*
1 parent 270b61a commit 9ade765

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

base/sparse/sparsematrix.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1685,7 +1685,9 @@ broadcast(::typeof(-), A::SparseMatrixCSC, B::Number) = convert(Array, A) .- B
16851685
broadcast(::typeof(-), A::Number, B::SparseMatrixCSC) = A .- convert(Array, B)
16861686
(-)(A::Array , B::SparseMatrixCSC) = A - convert(Array, B)
16871687

1688-
broadcast(::typeof(*), A::AbstractArray, B::AbstractArray) = broadcast_zpreserving(*, A, B)
1688+
broadcast(::typeof(*), A::SparseMatrixCSC, B::SparseMatrixCSC) = broadcast_zpreserving(*, A, B)
1689+
broadcast(::typeof(*), A::SparseMatrixCSC, B::Union{Array,BitArray}) = broadcast_zpreserving(*, A, B)
1690+
broadcast(::typeof(*), A::Union{Array,BitArray}, B::SparseMatrixCSC) = broadcast_zpreserving(*, A, B)
16891691
broadcast(::typeof(*), A::SparseMatrixCSC, B::Number) = SparseMatrixCSC(A.m, A.n, copy(A.colptr), copy(A.rowval), A.nzval .* B)
16901692
broadcast(::typeof(*), A::Number, B::SparseMatrixCSC) = SparseMatrixCSC(B.m, B.n, copy(B.colptr), copy(B.rowval), A .* B.nzval)
16911693

test/broadcast.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@ let x = [1:4;], y = x
275275
@test y === x == [0,1,2,3]
276276
end
277277

278+
# PR #17623: Fused binary operators
279+
@test [true] .* [true] == [true]
280+
278281
# PR 16988
279282
@test Base.promote_op(+, Bool) === Int
280283
@test isa(broadcast(+, [true]), Array{Int,1})

0 commit comments

Comments
 (0)