Skip to content

Walk the orbit instead of searching it when it is short - #38

Open
fingolfin wants to merge 1 commit into
masterfrom
mh/brute-force-short-orbits
Open

Walk the orbit instead of searching it when it is short#38
fingolfin wants to merge 1 commit into
masterfrom
mh/brute-force-short-orbits

Conversation

@fingolfin

Copy link
Copy Markdown
Member

For transformations, permutations and partial permutations the image
search runs in the row-column action on mMax^2 encoded pairs, where mMax
is the degree of the input. Lifting a single generator of G into that
action, or allocating one table indexed by it, already costs mMax^2
operations, so the search has a floor quadratic in the degree no matter
how short the orbit of the object happens to be.

When the orbit is shorter than that floor, walk it in full instead. That
costs one group element application per coset of the stabilizer, which
this code path has computed anyway. The images are compared as padded
image lists, which is the same comparison the search performs on the
encoded pair sets, so the minimum found is the same one.

Timings in ms on the example from issue #27, a group of order 2704 and
degree 2808 with a conjugacy class of length 52:

                  search   orbit
MinimalImage         613      14
IsMinimalImage       645      14
MinimalImagePerm     677      14
CanonicalImage       679      13

For reference Minimum(Orbit(C, pt, OnPoints)) takes 1 ms; nearly all of
what is left is the Centralizer and RightTransversal calls.

MinimalImage and IsMinimalImage return exactly what they returned before.
MinimalImagePerm may return a different element of the same coset, which
maps to the same minimal image. CanonicalImage picks a different
representative, which it is free to do.

The new 'bruteForce' option selects between the two ("auto" by default);
tst/test_bruteforce.tst uses it to check them against each other.

Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com

For transformations, permutations and partial permutations the image
search runs in the row-column action on mMax^2 encoded pairs, where mMax
is the degree of the input. Lifting a single generator of G into that
action, or allocating one table indexed by it, already costs mMax^2
operations, so the search has a floor quadratic in the degree no matter
how short the orbit of the object happens to be.

When the orbit is shorter than that floor, walk it in full instead. That
costs one group element application per coset of the stabilizer, which
this code path has computed anyway. The images are compared as padded
image lists, which is the same comparison the search performs on the
encoded pair sets, so the minimum found is the same one.

Timings in ms on the example from issue #27, a group of order 2704 and
degree 2808 with a conjugacy class of length 52:

                      search   orbit
    MinimalImage         613      14
    IsMinimalImage       645      14
    MinimalImagePerm     677      14
    CanonicalImage       679      13

For reference Minimum(Orbit(C, pt, OnPoints)) takes 1 ms; nearly all of
what is left is the Centralizer and RightTransversal calls.

MinimalImage and IsMinimalImage return exactly what they returned before.
MinimalImagePerm may return a different element of the same coset, which
maps to the same minimal image. CanonicalImage picks a different
representative, which it is free to do.

The new 'bruteForce' option selects between the two ("auto" by default);
tst/test_bruteforce.tst uses it to check them against each other.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@fingolfin

Copy link
Copy Markdown
Member Author

@ChrisJefferson assuming this passes, time for a new release?

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.69%. Comparing base (1a46452) to head (fd2f69b).

Files with missing lines Patch % Lines
gap/smallestImage.gi 97.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #38      +/-   ##
==========================================
+ Coverage   89.58%   89.69%   +0.11%     
==========================================
  Files          13       13              
  Lines        2572     2610      +38     
==========================================
+ Hits         2304     2341      +37     
- Misses        268      269       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MinimalImage runs out of memory for a group of order 2704, is stuck in ferret

1 participant