Ticket #14216: trac-14216-combinat-small-cleanup-fc.patch

File trac-14216-combinat-small-cleanup-fc.patch, 4.1 KB (added by chapoton, 9 years ago)
  • sage/combinat/all.py

    # HG changeset patch
    # User Frederic Chapoton <chapoton at math.univ-lyon1.fr>
    # Date 1362305007 -3600
    # Node ID 8a287dd7a15905db3a3e5599995a22edbe0304ab
    # Parent  be4962cdd100d0521c00f2469aa014e2a124ca5c
    trac #14216 small cleanup of some combinat files
    
    diff --git a/sage/combinat/all.py b/sage/combinat/all.py
    a b from finite_class import FiniteCombinato 
    116116
    117117
    118118from species.all import *
    119 from dlx import AllExactCovers, OneExactCover, DLXMatrix
    120119
    121120from multichoose_nk import MultichooseNK
    122121
  • sage/combinat/posets/hasse_diagram.py

    diff --git a/sage/combinat/posets/hasse_diagram.py b/sage/combinat/posets/hasse_diagram.py
    a b Hasse diagrams of posets 
    1717#                  http://www.gnu.org/licenses/
    1818#*****************************************************************************
    1919
    20 import copy
     20from copy import copy
    2121from sage.graphs.digraph import DiGraph
    2222from sage.matrix.constructor import matrix
    2323from sage.rings.integer_ring import ZZ
    class HasseDiagram(DiGraph): 
    934934            sage: H.order_ideal([7,10])
    935935            [0, 1, 2, 3, 4, 5, 6, 7, 8, 10]
    936936        """
    937         from copy import copy
    938937        H = copy(self).reverse()
    939938        oi = []
    940939        for i in elements:
    class HasseDiagram(DiGraph): 
    11041103            return self._meet
    11051104        n = self.cardinality()
    11061105        meet = [[0 for x in range(n)] for x in range(n)]
    1107         le = copy.copy(self.lequal_matrix())
     1106        le = copy(self.lequal_matrix())
    11081107        for i in range(n): le[i,i] = 1
    11091108        if not all([le[0,x]==1 for x in range(n)]):
    1110             raise ValueError, "Not a meet-semilattice: no bottom element."
     1109            raise ValueError("Not a meet-semilattice: no bottom element.")
    11111110        lc = [[y[0] for y in self.incoming_edges([x])] for x in range(n)]
    11121111
    11131112        for x in range(n): # x=x_k
    class HasseDiagram(DiGraph): 
    11221121                    if z>q: q = z
    11231122                for z in T:
    11241123                    if not le[z,q]:
    1125                         raise ValueError, "No meet for x=%s y=%s"%(x,y)
     1124                        raise ValueError("No meet for x=%s y=%s"%(x,y))
    11261125                meet[x][y] = q
    11271126                meet[y][x] = q
    11281127
    class HasseDiagram(DiGraph): 
    12091208        if hasattr(self,'_join'): return self._join
    12101209        n = self.cardinality()
    12111210        join = [[0 for x in range(n)] for x in range(n)]
    1212         le = copy.copy(self.lequal_matrix())
     1211        le = copy(self.lequal_matrix())
    12131212        for i in range(n): le[i,i] = 1
    12141213        if not all([le[x,n-1]==1 for x in range(n)]):
    1215             raise ValueError, "Not a join-semilattice: no top element."
     1214            raise ValueError("Not a join-semilattice: no top element.")
    12161215        uc = [sorted([n-1-y[1] for y in self.outgoing_edges([x])]) for
    12171216                x in reversed(range(n))]
    12181217
    class HasseDiagram(DiGraph): 
    12281227                    if z>q: q = z
    12291228                for z in T:
    12301229                    if not le[n-1-q,n-1-z]:
    1231                         raise ValueError, "No join for x=%s y=%s"%(x,y)
     1230                        raise ValueError("No join for x=%s y=%s"%(x,y))
    12321231                join[x][y] = q
    12331232                join[y][x] = q
    12341233
  • sage/combinat/posets/linear_extensions.py

    diff --git a/sage/combinat/posets/linear_extensions.py b/sage/combinat/posets/linear_extensions.py
    a b class LinearExtensionOfPoset(ClonableArr 
    323323            sage: p.evacuation().evacuation() == p
    324324            True
    325325        """
    326         L = []
    327326        for i in reversed(range(1,len(self)+1)):
    328327            for j in range(1,i):
    329328                self = self.tau(j)
  • sage/combinat/posets/poset_examples.py

    diff --git a/sage/combinat/posets/poset_examples.py b/sage/combinat/posets/poset_examples.py
    a b class Posets(object): 
    405405            atstring = []
    406406            btstring = []
    407407            c=0
    408             d=0
    409408            for i in range(len(a)):
    410409                atstring=atstring+a[i]
    411410            for i in range(len(b)):