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
RestrictedPartitions is very slow and a huge memory hog #5478
Comments
comment:1
Maybe I should add that I'm interested, of course, in iterating through all those partitions. Just running "
|
comment:2
For ease of reviewing, I plan to have two patches here: the first one includes deprecation for RestrictedPartitions and fixes up some problems with the Partitions docstring. The second will actually implement the new |
comment:3
The second patch gets doctests working and adds the new functionality. I'm not entirely sure I did the deprecation stuff correctly; I added a deprecation warning, and then fiddled with all the doctests in the old RestrictedPartitions code so that it passes doctests. |
comment:4
A little ego update to the patch -- I added myself to the authors list. Anyone reviewing this might want to look at my test script: restricted_partitions_test_suite.sage. I've run over 10,000 successful tests with it. |
comment:5
Some benchmarks (all on sage.math):
The above example which prompted this ticket:
|
comment:6
Patch look good. However, before finishing my review I'm waiting it to be rebased on top of 3.4.1. Also some interface problem have been discussed by e-mail: It was decided more that one month ago that a combinatorial class should define:
Florent |
comment:7
Please keep the subject standard so that the proper reports are picking up the right tickets. Cheers, Michael |
deprecate RestrictedPartitions and fix up some documentation |
Attachment: trac_5478-1.patch.gz implement new Partitions class with parts_in keyword |
comment:8
Attachment: trac_5478-2.patch.gz I've updated the patches to apply on top of 3.4.1.rc1. |
comment:9
Anyone reviewing this might want to look at my test script: restricted_partitions_test_suite.sage. I've run over 10,000 successful tests with it. This script is great. I should be put in sage in one place or one other. If someone tries to optimize your code (eg: Cythonize), he surely will be happy to have your test code. Why not shipping it into the patch with a more explicit name and a one-line example on how to use it with the comment " #longtest " ? Florent |
comment:10
Some comment on the first patch: I'm not a native English speaker but it seems to me that In the same way Otherwise the rest of the first patch looks good. I'm working on the second one. Florent |
comment:11
Replying to @hivert:
"p" refers to a partition, not to a part, so the text is okay. Perhaps we should make that more clear, though. I plan on opening a ticket to improve the documentation in partition.py, so we can do that then. Replying to @hivert:
Well, right now, the script only halts if it finds an error, so it would be a really, really long test. :) The tests also can use lots of memory, since it puts a list of the partitions into memory. But if anyone thinks (a mildly modified version of) the script should get run on a "long" test, I'm happy to have it included. |
Improved doctests for deprecation warnings. |
comment:13
Attachment: trac_5478-review.patch.gz The patch looks good. The doctests passed except that depending on the base the doctests numbers may differ. So I added a review patch which replace the explicit doctest numbers with I'm giving a positive review... Though maybe someone should reread my trivial review patch. Concerning the script it is quite redundant with the .check() method we'll have with categories. Florent |
comment:14
Thanks for fixing up those line numbers in the doctests...I struggled a bit to get those right, and had forgotten about the "..." stuff. |
comment:15
Merged all three patches in Sage 3.4.1.rc3. Cheers, Michael |
I have code that does the same as
but about 5.5 times faster...and on my system,
uses over two gigabytes of memory, whereas my code takes about 9.2 seconds with minimal memory usage.
I need to fiddle with my code so that it's a drop-in replacement for RestrictedPartitions, but I should have a patch up soon.
CC: @sagetrac-sage-combinat
Component: combinatorics
Keywords: combinat, partitions, gap
Issue created by migration from https://trac.sagemath.org/ticket/5478
The text was updated successfully, but these errors were encountered: