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

[Feature Request] [stdlib] Add argsort to the builtin sort module #2979

Open
1 task done
martinvuyk opened this issue Jun 7, 2024 · 1 comment
Open
1 task done
Labels
enhancement New feature or request mojo-repo Tag all issues with this label

Comments

@martinvuyk
Copy link
Contributor

Review Mojo's priorities

What is your request?

Add argsort similar to numpy's

What is your motivation for this change?

sorting inplace is not an option if you need to sort multiple arrays keeping the same permutations

Any other details?

I don't know what would be needed in terms of Span's capabilities. Because that permutation should be able to affect other items.

var my_list_distances = List[UInt64]()
var my_structures = List[MyStruct]()
...
var permutation = argsort(my_list_distances)
var ordered_structs = my_structures[permutation]

Or for now we can just return a list of indexes

@martinvuyk martinvuyk added enhancement New feature or request mojo-repo Tag all issues with this label labels Jun 7, 2024
Copy link
Collaborator

I agree we should provide some facilities to support sorting things beyond just in-place. This isn't currently a priority for the team, so I've put this as Postponed. We'll share more about our Q3 priorities soon to give some insights into how the community and us can build toward those goals together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

2 participants