# HG changeset patch
# User Franco Saliola <saliola@gmail.com>
# Date 1368736869 14400
# Node ID 1d1ff467d207c710f6ad3f8e2652b2944eedf6f0
# Parent 0c3a344c14bf71c8e7d444ee80ebc02c2fbae9b5
[mq]: trac_14141-add-r-fs.patch
diff --git a/sage/combinat/knutson_tao_puzzles.py b/sage/combinat/knutson_tao_puzzles.py
a
|
b
|
class PuzzlePiece(object): |
60 | 60 | """ |
61 | 61 | |
62 | 62 | def __eq__(self, other): |
63 | | """ |
| 63 | r""" |
64 | 64 | TESTS:: |
65 | 65 | |
66 | 66 | sage: from sage.combinat.knutson_tao_puzzles import DeltaPiece |
… |
… |
class PuzzlePiece(object): |
78 | 78 | return False |
79 | 79 | |
80 | 80 | def __hash__(self): |
81 | | """ |
| 81 | r""" |
82 | 82 | TESTS:: |
83 | 83 | |
84 | 84 | sage: from sage.combinat.knutson_tao_puzzles import DeltaPiece |
… |
… |
class PuzzlePiece(object): |
89 | 89 | return hash((type(self), self.border())) |
90 | 90 | |
91 | 91 | def border(self): |
92 | | """ |
| 92 | r""" |
93 | 93 | Returns the border of ``self``. |
94 | 94 | |
95 | 95 | EXAMPLES:: |
… |
… |
class PuzzlePiece(object): |
102 | 102 | return tuple(self.edge_label(edge) for edge in self.edges()) |
103 | 103 | |
104 | 104 | def color(self): |
105 | | """ |
| 105 | r""" |
106 | 106 | Returns the color of ``self``. |
107 | 107 | |
108 | 108 | EXAMPLES:: |
… |
… |
class PuzzlePiece(object): |
144 | 144 | return color |
145 | 145 | |
146 | 146 | def _plot_label(self, label, coords, fontcolor=(0.3,0.3,0.3), fontsize=15, rotation=0): |
147 | | """ |
| 147 | r""" |
148 | 148 | TESTS:: |
149 | 149 | |
150 | 150 | sage: from sage.combinat.knutson_tao_puzzles import DeltaPiece |
… |
… |
class PuzzlePiece(object): |
157 | 157 | return Graphics() |
158 | 158 | |
159 | 159 | def _plot_piece(self, coords, border_color=(0.5,0.5,0.5), border_thickness=1, style='fill'): |
160 | | """ |
| 160 | r""" |
161 | 161 | TESTS:: |
162 | 162 | |
163 | 163 | sage: from sage.combinat.knutson_tao_puzzles import DeltaPiece |
… |
… |
class PuzzlePiece(object): |
211 | 211 | return color |
212 | 212 | |
213 | 213 | def edge_label(self, edge): |
214 | | """ |
| 214 | r""" |
215 | 215 | Return the edge label of ``edge``. |
216 | 216 | |
217 | 217 | EXAMPLES:: |
… |
… |
class RhombusPiece(PuzzlePiece): |
428 | 428 | 2/\3 6\/5 |
429 | 429 | """ |
430 | 430 | def __init__(self, north_piece, south_piece): |
431 | | """ |
| 431 | r""" |
432 | 432 | EXAMPLES:: |
433 | 433 | |
434 | 434 | sage: from sage.combinat.knutson_tao_puzzles import DeltaPiece, NablaPiece, RhombusPiece |
… |
… |
class RhombusPiece(PuzzlePiece): |
491 | 491 | return self._south_piece |
492 | 492 | |
493 | 493 | def __repr__(self): |
494 | | """ |
| 494 | r""" |
495 | 495 | EXAMPLES:: |
496 | 496 | |
497 | 497 | sage: from sage.combinat.knutson_tao_puzzles import DeltaPiece, NablaPiece, RhombusPiece |
… |
… |
class PuzzlePieces(object): |
548 | 548 | 1/\1 10\/0, 1/\1 1\/1, 10/\1 0\/0, 10/\1 1\/10] |
549 | 549 | """ |
550 | 550 | def __init__(self, forbidden_border_labels=None): |
551 | | """ |
| 551 | r""" |
552 | 552 | INPUT: |
553 | 553 | |
554 | 554 | - ``forbidden_border_labels`` -- list of forbidden border labels given as strings |
… |
… |
class PuzzlePieces(object): |
576 | 576 | self._forbidden_border_labels = forbidden_border_labels |
577 | 577 | |
578 | 578 | def __eq__(self, other): |
579 | | """ |
| 579 | r""" |
580 | 580 | TESTS:: |
581 | 581 | |
582 | 582 | sage: from sage.combinat.knutson_tao_puzzles import H_grassmannian_pieces |
… |
… |
class PuzzlePieces(object): |
591 | 591 | return False |
592 | 592 | |
593 | 593 | def __hash__(self): |
594 | | """ |
| 594 | r""" |
595 | 595 | TESTS:: |
596 | 596 | |
597 | 597 | sage: from sage.combinat.knutson_tao_puzzles import H_grassmannian_pieces |
… |
… |
class PuzzlePieces(object): |
701 | 701 | self.add_piece(NablaPiece('T%s|%s' % (label1, label2), label1, label2), rotations=180) |
702 | 702 | |
703 | 703 | def __repr__(self): |
704 | | """ |
| 704 | r""" |
705 | 705 | TESTS:: |
706 | 706 | |
707 | 707 | sage: from sage.combinat.knutson_tao_puzzles import PuzzlePieces, DeltaPiece |
… |
… |
class PuzzlePieces(object): |
717 | 717 | return s |
718 | 718 | |
719 | 719 | def delta_pieces(self): |
720 | | """ |
| 720 | r""" |
721 | 721 | Returns the delta pieces as a set. |
722 | 722 | |
723 | 723 | EXAMPLES:: |
… |
… |
class PuzzlePieces(object): |
732 | 732 | return self._delta_pieces |
733 | 733 | |
734 | 734 | def nabla_pieces(self): |
735 | | """ |
| 735 | r""" |
736 | 736 | Returns the nabla pieces as a set. |
737 | 737 | |
738 | 738 | EXAMPLES:: |
… |
… |
class PuzzlePieces(object): |
770 | 770 | return rhombi |
771 | 771 | |
772 | 772 | def boundary_deltas(self): |
773 | | """ |
| 773 | r""" |
774 | 774 | Returns deltas with south edges not in the forbidden list. |
775 | 775 | |
776 | 776 | EXAMPLES:: |
… |
… |
class PuzzleFilling(object): |
960 | 960 | Create partial puzzles and provides methods to build puzzles from them. |
961 | 961 | """ |
962 | 962 | def __init__(self, north_west_labels, north_east_labels): |
963 | | """ |
| 963 | r""" |
964 | 964 | TESTS:: |
965 | 965 | |
966 | 966 | sage: from sage.combinat.knutson_tao_puzzles import PuzzleFilling |
… |
… |
class PuzzleFilling(object): |
975 | 975 | self._kink_coordinates = (1, self._n) |
976 | 976 | |
977 | 977 | def __getitem__(self, key): |
978 | | """ |
| 978 | r""" |
979 | 979 | TESTS:: |
980 | 980 | |
981 | 981 | sage: from sage.combinat.knutson_tao_puzzles import KnutsonTaoPuzzleSolver |
… |
… |
class PuzzleFilling(object): |
1009 | 1009 | return self._kink_coordinates |
1010 | 1010 | |
1011 | 1011 | def is_in_south_edge(self): |
1012 | | """ |
| 1012 | r""" |
1013 | 1013 | Checks whether kink coordinates of partial puzzle is in south corner. |
1014 | 1014 | |
1015 | 1015 | EXAMPLES:: |
… |
… |
class PuzzleFilling(object): |
1023 | 1023 | return i == j |
1024 | 1024 | |
1025 | 1025 | def north_west_label_of_kink(self): |
1026 | | """ |
| 1026 | r""" |
1027 | 1027 | Return north-west label of kink. |
1028 | 1028 | |
1029 | 1029 | EXAMPLES:: |
… |
… |
class PuzzleFilling(object): |
1040 | 1040 | return self._squares[i-1,j]['south_east'] |
1041 | 1041 | |
1042 | 1042 | def north_east_label_of_kink(self): |
1043 | | """ |
| 1043 | r""" |
1044 | 1044 | Return north east label of kink. |
1045 | 1045 | |
1046 | 1046 | EXAMPLES:: |
… |
… |
class PuzzleFilling(object): |
1057 | 1057 | return self._squares[i,j+1]['south_west'] |
1058 | 1058 | |
1059 | 1059 | def is_completed(self): |
1060 | | """ |
| 1060 | r""" |
1061 | 1061 | Whether partial puzzle is complete (completely filled) or not. |
1062 | 1062 | |
1063 | 1063 | EXAMPLES:: |
… |
… |
class PuzzleFilling(object): |
1077 | 1077 | return i == self._n + 1 |
1078 | 1078 | |
1079 | 1079 | def south_labels(self): |
1080 | | """ |
| 1080 | r""" |
1081 | 1081 | Return south labels for completed puzzle. |
1082 | 1082 | |
1083 | 1083 | EXAMPLES:: |
… |
… |
class PuzzleFilling(object): |
1188 | 1188 | return z |
1189 | 1189 | |
1190 | 1190 | def __repr__(self): |
1191 | | """ |
| 1191 | r""" |
1192 | 1192 | TESTS:: |
1193 | 1193 | |
1194 | 1194 | sage: from sage.combinat.knutson_tao_puzzles import H_grassmannian_pieces, PuzzleFilling |
… |
… |
class PuzzleFilling(object): |
1200 | 1200 | return str(self._squares) |
1201 | 1201 | |
1202 | 1202 | def __iter__(self): |
1203 | | """ |
| 1203 | r""" |
1204 | 1204 | Iterator. |
1205 | 1205 | |
1206 | 1206 | TESTS:: |
… |
… |
class KnutsonTaoPuzzleSolver(UniqueRepre |
1555 | 1555 | |
1556 | 1556 | @staticmethod |
1557 | 1557 | def __classcall_private__(cls, puzzle_pieces, max_letter=None): |
1558 | | """ |
| 1558 | r""" |
1559 | 1559 | TESTS:: |
1560 | 1560 | |
1561 | 1561 | sage: from sage.combinat.knutson_tao_puzzles import * |
… |
… |
class KnutsonTaoPuzzleSolver(UniqueRepre |
1591 | 1591 | return super(KnutsonTaoPuzzleSolver, cls).__classcall__(cls, puzzle_pieces) |
1592 | 1592 | |
1593 | 1593 | def __call__(self, lamda, mu, algorithm='strips'): |
1594 | | """ |
| 1594 | r""" |
1595 | 1595 | TESTS:: |
1596 | 1596 | |
1597 | 1597 | sage: from sage.combinat.knutson_tao_puzzles import KnutsonTaoPuzzleSolver |
… |
… |
class KnutsonTaoPuzzleSolver(UniqueRepre |
1612 | 1612 | solutions = __call__ |
1613 | 1613 | |
1614 | 1614 | def __repr__(self): |
1615 | | """ |
| 1615 | r""" |
1616 | 1616 | EXAMPLES:: |
1617 | 1617 | |
1618 | 1618 | sage: from sage.combinat.knutson_tao_puzzles import KnutsonTaoPuzzleSolver |