@@ -370,7 +370,7 @@ def __init__(self, data, frozen=None, is_principal=False, user_labels=None, user
370370 self ._init_exch = dict (islice (self ._init_vars .items (), self ._n ))
371371 self ._U = PolynomialRing (QQ , [f'y{ i } ' for i in range (self ._n )])
372372 self ._F = {i : self ._U (1 ) for i in self ._init_exch .values ()}
373- self ._R = PolynomialRing (QQ , [ val for val in self ._init_vars .values ()] )
373+ self ._R = PolynomialRing (QQ , list ( self ._init_vars .values ()) )
374374 self ._y = {self ._U .gen (j ): prod ([self ._R .gen (i )** self ._M [i , j ] for i in range (self ._n , self ._n + self ._m )])
375375 for j in range (self ._n )}
376376 self ._yhat = {self ._U .gen (j ): prod ([self ._R .gen (i )** self ._M [i , j ] for i in range (self ._n + self ._m )])
@@ -695,7 +695,7 @@ def use_fpolys(self, use=True, user_labels=None, user_labels_prefix=None):
695695 self ._init_exch = dict (islice (self ._init_vars .items (), self ._n ))
696696 self ._U = PolynomialRing (QQ , [f'y{ i } ' for i in range (self ._n )])
697697 self ._F = {i : self ._U (1 ) for i in self ._init_exch .values ()}
698- self ._R = PolynomialRing (QQ , [ val for val in self ._init_vars .values ()] )
698+ self ._R = PolynomialRing (QQ , list ( self ._init_vars .values ()) )
699699 self ._y = {self ._U .gen (j ): prod ([self ._R .gen (i )** self ._M [i , j ] for i in range (self ._n , self ._n + self ._m )])
700700 for j in range (self ._n )}
701701 self ._yhat = {self ._U .gen (j ): prod ([self ._R .gen (i )** self ._M [i , j ] for i in range (self ._n + self ._m )])
@@ -3556,7 +3556,7 @@ def mutation_class_iter(self, depth=infinity, show_depth=False,
35563556 dc += ' ' * (5 - len (dc ))
35573557 nr = str (len (clusters ))
35583558 nr += ' ' * (10 - len (nr ))
3559- print ("Depth: %s found: %s Time: %.2f s" % ( dc , nr , timer2 - timer ) )
3559+ print (f "Depth: { dc } found: { nr } Time: { timer2 - timer :.2f } s" )
35603560
35613561 # Each time we get bigger and we haven't hit the full depth
35623562 while gets_bigger and depth_counter < depth :
@@ -3592,11 +3592,11 @@ def mutation_class_iter(self, depth=infinity, show_depth=False,
35923592 if only_sink_source :
35933593 orbits = list (range (n ))
35943594 else :
3595- orbits = [index for index in range (n ) if index > i or sd2 ._M [index ,i ] != 0 ]
3595+ orbits = [index for index in range (n ) if index > i or sd2 ._M [index , i ] != 0 ]
35963596
35973597 clusters [cl2 ] = [sd2 , orbits , clusters [key ][2 ]+ [i ]]
35983598 if return_paths :
3599- yield (sd2 ,clusters [cl2 ][2 ])
3599+ yield (sd2 , clusters [cl2 ][2 ])
36003600 else :
36013601 yield sd2
36023602 depth_counter += 1
@@ -3606,7 +3606,7 @@ def mutation_class_iter(self, depth=infinity, show_depth=False,
36063606 dc += ' ' * (5 - len (dc ))
36073607 nr = str (len (clusters ))
36083608 nr += ' ' * (10 - len (nr ))
3609- print ("Depth: %s found: %s Time: % .2f s" % ( dc , nr , timer2 - timer ) )
3609+ print (f "Depth: { dc } found: { nr } Time: { timer2 - timer : .2f} s" )
36103610
36113611 def mutation_class (self , depth = infinity , show_depth = False , return_paths = False ,
36123612 up_to_equivalence = True , only_sink_source = False ):
@@ -3773,7 +3773,7 @@ def cluster_class(self, depth=infinity, show_depth=False, up_to_equivalence=True
37733773 if depth is infinity and not self .is_finite ():
37743774 raise ValueError ('The variable class can - for infinite types - only be computed up to a given depth' )
37753775
3776- return [ c for c in self .cluster_class_iter (depth = depth , show_depth = show_depth , up_to_equivalence = up_to_equivalence )]
3776+ return list ( self .cluster_class_iter (depth = depth , show_depth = show_depth , up_to_equivalence = up_to_equivalence ))
37773777
37783778 def b_matrix_class_iter (self , depth = infinity , up_to_equivalence = True ):
37793779 r"""
@@ -3989,51 +3989,51 @@ def variable_class_iter(self, depth=infinity, ignore_bipartite_belt=False):
39893989 (x0^8 + 4*x0^6 + 3*x0^4*x1^2 + 2*x0^2*x1^4 + x1^6 + 6*x0^4 + 6*x0^2*x1^2 + 3*x1^4 + 4*x0^2 + 3*x1^2 + 1)/(x0^3*x1^4)
39903990 (x0^6 + 3*x0^4 + 2*x0^2*x1^2 + x1^4 + 3*x0^2 + 2*x1^2 + 1)/(x0^2*x1^3)
39913991 """
3992- mut_iter = self .mutation_class_iter (depth = depth ,show_depth = False )
3992+ mut_iter = self .mutation_class_iter (depth = depth , show_depth = False )
39933993 var_class = set ()
39943994
39953995 for seed in mut_iter :
39963996 if seed is self :
39973997 seed = ClusterSeed (seed )
39983998 if not ignore_bipartite_belt and seed .is_bipartite ():
39993999 bipartition = seed .is_bipartite (return_bipartition = True )
4000- bipartition = (list (bipartition [0 ]),list (bipartition [1 ]))
4000+ bipartition = (list (bipartition [0 ]), list (bipartition [1 ]))
40014001 if depth is not infinity :
40024002 print ("Found a bipartite seed - restarting the depth counter at zero and constructing the variable class using its bipartite belt." )
40034003 depth_counter = 0
40044004 end = False
40054005 seed2 = ClusterSeed (seed )
40064006 for c in seed .cluster ():
40074007 if c not in var_class :
4008- yield ClusterVariable (FractionField (seed ._R ), c .numerator (), c .denominator (), mutation_type = self ._mutation_type , variable_type = 'cluster variable' ,xdim = seed ._n )
4008+ yield ClusterVariable (FractionField (seed ._R ), c .numerator (), c .denominator (), mutation_type = self ._mutation_type , variable_type = 'cluster variable' , xdim = seed ._n )
40094009 var_class = var_class .union (seed .cluster ())
40104010
40114011 init_cluster = set (seed .cluster ())
40124012 while not end and depth_counter < depth :
40134013 depth_counter += 1
40144014 seed .mutate (bipartition [0 ])
40154015 seed .mutate (bipartition [1 ])
4016- if set (seed .cluster ()) in [set (seed2 .cluster ()),init_cluster ]:
4016+ if set (seed .cluster ()) in [set (seed2 .cluster ()), init_cluster ]:
40174017 end = True
40184018 if not end :
40194019 for c in seed .cluster ():
40204020 if c not in var_class :
4021- yield ClusterVariable (FractionField (seed ._R ), c .numerator (), c .denominator (), mutation_type = self ._mutation_type , variable_type = 'cluster variable' ,xdim = seed ._n )
4021+ yield ClusterVariable (FractionField (seed ._R ), c .numerator (), c .denominator (), mutation_type = self ._mutation_type , variable_type = 'cluster variable' , xdim = seed ._n )
40224022 var_class = var_class .union (seed .cluster ())
40234023 seed2 .mutate (bipartition [1 ])
40244024 seed2 .mutate (bipartition [0 ])
4025- if set (seed2 .cluster ()) in [set (seed .cluster ()),init_cluster ]:
4025+ if set (seed2 .cluster ()) in [set (seed .cluster ()), init_cluster ]:
40264026 end = True
40274027 if not end :
40284028 for c in seed2 .cluster ():
40294029 if c not in var_class :
4030- yield ClusterVariable (FractionField (seed ._R ), c .numerator (), c .denominator (), mutation_type = self ._mutation_type , variable_type = 'cluster variable' ,xdim = seed ._n )
4030+ yield ClusterVariable (FractionField (seed ._R ), c .numerator (), c .denominator (), mutation_type = self ._mutation_type , variable_type = 'cluster variable' , xdim = seed ._n )
40314031 var_class = var_class .union (seed2 .cluster ())
40324032 return
40334033 else :
40344034 for c in seed .cluster ():
40354035 if c not in var_class :
4036- yield ClusterVariable (FractionField (seed ._R ), c .numerator (), c .denominator (), mutation_type = self ._mutation_type , variable_type = 'cluster variable' ,xdim = seed ._n )
4036+ yield ClusterVariable (FractionField (seed ._R ), c .numerator (), c .denominator (), mutation_type = self ._mutation_type , variable_type = 'cluster variable' , xdim = seed ._n )
40374037 var_class = var_class .union (seed .cluster ())
40384038
40394039 def variable_class (self , depth = infinity , ignore_bipartite_belt = False ):
@@ -4120,7 +4120,7 @@ def is_mutation_finite(self, nr_of_checks=None, return_path=False):
41204120 sage: S.is_mutation_finite()
41214121 False
41224122 """
4123- is_finite , path = is_mutation_finite (copy (self ._M ),nr_of_checks = nr_of_checks )
4123+ is_finite , path = is_mutation_finite (copy (self ._M ), nr_of_checks = nr_of_checks )
41244124 if return_path :
41254125 return is_finite , path
41264126 else :
@@ -4403,8 +4403,8 @@ def find_upper_bound(self, verbose=False):
44034403 """
44044404 rank = self .n ()
44054405
4406- xvars = ['x{}' . format ( t ) for t in range (rank )]
4407- xpvars = ['x{}p' . format ( t ) for t in range (rank )]
4406+ xvars = [f 'x{ t } ' for t in range (rank )]
4407+ xpvars = [f 'x{ t } p' for t in range (rank )]
44084408 gens = xvars + xpvars
44094409 initial_product = '*' .join (g for g in xvars )
44104410
@@ -4418,8 +4418,7 @@ def find_upper_bound(self, verbose=False):
44184418 for s in range (rank ))
44194419 deep_gens += [neighbor_product ]
44204420
4421- rels = ["-{}*{}+{}" .format (gens [t ], gens [t + rank ],
4422- lower_var [t + rank ].numerator ())
4421+ rels = [f"-{ gens [t ]} *{ gens [t + rank ]} +{ lower_var [t + rank ].numerator ()} "
44234422 for t in range (rank )]
44244423
44254424 while True :
@@ -4509,9 +4508,9 @@ def get_upper_cluster_algebra_element(self, a):
45094508 if len (a ) != B .ncols ():
45104509 raise ValueError ('The length of the input vector must be the same as the number of columns of B.' )
45114510 # Runs helper functions.
4512- v = _vector_decomposition (a ,B .nrows ())
4511+ v = _vector_decomposition (a , B .nrows ())
45134512 c = self ._compute_compatible_vectors (v )
4514- return self ._produce_upper_cluster_algebra_element (v ,c )
4513+ return self ._produce_upper_cluster_algebra_element (v , c )
45154514
45164515 def LLM_gen_set (self , size_limit = - 1 ):
45174516 r"""
@@ -4793,7 +4792,7 @@ def PathSubset(n, m):
47934792 sage: PathSubset(4,4)
47944793 {0, 1, 2, 3, 4, 5, 6, 7}
47954794 """
4796- S = set ( 2 * i + 1 for i in range (n ))
4795+ S = { 2 * i + 1 for i in range (n )}
47974796 if m > 0 :
47984797 for j in range (n ):
47994798 if ((j + 1 )* m ) // n - (j * m ) // n == 1 :
@@ -4831,7 +4830,7 @@ def SetToPath(T):
48314830 return ans
48324831
48334832
4834- def is_LeeLiZel_allowable (T ,n , m , b , c ):
4833+ def is_LeeLiZel_allowable (T , n , m , b , c ):
48354834 """
48364835 Check if the subset `T` contributes to the computation of the greedy element `x[m,n]` in the rank two `(b,c)`-cluster algebra.
48374836
0 commit comments