1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-11-19 14:35:28 +01:00

change WreathProducts accordingly

This commit is contained in:
kalmarek 2019-01-02 15:47:58 +01:00
parent e8b90ab54a
commit 74a559a17b

View File

@ -16,31 +16,31 @@ export WreathProduct, WreathProductElem
> `n-tuples` of elements from `N` > `n-tuples` of elements from `N`
# Arguments: # Arguments:
* `N::Group` : the single factor of group $N$ * `N::Group` : the single factor of the group $N$
* `P::Generic.PermGroup` : full `PermutationGroup` * `P::Generic.PermGroup` : full `PermutationGroup`
""" """
struct WreathProduct{T<:Group, I<:Integer} <: Group struct WreathProduct{N, T<:Group, I<:Integer} <: Group
N::DirectPowerGroup{T} N::DirectPowerGroup{N, T}
P::Generic.PermGroup{I} P::Generic.PermGroup{I}
function WreathProduct{T, I}(Gr::T, P::Generic.PermGroup{I}) where {T, I} function WreathProduct(Gr::T, P::Generic.PermGroup{I}) where {T, I}
N = DirectPowerGroup(Gr, Int(P.n)) N = DirectPowerGroup(Gr, Int(P.n))
return new(N, P) return new{Int(P.n), T, I}(N, P)
end end
end end
struct WreathProductElem{T<:GroupElem, I<:Integer} <: GroupElem struct WreathProductElem{N, T<:GroupElem, I<:Integer} <: GroupElem
n::DirectPowerGroupElem{T} n::DirectPowerGroupElem{N, T}
p::Generic.perm{I} p::Generic.perm{I}
# parent::WreathProduct # parent::WreathProduct
function WreathProductElem{T, I}(n::DirectPowerGroupElem{T}, p::Generic.perm{I}, function WreathProductElem(n::DirectPowerGroupElem{N,T}, p::Generic.perm{I},
check::Bool=true) where {T, I} check::Bool=true) where {N, T, I}
if check if check
length(n.elts) == length(p.d) || throw(DomainError( length(n.elts) == length(p.d) || throw(DomainError(
"Can't form WreathProductElem: lengths differ")) "Can't form WreathProductElem: lengths differ"))
end end
return new(n, p) return new{N, T, I}(n, p)
end end
end end
@ -50,23 +50,13 @@ end
# #
############################################################################### ###############################################################################
elem_type(::Type{WreathProduct{T, I}}) where {T, I} = WreathProductElem{elem_type(T), I} elem_type(::Type{WreathProduct{N, T, I}}) where {N, T, I} = WreathProductElem{N, elem_type(T), I}
parent_type(::Type{WreathProductElem{T, I}}) where {T, I} = parent_type(::Type{WreathProductElem{N, T, I}}) where {N, T, I} =
WreathProduct{parent_type(T), I} WreathProduct{N, parent_type(T), I}
parent(g::WreathProductElem) = WreathProduct(parent(g.n[1]), parent(g.p)) parent(g::WreathProductElem) = WreathProduct(parent(g.n[1]), parent(g.p))
###############################################################################
#
# WreathProduct / WreathProductElem constructors
#
###############################################################################
WreathProduct(G::T, P::Generic.PermGroup{I}) where {T, I} = WreathProduct{T, I}(G, P)
WreathProductElem(n::DirectPowerGroupElem{T}, p::Generic.perm{I}, check=true) where {T,I} = WreathProductElem{T,I}(n, p, check)
############################################################################### ###############################################################################
# #
# Parent object call overloads # Parent object call overloads