1
0
mirror of https://github.com/kalmarek/GroupRings.jl.git synced 2024-12-29 11:00: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}
pm::Array{Int,2}
function GroupRing(G::Gr; initialise=true)
A = new(G)
if initialise
complete(A)
function GroupRing(G::Group, basis::Vector{T}; init::Bool=false)
RG = new(G, basis, reverse_dict(basis))
if init
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
else
RG.pm = zeros(Int, length(basis), length(basis))
end
return A
return RG
end
function GroupRing(G::Gr, basis::Vector{T}, basis_dict::Dict{T,Int}, pm::Array{Int,2})
return new(G, basis, basis_dict, pm)
end
function GroupRing(G::Gr, pm::Array{Int,2})
RG = new(G)
RG.pm = pm
return RG
end
end
GroupRing{Gr<:Group}(G::Gr;initialise=true) = GroupRing{Gr, elem_type(G)}(G, initialise=initialise)