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

brave new inner constructors for GroupRing

This commit is contained in:
kalmar 2017-07-19 22:48:17 +02:00
parent f2ad7c8045
commit 5b128cd146

View File

@ -17,17 +17,30 @@ type GroupRing{Gr<:Group, T<:GroupElem} <: Ring
basis_dict::Dict{T, Int} basis_dict::Dict{T, Int}
pm::Array{Int,2} pm::Array{Int,2}
function GroupRing(G::Gr; initialise=true) function GroupRing(G::Group, basis::Vector{T}; init::Bool=false)
A = new(G) RG = new(G, basis, reverse_dict(basis))
if initialise if init
complete(A) RG.pm = try
create_pm(RG.basis, RG.basis_dict)
catch err
isa(err, KeyError) && throw("Product is not supported on basis")
throw(err)
end end
return A else
RG.pm = zeros(Int, length(basis), length(basis))
end
return RG
end end
function GroupRing(G::Gr, basis::Vector{T}, basis_dict::Dict{T,Int}, pm::Array{Int,2}) function GroupRing(G::Gr, basis::Vector{T}, basis_dict::Dict{T,Int}, pm::Array{Int,2})
return new(G, basis, basis_dict, pm) return new(G, basis, basis_dict, pm)
end end
function GroupRing(G::Gr, pm::Array{Int,2})
RG = new(G)
RG.pm = pm
return RG
end
end end
GroupRing{Gr<:Group}(G::Gr;initialise=true) = GroupRing{Gr, elem_type(G)}(G, initialise=initialise) GroupRing{Gr<:Group}(G::Gr;initialise=true) = GroupRing{Gr, elem_type(G)}(G, initialise=initialise)