Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: subgroup enumeration with no subgroups #1670

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading