1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-12-12 15:16:27 +01:00
Groups.jl/test/WreathProd-tests.jl

110 lines
3.2 KiB
Julia
Raw Normal View History

2017-07-23 17:09:50 +02:00
@testset "WreathProducts" begin
S_3 = PermutationGroup(3)
2018-07-30 15:20:37 +02:00
R, x = PolynomialRing(QQ, "x")
F, a = NumberField(x^2 + 1, "a")
2017-07-23 17:09:50 +02:00
b = S_3([2,3,1])
@testset "Constructors" begin
2018-07-30 08:30:27 +02:00
@test isa(Groups.WreathProduct(F, S_3), AbstractAlgebra.Group)
2017-07-23 17:09:50 +02:00
@test isa(Groups.WreathProduct(F, S_3), Groups.WreathProduct)
2018-07-30 15:20:37 +02:00
@test isa(Groups.WreathProduct(F, S_3), Groups.WreathProduct{AddGrp{Generic.ResField{Generic.Poly{Rational{BigInt}}}}, Int64})
2017-07-23 17:09:50 +02:00
aa = Groups.DirectProductGroupElem([a^0 ,a, a^2])
2018-07-30 08:30:27 +02:00
@test isa(Groups.WreathProductElem(aa, b), AbstractAlgebra.GroupElem)
2017-07-23 17:09:50 +02:00
@test isa(Groups.WreathProductElem(aa, b), Groups.WreathProductElem)
2018-07-30 15:20:37 +02:00
@test isa(Groups.WreathProductElem(aa, b), Groups.WreathProductElem{AddGrpElem{Generic.ResF{Generic.Poly{Rational{BigInt}}}}, Int64})
2017-07-23 17:09:50 +02:00
B3 = Groups.WreathProduct(F, S_3)
@test B3.N == Groups.DirectProductGroup(F, 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())
2018-07-30 15:20:37 +02:00
@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(F, S_3)
@test elem_type(B3) == Groups.WreathProductElem{AddGrpElem{elem_type(F)}, Int}
@test parent_type(typeof(B3())) == Groups.WreathProduct{parent_type(typeof(B3.N.group())), Int}
@test parent(B3()) == Groups.WreathProduct(F,S_3)
@test parent(B3()) == B3
end
@testset "Basic operations on WreathProductElem" begin
aa = Groups.DirectProductGroupElem([a^0 ,a, a^2])
B3 = Groups.WreathProduct(F, S_3)
2017-07-23 17:09:50 +02:00
g = B3(aa, b)
@test g.p == b
2018-07-30 15:20:37 +02:00
@test g.n == DirectProductGroupElem(AddGrpElem.(aa.elts))
2017-07-23 17:09:50 +02:00
h = deepcopy(g)
2018-07-30 15:20:37 +02:00
@test h == g
@test !(g === h)
2017-07-23 17:09:50 +02:00
2018-07-30 15:20:37 +02:00
g.n[1] = parent(g.n[1])(a)
2017-07-23 17:09:50 +02:00
2018-07-30 15:20:37 +02:00
@test g.n[1] == parent(g.n[1])(a)
@test g != h
@test hash(g) != hash(h)
2017-07-23 17:09:50 +02:00
2018-07-30 15:20:37 +02:00
g.n[1] = a
@test g.n[1] == parent(g.n[1])(a)
2017-07-23 17:09:50 +02:00
@test g != h
@test hash(g) != hash(h)
end
2018-07-30 15:20:37 +02:00
@testset "Group arithmetic" begin
B4 = Groups.WreathProduct(GF(3), PermutationGroup(4))
2017-07-23 17:09:50 +02:00
2018-07-30 15:20:37 +02:00
x = B4([0,1,2,0], perm"(1,2,3)(4)")
@test inv(x) == B4([1,0,2,0], perm"(1,3,2)(4)")
2017-07-23 17:09:50 +02:00
2018-07-30 15:20:37 +02:00
y = B4([1,0,1,2], perm"(1,4)(2,3)")
@test inv(y) == B4([1,2,0,2], perm"(1,4)(2,3)")
2017-07-23 17:09:50 +02:00
2018-07-30 15:20:37 +02:00
@test x*y == B4([0,2,0,2], perm"(1,3,4)(2)")
2017-07-23 17:09:50 +02:00
2018-07-30 15:20:37 +02:00
@test y*x == B4([1,2,2,2], perm"(1,4,2)(3)")
2017-07-23 17:09:50 +02:00
2018-07-30 15:20:37 +02:00
@test inv(x)*y == B4([2,1,2,2], perm"(1,2,4)(3)")
2017-07-23 17:09:50 +02:00
2018-07-30 15:20:37 +02:00
@test y*inv(x) == B4([1,2,1,0], perm"(1,4,3)(2)")
2017-07-23 17:09:50 +02:00
end
@testset "Misc" begin
2018-07-30 15:20:37 +02:00
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
2017-07-23 17:09:50 +02:00
2018-07-30 15:20:37 +02:00
Wr = WreathProduct(PermutationGroup(2),PermutationGroup(4))
2017-07-23 17:09:50 +02:00
@test isa([elements(Wr)...], Vector{Groups.WreathProductElem{Generic.perm{Int}, Int}})
2018-07-30 15:20:37 +02:00
@test order(Wr) == 2^4*factorial(4)
2017-07-23 17:09:50 +02:00
elts = [elements(Wr)...]
@test length(elts) == order(Wr)
@test all([g*inv(g) for g in elts] .== Wr())
@test all(inv(g*h) == inv(h)*inv(g) for g in elts for h in elts)
end
end