JuliaSparse / SuiteSparseGraphBLAS.jl

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

reduce fails when using any as a function #88

Closed andreyz4k closed 1 year ago

andreyz4k commented 2 years ago
julia> A = GBMatrix([1,1,2,2,3,4,4,5,6,7,7,7], [2,4,5,7,6,1,3,6,3,3,4,5], [1:12...])
7x7 GraphBLAS int64_t matrix, bitmap by row
  12 entries, memory: 649 bytes

    (1,2)   1
    (1,4)   2
    (2,5)   3
    (2,7)   4
    (3,6)   5
    (4,1)   6
    (4,3)   7
    (5,6)   8
    (6,3)   9
    (7,3)   10
    (7,4)   11
    (7,5)   12

julia> reduce(any, A, dims=2)
ERROR: ArgumentError: The SuiteSparse:GraphBLAS reduce function only supports monoids where T x T -> T.
            Please pass a function whose output type matches both input types.
Stacktrace:
 [1] reduce(op::Function, A::GBMatrix{Int64, Nothing}; dims::Int64, typeout::Nothing, init::Nothing, mask::Nothing, accum::Nothing, desc::Nothing)
   @ SuiteSparseGraphBLAS ~/.julia/packages/SuiteSparseGraphBLAS/SK9Eh/src/operations/reduce.jl:33
 [2] top-level scope
   @ REPL[37]:1

Probably it's something with the type check since ANYMONOID is in the list of existing monoids.