Skip to content

reduce fails when using any as a function #88

Closed

Description

@andreyz4k
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.

Activity

  1. added a commit that references this issue on Sep 19, 2022
    44be4e0
  2. added a commit that references this issue on Oct 27, 2026
    0a7e297
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions