You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
julia> a =ones(Bool, 3, 3);
julia> b =ones(Bool, 3, 3);
julia> a * b
3×3 Array{Int64,2}:333333333
julia>using SparseArrays
julia>sparse(a) *sparse(b)
ERROR: InexactError:Bool(Bool, 2)
Stacktrace:
[1] Type at ./float.jl:73 [inlined]
[2] convert at ./number.jl:7 [inlined]
[3] setindex! at ./array.jl:745 [inlined]
[4] #spmatmul#60(::Symbol, ::Function, ::SparseMatrixCSC{Bool,Int64}, ::SparseMatrixCSC{Bool,Int64}) at /Users/yurivish/Documents/julia/usr/share/julia/stdlib/v0.7/SparseArrays/src/linalg.jl:186
[5] spmatmul at /Users/yurivish/Documents/julia/usr/share/julia/stdlib/v0.7/SparseArrays/src/linalg.jl:151 [inlined]
[6] *(::SparseMatrixCSC{Bool,Int64}, ::SparseMatrixCSC{Bool,Int64}) at /Users/yurivish/Documents/julia/usr/share/julia/stdlib/v0.7/SparseArrays/src/linalg.jl:141
[7] top-level scope at none:0
I would have expected sparse and dense matrix multiplication to work the same way, but instead the sparse version seems to require the resulting array to be of the same type as the input arrays.
I believe the behavior on dense matrices is correct; true + true + true == 3.
The text was updated successfully, but these errors were encountered:
yurivish
changed the title
Difference between sparse and dense matrix multiplication
Sparse matrix multiplication error; difference between sparse and dense matrix multiplication
Jun 13, 2018
I would have expected sparse and dense matrix multiplication to work the same way, but instead the sparse version seems to require the resulting array to be of the same type as the input arrays.
I believe the behavior on dense matrices is correct;
true + true + true == 3
.The text was updated successfully, but these errors were encountered: