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

modify reverse_dict to allow generator arg

e.g. reverse_dict(elements(G))
This commit is contained in:
kalmar 2017-05-17 17:43:11 +02:00
parent e18e90ddaf
commit bef0b67af6

View File

@ -338,8 +338,9 @@ 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))
function reverse_dict(iter)
T = eltype(iter)
return Dict{T, Int}(x => i for (i,x) in enumerate(iter))
end
function create_pm{T<:GroupElem}(basis::Vector{T}, basis_dict::Dict{T, Int},