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

CartesianIndex version of find/findnz? #20684

Closed
malmaud opened this issue Feb 19, 2017 · 2 comments
Closed

CartesianIndex version of find/findnz? #20684

malmaud opened this issue Feb 19, 2017 · 2 comments
Labels
arrays [a, r, r, a, y, s] collections Data structures holding multiple items, e.g. sets design Design of APIs or of the language itself search & find The find* family of functions speculative Whether the change will be implemented is speculative

Comments

@malmaud
Copy link
Contributor

malmaud commented Feb 19, 2017

Seems like it would be useful to have a version of find that returns a vector of cartesian indices, in analogy to the new enumerate. findnz is basically a pre-CartesianIndex version of this idea that only happens to work for 2d arrays.

One possible API, in analogy with the enumerate API, is to have find take a singleton-valued first parameter that selects the output format.

Thoughts?

@ararslan ararslan added collections Data structures holding multiple items, e.g. sets design Design of APIs or of the language itself speculative Whether the change will be implemented is speculative labels Feb 20, 2017
@nalimilan
Copy link
Member

See recent discussion at JuliaLang/Juleps#27.

@JeffBezanson JeffBezanson added the arrays [a, r, r, a, y, s] label Aug 24, 2017
@nalimilan nalimilan added the search & find The find* family of functions label Nov 24, 2017
@nalimilan nalimilan changed the title CartesianIndex version of findnz? CartesianIndex version of find/findnz? Nov 30, 2017
@nalimilan
Copy link
Member

#24774 mostly implements this, by returning cartesian indices by default for matrices. It could then be extended so that the type of index is passed as the single argument (for when you want a linear index, or a cartesian index even for a vector).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s] collections Data structures holding multiple items, e.g. sets design Design of APIs or of the language itself search & find The find* family of functions speculative Whether the change will be implemented is speculative
Projects
None yet
Development

No branches or pull requests

4 participants