#15428: Partitions to posets
-------------------------------------------------+-------------------------
Reporter: darij | Owner:
Type: enhancement | Status:
Priority: major | needs_work
Component: combinatorics | Milestone: sage-5.13
Keywords: sage-combinat, partition, | Resolution:
poset | Merged in:
Authors: Darij Grinberg | Reviewers: Travis
Report Upstream: N/A | Scrimshaw
Branch: | Work issues:
Dependencies: #15350 | Commit:
| Stopgaps:
-------------------------------------------------+-------------------------
Comment (by nthiery):
Replying to [comment:20 darij]:
> I've replaced NW by SE in the doc.
Thanks!
> About %timeit not seeing the advantages of UniqueRepresentation: I
> kind of expected it, but I don't really know how to measure the
> timing right (I asked something similar on sage-devel a week
> ago). Maybe this:
> {{{
> sage: %timeit [Poset({1: [2,3], 2: [4,5], 5: [6,7,8]}) for i in
range(12)]
> 1 loops, best of 3: 15.5 ms per loop
> sage: %timeit [Poset([[1,2],[1,3],[2,4],[2,5],[5,6],[5,7],[5,8]]) for i
in range(12)]
> 10 loops, best of 3: 21.2 ms per loop
> }}}
> I think that even when we speed up `Poset.__init__` --
> *particularly* when we speed it up -- the difference between a
> dictionary and a list input will become more noticeable. I'm pretty
> sure that the dictionary is the form that makes it easier to compute
> the poset because lookup is faster. Or not?q
The conversion from a list to a dictionary is orders of magnitude
faster than the creation of a poset:
{{{
sage: l = [[1,2],[1,3],[2,4],[2,5],[5,6],[5,7],[5,8]]
sage: %timeit dict(l)
100000 loops, best of 3: 3.76 us per loop
}}}
So, don't worry about this at this point.
> I don't think that separating the `orientation` variable is really
> separation of concerns -- there is much more similarities between SE
> and NW than between SE and NE (for example).
Fair enough :-)
Cheers,
Nicolas
--
Ticket URL: <http://trac.sagemath.org/ticket/15428#comment:21>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.