diff --git a/src/Groups/libraries/primitivegroups.jl b/src/Groups/libraries/primitivegroups.jl index 6e28c2bd5ebf..a06f067f7487 100644 --- a/src/Groups/libraries/primitivegroups.jl +++ b/src/Groups/libraries/primitivegroups.jl @@ -184,8 +184,16 @@ The following functions are currently supported as values for `func`: The type of the returned groups is `PermGroup`. +If no conditions beside the degree are used, one can also use the shorthand +`all_primitive_groups(degree)` where `degree` is an integer or a list or range of integers. + # Examples ```jldoctest +julia> all_primitive_groups(4) +2-element Vector{PermGroup}: + Alt(4) + Sym(4) + julia> all_primitive_groups(degree => 3:5, is_abelian) 2-element Vector{PermGroup}: Alt(3) @@ -200,4 +208,16 @@ function all_primitive_groups(L...) return [PermGroup(x) for x in K] end +function all_primitive_groups(deg::Integer) + return all_primitive_groups(degree => deg) +end + +function all_primitive_groups(degs::Vector{<:Integer}) + return all_primitive_groups(degree => degs) +end + +function all_primitive_groups(degs::AbstractRange{<:Integer}) + return all_primitive_groups(degree => degs) +end + # TODO: turn this into an iterator, possibly using PrimitiveGroupsIterator diff --git a/src/Groups/libraries/transitivegroups.jl b/src/Groups/libraries/transitivegroups.jl index 87e8c393f925..4ea05ef7bf81 100644 --- a/src/Groups/libraries/transitivegroups.jl +++ b/src/Groups/libraries/transitivegroups.jl @@ -180,8 +180,19 @@ The following functions are currently supported as values for `func`: The type of the returned groups is `PermGroup`. +If no conditions beside the degree are used, one can also use the shorthand +`all_transitive_groups(degree)` where `degree` is an integer or a list or range of integers. + # Examples ```jldoctest +julia> all_transitive_groups(4) +5-element Vector{PermGroup}: + Permutation group of degree 4 + Permutation group of degree 4 + Permutation group of degree 4 + Alt(4) + Sym(4) + julia> all_transitive_groups(degree => 3:5, is_abelian) 4-element Vector{PermGroup}: Alt(3) @@ -197,4 +208,16 @@ function all_transitive_groups(L...) return [PermGroup(x) for x in K] end +function all_transitive_groups(deg::Integer) + return all_transitive_groups(degree => deg) +end + +function all_transitive_groups(degs::Vector{<:Integer}) + return all_transitive_groups(degree => degs) +end + +function all_transitive_groups(degs::AbstractRange{<:Integer}) + return all_transitive_groups(degree => degs) +end + # TODO: turn this into an iterator, possibly using PrimitiveGroupsIterator diff --git a/test/Groups/libraries.jl b/test/Groups/libraries.jl index 70b7d59b81e3..81bec96db549 100644 --- a/test/Groups/libraries.jl +++ b/test/Groups/libraries.jl @@ -83,6 +83,10 @@ end @test is_regular(H,[1,2]) @test_throws ArgumentError transitive_group(1, 2) + + @test issetequal(all_transitive_groups(3:2:9), all_transitive_groups(degree => 3:2:9)) + @test issetequal(all_transitive_groups(collect(3:2:9)), all_transitive_groups(3:2:9)) + @test issetequal(reduce(vcat, (all_transitive_groups(i) for i in 3:2:9)), all_transitive_groups(3:2:9)) end @testset "Perfect groups" begin @@ -156,6 +160,10 @@ end @test has_primitive_groups(50) @test_throws ArgumentError primitive_group(1, 1) @test number_of_primitive_groups(50) == 9 + + @test issetequal(all_primitive_groups(3:2:9), all_primitive_groups(degree => 3:2:9)) + @test issetequal(all_primitive_groups(collect(3:2:9)), all_primitive_groups(3:2:9)) + @test issetequal(reduce(vcat, (all_primitive_groups(i) for i in 3:2:9)), all_primitive_groups(3:2:9)) end @testset "Atlas groups" begin