Commit
2 years ago
gh-35173: Speedup of Poset characteristic polynomial ### 📚 Description Add special method for Moebius function computation with minimal element, add cached_method to HasseDiagram.bottom, change to sum over bottom_moebius_function This drastically reduces the time required to compute characteristic polynomials. On commit `fbb412787f`, we see sage: P = posets.SetPartitions(7) sage: %time P.characteristic_polynomial() CPU times: user 42.2 s, sys: 475 ms, total: 42.7 s Wall time: 45.2 s q^6 - 21*q^5 + 175*q^4 - 735*q^3 + 1624*q^2 - 1764*q + 720 With this commit we see: sage: P = posets.SetPartitions(7) sage: %time P.characteristic_polynomial() CPU times: user 62.2 ms, sys: 1.83 ms, total: 64 ms Wall time: 63.1 ms q^6 - 21*q^5 + 175*q^4 - 735*q^3 + 1624*q^2 - 1764*q + 720 Fixes #34971 ### 📝 Checklist - [x] I have made sure that the title is self-explanatory and the description concisely explains the PR. - [x] I have linked an issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation accordingly. ### ⌛ Dependencies None @tscrim is a suggested reviewer. URL: https://github.com/sagemath/sage/pull/35173 Reported by: trevorkarn Reviewer(s): Travis Scrimshaw, trevorkarn
Author
Release Manager
Loading