See also:
- Unique (indices) method similar to MATLAB
- indices of unique elements of vector in Julia - Stack Overflow
- https://groups.google.com/g/julia-users/c/205gVuPuZFU?pli=1
- https://github.com/JuliaLang/julia/issues/1845
And in particular this solution:
uniqueinds(x) = unique(i -> x[i], eachindex(x))
However, this isn’t quite the same thing: it’s equivalent to return_index=True
in numpy.unique
, not return_inverse=True
.