JuliaSparse / SuiteSparseGraphBLAS.jl

Sparse, General Linear Algebra for Graphs!
MIT License
102 stars 16 forks source link

ambiguous scalar by matrix multiplication #96

Closed CarloLucibello closed 1 year ago

CarloLucibello commented 1 year ago
julia> using SparseArrays, SuiteSparseGraphBlas

julia> x = sprand(5, 5, 0.5) |> GBMatrix
5x5 GraphBLAS double matrix, sparse by col
  14 entries, memory: 480 bytes

    (1,1)    0.652571
    (2,1)    0.877267
    (5,1)    0.498966
    (4,2)    0.109951
    (1,3)    0.517752
    (3,3)    0.812603
    (1,4)    0.0272527
    (2,4)    0.997701
    (3,4)    0.31351
    (4,4)    0.0128793
    (5,4)    0.806709
    (1,5)    0.207728
    (3,5)    0.497848
    (4,5)    0.993865

julia> 2 * x
ERROR: MethodError: *(::Int64, ::GBMatrix{Float64, Nothing}) is ambiguous. Candidates:
  *(x::V, u::Union{Transpose{T, <:SuiteSparseGraphBLAS.AbstractGBArray{T}}, SuiteSparseGraphBLAS.AbstractGBArray{T}}; mask, accum, desc) where {T, V<:(Union{var"#s4468", T, var"#s4467"} where {var"#s4468"<:Union{Bool, Float32, Float64, Int16, Int32, Int64, Int8, UInt16, UInt32, UInt64, UInt8, ComplexF32, ComplexF64}, var"#s4467"<:Number})} in SuiteSparseGraphBLAS at /Users/carlo/.julia/packages/SuiteSparseGraphBLAS/ijDcs/src/operations/map.jl:118
  *(A::Number, B::AbstractArray) in Base at arraymath.jl:21
Possible fix, define
  *(::V, ::Union{Transpose{T, <:SuiteSparseGraphBLAS.AbstractGBArray{T}}, SuiteSparseGraphBLAS.AbstractGBArray{T}}) where {T, V<:Number}
Stacktrace:
 [1] top-level scope
   @ REPL[20]:1
rayegun commented 1 year ago

Can you check either 0.9 or master? This should have been fixed, but I haven't run Aqua's ambiguity checker recently.

CarloLucibello commented 1 year ago

works on 0.9!