Skip to content
This repository was archived by the owner on Jun 1, 2021. It is now read-only.

Remove erroneous SparseVector early exit #5

Merged
merged 1 commit into from
Dec 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ function _binarymap{Tx,Ty}(f::BinaryOp,
ynzval = nonzeros(y)
mx = length(xnzind)
my = length(ynzind)
(mx == 0 || my == 0) && return SparseVector(R, 0)
cap = (mode == 0 ? min(mx, my) : mx + my)::Int

rind = Array(Int, cap)
Expand Down
7 changes: 7 additions & 0 deletions test/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,10 @@ let x = sparsevector(Float64, 8)
@test maxabs(x) == 0.0
@test minabs(x) == 0.0
end

# Issue https://github.com/JuliaLang/julia/issues/14046
let s14046 = sprand(5, 1.0)
z = sparsevector(Float64, 5)
@test z + s14046 == s14046
@test 2*z == z + z == z
end