Dictionary of all indices of all unique values in an array


#1

StatsBase.indexmap(a) creates a dictionary of indices of first occurrences of all unique values in a.

Is there a standard function that would create a map to all indices of all unique values in a (not only the first one). I am thinking of a function like:

function indexmapall{T}(a::AbstractArray{T})
    d = Dict{T,Vector{Int}}()
    for (i, k) = enumerate(a)
        push!(get!(d, k, []), i)
    end
    return d
end