Skip to content

Commit

Permalink
feat: subgroup enumeration with no subgroups
Browse files Browse the repository at this point in the history
  • Loading branch information
thofma committed Nov 1, 2024
1 parent ab9b6d2 commit a56518c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ If your research depends on computations done with Hecke, please consider giving
- Claus Fieker, William Hart, Tommy Hofmann and Fredrik Johansson, [Nemo/Hecke: Computer Algebra and Number Theory Packages
for the Julia Programming Language](https://doi.acm.org/10.1145/3087604.3087611). In: Proceedings of ISSAC '17, pages 157–164, New York, NY, USA, 2017. ACM.

```bib
```
@inproceedings{nemo,
author = {Fieker, Claus and Hart, William and Hofmann, Tommy and Johansson, Fredrik},
title = {Nemo/Hecke: Computer Algebra and Number Theory Packages for the Julia Programming Language},
Expand Down
15 changes: 7 additions & 8 deletions src/GrpAb/SubgroupEnum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,13 @@ end
# Same as above but now allow a function to be applied to the output
function _subgroups(G::FinGenAbGroup; subtype = [-1], quotype = [-1], order = -1,
index = -1, fun = sub)
if !is_divisible_by(Hecke.order(G), order) || # the -1 default is ok
!is_divisible_by(Hecke.order(G), index) ||
(subtype != [-1] && !has_quotient(G, subtype)) ||
(quotype != [-1] && !has_quotient(G, quotype))
return ()
end

return ( fun(G, convert(Vector{FinGenAbGroupElem}, z)) for z in _subgroups_gens(G, subtype, quotype, order, index))
end

Expand Down Expand Up @@ -919,14 +926,6 @@ function subgroups(G::FinGenAbGroup; subtype = :all,

options = Int16[ subtype != :all, quotype != :all, order != -1, index != -1]

if mod(Hecke.order(G), index) != 0
error("Index must divide the group order")
end

if mod(Hecke.order(G), order) != 0
error("Index must divide the group order")
end

if sum(options) > 1
error("Currently only one non-default parameter is supported.")
end
Expand Down
11 changes: 11 additions & 0 deletions test/GrpAb/SubgroupEnum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,15 @@
@test all([order(t[1]) == 7*3 for t in T])
end
end

# test for no subgroups

G = abelian_group([9, 3, 3])
@test length(collect(subgroups(G; index = 2))) == 0
@test length(collect(subgroups(G; order = 10001323))) == 0
@test length(collect(subgroups(G; subtype = [6, 6, 6]))) == 0
@test length(collect(subgroups(G; quotype = [6, 6, 6]))) == 0

G = abelian_group([2])
@test length(collect(subgroups(G; quotype = [3]))) == 0
end

0 comments on commit a56518c

Please sign in to comment.