1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-11-28 08:45:27 +01:00

Compare commits

..

No commits in common. "866e431c1aa184fd6a223431c69315aec91f6b7a" and "d385992e92a62bd3a9e356f804341c6ea11878b9" have entirely different histories.

4 changed files with 20 additions and 29 deletions

View File

@ -1,7 +1,7 @@
name = "Groups" name = "Groups"
uuid = "5d8bd718-bd84-11e8-3b40-ad14f4a32557" uuid = "5d8bd718-bd84-11e8-3b40-ad14f4a32557"
authors = ["Marek Kaluba <kalmar@amu.edu.pl>"] authors = ["Marek Kaluba <kalmar@amu.edu.pl>"]
version = "0.7.8" version = "0.7.7"
[deps] [deps]
GroupsCore = "d5909c97-4eac-4ecc-a3dc-fdd0858a4120" GroupsCore = "d5909c97-4eac-4ecc-a3dc-fdd0858a4120"
@ -17,7 +17,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
GroupsCore = "0.4" GroupsCore = "0.4"
KnuthBendix = "0.4" KnuthBendix = "0.4"
OrderedCollections = "1" OrderedCollections = "1"
PermutationGroups = "0.4" PermutationGroups = "0.3"
StaticArrays = "1" StaticArrays = "1"
julia = "1.6" julia = "1.6"

View File

@ -1,7 +1,5 @@
import PermutationGroups: import PermutationGroups:
AbstractPermutationGroup, AbstractPermutationGroup, AbstractPerm, degree, SymmetricGroup
AbstractPermutation,
degree
""" """
WreathProduct(G::Group, P::AbstractPermutationGroup) <: Group WreathProduct(G::Group, P::AbstractPermutationGroup) <: Group
@ -29,7 +27,7 @@ end
struct WreathProductElement{ struct WreathProductElement{
DPEl<:DirectPowerElement, DPEl<:DirectPowerElement,
PEl<:AbstractPermutation, PEl<:AbstractPerm,
Wr<:WreathProduct, Wr<:WreathProduct,
} <: GroupsCore.GroupElement } <: GroupsCore.GroupElement
n::DPEl n::DPEl
@ -38,7 +36,7 @@ struct WreathProductElement{
function WreathProductElement( function WreathProductElement(
n::DirectPowerElement, n::DirectPowerElement,
p::AbstractPermutation, p::AbstractPerm,
W::WreathProduct, W::WreathProduct,
) )
return new{typeof(n),typeof(p),typeof(W)}(n, p, W) return new{typeof(n),typeof(p),typeof(W)}(n, p, W)
@ -55,19 +53,16 @@ function Base.iterate(G::WreathProduct)
itr = Iterators.product(G.N, G.P) itr = Iterators.product(G.N, G.P)
res = iterate(itr) res = iterate(itr)
@assert res !== nothing @assert res !== nothing
ab, st = res elt = WreathProductElement(first(res)..., G)
(a, b) = ab return elt, (iterator = itr, state = last(res))
elt = WreathProductElement(a, b, G)
return elt, (itr, st)
end end
function Base.iterate(G::WreathProduct, state) function Base.iterate(G::WreathProduct, state)
itr, st = state itr, st = state.iterator, state.state
res = iterate(itr, st) res = iterate(itr, st)
res === nothing && return nothing res === nothing && return nothing
(a::eltype(G.N), b::eltype(G.P)), st = res elt = WreathProductElement(first(res)..., G)
elt = WreathProductElement(a, b, G) return elt, (iterator = itr, state = last(res))
return elt, (itr, st)
end end
function Base.IteratorSize(::Type{<:WreathProduct{DP,PGr}}) where {DP,PGr} function Base.IteratorSize(::Type{<:WreathProduct{DP,PGr}}) where {DP,PGr}
@ -123,11 +118,8 @@ function Base.deepcopy_internal(g::WreathProductElement, stackdict::IdDict)
) )
end end
function _act(p::AbstractPermutation, n::DirectPowerElement) function _act(p::AbstractPerm, n::DirectPowerElement)
return DirectPowerElement( return DirectPowerElement(n.elts^p, parent(n))
ntuple(i -> n.elts[i^p], length(n.elts)),
parent(n),
)
end end
function Base.inv(g::WreathProductElement) function Base.inv(g::WreathProductElement)

View File

@ -5,7 +5,7 @@
@test contains(sprint(print, π₁Σ), "surface") @test contains(sprint(print, π₁Σ), "surface")
Groups.PermRightAut(p::Perm) = Groups.PermRightAut([i^p for i in 1:2genus]) Groups.PermRightAut(p::Perm) = Groups.PermRightAut(p.d)
# Groups.PermLeftAut(p::Perm) = Groups.PermLeftAut(p.d) # Groups.PermLeftAut(p::Perm) = Groups.PermLeftAut(p.d)
autπ₁Σ = let autπ₁Σ = AutomorphismGroup(π₁Σ) autπ₁Σ = let autπ₁Σ = AutomorphismGroup(π₁Σ)
pauts = let p = perm"(1,3,5)(2,4,6)" pauts = let p = perm"(1,3,5)(2,4,6)"
@ -50,9 +50,8 @@
@test π₁Σ.(word.(z)) == Groups.domain(first(S)) @test π₁Σ.(word.(z)) == Groups.domain(first(S))
d = Groups.domain(first(S)) d = Groups.domain(first(S))
p = perm"(1,3,5)(2,4,6)" p = perm"(1,3,5)(2,4,6)"
@test Groups.evaluate!(deepcopy(d), τ) == @test Groups.evaluate!(deepcopy(d), τ) == d^inv(p)
ntuple(i -> d[i^inv(p)], length(d)) @test Groups.evaluate!(deepcopy(d), τ^2) == d^p
@test Groups.evaluate!(deepcopy(d), τ^2) == ntuple(i -> d[i^p], length(d))
E, sizes = Groups.wlmetric_ball(S, radius=3) E, sizes = Groups.wlmetric_ball(S, radius=3)
@test sizes == [49, 1813, 62971] @test sizes == [49, 1813, 62971]

View File

@ -1,10 +1,9 @@
@testset "GroupConstructions" begin @testset "GroupConstructions" begin
symmetric_group(n) = PermGroup(perm"(1,2)", Perm([2:n; 1]))
@testset "DirectProduct" begin @testset "DirectProduct" begin
GH = GH =
let G = symmetric_group(3), H = symmetric_group(4) let G = PermutationGroups.SymmetricGroup(3),
H = PermutationGroups.SymmetricGroup(4)
Groups.Constructions.DirectProduct(G, H) Groups.Constructions.DirectProduct(G, H)
end end
@ -18,7 +17,7 @@
@testset "DirectPower" begin @testset "DirectPower" begin
GGG = Groups.Constructions.DirectPower{3}( GGG = Groups.Constructions.DirectPower{3}(
symmetric_group(3), PermutationGroups.SymmetricGroup(3),
) )
test_Group_interface(GGG) test_Group_interface(GGG)
test_GroupElement_interface(rand(GGG, 2)...) test_GroupElement_interface(rand(GGG, 2)...)
@ -29,7 +28,8 @@
end end
@testset "WreathProduct" begin @testset "WreathProduct" begin
W = W =
let G = symmetric_group(2), P = symmetric_group(4) let G = PermutationGroups.SymmetricGroup(2),
P = PermutationGroups.SymmetricGroup(4)
Groups.Constructions.WreathProduct(G, P) Groups.Constructions.WreathProduct(G, P)
end end