mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2024-12-26 02:20:30 +01:00
update to AbstractAlgebra v0.9
This commit is contained in:
parent
622f5bc6b3
commit
0bee697ed8
@ -8,11 +8,11 @@ AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
|
|||||||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
|
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
|
||||||
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
|
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
|
||||||
|
|
||||||
|
[compat]
|
||||||
|
AbstractAlgebra = "^0.9.0"
|
||||||
|
|
||||||
[extras]
|
[extras]
|
||||||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
|
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
|
||||||
|
|
||||||
[targets]
|
[targets]
|
||||||
test = ["Test"]
|
test = ["Test"]
|
||||||
|
|
||||||
[compat]
|
|
||||||
AbstractAlgebra = "^0.7.0"
|
|
||||||
|
@ -170,7 +170,7 @@ function AutGroup(G::FreeGroup; special=false)
|
|||||||
|
|
||||||
if !special
|
if !special
|
||||||
flips = [flip(i) for i in 1:n]
|
flips = [flip(i) for i in 1:n]
|
||||||
syms = [AutSymbol(p) for p in PermutationGroup(Int8(n))][2:end]
|
syms = [AutSymbol(p) for p in SymmetricGroup(Int8(n))][2:end]
|
||||||
|
|
||||||
append!(S, [flips; syms])
|
append!(S, [flips; syms])
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
export WreathProduct, WreathProductElem
|
export WreathProduct, WreathProductElem
|
||||||
|
|
||||||
|
import AbstractAlgebra: AbstractPermutationGroup, AbstractPerm
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
# WreathProduct / WreathProductElem
|
# WreathProduct / WreathProductElem
|
||||||
@ -19,22 +21,23 @@ export WreathProduct, WreathProductElem
|
|||||||
* `N::Group` : the single factor of the group $N$
|
* `N::Group` : the single factor of the group $N$
|
||||||
* `P::Generic.PermGroup` : full `PermutationGroup`
|
* `P::Generic.PermGroup` : full `PermutationGroup`
|
||||||
"""
|
"""
|
||||||
struct WreathProduct{N, T<:Group, PG<:Generic.PermGroup} <: Group
|
struct WreathProduct{N, T<:Group, PG<:AbstractPermutationGroup} <: Group
|
||||||
N::DirectPowerGroup{N, T}
|
N::DirectPowerGroup{N, T}
|
||||||
P::PG
|
P::PG
|
||||||
|
|
||||||
function WreathProduct(Gr::T, P::PG) where {T, PG<:Generic.PermGroup}
|
function WreathProduct(G::Gr, P::PG) where
|
||||||
N = DirectPowerGroup(Gr, Int(P.n))
|
{Gr <: Group, PG <: AbstractPermutationGroup}
|
||||||
return new{Int(P.n), T, PG}(N, P)
|
N = DirectPowerGroup(G, Int(P.n))
|
||||||
|
return new{Int(P.n), Gr, PG}(N, P)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
struct WreathProductElem{N, T<:GroupElem, P<:Generic.Perm} <: GroupElem
|
struct WreathProductElem{N, T<:GroupElem, P<:AbstractPerm} <: GroupElem
|
||||||
n::DirectPowerGroupElem{N, T}
|
n::DirectPowerGroupElem{N, T}
|
||||||
p::P
|
p::P
|
||||||
|
|
||||||
function WreathProductElem(n::DirectPowerGroupElem{N,T}, p::P,
|
function WreathProductElem(n::DirectPowerGroupElem{N,T}, p::P,
|
||||||
check::Bool=true) where {N, T, P<:Generic.Perm}
|
check::Bool=true) where {N, T, P<:AbstractPerm}
|
||||||
if check
|
if check
|
||||||
N == length(p.d) || throw(DomainError(
|
N == length(p.d) || throw(DomainError(
|
||||||
"Can't form WreathProductElem: lengths differ"))
|
"Can't form WreathProductElem: lengths differ"))
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
# workarounds
|
# workarounds
|
||||||
Base.one(G::Generic.PermGroup) = Generic.Perm(G.n)
|
Base.one(G::Generic.SymmetricGroup) = Generic.Perm(G.n)
|
||||||
Base.one(r::NCRingElem) = one(parent(r))
|
|
||||||
|
|
||||||
# fallback definitions
|
# fallback definitions
|
||||||
# note: the user should implement those on type, when possible
|
# note: the user should implement those on type, when possible
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@testset "Automorphisms" begin
|
@testset "Automorphisms" begin
|
||||||
|
|
||||||
G = PermutationGroup(Int8(4))
|
G = SymmetricGroup(Int8(4))
|
||||||
|
|
||||||
@testset "AutSymbol" begin
|
@testset "AutSymbol" begin
|
||||||
@test_throws MethodError Groups.AutSymbol(:a)
|
@test_throws MethodError Groups.AutSymbol(:a)
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
×(a,b) = Groups.DirectPower(a,b)
|
×(a,b) = Groups.DirectPower(a,b)
|
||||||
|
|
||||||
@testset "Constructors" begin
|
@testset "Constructors" begin
|
||||||
G = PermutationGroup(3)
|
G = SymmetricGroup(3)
|
||||||
|
|
||||||
@test Groups.DirectPowerGroup(G,2) isa AbstractAlgebra.Group
|
@test Groups.DirectPowerGroup(G,2) isa AbstractAlgebra.Group
|
||||||
@test G×G isa AbstractAlgebra.Group
|
@test G×G isa AbstractAlgebra.Group
|
||||||
@test Groups.DirectPowerGroup(G,2) isa Groups.DirectPowerGroup{2, Generic.PermGroup{Int64}}
|
@test Groups.DirectPowerGroup(G,2) isa Groups.DirectPowerGroup{2, Generic.SymmetricGroup{Int64}}
|
||||||
|
|
||||||
@test (G×G)×G == DirectPowerGroup(G, 3)
|
@test (G×G)×G == DirectPowerGroup(G, 3)
|
||||||
@test (G×G)×G == (G×G)×G
|
@test (G×G)×G == (G×G)×G
|
||||||
@ -42,7 +42,7 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
@testset "Basic arithmetic" begin
|
@testset "Basic arithmetic" begin
|
||||||
G = PermutationGroup(3)
|
G = SymmetricGroup(3)
|
||||||
GG = G×G
|
GG = G×G
|
||||||
i = perm"(1,3)"
|
i = perm"(1,3)"
|
||||||
g = perm"(1,2,3)"
|
g = perm"(1,2,3)"
|
||||||
@ -65,7 +65,7 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
@testset "elem/parent_types" begin
|
@testset "elem/parent_types" begin
|
||||||
G = PermutationGroup(3)
|
G = SymmetricGroup(3)
|
||||||
g = perm"(1,2,3)"
|
g = perm"(1,2,3)"
|
||||||
|
|
||||||
@test elem_type(G×G) == DirectPowerGroupElem{2, elem_type(G)}
|
@test elem_type(G×G) == DirectPowerGroupElem{2, elem_type(G)}
|
||||||
@ -75,7 +75,7 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
@testset "Misc" begin
|
@testset "Misc" begin
|
||||||
G = PermutationGroup(3)
|
G = SymmetricGroup(3)
|
||||||
GG = Groups.DirectPowerGroup(G,3)
|
GG = Groups.DirectPowerGroup(G,3)
|
||||||
@test order(GG) == 216
|
@test order(GG) == 216
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@testset "WreathProducts" begin
|
@testset "WreathProducts" begin
|
||||||
S_3 = PermutationGroup(3)
|
S_3 = SymmetricGroup(3)
|
||||||
S_2 = PermutationGroup(2)
|
S_2 = SymmetricGroup(2)
|
||||||
b = perm"(1,2,3)"
|
b = perm"(1,2,3)"
|
||||||
a = perm"(1,2)"
|
a = perm"(1,2)"
|
||||||
|
|
||||||
@ -8,7 +8,7 @@
|
|||||||
@test Groups.WreathProduct(S_2, S_3) isa AbstractAlgebra.Group
|
@test Groups.WreathProduct(S_2, S_3) isa AbstractAlgebra.Group
|
||||||
B3 = Groups.WreathProduct(S_2, S_3)
|
B3 = Groups.WreathProduct(S_2, S_3)
|
||||||
@test B3 isa Groups.WreathProduct
|
@test B3 isa Groups.WreathProduct
|
||||||
@test B3 isa WreathProduct{3, Generic.PermGroup{Int}, Generic.PermGroup{Int}}
|
@test B3 isa WreathProduct{3, Generic.SymmetricGroup{Int}, Generic.SymmetricGroup{Int}}
|
||||||
|
|
||||||
aa = Groups.DirectPowerGroupElem((a^0 ,a, a^2))
|
aa = Groups.DirectPowerGroupElem((a^0 ,a, a^2))
|
||||||
|
|
||||||
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
@test elem_type(B3) == Groups.WreathProductElem{3, Generic.Perm{Int}, Generic.Perm{Int}}
|
@test elem_type(B3) == Groups.WreathProductElem{3, Generic.Perm{Int}, Generic.Perm{Int}}
|
||||||
|
|
||||||
@test parent_type(typeof(one(B3))) == Groups.WreathProduct{3, parent_type(typeof(one(B3.N.group))), Generic.PermGroup{Int}}
|
@test parent_type(typeof(one(B3))) == Groups.WreathProduct{3, parent_type(typeof(one(B3.N.group))), Generic.SymmetricGroup{Int}}
|
||||||
|
|
||||||
@test parent(one(B3)) == Groups.WreathProduct(S_2,S_3)
|
@test parent(one(B3)) == Groups.WreathProduct(S_2,S_3)
|
||||||
@test parent(one(B3)) == B3
|
@test parent(one(B3)) == B3
|
||||||
@ -64,7 +64,7 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
@testset "Group arithmetic" begin
|
@testset "Group arithmetic" begin
|
||||||
B4 = Groups.WreathProduct(PermutationGroup(3), PermutationGroup(4))
|
B4 = Groups.WreathProduct(SymmetricGroup(3), SymmetricGroup(4))
|
||||||
|
|
||||||
id, a, b = perm"(3)", perm"(1,2)(3)", perm"(1,2,3)"
|
id, a, b = perm"(3)", perm"(1,2)(3)", perm"(1,2,3)"
|
||||||
|
|
||||||
@ -84,7 +84,7 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
@testset "Iteration" begin
|
@testset "Iteration" begin
|
||||||
Wr = WreathProduct(PermutationGroup(2),PermutationGroup(4))
|
Wr = WreathProduct(SymmetricGroup(2),SymmetricGroup(4))
|
||||||
|
|
||||||
elts = collect(Wr)
|
elts = collect(Wr)
|
||||||
@test elts isa Vector{Groups.WreathProductElem{4, Generic.Perm{Int}, Generic.Perm{Int}}}
|
@test elts isa Vector{Groups.WreathProductElem{4, Generic.Perm{Int}, Generic.Perm{Int}}}
|
||||||
|
Loading…
Reference in New Issue
Block a user