-
-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Labels
sparseSparse arraysSparse arrays
Description
julia> a = ones(Bool, 3, 3);
julia> b = ones(Bool, 3, 3);
julia> a * b
3×3 Array{Int64,2}:
3 3 3
3 3 3
3 3 3
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:0I 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.
Metadata
Metadata
Assignees
Labels
sparseSparse arraysSparse arrays