Commit
2 years ago
gh-36814: Fast cardinality method for IntegerVectorsModPermutationGroup # Fast cardinality method for IntegerVectorsModPermutationGroup This patch fixes #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 #36681 so that cardinality and iter no longer crash in empty-domain situations. ### :memo: 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. ### :hourglass: Dependencies - #36873: we can use `is_trivial` from that PR <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: https://github.com/sagemath/sage/pull/36814 Reported by: Jukka Kohonen Reviewer(s): Dima Pasechnik, Jukka Kohonen, Martin Rubey, Travis Scrimshaw
Author
Release Manager
Loading