Ticket #13425: trac_13425-review_two-cs.patch
File trac_13425-review_two-cs.patch, 10.2 KB (added by , 7 years ago) |
---|
-
sage/combinat/cluster_algebra_quiver/cluster_seed.py
# HG changeset patch # User Christian Stump <christian.stump at gmail.com> # Date 1363804671 -3600 # Node ID 1d453851f5b93e96eef56e6daa63225b4cc91815 # Parent 5dd0c68446bf57a22b6b5737cce32989a512f289 Trac 13425: Second review patch diff --git a/sage/combinat/cluster_algebra_quiver/cluster_seed.py b/sage/combinat/cluster_algebra_quiver/cluster_seed.py
a b class ClusterSeed(SageObject): 1313 1313 1314 1314 sage: A = ClusterSeed(['A',3]).mutation_class() 1315 1315 """ 1316 if depth is infinity :1317 assert self.is_finite(), 'The mutation class can - for infinite types - only be computed up to a given depth'1316 if depth is infinity and not self.is_finite(): 1317 raise ValueError('The mutation class can - for infinite types - only be computed up to a given depth') 1318 1318 return list( S for S in self.mutation_class_iter( depth=depth, show_depth=show_depth, return_paths=return_paths, up_to_equivalence=up_to_equivalence, only_sink_source=only_sink_source ) ) 1319 1319 1320 1320 def cluster_class_iter(self, depth=infinity, show_depth=False, up_to_equivalence=True): … … class ClusterSeed(SageObject): 1448 1448 1449 1449 sage: A = ClusterSeed(['A',3]).cluster_class() 1450 1450 """ 1451 if depth is infinity :1452 assert self.is_finite(), 'The variable class can - for infinite types - only be computed up to a given depth'1451 if depth is infinity and not self.is_finite(): 1452 raise ValueError('The variable class can - for infinite types - only be computed up to a given depth') 1453 1453 1454 1454 return [ c for c in self.cluster_class_iter(depth=depth, show_depth=show_depth, up_to_equivalence=up_to_equivalence) ] 1455 1455 … … class ClusterSeed(SageObject): 1600 1600 sage: A = ClusterSeed(['A',3]).b_matrix_class() 1601 1601 sage: A = ClusterSeed(['A',[2,1],1]).b_matrix_class() 1602 1602 """ 1603 if depth is infinity :1604 assert self.is_mutation_finite(), 'The B-matrix class can - for infinite mutation types - only be computed up to a given depth'1603 if depth is infinity and not self.is_mutation_finite(): 1604 raise ValueError('The B-matrix class can - for infinite mutation types - only be computed up to a given depth') 1605 1605 1606 1606 return [ M for M in self.b_matrix_class_iter( depth=depth, up_to_equivalence=up_to_equivalence ) ] 1607 1607 … … class ClusterSeed(SageObject): 1749 1749 1750 1750 sage: A = ClusterSeed(['A',3]).variable_class() 1751 1751 """ 1752 if depth is infinity :1753 assert self.is_finite(), 'The variable class can - for infinite types - only be computed up to a given depth'1752 if depth is infinity and not self.is_finite(): 1753 raise ValueError('The variable class can - for infinite types - only be computed up to a given depth') 1754 1754 1755 1755 var_iter = self.variable_class_iter( depth=depth, ignore_bipartite_belt=ignore_bipartite_belt ) 1756 1756 Vs = [ var for var in var_iter ] -
sage/combinat/cluster_algebra_quiver/quiver.py
diff --git a/sage/combinat/cluster_algebra_quiver/quiver.py b/sage/combinat/cluster_algebra_quiver/quiver.py
a b AUTHORS: 15 15 16 16 .. seealso:: For mutation types of combinatorial quivers, see :meth:`~sage.combinat.cluster_algebra_quiver.quiver_mutation_type.QuiverMutationType`. Cluster seeds are closely related to :meth:`~sage.combinat.cluster_algebra_quiver.cluster_seed.ClusterSeed`. 17 17 """ 18 19 18 #***************************************************************************** 20 19 # Copyright (C) 2011 Gregg Musiker <musiker@math.mit.edu> 21 20 # Christian Stump <christian.stump@univie.ac.at> … … class ClusterQuiver(SageObject): 174 173 Traceback (most recent call last): 175 174 ... 176 175 ValueError: The input data was not recognized. 177 178 176 """ 179 177 def __init__( self, data, frozen=None ): 180 178 """ … … class ClusterQuiver(SageObject): 725 723 sage: ClusterQuiver(['B',4,1]).mutation_type() 726 724 ['BD', 4, 1] 727 725 728 -finite types::726 finite types:: 729 727 730 728 sage: Q = ClusterQuiver(['A',5]) 731 729 sage: Q._mutation_type = None … … class ClusterQuiver(SageObject): 736 734 sage: Q.mutation_type() 737 735 ['A', 5] 738 736 739 -affine types::737 affine types:: 740 738 741 739 sage: Q = ClusterQuiver(['E',8,[1,1]]); Q 742 740 Quiver on 10 vertices of type ['E', 8, [1, 1]] … … class ClusterQuiver(SageObject): 745 743 sage: Q.mutation_type() # long time 746 744 ['E', 8, [1, 1]] 747 745 748 -the not yet working affine type D (unless user has saved small classical quiver data)::746 the not yet working affine type D (unless user has saved small classical quiver data):: 749 747 750 748 sage: Q = ClusterQuiver(['D',4,1]) 751 749 sage: Q._mutation_type = None 752 750 sage: Q.mutation_type() # todo: not implemented 753 751 ['D', 4, 1] 754 752 755 -the exceptional types::753 the exceptional types:: 756 754 757 755 sage: Q = ClusterQuiver(['X',6]) 758 756 sage: Q._mutation_type = None 759 757 sage: Q.mutation_type() # long time 760 758 ['X', 6] 761 759 762 -examples from page 8 of Keller's article "Cluster algebras, quiver representations760 examples from page 8 of Keller's article "Cluster algebras, quiver representations 763 761 and triangulated categories" (arXiv:0807.1960):: 764 762 765 763 sage: dg = DiGraph(); dg.add_edges([(9,0),(9,4),(4,6),(6,7),(7,8),(8,3),(3,5),(5,6),(8,1),(2,3)]) … … class ClusterQuiver(SageObject): 774 772 sage: ClusterQuiver( dg ).mutation_type() # long time 775 773 ['E', 8, [1, 1]] 776 774 777 -infinite types::775 infinite types:: 778 776 779 777 sage: Q = ClusterQuiver(['GR',[4,9]]) 780 778 sage: Q._mutation_type = None 781 779 sage: Q.mutation_type() 782 780 'undetermined infinite mutation type' 783 781 784 - reducible types:: 782 reducible types:: 783 785 784 sage: Q = ClusterQuiver([['A', 3], ['B', 3]]) 786 785 sage: Q._mutation_type = None 787 786 sage: Q.mutation_type() … … class ClusterQuiver(SageObject): 802 801 ['undetermined finite mutation type', ['A', 3]] 803 802 804 803 TESTS:: 804 805 805 sage: Q = ClusterQuiver(matrix([[0, 3], [-1, 0], [1, 0], [0, 1]])) 806 806 sage: Q.mutation_type() 807 807 ['G', 2] … … class ClusterQuiver(SageObject): 1483 1483 sage: all( len(ClusterQuiver(['B',n]).mutation_class()) == ClusterQuiver(['B',n]).mutation_type().class_size() for n in [2..6]) 1484 1484 True 1485 1485 """ 1486 if depth is infinity :1487 assert self.is_mutation_finite(), 'The mutation class can - for infinite mutation types - only be computed up to a given depth'1486 if depth is infinity and not self.is_mutation_finite(): 1487 raise ValueError('The mutation class can - for infinite mutation types - only be computed up to a given depth') 1488 1488 return [ Q for Q in self.mutation_class_iter( depth=depth, show_depth=show_depth, return_paths=return_paths, data_type=data_type, up_to_equivalence=up_to_equivalence, sink_source=sink_source ) ] 1489 1489 1490 1490 def is_finite( self ): … … class ClusterQuiver(SageObject): 1493 1493 1494 1494 EXAMPLES:: 1495 1495 1496 sage: Q = ClusterQuiver(['A',3])1497 sage: Q.is_finite()1498 True1499 sage: Q = ClusterQuiver(['A',[2,2],1])1500 sage: Q.is_finite()1501 False1502 sage: Q = ClusterQuiver([['A',3],['B',3]])1503 sage: Q.is_finite()1504 True1505 sage: Q = ClusterQuiver(['T',[4,4,4]])1506 sage: Q.is_finite()1507 False1508 sage: Q = ClusterQuiver([['A',3],['T',[4,4,4]]])1509 sage: Q.is_finite()1510 False1511 sage: Q = ClusterQuiver([['A',3],['T',[2,2,3]]])1512 sage: Q.is_finite()1513 True1514 sage: Q = ClusterQuiver([['A',3],['D',5]])1515 sage: Q.is_finite()1516 True1517 sage: Q = ClusterQuiver([['A',3],['D',5,1]])1518 sage: Q.is_finite()1519 False1496 sage: Q = ClusterQuiver(['A',3]) 1497 sage: Q.is_finite() 1498 True 1499 sage: Q = ClusterQuiver(['A',[2,2],1]) 1500 sage: Q.is_finite() 1501 False 1502 sage: Q = ClusterQuiver([['A',3],['B',3]]) 1503 sage: Q.is_finite() 1504 True 1505 sage: Q = ClusterQuiver(['T',[4,4,4]]) 1506 sage: Q.is_finite() 1507 False 1508 sage: Q = ClusterQuiver([['A',3],['T',[4,4,4]]]) 1509 sage: Q.is_finite() 1510 False 1511 sage: Q = ClusterQuiver([['A',3],['T',[2,2,3]]]) 1512 sage: Q.is_finite() 1513 True 1514 sage: Q = ClusterQuiver([['A',3],['D',5]]) 1515 sage: Q.is_finite() 1516 True 1517 sage: Q = ClusterQuiver([['A',3],['D',5,1]]) 1518 sage: Q.is_finite() 1519 False 1520 1520 1521 sage: Q = ClusterQuiver([[0,1,2],[1,2,2],[2,0,2]])1522 sage: Q.is_finite()1523 False1521 sage: Q = ClusterQuiver([[0,1,2],[1,2,2],[2,0,2]]) 1522 sage: Q.is_finite() 1523 False 1524 1524 1525 sage: Q = ClusterQuiver([[0,1,2],[1,2,2],[2,0,2],[3,4,1],[4,5,1]])1526 sage: Q.is_finite()1527 False1525 sage: Q = ClusterQuiver([[0,1,2],[1,2,2],[2,0,2],[3,4,1],[4,5,1]]) 1526 sage: Q.is_finite() 1527 False 1528 1528 """ 1529 1529 mt = self.mutation_type() 1530 1530 if type( mt ) in [QuiverMutationType_Irreducible, QuiverMutationType_Reducible] and mt.is_finite(): -
sage/combinat/cluster_algebra_quiver/quiver_mutation_type.py
diff --git a/sage/combinat/cluster_algebra_quiver/quiver_mutation_type.py b/sage/combinat/cluster_algebra_quiver/quiver_mutation_type.py
a b def _save_data_dig6(n, types='ClassicalE 2118 2118 def save_quiver_data(n, up_to=True, types='ClassicalExceptional', verbose=True): 2119 2119 r""" 2120 2120 Saves mutation classes of certain quivers of ranks up to and equal to ``n`` or equal to ``n`` 2121 to ``SAGE_SHARE/cluster_algebra_quiver/mutation_classes_n.dig6 .2121 to ``SAGE_SHARE/cluster_algebra_quiver/mutation_classes_n.dig6``. 2122 2122 2123 2123 This data will then be used to determine quiver mutation types. 2124 2124