#13605: Partition options and cleanup partitions documentation
-----------------------------------------------+----------------------------
Reporter: tscrim | Owner: sage-combinat
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-5.7
Component: combinatorics | Resolution:
Keywords: partition, options, output | Work issues:
Report Upstream: N/A | Reviewers: Andew Mathas
Authors: Travis Scrimshaw | Merged in:
Dependencies: #13074 #13762 #13840 #10193 | Stopgaps:
-----------------------------------------------+----------------------------
Comment (by andrew.mathas):
As I said above, I was concerned that patch might increase the time that
it takes to compare partitions because the new order option manifests
itself as a series of if-then-else statements inside each of the
comparison functions __lt__, __le__ etc. I just did some timings on 5.5 to
see if there is a significant difference in sorting speeds.
''The short answer is that sorting appears to be almost 3 times slower
with the patch.''
It could be that my test is not the best, so please feel free to suggest a
better one.
With the patch applied:
{{{
sage: parts=list(Partitions(50));
sage: %timeit parts.sort()
5 loops, best of 3: 627 ms per loop
}}}
Without the patch applied:
{{{
sage: parts=list(Partitions(50));
sage: %timeit parts.sort()
5 loops, best of 3: 221 ms per loop
}}}
Rather than having the if-then-else structure inside the comparison
functions there would be less overhead using somethng like the syntax used
for _repr_:
{{{#!python
def __lt__(self, other):
return getattr(self, '__lt__'+partition_options['order'])(self, other)
}}}
Of course, this won't work at the moment as order is not an option...
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13605#comment:19>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.