1
0
mirror of https://github.com/kalmarek/GroupRings.jl.git synced 2024-11-10 12:20:27 +01:00

reverse_dict function for fast basis element lookup

This commit is contained in:
kalmar 2017-05-16 18:46:30 +02:00
parent d13a8b27df
commit 70817a8fbc

View File

@ -191,6 +191,8 @@ function rationalize{T<:Integer, S<:Number}(::Type{T}, X::GroupRingElem{S};
return GroupRingElem(v, parent(X))
end
function reverse_dict(a::AbstractVector)
return Dict{eltype(a), Int}(x => i for (i,x) in enumerate(a))
end