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

GxB sort with smaller (or larger) output objects #180

Open
eriknw opened this issue Nov 19, 2022 · 0 comments
Open

GxB sort with smaller (or larger) output objects #180

eriknw opened this issue Nov 19, 2022 · 0 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@eriknw
Copy link
Contributor

eriknw commented Nov 19, 2022

Why do the output vectors and matrices need to be the same size as the inputs?

If one wants e.g. the k smallest elements, it makes sense to me to pass a vector of size k to GxB_Vector_sort. Similarly, the number of columns (by default) or rows (if transposed descriptor is set) can also be used to limit the number of results.

This operation is commonly known as e.g. nsmallest and nlargest. With PAIR/ONEB and ZEROB, one can also get firstn and lastn.

Small aside: what I really want is to randomly sample k elements per row or column, but there is not yet a "random" binary operator or monoid.

Btw, we implemented compactify (very similar to your sort) in python-graphblas years ago that supports first, last, smallest, largest, and random, because we needed it for multiple workloads.

@DrTimothyAldenDavis DrTimothyAldenDavis added enhancement New feature or request question Further information is requested labels Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants