diff --git a/src/GroupAlgebras.jl b/src/GroupAlgebras.jl index ec42883..90eda11 100644 --- a/src/GroupAlgebras.jl +++ b/src/GroupAlgebras.jl @@ -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)