Ticket #13425: trac_13425-review_two-cs.patch

File trac_13425-review_two-cs.patch, 10.2 KB (added by stumpc5, 6 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): 
    13131313
    13141314            sage: A = ClusterSeed(['A',3]).mutation_class()
    13151315        """
    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')
    13181318        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 ) )
    13191319
    13201320    def cluster_class_iter(self, depth=infinity, show_depth=False, up_to_equivalence=True):
    class ClusterSeed(SageObject): 
    14481448
    14491449            sage: A = ClusterSeed(['A',3]).cluster_class()
    14501450        """
    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')
    14531453
    14541454        return [ c for c in self.cluster_class_iter(depth=depth, show_depth=show_depth, up_to_equivalence=up_to_equivalence) ]
    14551455
    class ClusterSeed(SageObject): 
    16001600            sage: A = ClusterSeed(['A',3]).b_matrix_class()
    16011601            sage: A = ClusterSeed(['A',[2,1],1]).b_matrix_class()
    16021602        """
    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')
    16051605
    16061606        return [ M for M in self.b_matrix_class_iter( depth=depth, up_to_equivalence=up_to_equivalence ) ]
    16071607
    class ClusterSeed(SageObject): 
    17491749
    17501750            sage: A = ClusterSeed(['A',3]).variable_class()
    17511751        """
    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')
    17541754
    17551755        var_iter = self.variable_class_iter( depth=depth, ignore_bipartite_belt=ignore_bipartite_belt )
    17561756        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: 
    1515
    1616.. 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`.
    1717"""
    18 
    1918#*****************************************************************************
    2019#       Copyright (C) 2011 Gregg Musiker <musiker@math.mit.edu>
    2120#                          Christian Stump <christian.stump@univie.ac.at>
    class ClusterQuiver(SageObject): 
    174173        Traceback (most recent call last):
    175174        ...
    176175        ValueError: The input data was not recognized.
    177 
    178176    """
    179177    def __init__( self, data, frozen=None ):
    180178        """
    class ClusterQuiver(SageObject): 
    725723            sage: ClusterQuiver(['B',4,1]).mutation_type()
    726724            ['BD', 4, 1]
    727725
    728         - finite types::
     726        finite types::
    729727
    730728            sage: Q = ClusterQuiver(['A',5])
    731729            sage: Q._mutation_type = None
    class ClusterQuiver(SageObject): 
    736734            sage: Q.mutation_type()
    737735            ['A', 5]
    738736
    739         - affine types::
     737        affine types::
    740738
    741739            sage: Q = ClusterQuiver(['E',8,[1,1]]); Q
    742740            Quiver on 10 vertices of type ['E', 8, [1, 1]]
    class ClusterQuiver(SageObject): 
    745743            sage: Q.mutation_type() # long time
    746744            ['E', 8, [1, 1]]
    747745
    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)::
    749747
    750748            sage: Q = ClusterQuiver(['D',4,1])
    751749            sage: Q._mutation_type = None
    752750            sage: Q.mutation_type() # todo: not implemented
    753751            ['D', 4, 1]
    754752
    755         - the exceptional types::
     753        the exceptional types::
    756754
    757755            sage: Q = ClusterQuiver(['X',6])
    758756            sage: Q._mutation_type = None
    759757            sage: Q.mutation_type() # long time
    760758            ['X', 6]
    761759
    762         - examples from page 8 of Keller's article "Cluster algebras, quiver representations
     760        examples from page 8 of Keller's article "Cluster algebras, quiver representations
    763761        and triangulated categories" (arXiv:0807.1960)::
    764762
    765763            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): 
    774772            sage: ClusterQuiver( dg ).mutation_type() # long time
    775773            ['E', 8, [1, 1]]
    776774
    777         - infinite types::
     775        infinite types::
    778776
    779777            sage: Q = ClusterQuiver(['GR',[4,9]])
    780778            sage: Q._mutation_type = None
    781779            sage: Q.mutation_type()
    782780            'undetermined infinite mutation type'
    783781
    784         - reducible types::
     782        reducible types::
     783
    785784            sage: Q = ClusterQuiver([['A', 3], ['B', 3]])
    786785            sage: Q._mutation_type = None
    787786            sage: Q.mutation_type()
    class ClusterQuiver(SageObject): 
    802801            ['undetermined finite mutation type', ['A', 3]]
    803802
    804803        TESTS::
     804
    805805            sage: Q = ClusterQuiver(matrix([[0, 3], [-1, 0], [1, 0], [0, 1]]))
    806806            sage: Q.mutation_type()
    807807            ['G', 2]
    class ClusterQuiver(SageObject): 
    14831483            sage: all( len(ClusterQuiver(['B',n]).mutation_class()) == ClusterQuiver(['B',n]).mutation_type().class_size() for n in [2..6])
    14841484            True
    14851485        """
    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')
    14881488        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 ) ]
    14891489
    14901490    def is_finite( self ):
    class ClusterQuiver(SageObject): 
    14931493
    14941494        EXAMPLES::
    14951495
    1496         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
     1496            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
    15201520
    1521         sage: Q = ClusterQuiver([[0,1,2],[1,2,2],[2,0,2]])
    1522         sage: Q.is_finite()
    1523         False
     1521            sage: Q = ClusterQuiver([[0,1,2],[1,2,2],[2,0,2]])
     1522            sage: Q.is_finite()
     1523            False
    15241524
    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         False
     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            False
    15281528        """
    15291529        mt = self.mutation_type()
    15301530        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 
    21182118def save_quiver_data(n, up_to=True, types='ClassicalExceptional', verbose=True):
    21192119    r"""
    21202120    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``.
    21222122
    21232123    This data will then be used to determine quiver mutation types.
    21242124