Ticket #14141: trac_14141-BK-fix-fs.patch

File trac_14141-BK-fix-fs.patch, 5.2 KB (added by saliola, 8 years ago)
  • sage/combinat/knutson_tao_puzzles.py

    # HG changeset patch
    # User Franco Saliola <saliola@gmail.com>
    # Date 1368504746 14400
    # Node ID bb92189638fd842c178ca4bccc25398f8f2f2c73
    # Parent  16c3277ad4c1699b97852c96c0bc4dfc50eae2ae
    [mq]: trac_14141-BK-fix-fs.patch
    
    diff --git a/sage/combinat/knutson_tao_puzzles.py b/sage/combinat/knutson_tao_puzzles.py
    a b def HT_two_step_pieces(): 
    906906
    907907def BK_pieces(max_letter):
    908908    """
    909     Defines the puzzle pieces used in computing the Belkale-Kumar coefficients for any partial flag variety in type `A`.
     909    The puzzle pieces used in computing the Belkale-Kumar coefficients for any
     910    partial flag variety in type `A`.
     911
     912    There are two types of puzzle pieces:
     913
     914    - a triangle, with each edge labeled with the same letter;
     915    - a rhombus, with edges labeled `i`, `j`, `i`, `j` in clockwise order with
     916      `i > j`.
     917
     918    Each of these is rotated by 60 degrees, but not reflected.
     919
     920    We model the rhombus pieces as two triangles: a delta piece north-west
     921    label `i`, north-east label `j` and south label `i(j)`; and a nabla piece
     922    with south-east label `i`, south-west label `j` and north label `i(j)`.
    910923
    911924    INPUT:
    912925
    913     - ``max_letter`` -- positive integer specifying the number of steps in the partial flag variety
     926    - ``max_letter`` -- positive integer specifying the number of steps in the
     927      partial flag variety, equivalently, the number of elements in the
     928      alphabet for the edge labels. The smallest label is `1`.
    914929
    915930    REFERENCES:
    916931
    917     .. [KnutsonPurbhoo10] A. Knutson, K. Purbhoo, Product and puzzle formulae for `GL_n` Belkale-Kumar coefficients,
    918        {{{:arXiv:`1008.4979`}}}
     932    .. [KnutsonPurbhoo10] A. Knutson, K. Purbhoo, Product and puzzle formulae
     933       for `GL_n` Belkale-Kumar coefficients, {{{:arXiv:`1008.4979`}}}
    919934
    920935    EXAMPLES::
    921936
    922937        sage: from sage.combinat.knutson_tao_puzzles import BK_pieces
    923938        sage: BK_pieces(3)
    924         Nablas : [0\0/0, 1\1/1, 2\2/2, 3\3/3]
    925         Deltas : [0/0\0, 1/1\1, 2/2\2, 3/3\3]
     939        Nablas : [1\1/1, 1\2(1)/2, 1\3(1)/3, 2(1)\2/1, 2\1/2(1), 2\2/2, 2\3(2)/3, 3(1)\3/1, 3(2)\3/2, 3\1/3(1), 3\2/3(2), 3\3/3]
     940        Deltas : [1/1\1, 1/2\2(1), 1/3\3(1), 2(1)/1\2, 2/2(1)\1, 2/2\2, 2/3\3(2), 3(1)/1\3, 3(2)/2\3, 3/3(1)\1, 3/3(2)\2, 3/3\3]
     941
    926942    """
    927     max_letter += 1
    928     forbidden_border_labels = ['%s%s' % (i,j) for j in range(max_letter-1) for i in range(j+1,max_letter)]
     943    forbidden_border_labels = ['%s(%s)' % (i, j)
     944                                for i in range(1, max_letter + 1)
     945                                for j in range(1, i)]
    929946    pieces = PuzzlePieces(forbidden_border_labels)
    930     for j in range(0, max_letter):
    931         jstr = '%s'%j
    932         pieces.add_piece(DeltaPiece(jstr,jstr,jstr), rotations = 60)
    933 
    934     for i in range(j+1, max_letter):
    935         istr = '%s'%i
    936         pieces.add_piece(DeltaPiece(istr+jstr, istr, jstr), rotations = 60)
    937 
     947    for i in range(1, max_letter + 1):
     948        piece = DeltaPiece('%s'%i, '%s'%i, '%s'%i)
     949        pieces.add_piece(piece, rotations=60)
     950        for j in range(1, i):
     951            piece = DeltaPiece(north_west='%s'%i, north_east='%s'%j, south='%s(%s)'%(i,j))
     952            pieces.add_piece(piece, rotations=60)
    938953    return pieces
    939954
    940955class PuzzleFilling(object):
    class KnutsonTaoPuzzleSolver(UniqueRepre 
    14781493            {(1, 2): 0/\21  21\/0, (1, 3): 2/\2  21\/1, (3, 3): 0/0\0, (4, 5): 2/\1  1\/2, (4, 4): 1/1\1, (5, 5): 2/2\2, (1, 4): 1/\1  2\/21, (1, 1): 1/2\21, (1, 5): 2/\1  1\/2, (2, 3): 1/\1  10\/0, (2, 2): 0/1\10, (2, 5): 2/\2  2\/2, (3, 4): 1/\0  0\/1, (2, 4): 21/\2  1\/1, (3, 5): 2/\0  0\/2}]
    14791494
    14801495
    1481         Belkale-Kumar puzzles::
     1496        Belkale-Kumar puzzles (the following example is Figure 2 of [KnutsonPurbhoo10])::
    14821497
    1483             sage: ps = KnutsonTaoPuzzleSolver("BK", 3)
    1484             sage: solns = ps('10212', '12012')
    1485             sage: sorted(solns, key=str)
     1498            sage: ps = KnutsonTaoPuzzleSolver('BK', 3)
     1499            sage: solns = ps('12132', '23112')
     1500            sage: len(solns)
     1501            1
     1502            sage: solns[0].south_labels()
     1503            ('3', '2', '1', '2', '1')
     1504            sage: solns
     1505            [{(1, 2): 2/\3(2)  3(1)\/1, (1, 3): 1/\3(1)  3(2)\/2, (3, 3): 1/1\1, (4, 5): 1/\1  2\/2(1), (4, 4): 2/2\2, (5, 5): 2(1)/1\2, (1, 4): 3/\3  3(1)\/1, (1, 1): 1/3\3(1), (1, 5): 2/\2  3\/3(2), (2, 3): 2/\2  2(1)\/1, (2, 2): 1/2\2(1), (2, 5): 3(2)/\3  2(1)\/1, (3, 4): 2/\1  1\/2, (2, 4): 1/\2(1)  2\/2, (3, 5): 1/\1  1\/1}]
    14861506
    14871507        TESTS:
    14881508
    class KnutsonTaoPuzzleSolver(UniqueRepre 
    15761596        """
    15771597        return "Knutson-Tao puzzle solver with pieces:\n%s" % self._puzzle_pieces
    15781598
     1599    def puzzle_pieces(self):
     1600        r"""
     1601        The puzzle pieces used for filling in the puzzles.
     1602
     1603        EXAMPLES::
     1604
     1605            sage: from sage.combinat.knutson_tao_puzzles import KnutsonTaoPuzzleSolver
     1606            sage: ps = KnutsonTaoPuzzleSolver('H')
     1607            sage: ps.puzzle_pieces()
     1608            Nablas : [0\0/0, 0\10/1, 10\1/0, 1\0/10, 1\1/1]
     1609            Deltas : [0/0\0, 0/1\10, 1/10\0, 1/1\1, 10/0\1]
     1610        """
     1611        return self._puzzle_pieces
     1612
    15791613    def _fill_piece(self, nw_label, ne_label, pieces):
    15801614        """
    15811615        Fillings of a piece.