#17053: Add function for direct sum of posets
---------------------------------+-----------------------------
       Reporter:  jmantysalo     |        Owner:
           Type:  enhancement    |       Status:  new
       Priority:  major          |    Milestone:  sage-wishlist
      Component:  combinatorics  |   Resolution:
       Keywords:                 |    Merged in:
        Authors:                 |    Reviewers:
Report Upstream:  N/A            |  Work issues:
         Branch:                 |       Commit:
   Dependencies:                 |     Stopgaps:
---------------------------------+-----------------------------

Comment (by jmantysalo):

 Function could then be something like

 {{{
 def direct_sum(self, other, relabel=None):
     if not hasattr(other, 'hasse_diagram'):
         raise ValueError('The input is not a finite poset.')
     if relabel == None:
         elements=self.list()+other.list()
         if len(elements) != len(set(elements)):
             raise ValueError("Posets contain equal elements. Try
 relabel='pairs' or relabel='linear'.")
         return Poset(self.hasse_diagram().union(other.hasse_diagram()))
     if relabel == 'pairs':
         return
 Poset(self.hasse_diagram().disjoint_union(other.hasse_diagram()))
     if relabel == 'linear':
         return
 Poset(self._hasse_diagram.disjoint_union(other.hasse_diagram(),
 verbose_relabel=False))
 }}}

 1) Why I must say `other.hasse_diagram()` on last line,
 `other._hasse_diagram` should work. Again some copy-immutable -thing?

 2) What should be the name of parameter and values for it?
 `verbose_relabel` to be consistent with graphs? Default value for it?

--
Ticket URL: <http://trac.sagemath.org/ticket/17053#comment:6>
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/d/optout.

Reply via email to