-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
IntegerVectorsModPermutationGroup crashes on empty domain #36681
Comments
Thanks for reporting the bug. I think the problem is with the iterator itself, not the cardinality method, because the following also gives a segmentation fault for me.
|
Pull request #36814 fixes the problem for cardinality in the finite case, because it does not call the iterator. It does not fix the underlying problem with the iterator. |
still crashes in the latest beta 10.3.beta0 |
PR #36814 should now fix this in all cases, both finite and infinite, both in cardinality and the iterator. In the end I basically special-cased all empty-domain situations. I certainly did not feel the urge to find why the underlying |
sagemathgh-36814: Fast cardinality method for IntegerVectorsModPermutationGroup # Fast cardinality method for IntegerVectorsModPermutationGroup This patch fixes sagemath#36787 by implementing a `cardinality` method for `IntegerVectorsModPermutationGroup_with_constraints`. The method calculates the cardinality using the the [Polya enumeration theorem](https://en.wikipedia.org/wiki/P%C3%B3lya_enumeration_theorem) (also known as the cycle index theorem). It is faster than the the default implementation, which iterates through the full set to find the cardinality. Incidentally this PR fixes also sagemath#36681 so that cardinality and iter no longer crash in empty-domain situations. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation accordingly. ### ⌛ Dependencies - sagemath#36873: we can use `is_trivial` from that PR <!-- List all open PRs that this PR logically depends on - sagemath#12345: short description why this is a dependency - sagemath#34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: sagemath#36814 Reported by: Jukka Kohonen Reviewer(s): Dima Pasechnik, Jukka Kohonen, Martin Rubey, Travis Scrimshaw
fixed by #36814 |
Steps To Reproduce
In SageMath version 9.0, Release Date: 2020-01-01, run the following:
Expected Behavior
The cardinality should be zero.
The domain is empty, so we are counting empty integer vectors whose sum is 1. There are no such vectors.
Actual Behavior
SageMath crashes with the following dump.
Additional Information
No response
Environment
Checklist
The text was updated successfully, but these errors were encountered: