Skip to content

No type promotion in reduce with Monoids #129

@AntoineBut

Description

@AntoineBut

Hello,

Im currently getting started with your package (very nice work btw!) and I am wondering if there is a way to make something like this :

using SuiteSparseGraphsBLAS, Graphs
A_T = GBMatrix{Bool}((adjacency_matrix(graph, Bool; dir=:in)))   # Some sparse GB_Matrix of Bool
out_degree = reduce(+, A_T; dims=2)   # count the number of true elements on each line

without having this 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.

The way I understand it, there is no type promotion happening in the reduce function. Since using the boolean matrix is quite faster for some operations, I'd be nice to have a way of doing this. Do you know any way around this ? Is this something that could be made possible at some point ?

Thank you for this nice package!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions