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

constructors for GroupRing

This commit is contained in:
kalmar 2017-05-16 18:32:12 +02:00
parent 84de4de030
commit 82fb401539

View File

@ -37,6 +37,28 @@ GroupRingElem{T}(c::AbstractVector{T}, A::GroupRing) = GroupRingElem{T}(c,A)
convert{T<:Number}(::Type{T}, X::GroupRingElem) = convert{T<:Number}(::Type{T}, X::GroupRingElem) =
GroupRingElem(parent(X), convert(AbstractVector{T}, X.coeffs)) 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 end
(==)(X::GroupAlgebraElement, Y::GroupAlgebraElement) = isequal(X,Y) (==)(X::GroupAlgebraElement, Y::GroupAlgebraElement) = isequal(X,Y)