#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 darij):

 Replying to [comment:17 nthiery]:
 > Thanks. Maybe you could use SE rather than NW as well in the
 documentation when you explain what the poset is about.

 Will do next time I'm editing the file; good point!

 > > About the DRYness, what exactly would you factor out? What do you mean
 by "indexing" rows and columns?
 >
 > Oh, now I see the misunderstanding; I thought the option was about the
 > indexing of the cells, ... Which indeed was stupid (same poset). Never
 > mind.
 >
 > To make your code DRY, you could build two lists horizontal_covers and
 > vertical_covers, then, depending on the options, map a reverse on them:
 > {{{
 > if ...:
 >     horizontal_covers = [ (j,i) for (i,j) in horizontal_covers ]
 > if ...:
 >     vertical_covers = [ (j,i) for (i,j) in vertical_covers ]
 > }}}

 Hmm. TBH I still don't understand you. How do you get anything from
 reversal? I'm building up a dictionary, not a list of cover relations. The
 (arguably toy) timing I have done shows the dictionary to be faster:

 {{{
 sage: %timeit Poset({1: [2,3], 2: [4,5], 5: [6,7,8]})
 1000 loops, best of 3: 1.31 ms per loop
 sage: %timeit Poset([[1,2],[1,3],[2,4],[2,5],[5,6],[5,7],[5,8]])
 100 loops, best of 3: 1.9 ms per loop
 }}}

 > For consistency, I would tend to favor non boolean options like
 > horiz="left" / "right" (we have a bunch of them e.g. in the Coxeter
 > code). But I don't have great suggestions for the option names
 > themselves.

 Hmm. I thought you wanted to get rid of strings as arguments. I'm not
 really convinced of replacing a 2-letter string by 2 multiletter strings
 :/

--
Ticket URL: <http://trac.sagemath.org/ticket/15428#comment:18>
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.

Reply via email to