#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):
Then it would be like
{{{
def direct_sum(self, other, labels='pairs'):
"""
Docs here...
Examples: ...
Now we want literally direct sum with elements untouched:
sage: P1=Poset({'a':['b']})
sage: P2=Poset({'c':['d']})
sage: P=P1.direct_sum(P2).relabel(lambda x: x[1])
sage: P.list()
['a', 'b', 'c', 'd']
"""
if not hasattr(other, 'hasse_diagram'):
raise ValueError('The input is not a finite poset.')
if labels == 'pairs':
return
Poset(self.hasse_diagram().disjoint_union(other.hasse_diagram()))
if labels == 'integers':
return
Poset(self.hasse_diagram().disjoint_union(other.hasse_diagram(),
verbose_relabel=False))
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/17053#comment:8>
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.