constructors for GroupRing

This commit is contained in:
kalmar 2017-05-16 18:32:12 +02:00
parent 84de4de030
commit 82fb401539
1 changed files with 22 additions and 0 deletions

View File

@ -37,6 +37,28 @@ GroupRingElem{T}(c::AbstractVector{T}, A::GroupRing) = GroupRingElem{T}(c,A)
convert{T<:Number}(::Type{T}, X::GroupRingElem) =
GroupRingElem(parent(X), convert(AbstractVector{T}, X.coeffs))
function GroupRing(G::Group, pm::Array{Int,2})
size(pm,1) == size(pm,2) || throw("pm must be of size (n,n), got
$(size(pm))")
return GroupRing(Group, pm)
end
function GroupRing(G::Group, pm::Array{Int,2}, basis::Vector)
size(pm,1) == size(pm,2) || throw("pm must be of size (n,n), got
$(size(pm))")
eltype(basis) == elem_type(G) || throw("basis must consist of elements of $G")
basis_dict = Dict(g => i for (i,g) in enumerate(basis))
return GroupRing(Group, pm, basis, basis_dict)
end
function GroupRing(G::Group; complete=false)
A = GroupRing(Group)
if complete
complete(A)
end
return A
end
end
(==)(X::GroupAlgebraElement, Y::GroupAlgebraElement) = isequal(X,Y)