From 0bee697ed82c6e1c40fe247e443972faa943e33e Mon Sep 17 00:00:00 2001 From: kalmarek Date: Wed, 25 Mar 2020 13:48:44 +0100 Subject: [PATCH] update to AbstractAlgebra v0.9 --- Project.toml | 6 +++--- src/AutGroup.jl | 2 +- src/WreathProducts.jl | 15 +++++++++------ src/fallbacks.jl | 3 +-- test/AutGroup-tests.jl | 2 +- test/DirectPower-tests.jl | 10 +++++----- test/WreathProd-tests.jl | 12 ++++++------ 7 files changed, 26 insertions(+), 24 deletions(-) diff --git a/Project.toml b/Project.toml index 5b2d400..5964d55 100644 --- a/Project.toml +++ b/Project.toml @@ -8,11 +8,11 @@ AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" +[compat] +AbstractAlgebra = "^0.9.0" + [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] test = ["Test"] - -[compat] -AbstractAlgebra = "^0.7.0" diff --git a/src/AutGroup.jl b/src/AutGroup.jl index 28374bb..3499ec7 100644 --- a/src/AutGroup.jl +++ b/src/AutGroup.jl @@ -170,7 +170,7 @@ function AutGroup(G::FreeGroup; special=false) if !special 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]) end diff --git a/src/WreathProducts.jl b/src/WreathProducts.jl index 18f0961..3754892 100644 --- a/src/WreathProducts.jl +++ b/src/WreathProducts.jl @@ -1,5 +1,7 @@ export WreathProduct, WreathProductElem +import AbstractAlgebra: AbstractPermutationGroup, AbstractPerm + ############################################################################### # # WreathProduct / WreathProductElem @@ -19,22 +21,23 @@ export WreathProduct, WreathProductElem * `N::Group` : the single factor of the group $N$ * `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} P::PG - function WreathProduct(Gr::T, P::PG) where {T, PG<:Generic.PermGroup} - N = DirectPowerGroup(Gr, Int(P.n)) - return new{Int(P.n), T, PG}(N, P) + function WreathProduct(G::Gr, P::PG) where + {Gr <: Group, PG <: AbstractPermutationGroup} + N = DirectPowerGroup(G, Int(P.n)) + return new{Int(P.n), Gr, PG}(N, P) end end -struct WreathProductElem{N, T<:GroupElem, P<:Generic.Perm} <: GroupElem +struct WreathProductElem{N, T<:GroupElem, P<:AbstractPerm} <: GroupElem 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 N == length(p.d) || throw(DomainError( "Can't form WreathProductElem: lengths differ")) diff --git a/src/fallbacks.jl b/src/fallbacks.jl index bc1d1db..8fccc98 100644 --- a/src/fallbacks.jl +++ b/src/fallbacks.jl @@ -1,6 +1,5 @@ # workarounds -Base.one(G::Generic.PermGroup) = Generic.Perm(G.n) -Base.one(r::NCRingElem) = one(parent(r)) +Base.one(G::Generic.SymmetricGroup) = Generic.Perm(G.n) # fallback definitions # note: the user should implement those on type, when possible diff --git a/test/AutGroup-tests.jl b/test/AutGroup-tests.jl index 3d140d6..8699874 100644 --- a/test/AutGroup-tests.jl +++ b/test/AutGroup-tests.jl @@ -1,6 +1,6 @@ @testset "Automorphisms" begin - G = PermutationGroup(Int8(4)) + G = SymmetricGroup(Int8(4)) @testset "AutSymbol" begin @test_throws MethodError Groups.AutSymbol(:a) diff --git a/test/DirectPower-tests.jl b/test/DirectPower-tests.jl index 5eb4a80..65722f5 100644 --- a/test/DirectPower-tests.jl +++ b/test/DirectPower-tests.jl @@ -3,11 +3,11 @@ ×(a,b) = Groups.DirectPower(a,b) @testset "Constructors" begin - G = PermutationGroup(3) + G = SymmetricGroup(3) @test Groups.DirectPowerGroup(G,2) 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 == (G×G)×G @@ -42,7 +42,7 @@ end @testset "Basic arithmetic" begin - G = PermutationGroup(3) + G = SymmetricGroup(3) GG = G×G i = perm"(1,3)" g = perm"(1,2,3)" @@ -65,7 +65,7 @@ end @testset "elem/parent_types" begin - G = PermutationGroup(3) + G = SymmetricGroup(3) g = perm"(1,2,3)" @test elem_type(G×G) == DirectPowerGroupElem{2, elem_type(G)} @@ -75,7 +75,7 @@ end @testset "Misc" begin - G = PermutationGroup(3) + G = SymmetricGroup(3) GG = Groups.DirectPowerGroup(G,3) @test order(GG) == 216 diff --git a/test/WreathProd-tests.jl b/test/WreathProd-tests.jl index 33aafb7..158e056 100644 --- a/test/WreathProd-tests.jl +++ b/test/WreathProd-tests.jl @@ -1,6 +1,6 @@ @testset "WreathProducts" begin - S_3 = PermutationGroup(3) - S_2 = PermutationGroup(2) + S_3 = SymmetricGroup(3) + S_2 = SymmetricGroup(2) b = perm"(1,2,3)" a = perm"(1,2)" @@ -8,7 +8,7 @@ @test Groups.WreathProduct(S_2, S_3) isa AbstractAlgebra.Group B3 = Groups.WreathProduct(S_2, S_3) @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)) @@ -37,7 +37,7 @@ @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)) == B3 @@ -64,7 +64,7 @@ end @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)" @@ -84,7 +84,7 @@ end @testset "Iteration" begin - Wr = WreathProduct(PermutationGroup(2),PermutationGroup(4)) + Wr = WreathProduct(SymmetricGroup(2),SymmetricGroup(4)) elts = collect(Wr) @test elts isa Vector{Groups.WreathProductElem{4, Generic.Perm{Int}, Generic.Perm{Int}}}