1
0
mirror of https://github.com/kalmarek/GroupRings.jl.git synced 2024-12-28 18:50:29 +01:00

fix constructor issue

This commit is contained in:
kalmarek 2018-08-14 20:18:34 +02:00
parent c7115c689e
commit 607d2b42c0

View File

@ -59,12 +59,32 @@ mutable struct GroupRingElem{T, A<:AbstractVector, GR<:GroupRing} <: RingElem
warn("Basis of the GroupRing is not defined.")
end
end
return new(c, RG)
return new{T, A, GR}(c, RG)
end
end
export GroupRing, GroupRingElem, complete!, create_pm, star, aug, supp
###############################################################################
#
# GroupRing / GroupRingElem constructors
#
###############################################################################
function GroupRingElem(c::AbstractVector, RG::GroupRing)
return GroupRingElem{eltype(c), typeof(c), typeof(RG)}(c, RG)
end
function GroupRing(G::Group; fastm::Bool=false)
return GroupRing(G, vec(collect(elements(G))), fastm=fastm)
end
function GroupRing(G::Group, basis::Vector, pm::Array{Int,2})
size(pm,1) == size(pm,2) || throw("pm must be square, got $(size(pm))")
eltype(basis) == elem_type(G) || throw("Basis must consist of elements of $G")
return GroupRing(G, basis, reverse_dict(basis), pm)
end
###############################################################################
#
# Type and parent object methods
@ -88,26 +108,6 @@ function convert(::Type{T}, X::GroupRingElem) where {T<:Number}
return GroupRingElem(Vector{T}(X.coeffs), parent(X))
end
###############################################################################
#
# GroupRing / GroupRingElem constructors
#
###############################################################################
function GroupRingElem(c::AbstractVector, RG::GroupRing)
return GroupRingElem{eltype(c), typeof(c), typeof(RG)}(c, RG)
end
function GroupRing(G::Group; fastm::Bool=false)
return GroupRing(G, vec(collect(elements(G))), fastm=fastm)
end
function GroupRing(G::Group, basis::Vector, pm::Array{Int,2})
size(pm,1) == size(pm,2) || throw("pm must be square, got $(size(pm))")
eltype(basis) == elem_type(G) || throw("Basis must consist of elements of $G")
return GroupRing(G, basis, reverse_dict(basis), pm)
end
###############################################################################
#
# Parent object call overloads
@ -153,7 +153,7 @@ end
# keep storage type
function (RG::GroupRing)(x::AbstractVector{T}) where T
function (RG::GroupRing)(x::AbstractVector{T}) where T<:Number
length(x) == length(RG.basis) || throw("Can not coerce to $RG: lengths differ")
return GroupRingElem(x, RG)
end