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

adapt GroupRing constructors to new type definition

This commit is contained in:
kalmar 2017-05-17 17:40:32 +02:00
parent 203743bb4d
commit 4491078b9e

View File

@ -77,12 +77,23 @@ function GroupRing(G::Group, pm::Array{Int,2})
return GroupRing(G, pm) return GroupRing(G, pm)
end end
function GroupRing(G::Group, pm::Array{Int,2}, basis::Vector) function GroupRing(G::Group, basis::Vector)
basis_dict = reverse_dict(basis)
pm = try
create_pm(basis, basis_dict)
catch err
isa(err, KeyError) && throw("Products are not supported on basis")
throw(err)
end
return GroupRing(G, basis, basis_dict, pm)
end
function GroupRing(G::Group, basis::Vector, pm::Array{Int,2})
size(pm,1) == size(pm,2) || throw("pm must be of size (n,n), got size(pm,1) == size(pm,2) || throw("pm must be of size (n,n), got
$(size(pm))") $(size(pm))")
eltype(basis) == elem_type(G) || throw("basis must consist of elements of $G") eltype(basis) == elem_type(G) || throw("basis must consist of elements of $G")
basis_dict = reverse_dict(basis) basis_dict = reverse_dict(basis)
return GroupRing(Group, pm, basis, basis_dict) return GroupRing(G, basis, basis_dict, pm)
end end
############################################################################### ###############################################################################