@@ -125,7 +125,7 @@ def __init__(self, ct, base_ring=ZZ, prefix=None, style="lattice", k=None, conju
125
125
self ._origin = self ._space .zero ()
126
126
if prefix is None :
127
127
if ct .is_atomic ():
128
- prefix = ct [0 ]+ str (ct [1 ])
128
+ prefix = ct [0 ] + str (ct [1 ])
129
129
else :
130
130
prefix = repr (ct )
131
131
self ._prefix = prefix
@@ -510,7 +510,7 @@ def product_on_basis(self, a, b):
510
510
# smaller character is the one that is decomposed
511
511
# into weights.
512
512
if sum (a .coefficients ()) > sum (b .coefficients ()):
513
- a ,b = b ,a
513
+ a , b = b , a
514
514
return self ._product_helper (self ._irr_weights (a ), b )
515
515
516
516
def _product_helper (self , d1 , b ):
@@ -535,11 +535,11 @@ def _product_helper(self, d1, b):
535
535
"""
536
536
d = {}
537
537
for k in d1 :
538
- [epsilon ,g ] = self .dot_reduce (b + k )
538
+ [epsilon , g ] = self .dot_reduce (b + k )
539
539
if epsilon == 1 :
540
- d [g ] = d .get (g ,0 ) + d1 [k ]
540
+ d [g ] = d .get (g , 0 ) + d1 [k ]
541
541
elif epsilon == - 1 :
542
- d [g ] = d .get (g ,0 ) - d1 [k ]
542
+ d [g ] = d .get (g , 0 ) - d1 [k ]
543
543
return self ._from_dict (d , coerce = True )
544
544
545
545
def dot_reduce (self , a ):
@@ -576,31 +576,32 @@ def dot_reduce(self, a):
576
576
return [0 , self ._space .zero ()]
577
577
elif c < - 1 :
578
578
epsilon = - epsilon
579
- ret -= (1 + c ) * alpha [i ]
579
+ ret -= (1 + c ) * alpha [i ]
580
580
done = False
581
581
break
582
582
if self ._k is not None :
583
583
l = self .level (ret )
584
584
k = self ._k
585
585
if l > k :
586
- if l == k + 1 :
586
+ if l == k + 1 :
587
587
return [0 , self ._space .zero ()]
588
588
else :
589
589
epsilon = - epsilon
590
- ret = self .affine_reflect (ret ,k + 1 )
590
+ ret = self .affine_reflect (ret , k + 1 )
591
591
done = False
592
592
return [epsilon , ret ]
593
593
594
594
def affine_reflect (self , wt , k = 0 ):
595
595
r"""
596
+ Return the reflection of wt in the hyperplane `\theta`.
597
+
598
+ Optionally, this also shifts by a multiple `k` of `\theta`.
599
+
596
600
INPUT:
597
601
598
602
- ``wt`` -- a weight
599
603
- ``k`` -- (optional) a positive integer
600
604
601
- Returns the reflection of wt in the hyperplane
602
- `\theta`. Optionally shifts by a multiple `k`of `\theta`.
603
-
604
605
EXAMPLES::
605
606
606
607
sage: B22 = FusionRing("B2",2)
@@ -609,8 +610,8 @@ def affine_reflect(self, wt, k=0):
609
610
sage: [B22.affine_reflect(x,2) for x in fw]
610
611
[(2, 1), (3/2, 3/2)]
611
612
"""
612
- coef = ZZ (2 * wt .inner_product (self ._highest )/ self ._hip )
613
- return wt + ( k - coef )* self ._highest
613
+ coef = ZZ (2 * wt .inner_product (self ._highest ) / self ._hip )
614
+ return wt + ( k - coef ) * self ._highest
614
615
615
616
def some_elements (self ):
616
617
"""
@@ -722,7 +723,7 @@ def _demazure_helper(self, dd, word="long", debug=False):
722
723
for i in index_set :
723
724
temp = []
724
725
cm [i ] = [0 ] * r
725
- for ind ,j in enumerate (index_set ):
726
+ for ind , j in enumerate (index_set ):
726
727
cm [i ][ind ] = int (alpha [i ].inner_product (alphacheck [j ]))
727
728
if cm [i ][ind ]:
728
729
temp .append (ind )
@@ -737,27 +738,27 @@ def _demazure_helper(self, dd, word="long", debug=False):
737
738
print ("i=%s" % i )
738
739
next = {}
739
740
for v in accum :
740
- coroot = v [i - 1 ]
741
+ coroot = v [i - 1 ]
741
742
if debug :
742
743
print (" v=%s, coroot=%s" % (v , coroot ))
743
744
if coroot >= 0 :
744
745
mu = v
745
- for j in range (coroot + 1 ):
746
- next [mu ] = next .get (mu ,0 ) + accum [v ]
746
+ for j in range (coroot + 1 ):
747
+ next [mu ] = next .get (mu , 0 ) + accum [v ]
747
748
if debug :
748
749
print (" mu=%s, next[mu]=%s" % (mu , next [mu ]))
749
750
mu = list (mu )
750
- for k in supp [i - 1 ]:
751
+ for k in supp [i - 1 ]:
751
752
mu [k ] -= cm [i ][k ]
752
753
mu = tuple (mu )
753
754
else :
754
755
mu = v
755
- for j in range (- 1 - coroot ):
756
+ for j in range (- 1 - coroot ):
756
757
mu = list (mu )
757
- for k in supp [i - 1 ]:
758
+ for k in supp [i - 1 ]:
758
759
mu [k ] += cm [i ][k ]
759
760
mu = tuple (mu )
760
- next [mu ] = next .get (mu ,0 ) - accum [v ]
761
+ next [mu ] = next .get (mu , 0 ) - accum [v ]
761
762
if debug :
762
763
print (" mu=%s, next[mu]=%s" % (mu , next [mu ]))
763
764
accum = {}
@@ -789,9 +790,9 @@ def _weight_multiplicities(self, x):
789
790
d1 = self ._irr_weights (k )
790
791
for l in d1 :
791
792
if l in d :
792
- d [l ] += c * d1 [l ]
793
+ d [l ] += c * d1 [l ]
793
794
else :
794
- d [l ] = c * d1 [l ]
795
+ d [l ] = c * d1 [l ]
795
796
for k in list (d ):
796
797
if d [k ] == 0 :
797
798
del d [k ]
@@ -824,7 +825,7 @@ def irr_repr(self, hwv):
824
825
sage: [B3.irr_repr(v) for v in B3.fundamental_weights()]
825
826
['B3(1,0,0)', 'B3(0,1,0)', 'B3(0,0,1)']
826
827
"""
827
- return self ._prefix + self ._wt_repr (hwv )
828
+ return self ._prefix + self ._wt_repr (hwv )
828
829
829
830
def level (self , wt ):
830
831
"""
@@ -838,7 +839,7 @@ def level(self, wt):
838
839
sage: [CartanType("F4~").dual().a()[x] for x in [1..4]]
839
840
[2, 3, 2, 1]
840
841
"""
841
- return ZZ (2 * wt .inner_product (self ._highest )/ self ._hip )
842
+ return ZZ (2 * wt .inner_product (self ._highest ) / self ._hip )
842
843
843
844
def _dual_helper (self , wt ):
844
845
"""
@@ -857,7 +858,7 @@ def _dual_helper(self, wt):
857
858
alphacheck = self ._space .simple_coroots ()
858
859
fw = self ._space .fundamental_weights ()
859
860
for i in self ._space .index_set ():
860
- ret += wt .inner_product (alphacheck [i ])* fw [self ._opposition [i ]]
861
+ ret += wt .inner_product (alphacheck [i ]) * fw [self ._opposition [i ]]
861
862
return ret
862
863
863
864
def _wt_repr (self , wt ):
@@ -1078,7 +1079,7 @@ def _char_from_weights(self, mdict):
1078
1079
hdict = {}
1079
1080
ddict = mdict .copy ()
1080
1081
while ddict :
1081
- highest = max ((x .inner_product (self ._space .rho ()),x ) for x in ddict )[1 ]
1082
+ highest = max ((x .inner_product (self ._space .rho ()), x ) for x in ddict )[1 ]
1082
1083
if not highest .is_dominant ():
1083
1084
raise ValueError ("multiplicity dictionary may not be Weyl group invariant" )
1084
1085
sdict = self ._irr_weights (highest )
@@ -1279,8 +1280,10 @@ def dual(self):
1279
1280
1280
1281
def highest_weight (self ):
1281
1282
"""
1282
- This method is only available for basis elements. Returns the
1283
- parametrizing dominant weight of an irreducible character.
1283
+ Return the parametrizing dominant weight
1284
+ of an irreducible character.
1285
+
1286
+ This method is only available for basis elements.
1284
1287
1285
1288
EXAMPLES::
1286
1289
@@ -1323,7 +1326,7 @@ def __pow__(self, n):
1323
1326
n = - n
1324
1327
1325
1328
res = self
1326
- for i in range (n - 1 ):
1329
+ for i in range (n - 1 ):
1327
1330
res = self * res
1328
1331
return res
1329
1332
@@ -1371,13 +1374,12 @@ def symmetric_power(self, k):
1371
1374
if k == 1 :
1372
1375
return self
1373
1376
ret = par .zero ()
1374
- for r in range (1 , k + 1 ):
1375
- adam_r = self ._adams_operation_helper (r )
1376
- ret += par .linear_combination ((par ._product_helper (adam_r , l ), c ) for ( l , c ) in self . symmetric_power ( k - r ))
1377
- dd = {}
1377
+ for r in range (1 , k + 1 ):
1378
+ adam_r = self ._adams_operator_helper (r )
1379
+ ret += par .linear_combination ((par ._product_helper (adam_r , l ), c )
1380
+ for l , c in self . symmetric_power ( k - r ))
1378
1381
m = ret .weight_multiplicities ()
1379
- for l in m :
1380
- dd [l ] = m [l ]/ k
1382
+ dd = {key : val / k for key , val in m .items ()}
1381
1383
return self .parent ().char_from_weights (dd )
1382
1384
1383
1385
@cached_method
@@ -1410,8 +1412,8 @@ def exterior_power(self, k):
1410
1412
if k == 1 :
1411
1413
return self
1412
1414
ret = par .zero ()
1413
- for r in range (1 ,k + 1 ):
1414
- adam_r = self ._adams_operation_helper (r )
1415
+ for r in range (1 , k + 1 ):
1416
+ adam_r = self ._adams_operator_helper (r )
1415
1417
if is_even (r ):
1416
1418
ret -= par .linear_combination ((par ._product_helper (adam_r , l ), c ) for (l , c ) in self .exterior_power (k - r ))
1417
1419
else :
@@ -1422,7 +1424,7 @@ def exterior_power(self, k):
1422
1424
dd [l ] = m [l ]/ k
1423
1425
return self .parent ().char_from_weights (dd )
1424
1426
1425
- def adams_operation (self , r ):
1427
+ def adams_operator (self , r ):
1426
1428
"""
1427
1429
Return the `r`-th Adams operation of ``self``.
1428
1430
@@ -1436,12 +1438,14 @@ def adams_operation(self, r):
1436
1438
EXAMPLES::
1437
1439
1438
1440
sage: A2 = WeylCharacterRing("A2")
1439
- sage: A2(1,1,0).adams_operation (3)
1441
+ sage: A2(1,1,0).adams_operator (3)
1440
1442
A2(2,2,2) - A2(3,2,1) + A2(3,3,0)
1441
1443
"""
1442
- return self .parent ().char_from_weights (self ._adams_operation_helper (r ))
1444
+ return self .parent ().char_from_weights (self ._adams_operator_helper (r ))
1443
1445
1444
- def _adams_operation_helper (self , r ):
1446
+ adams_operation = adams_operator
1447
+
1448
+ def _adams_operator_helper (self , r ):
1445
1449
"""
1446
1450
Helper function for Adams operations.
1447
1451
@@ -1455,14 +1459,11 @@ def _adams_operation_helper(self, r):
1455
1459
EXAMPLES::
1456
1460
1457
1461
sage: A2 = WeylCharacterRing("A2")
1458
- sage: A2(1,1,0)._adams_operation_helper (3)
1462
+ sage: A2(1,1,0)._adams_operator_helper (3)
1459
1463
{(3, 3, 0): 1, (3, 0, 3): 1, (0, 3, 3): 1}
1460
1464
"""
1461
1465
d = self .weight_multiplicities ()
1462
- dd = {}
1463
- for k in d :
1464
- dd [r * k ] = d [k ]
1465
- return dd
1466
+ return {r * key : val for key , val in d .items ()}
1466
1467
1467
1468
def symmetric_square (self ):
1468
1469
"""
@@ -1701,14 +1702,14 @@ def irreducible_character_freudenthal(hwv, debug=False):
1701
1702
for alpha in positive_roots :
1702
1703
mu_plus_i_alpha = mu + alpha
1703
1704
while mu_plus_i_alpha in mdict :
1704
- accum += mdict [mu_plus_i_alpha ]* (mu_plus_i_alpha ).inner_product (alpha )
1705
+ accum += mdict [mu_plus_i_alpha ] * (mu_plus_i_alpha ).inner_product (alpha )
1705
1706
mu_plus_i_alpha += alpha
1706
1707
if accum == 0 :
1707
1708
next_layer [mu ] = 0
1708
1709
else :
1709
1710
hwv_plus_rho = hwv + rho
1710
1711
mu_plus_rho = mu + rho
1711
- next_layer [mu ] = ZZ (2 * accum )/ ZZ ((hwv_plus_rho ).inner_product (hwv_plus_rho )- (mu_plus_rho ).inner_product (mu_plus_rho ))
1712
+ next_layer [mu ] = ZZ (2 * accum ) / ZZ ((hwv_plus_rho ).inner_product (hwv_plus_rho ) - (mu_plus_rho ).inner_product (mu_plus_rho ))
1712
1713
current_layer = next_layer
1713
1714
return mdict
1714
1715
@@ -1786,7 +1787,7 @@ def __init__(self, parent, prefix):
1786
1787
self ._base_ring = parent ._base_ring
1787
1788
if prefix is None :
1788
1789
# TODO: refactor this fragile logic into CartanType's
1789
- if self ._parent ._prefix .replace ('x' ,'_' ).isupper ():
1790
+ if self ._parent ._prefix .replace ('x' , '_' ).isupper ():
1790
1791
# The 'x' workaround above is to support reducible Cartan types like 'A1xB2'
1791
1792
prefix = self ._parent ._prefix .lower ()
1792
1793
elif self ._parent ._prefix .islower ():
@@ -1878,7 +1879,7 @@ def product_on_basis(self, a, b):
1878
1879
sage: a2(1,0,0) * a2(0,1,0) # indirect doctest
1879
1880
a2(1,1,0)
1880
1881
"""
1881
- return self (a + b )
1882
+ return self (a + b )
1882
1883
1883
1884
def some_elements (self ):
1884
1885
"""
@@ -2012,7 +2013,7 @@ def wt_repr(self, wt):
2012
2013
sage: [G2.ambient().wt_repr(x) for x in G2.fundamental_weights()]
2013
2014
['g2(1,0)', 'g2(0,1)']
2014
2015
"""
2015
- return self ._prefix + self .parent ()._wt_repr (wt )
2016
+ return self ._prefix + self .parent ()._wt_repr (wt )
2016
2017
2017
2018
def _repr_term (self , t ):
2018
2019
"""
@@ -2118,9 +2119,7 @@ def shift(self, mu):
2118
2119
[g2(2,2), g2(1,3)]
2119
2120
"""
2120
2121
d1 = self .monomial_coefficients ()
2121
- d2 = {}
2122
- for nu in d1 :
2123
- d2 [mu + nu ] = d1 [nu ]
2122
+ d2 = {mu + nu : val for nu , val in d1 .items ()}
2124
2123
return self .parent ()._from_dict (d2 )
2125
2124
2126
2125
def demazure (self , w , debug = False ):
@@ -2228,7 +2227,7 @@ def demazure_lusztig(self, i, v):
2228
2227
if i in self .parent ().space ().index_set ():
2229
2228
rho = self .parent ().space ().from_vector_notation (self .parent ().space ().rho (), style = "coroots" )
2230
2229
inv = self .scale (- 1 )
2231
- return (- inv .shift (- rho ).demazure ([i ]).shift (rho )+ v * inv .demazure ([i ])).scale (- 1 )
2230
+ return (- inv .shift (- rho ).demazure ([i ]).shift (rho ) + v * inv .demazure ([i ])).scale (- 1 )
2232
2231
elif isinstance (i , list ):
2233
2232
if not i :
2234
2233
return self
0 commit comments