Skip to content

handle permutations in S_n with n > 2^16 #39999

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

edgarcosta
Copy link
Member

@edgarcosta edgarcosta commented Apr 22, 2025

This resolves #39998, as the issue is gap having small and large permutations:
https://github.com/gap-system/gap/blob/f0b438db8fa5786d19975e6040076fd46b08bd85/src/permutat.h#L18-L26

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

Copy link

Documentation preview for this PR (built with commit c5eab93; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@edgarcosta edgarcosta marked this pull request as ready for review April 23, 2025 00:00
Copy link
Member

@saraedum saraedum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the failing tests have nothing to do with these changes. If so, feel free to set this to positive review.

Copy link
Collaborator

@tscrim tscrim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except I have one question: did you look at the memory usage of your doctest? Does it require a lot of memory?

@edgarcosta
Copy link
Member Author

edgarcosta commented Apr 24, 2025

In theory it just needs to allocate an array 2**17 of int32_t, but something else is going on behind the scenes.
Nonetheless, in practice the memory usage jumps by 112 MB

>>> (310099968 - 192577536)/1024.**2
112.078125

via:

/usr/bin/time -lh ./sage -c ""                                                                                                                                                          
           192577536  maximum resident set size
                   0  average shared memory size
                   0  average unshared data size
                   0  average unshared stack size
               36503  page reclaims
                 110  page faults
                   0  swaps
                   0  block input operations
                   0  block output operations
                   0  messages sent
                   0  messages received
                   0  signals received
                  10  voluntary context switches
                 158  involuntary context switches
           116133618  instructions retired
            47630290  cycles elapsed
             1458488  peak memory footprint

vs

/usr/bin/time -lh ./sage -c "SymmetricGroup(2**17)((2**16,2**17-1))._libgap_()" 
	1.00s real		0.52s user		0.25s sys
           310099968  maximum resident set size
                   0  average shared memory size
                   0  average unshared data size
                   0  average unshared stack size
               48026  page reclaims
                 114  page faults
                   0  swaps
                   0  block input operations
                   0  block output operations
                   0  messages sent
                   0  messages received
                   0  signals received
                  13  voluntary context switches
                7762  involuntary context switches
           116675395  instructions retired
            46895391  cycles elapsed
             1491280  peak memory footprint

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

Successfully merging this pull request may close these issues.

Overfllow in libgap interface
3 participants