Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No type promotion in reduce with Monoids #129

Open
AntoineBut opened this issue May 8, 2024 · 0 comments
Open

No type promotion in reduce with Monoids #129

AntoineBut opened this issue May 8, 2024 · 0 comments

Comments

@AntoineBut
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant