-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Return index vectors from unique #1845
Comments
This is closely linked to the |
I prefer the consistency but I would prefer ind to be a suffix making the functions discoverable through auto completion when you press tab. |
A more composable solution would be better here. Consider the way that sortperm is implemented in terms of applying |
+1 to following a similar approach here as well. |
What we need is |
Would Side note, one of the most aggravating things Mathworks ever did IMO was changing the default result ordering of the index outputs from |
Unique perm wouldn't actually return a permutation, would it? |
ah yeah it's not really the same thing, you get a many-to-few index map and/or a few-to-many index map |
Let's not call it "perm" then. |
Yes, it is not strictly a permutation. Perhaps a selection or something. |
Hi @drgar, I'm really glad you're excited about Julia. Unfortunately, posting GPL code in a public forum puts us in legal danger, so I deleted all of the code you posted without reading it. It's a frustrating limitation, but you cannot safely post code to GitHub that you don't own the copyrights to. |
Don't worry about it. I caught it fast enough that it's not an issue. I just wanted to make sure you understood why I edited your comment. |
@johnmyleswhite I think your statement is a bit too strong here. Posting the GPL code in public does not create any legal danger. Please don't spread the idea that GPL is something dangerous. The problem is only about Julia developers being suspected of having read and taken inspiration of this code when writing BSD-licensed code in Julia. (So I agree it's better remove the code from this issue.) |
@nalimilan: You're right. The correct summary is that posting GPL code in a public forum read by Julia developers is dangerous. Posting GPL code on the internet is harmless. It's only when you post the code somewhere that could be construed as influencing Julia's development that Julia is put in jeopardy. |
We probably err on the side of being more vigilant than necessary, but we really do not want to accidentally create a situation – or the perception of one – where Julia is violating the copyrights of other projects, GPL or otherwise. If our GitHub repositories are littered with GPL code and even vaguely similar code – written independently – ends up in Julia, that could cause some very unfortunate legal doubts. This is why we're very careful not to post any GPL or proprietary code around here. |
Please review the PR in #14142 and provide any comments related to implementation (choice of output arguments, efficiency of algorithmic choices, etc.) as well as documentation, and function name. I do still need to add a few tests for automated testing purposes, but there are a few examples of usage in the doc string. |
This functionality was further discussed in #15503 implemented in https://github.com/AndyGreenwell/GroupSlices.jl. We can decide to refactor it, or bring into base as necessary. |
Given that the package is abandoned and unusable on current Julia, is there any interest to bringing this to Base eventually? |
Since GroupSlices does not seem to be maintained. Maybe this functionalities, as other julia implementations of Matlab functions could be added to the package https://github.com/ChrisRackauckas/VectorizedRoutines.jl. |
The way forward with GroupSlices (Andy seems unresponsive—he probably never looks at GitHub anymore), is to figure out if there's a clean and relatively simple API to be extracted from it that covers the common use cases and then maybe import that into Base or put it into a new package. As I recall, there was a PR to put it into Base but it was just a little too sprawling of an API to be satisfying. |
Has anything been done to include the functionalities of GroupSlices.jl into Base? |
That’s what my last comment was addressing: what was attempted, why it wasn’t satisfactory, and what would need to be done to make forward progress. |
From the discussion in this thread it is not clear what is the current status of this more general interface (i.e. |
Note that since uniqueind(x) = unique(i -> x[i], eachindex(x)) as suggested here. Since this is a one-liner, there's not a pressing need to provide a library function for this. On the other hand, this trick is not obvious to new users and it seems to be requested a lot. |
Maybe the trick could be mentioned in the docstring? |
Note that |
In Matlab,
unique
can return optional index vectors, such that one can construct the unique version from the input and vice versa. This is quite handy, and would be nice to have in julia.http://www.mathworks.com/help/matlab/ref/unique.html
We would probably need the function to be called
unique_ind
or something, until we have keyword args.The text was updated successfully, but these errors were encountered: