-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix SparseVector broadcasting oddities (#26474)
* Fix SparseVector broadcasting oddities Lots of SparseVector oddities fixed here, all by deleting code. Previous behaviors that are now fixed include: ```julia julia> spzeros(5) .* [1] ERROR: DimensionMismatch("") Stacktrace: [1] _binarymap(::typeof(*), ::SparseVector{Float64,Int64}, ::Array{Int64,1}, ::Int64) at /home/mbauman/julia-wip3/usr/share/julia/site/v0.7/SparseArrays/src/sparsevector.jl:1325 [2] _vmul at /home/mbauman/julia-wip3/usr/share/julia/site/v0.7/SparseArrays/src/sparsevector.jl:1369 [inlined] [3] broadcast(::typeof(*), ::SparseVector{Float64,Int64}, ::Array{Int64,1}) at /home/mbauman/julia-wip3/usr/share/julia/site/v0.7/SparseArrays/src/sparsevector.jl:1388 [4] top-level scope julia> spzeros(5) .* ones(5) 5-element Array{Float64,1}: 0.0 0.0 0.0 0.0 0.0 julia> spzeros(5) .* ones(5) .* 1 # this is as expected 5-element SparseVector{Float64,Int64} with 0 stored entries ``` Those all now behave as you'd expect, returning a SparseVector in all cases. * Remove debugging code [ci skip]
- Loading branch information
Showing
4 changed files
with
38 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters