mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2024-11-19 14:35:28 +01:00
109 lines
3.0 KiB
Julia
109 lines
3.0 KiB
Julia
@testset "WreathProducts" begin
|
|
S_3 = PermutationGroup(3)
|
|
S_2 = PermutationGroup(2)
|
|
b = S_3([2,3,1])
|
|
a = S_2([2,1])
|
|
|
|
@testset "Constructors" begin
|
|
@test isa(Groups.WreathProduct(S_2, S_3), AbstractAlgebra.Group)
|
|
B3 = Groups.WreathProduct(S_2, S_3)
|
|
@test B3 isa Groups.WreathProduct
|
|
@test B3 isa WreathProduct{AbstractAlgebra.Generic.PermGroup{Int}, Int}
|
|
|
|
aa = Groups.DirectProductGroupElem([a^0 ,a, a^2])
|
|
|
|
@test isa(Groups.WreathProductElem(aa, b), AbstractAlgebra.GroupElem)
|
|
x = Groups.WreathProductElem(aa, b)
|
|
@test x isa Groups.WreathProductElem
|
|
@test x isa Groups.WreathProductElem{AbstractAlgebra.Generic.perm{Int}, Int}
|
|
|
|
@test B3.N == Groups.DirectProductGroup(S_2, 3)
|
|
@test B3.P == S_3
|
|
|
|
@test B3(aa, b) == Groups.WreathProductElem(aa, b)
|
|
@test B3(b) == Groups.WreathProductElem(B3.N(), b)
|
|
@test B3(aa) == Groups.WreathProductElem(aa, S_3())
|
|
|
|
@test B3([a^0 ,a, a^2], perm"(1,2,3)") isa WreathProductElem
|
|
|
|
@test B3([a^0 ,a, a^2], perm"(1,2,3)") == B3(aa, b)
|
|
end
|
|
|
|
@testset "Types" begin
|
|
B3 = Groups.WreathProduct(S_2, S_3)
|
|
|
|
@test elem_type(B3) == Groups.WreathProductElem{perm{Int}, Int}
|
|
|
|
@test parent_type(typeof(B3())) == Groups.WreathProduct{parent_type(typeof(B3.N.group())), Int}
|
|
|
|
@test parent(B3()) == Groups.WreathProduct(S_2,S_3)
|
|
@test parent(B3()) == B3
|
|
end
|
|
|
|
@testset "Basic operations on WreathProductElem" begin
|
|
aa = Groups.DirectProductGroupElem([a^0 ,a, a^2])
|
|
B3 = Groups.WreathProduct(S_2, S_3)
|
|
g = B3(aa, b)
|
|
|
|
@test g.p == b
|
|
@test g.n == DirectProductGroupElem(aa.elts)
|
|
|
|
h = deepcopy(g)
|
|
@test h == g
|
|
@test !(g === h)
|
|
|
|
g.n[1] = parent(g.n[1])(a)
|
|
|
|
@test g.n[1] == parent(g.n[1])(a)
|
|
@test g != h
|
|
|
|
@test hash(g) != hash(h)
|
|
|
|
g.n[1] = a
|
|
@test g.n[1] == parent(g.n[1])(a)
|
|
@test g != h
|
|
|
|
@test hash(g) != hash(h)
|
|
end
|
|
|
|
@testset "Group arithmetic" begin
|
|
B4 = Groups.WreathProduct(AdditiveGroup(GF(3)), PermutationGroup(4))
|
|
|
|
x = B4([0,1,2,0], perm"(1,2,3)(4)")
|
|
@test inv(x) == B4([1,0,2,0], perm"(1,3,2)(4)")
|
|
|
|
y = B4([1,0,1,2], perm"(1,4)(2,3)")
|
|
@test inv(y) == B4([1,2,0,2], perm"(1,4)(2,3)")
|
|
|
|
@test x*y == B4([0,2,0,2], perm"(1,3,4)(2)")
|
|
|
|
@test y*x == B4([1,2,2,2], perm"(1,4,2)(3)")
|
|
|
|
|
|
@test inv(x)*y == B4([2,1,2,2], perm"(1,2,4)(3)")
|
|
|
|
@test y*inv(x) == B4([1,2,1,0], perm"(1,4,3)(2)")
|
|
|
|
end
|
|
|
|
@testset "Misc" begin
|
|
B3 = Groups.WreathProduct(GF(3), S_3)
|
|
@test order(B3) == 3^3*6
|
|
|
|
# B3 = Groups.WreathProduct(MultiplicativeGroup(GF(3)), S_3)
|
|
# @test order(B3) == 2^3*6
|
|
|
|
Wr = WreathProduct(PermutationGroup(2),PermutationGroup(4))
|
|
|
|
@test isa([elements(Wr)...], Vector{Groups.WreathProductElem{Generic.perm{Int}, Int}})
|
|
@test order(Wr) == 2^4*factorial(4)
|
|
|
|
elts = [elements(Wr)...]
|
|
|
|
@test length(elts) == order(Wr)
|
|
@test all([g*inv(g) == Wr() for g in elts])
|
|
@test all(inv(g*h) == inv(h)*inv(g) for g in elts for h in elts)
|
|
end
|
|
|
|
end
|