This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
weyl_characters.py
2266 lines (1845 loc) · 80.1 KB
/
weyl_characters.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""
Weyl Character Rings
"""
#*****************************************************************************
# Copyright (C) 2011 Daniel Bump <bump at match.stanford.edu>
# Nicolas Thiery <nthiery at users.sf.net>
#
# Distributed under the terms of the GNU General Public License (GPL)
# http://www.gnu.org/licenses/
#*****************************************************************************
from __future__ import print_function
import sage.combinat.root_system.branching_rules
from sage.categories.all import Category, Algebras, AlgebrasWithBasis
from sage.combinat.free_module import CombinatorialFreeModule
from sage.combinat.root_system.cartan_type import CartanType
from sage.combinat.root_system.root_system import RootSystem
from sage.misc.cachefunc import cached_method
from sage.misc.lazy_attribute import lazy_attribute
from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet
from sage.misc.functional import is_even
from sage.misc.misc import inject_variable
from sage.rings.all import ZZ
class WeylCharacterRing(CombinatorialFreeModule):
r"""
A class for rings of Weyl characters.
Let `K` be a compact Lie group, which we assume is semisimple and
simply-connected. Its complexified Lie algebra `L` is the Lie algebra of a
complex analytic Lie group `G`. The following three categories are
equivalent: finite-dimensional representations of `K`; finite-dimensional
representations of `L`; and finite-dimensional analytic representations of
`G`. In every case, there is a parametrization of the irreducible
representations by their highest weight vectors. For this theory of Weyl,
see (for example):
* Adams, *Lectures on Lie groups*
* Broecker and Tom Dieck, *Representations of Compact Lie groups*
* Bump, *Lie Groups*
* Fulton and Harris, *Representation Theory*
* Goodman and Wallach, *Representations and Invariants of the Classical Groups*
* Hall, *Lie Groups, Lie Algebras and Representations*
* Humphreys, *Introduction to Lie Algebras and their representations*
* Procesi, *Lie Groups*
* Samelson, *Notes on Lie Algebras*
* Varadarajan, *Lie groups, Lie algebras, and their representations*
* Zhelobenko, *Compact Lie Groups and their Representations*.
Computations that you can do with these include computing their
weight multiplicities, products (thus decomposing the tensor
product of a representation into irreducibles) and branching
rules (restriction to a smaller group).
There is associated with `K`, `L` or `G` as above a lattice, the weight
lattice, whose elements (called weights) are characters of a Cartan
subgroup or subalgebra. There is an action of the Weyl group `W` on
the lattice, and elements of a fixed fundamental domain for `W`, the
positive Weyl chamber, are called dominant. There is for each
representation a unique highest dominant weight that occurs with
nonzero multiplicity with respect to a certain partial order, and
it is called the highest weight vector.
EXAMPLES::
sage: L = RootSystem("A2").ambient_space()
sage: [fw1,fw2] = L.fundamental_weights()
sage: R = WeylCharacterRing(['A',2], prefix="R")
sage: [R(1),R(fw1),R(fw2)]
[R(0,0,0), R(1,0,0), R(1,1,0)]
Here ``R(1)``, ``R(fw1)``, and ``R(fw2)`` are irreducible representations
with highest weight vectors `0`, `\Lambda_1`, and `\Lambda_2` respectively
(the first two fundamental weights).
For type `A` (also `G_2`, `F_4`, `E_6` and `E_7`) we will take as the
weight lattice not the weight lattice of the semisimple group, but for a
larger one. For type `A`, this means we are concerned with the
representation theory of `K = U(n)` or `G = GL(n, \CC)` rather than `SU(n)`
or `SU(n, \CC)`. This is useful since the representation theory of `GL(n)`
is ubiquitous, and also since we may then represent the fundamental
weights (in :mod:`sage.combinat.root_system.root_system`) by vectors
with integer entries. If you are only interested in `SL(3)`, say, use
``WeylCharacterRing(['A',2])`` as above but be aware that ``R([a,b,c])``
and ``R([a+1,b+1,c+1])`` represent the same character of `SL(3)` since
``R([1,1,1])`` is the determinant.
For more information, see the thematic tutorial *Lie Methods and
Related Combinatorics in Sage*, available at:
https://doc.sagemath.org/html/en/thematic_tutorials/lie.html
"""
@staticmethod
def __classcall__(cls, ct, base_ring=ZZ, prefix=None, style="lattice", k=None):
"""
TESTS::
sage: R = WeylCharacterRing("G2", style="coroots")
sage: R.cartan_type() is CartanType("G2")
True
sage: R.base_ring() is ZZ
True
"""
ct = CartanType(ct)
if prefix is None:
if ct.is_atomic():
prefix = ct[0]+str(ct[1])
else:
prefix = repr(ct)
return super(WeylCharacterRing, cls).__classcall__(cls, ct, base_ring=base_ring, prefix=prefix, style=style, k=k)
def __init__(self, ct, base_ring=ZZ, prefix=None, style="lattice", k=None):
"""
EXAMPLES::
sage: A2 = WeylCharacterRing("A2")
sage: TestSuite(A2).run()
"""
ct = CartanType(ct)
self._cartan_type = ct
self._rank = ct.rank()
self._base_ring = base_ring
self._space = RootSystem(self._cartan_type).ambient_space()
self._origin = self._space.zero()
if prefix is None:
if ct.is_atomic():
prefix = ct[0]+str(ct[1])
else:
prefix = repr(ct)
self._prefix = prefix
self._style = style
self._fusion_labels = None
self._k = k
if ct.is_atomic():
self._opposition = ct.opposition_automorphism()
self._highest = self._space.highest_root()
self._hip = self._highest.inner_product(self._highest)
if style == "coroots":
self._word = self._space.weyl_group().long_element().reduced_word()
# Set the basis
if k is not None:
self._prefix += str(k)
fw = self._space.fundamental_weights()
def next_level(wt):
return [wt + la for la in fw if self.level(wt + la) <= k]
B = list(RecursivelyEnumeratedSet([self._space.zero()], next_level))
else:
B = self._space
# TODO: remove the Category.join once not needed anymore (bug in CombinatorialFreeModule)
# TODO: use GradedAlgebrasWithBasis
category = Category.join([AlgebrasWithBasis(base_ring), Algebras(base_ring).Subobjects()])
CombinatorialFreeModule.__init__(self, base_ring, B, category=category)
# Register the embedding of self into ambient as a coercion
self.lift.register_as_coercion()
# Register the partial inverse as a conversion
self.register_conversion(self.retract)
@cached_method
def ambient(self):
"""
Returns the weight ring of ``self``.
EXAMPLES::
sage: WeylCharacterRing("A2").ambient()
The Weight ring attached to The Weyl Character Ring of Type A2 with Integer Ring coefficients
"""
return WeightRing(self)
# Eventually, one could want to put the cache_method here rather
# than on _irr_weights. Or just to merge this method and _irr_weights
def lift_on_basis(self, irr):
"""
Expand the basis element indexed by the weight ``irr`` into the
weight ring of ``self``.
INPUT:
- ``irr`` -- a dominant weight
This is used to implement :meth:`lift`.
EXAMPLES::
sage: A2 = WeylCharacterRing("A2")
sage: v = A2._space([2,1,0]); v
(2, 1, 0)
sage: A2.lift_on_basis(v)
2*a2(1,1,1) + a2(1,2,0) + a2(1,0,2) + a2(2,1,0) + a2(2,0,1) + a2(0,1,2) + a2(0,2,1)
This is consistent with the analoguous calculation with symmetric
Schur functions::
sage: s = SymmetricFunctions(QQ).s()
sage: s[2,1].expand(3)
x0^2*x1 + x0*x1^2 + x0^2*x2 + 2*x0*x1*x2 + x1^2*x2 + x0*x2^2 + x1*x2^2
"""
return self.ambient()._from_dict(self._irr_weights(irr))
def demazure_character(self, hwv, word, debug=False):
r"""
Compute the Demazure character.
INPUT:
- ``hwv`` -- a (usually dominant) weight
- ``word`` -- a Weyl group word
Produces the Demazure character with highest weight ``hwv`` and
``word`` as an element of the weight ring. Only available if
``style="coroots"``. The Demazure operators are also available as
methods of :class:`WeightRing` elements, and as methods of crystals.
Given a
:class:`~sage.combinat.crystals.tensor_product.CrystalOfTableaux`
with given highest weight vector, the Demazure method on the
crystal will give the equivalent of this method, except that
the Demazure character of the crystal is given as a sum of
monomials instead of an element of the :class:`WeightRing`.
See :meth:`WeightRing.Element.demazure` and
:meth:`sage.categories.classical_crystals.ClassicalCrystals.ParentMethods.demazure_character`
EXAMPLES::
sage: A2=WeylCharacterRing("A2",style="coroots")
sage: h=sum(A2.fundamental_weights()); h
(2, 1, 0)
sage: A2.demazure_character(h,word=[1,2])
a2(0,0) + a2(-2,1) + a2(2,-1) + a2(1,1) + a2(-1,2)
sage: A2.demazure_character((1,1),word=[1,2])
a2(0,0) + a2(-2,1) + a2(2,-1) + a2(1,1) + a2(-1,2)
"""
if self._style != "coroots":
raise ValueError('demazure method unavailable. Use style="coroots".')
hwv = self._space.from_vector_notation(hwv, style = "coroots")
return self.ambient()._from_dict(self._demazure_weights(hwv, word=word, debug=debug))
@lazy_attribute
def lift(self):
"""
The embedding of ``self`` into its weight ring.
EXAMPLES::
sage: A2 = WeylCharacterRing("A2")
sage: A2.lift
Generic morphism:
From: The Weyl Character Ring of Type A2 with Integer Ring coefficients
To: The Weight ring attached to The Weyl Character Ring of Type A2 with Integer Ring coefficients
::
sage: x = -A2(2,1,1) - A2(2,2,0) + A2(3,1,0)
sage: A2.lift(x)
a2(1,3,0) + a2(1,0,3) + a2(3,1,0) + a2(3,0,1) + a2(0,1,3) + a2(0,3,1)
As a shortcut, you may also do::
sage: x.lift()
a2(1,3,0) + a2(1,0,3) + a2(3,1,0) + a2(3,0,1) + a2(0,1,3) + a2(0,3,1)
Or even::
sage: a2 = WeightRing(A2)
sage: a2(x)
a2(1,3,0) + a2(1,0,3) + a2(3,1,0) + a2(3,0,1) + a2(0,1,3) + a2(0,3,1)
"""
return self.module_morphism(self.lift_on_basis,
codomain = self.ambient(),
category = AlgebrasWithBasis(self.base_ring()))
def _retract(self, chi):
"""
Construct a Weyl character from an invariant element of the weight ring
INPUT:
- ``chi`` -- a linear combination of weights which
shall be invariant under the action of the Weyl group
OUTPUT: the corresponding Weyl character
Please use instead the morphism :meth:`retract` which is
implemented using this method.
EXAMPLES::
sage: A2 = WeylCharacterRing("A2")
sage: a2 = WeightRing(A2)
::
sage: v = A2._space([3,1,0]); v
(3, 1, 0)
sage: chi = a2.sum_of_monomials(v.orbit()); chi
a2(1,3,0) + a2(1,0,3) + a2(3,1,0) + a2(3,0,1) + a2(0,1,3) + a2(0,3,1)
sage: A2._retract(chi)
-A2(2,1,1) - A2(2,2,0) + A2(3,1,0)
"""
return self.char_from_weights(dict(chi))
@lazy_attribute
def retract(self):
"""
The partial inverse map from the weight ring into ``self``.
EXAMPLES::
sage: A2 = WeylCharacterRing("A2")
sage: a2 = WeightRing(A2)
sage: A2.retract
Generic morphism:
From: The Weight ring attached to The Weyl Character Ring of Type A2 with Integer Ring coefficients
To: The Weyl Character Ring of Type A2 with Integer Ring coefficients
::
sage: v = A2._space([3,1,0]); v
(3, 1, 0)
sage: chi = a2.sum_of_monomials(v.orbit()); chi
a2(1,3,0) + a2(1,0,3) + a2(3,1,0) + a2(3,0,1) + a2(0,1,3) + a2(0,3,1)
sage: A2.retract(chi)
-A2(2,1,1) - A2(2,2,0) + A2(3,1,0)
The input should be invariant::
sage: A2.retract(a2.monomial(v))
Traceback (most recent call last):
...
ValueError: multiplicity dictionary may not be Weyl group invariant
As a shortcut, you may use conversion::
sage: A2(chi)
-A2(2,1,1) - A2(2,2,0) + A2(3,1,0)
sage: A2(a2.monomial(v))
Traceback (most recent call last):
...
ValueError: multiplicity dictionary may not be Weyl group invariant
"""
from sage.categories.homset import Hom
from sage.categories.morphism import SetMorphism
category = Algebras(self.base_ring())
return SetMorphism(Hom(self.ambient(), self, category), self._retract)
def _repr_(self):
"""
EXAMPLES::
sage: WeylCharacterRing("A3")
The Weyl Character Ring of Type A3 with Integer Ring coefficients
"""
if self._k is None:
return "The Weyl Character Ring of Type {} with {} coefficients".format(self._cartan_type._repr_(compact=True), self._base_ring)
else:
return "The Fusion Ring of Type {} and level {} with {} coefficients".format(self._cartan_type._repr_(compact=True), self._k, self._base_ring)
def __call__(self, *args):
"""
Construct an element of ``self``.
The input can either be an object that can be coerced or
converted into ``self`` (an element of ``self``, of the base
ring, of the weight ring), or a dominant weight. In the later
case, the basis element indexed by that weight is returned.
To specify the weight, you may give it explicitly. Alternatively,
you may give a tuple of integers. Normally these are the
components of the vector in the standard realization of
the weight lattice as a vector space. Alternatively, if
the ring is constructed with ``style = "coroots"``, you may
specify the weight by giving a set of integers, one for each
fundamental weight; the weight is then the linear combination
of the fundamental weights with these coefficients.
As a syntactical shorthand, for tuples of length at least two,
the parenthesis may be omitted.
EXAMPLES::
sage: A2 = WeylCharacterRing("A2")
sage: [A2(x) for x in [-2,-1,0,1,2]]
[-2*A2(0,0,0), -A2(0,0,0), 0, A2(0,0,0), 2*A2(0,0,0)]
sage: [A2(2,1,0), A2([2,1,0]), A2(2,1,0)== A2([2,1,0])]
[A2(2,1,0), A2(2,1,0), True]
sage: A2([2,1,0]) == A2(2,1,0)
True
sage: l = -2*A2(0,0,0) - A2(1,0,0) + A2(2,0,0) + 2*A2(3,0,0)
sage: [l in A2, A2(l) == l]
[True, True]
sage: P.<q> = QQ[]
sage: A2 = WeylCharacterRing(['A',2], base_ring = P)
sage: [A2(x) for x in [-2,-1,0,1,2,-2*q,-q,q,2*q,(1-q)]]
[-2*A2(0,0,0), -A2(0,0,0), 0, A2(0,0,0), 2*A2(0,0,0), -2*q*A2(0,0,0), -q*A2(0,0,0),
q*A2(0,0,0), 2*q*A2(0,0,0), (-q+1)*A2(0,0,0)]
sage: R.<q> = ZZ[]
sage: A2 = WeylCharacterRing(['A',2], base_ring = R, style="coroots")
sage: q*A2(1)
q*A2(0,0)
sage: [A2(x) for x in [-2,-1,0,1,2,-2*q,-q,q,2*q,(1-q)]]
[-2*A2(0,0), -A2(0,0), 0, A2(0,0), 2*A2(0,0), -2*q*A2(0,0), -q*A2(0,0), q*A2(0,0), 2*q*A2(0,0), (-q+1)*A2(0,0)]
"""
# The purpose of this __call__ method is only to handle the
# syntactical shorthand; otherwise it just delegates the work
# to the coercion model, which itself will call
# _element_constructor_ if the input is made of exactly one
# object which can't be coerced into self
if len(args) > 1:
args = (args,)
return super(WeylCharacterRing, self).__call__(*args)
def _element_constructor_(self, weight):
"""
Construct a monomial from a dominant weight.
INPUT:
- ``weight`` -- an element of the weight space, or a tuple
This method is responsible for constructing an appropriate
dominant weight from ``weight``, and then return the monomial
indexed by that weight. See :meth:`__call__` and
:meth:`sage.combinat.root_system.ambient_space.AmbientSpace.from_vector`.
TESTS::
sage: A2 = WeylCharacterRing("A2")
sage: A2._element_constructor_([2,1,0])
A2(2,1,0)
"""
weight = self._space.from_vector_notation(weight, style = self._style)
if not weight.is_dominant_weight():
raise ValueError("{} is not a dominant element of the weight lattice".format(weight))
if self._k is not None:
if self.level(weight) > self._k:
raise ValueError("{} has level greater than {}".format(weight, self._k))
return self.monomial(weight)
def product_on_basis(self, a, b):
r"""
Compute the tensor product of two irreducible representations ``a``
and ``b``.
EXAMPLES::
sage: D4 = WeylCharacterRing(['D',4])
sage: spin_plus = D4(1/2,1/2,1/2,1/2)
sage: spin_minus = D4(1/2,1/2,1/2,-1/2)
sage: spin_plus * spin_minus # indirect doctest
D4(1,0,0,0) + D4(1,1,1,0)
sage: spin_minus * spin_plus
D4(1,0,0,0) + D4(1,1,1,0)
Uses the Brauer-Klimyk method.
"""
# The method is asymmetrical, and as a rule of thumb
# it is fastest to switch the factors so that the
# smaller character is the one that is decomposed
# into weights.
if sum(a.coefficients()) > sum(b.coefficients()):
a,b = b,a
return self._product_helper(self._irr_weights(a), b)
def _product_helper(self, d1, b):
"""
Helper function for :meth:`product_on_basis`.
INPUT:
- ``d1`` -- a dictionary of weight multiplicities
- ``b`` -- a dominant weight
If ``d1`` is the dictionary of weight multiplicities of a character,
returns the product of that character by the irreducible character
with highest weight ``b``.
EXAMPLES::
sage: A2 = WeylCharacterRing("A2")
sage: r = A2(1,0,0)
sage: [A2._product_helper(r.weight_multiplicities(),x) for x in A2.space().fundamental_weights()]
[A2(1,1,0) + A2(2,0,0), A2(1,1,1) + A2(2,1,0)]
"""
d = {}
for k in d1:
[epsilon,g] = self.dot_reduce(b+k)
if epsilon == 1:
d[g] = d.get(g,0) + d1[k]
elif epsilon == -1:
d[g] = d.get(g,0)- d1[k]
return self._from_dict(d)
def dot_reduce(self, a):
r"""
Auxiliary function for :meth:`product_on_basis`.
Return a pair `[\epsilon, b]` where `b` is a dominant weight and
`\epsilon` is 0, 1 or -1. To describe `b`, let `w` be an element of
the Weyl group such that `w(a + \rho)` is dominant. If
`w(a + \rho) - \rho` is dominant, then `\epsilon` is the sign of
`w` and `b` is `w(a + \rho) - \rho`. Otherwise, `\epsilon` is zero.
INPUT:
- ``a`` -- a weight
EXAMPLES::
sage: A2 = WeylCharacterRing("A2")
sage: weights = sorted(A2(2,1,0).weight_multiplicities().keys(), key=str); weights
[(0, 1, 2), (0, 2, 1), (1, 0, 2), (1, 1, 1), (1, 2, 0), (2, 0, 1), (2, 1, 0)]
sage: [A2.dot_reduce(x) for x in weights]
[[0, (0, 0, 0)], [-1, (1, 1, 1)], [-1, (1, 1, 1)], [1, (1, 1, 1)], [0, (0, 0, 0)], [0, (0, 0, 0)], [1, (2, 1, 0)]]
"""
alphacheck = self._space.simple_coroots()
alpha = self._space.simple_roots()
[epsilon, ret] = [1, a]
done = False
while not done:
done = True
for i in self._space.index_set():
c = ret.inner_product(alphacheck[i])
if c == -1:
return [0, self._space.zero()]
elif c < -1:
epsilon = -epsilon
ret -= (1+c)*alpha[i]
done = False
break
if self._k is not None:
l = self.level(ret)
k = self._k
if l > k:
if l == k+1:
return [0, self._space.zero()]
else:
epsilon = -epsilon
ret = self.affine_reflect(ret,k+1)
done = False
return [epsilon, ret]
def affine_reflect(self, wt, k=0):
r"""
INPUT:
- ``wt`` -- a weight
- ``k`` -- (optional) a positive integer
Returns the reflection of wt in the hyperplane
`\theta`. Optionally shifts by a multiple `k`of `\theta`.
EXAMPLES::
sage: B22=FusionRing("B2",2)
sage: fw = B22.fundamental_weights(); fw
Finite family {1: (1, 0), 2: (1/2, 1/2)}
sage: [B22.affine_reflect(x,2) for x in fw]
[(2, 1), (3/2, 3/2)]
"""
coef = ZZ(2*wt.inner_product(self._highest)/self._hip)
return wt+(k-coef)*self._highest
def some_elements(self):
"""
Return some elements of ``self``.
EXAMPLES::
sage: WeylCharacterRing("A3").some_elements()
[A3(1,0,0,0), A3(1,1,0,0), A3(1,1,1,0)]
"""
return [self.monomial(x) for x in self.fundamental_weights()]
def one_basis(self):
"""
Return the index of 1 in ``self``.
EXAMPLES::
sage: WeylCharacterRing("A3").one_basis()
(0, 0, 0, 0)
sage: WeylCharacterRing("A3").one()
A3(0,0,0,0)
"""
return self._space.zero()
@cached_method
def _irr_weights(self, hwv):
"""
Compute the weights of an irreducible as a dictionary.
Given a dominant weight ``hwv``, this produces a dictionary of
weight multiplicities for the irreducible representation
with highest weight vector ``hwv``. This method is cached
for efficiency.
INPUT:
- ``hwv`` -- a dominant weight
EXAMPLES::
sage: A2=WeylCharacterRing("A2")
sage: v = A2.fundamental_weights()[1]; v
(1, 0, 0)
sage: A2._irr_weights(v)
{(1, 0, 0): 1, (0, 1, 0): 1, (0, 0, 1): 1}
"""
if self._style == "coroots":
return self._demazure_weights(hwv)
else:
return irreducible_character_freudenthal(hwv)
def _demazure_weights(self, hwv, word="long", debug=False):
"""
Computes the weights of a Demazure character.
This method duplicates the functionality of :meth:`_irr_weights`, under
the assumption that ``style = "coroots"``, but allows an optional
parameter ``word``. (This is not allowed in :meth:`_irr_weights` since
it would interfere with the ``@cached_method``.) Produces the
dictionary of weights for the irreducible character with highest
weight ``hwv`` when ``word`` is omitted, or for the Demazure character
if ``word`` is included.
INPUT:
- ``hwv`` -- a dominant weight
EXAMPLES::
sage: B2=WeylCharacterRing("B2", style="coroots")
sage: [B2._demazure_weights(v, word=[1,2]) for v in B2.fundamental_weights()]
[{(1, 0): 1, (0, 1): 1}, {(-1/2, 1/2): 1, (1/2, -1/2): 1, (1/2, 1/2): 1}]
"""
alphacheck = self._space.simple_coroots()
dd = {}
h = tuple(int(hwv.inner_product(alphacheck[j]))
for j in self._space.index_set())
dd[h] = int(1)
return self._demazure_helper(dd, word=word, debug=debug)
def _demazure_helper(self, dd, word="long", debug=False):
r"""
Assumes ``style = "coroots"``. If the optional parameter ``word`` is
specified, produces a Demazure character (defaults to the long Weyl
group element.
INPUT:
- ``dd`` -- a dictionary of weights
- ``word`` -- (optional) a Weyl group reduced word
EXAMPLES::
sage: A2=WeylCharacterRing("A2",style="coroots")
sage: dd = {}; dd[(1,1)]=int(1)
sage: A2._demazure_helper(dd,word=[1,2])
{(0, 0, 0): 1, (-1, 1, 0): 1, (1, -1, 0): 1, (1, 0, -1): 1, (0, 1, -1): 1}
"""
if self._style != "coroots":
raise ValueError('_demazure_helper method unavailable. Use style="coroots".')
index_set = self._space.index_set()
alphacheck = self._space.simple_coroots()
alpha = self._space.simple_roots()
r = self.rank()
cm = {}
for i in index_set:
cm[i] = tuple(int(alpha[i].inner_product(alphacheck[j])) for j in index_set)
if debug:
print("cm[%s]=%s" % (i, cm[i]))
accum = dd
if word == "long":
word = self._word
for i in reversed(word):
if debug:
print("i=%s" % i)
next = {}
for v in accum:
coroot = v[i-1]
if debug:
print(" v=%s, coroot=%s" % (v, coroot))
if coroot >= 0:
mu = v
for j in range(coroot+1):
next[mu] = next.get(mu,0)+accum[v]
if debug:
print(" mu=%s, next[mu]=%s" % (mu, next[mu]))
mu = tuple(mu[k] - cm[i][k] for k in range(r))
else:
mu = v
for j in range(-1-coroot):
mu = tuple(mu[k] + cm[i][k] for k in range(r))
next[mu] = next.get(mu,0)-accum[v]
if debug:
print(" mu=%s, next[mu]=%s" % (mu, next[mu]))
accum = {}
for v in next:
accum[v] = next[v]
ret = {}
for v in accum:
if accum[v]:
ret[self._space.from_vector_notation(v, style="coroots")] = accum[v]
return ret
@cached_method
def _weight_multiplicities(self, x):
"""
Produce weight multiplicities for the (possibly reducible)
WeylCharacter ``x``.
EXAMPLES::
sage: B2=WeylCharacterRing("B2",style="coroots")
sage: chi=2*B2(1,0)
sage: B2._weight_multiplicities(chi)
{(0, 0): 2, (-1, 0): 2, (1, 0): 2, (0, -1): 2, (0, 1): 2}
"""
d = {}
m = x._monomial_coefficients
for k in m:
c = m[k]
d1 = self._irr_weights(k)
for l in d1:
if l in d:
d[l] += c*d1[l]
else:
d[l] = c*d1[l]
for k in list(d):
if d[k] == 0:
del d[k]
else:
d[k] = self._base_ring(d[k])
return d
def base_ring(self):
"""
Return the base ring of ``self``.
EXAMPLES::
sage: R = WeylCharacterRing(['A',3], base_ring = CC); R.base_ring()
Complex Field with 53 bits of precision
"""
return self._base_ring
def irr_repr(self, hwv):
"""
Return a string representing the irreducible character with highest
weight vector ``hwv``.
EXAMPLES::
sage: B3 = WeylCharacterRing("B3")
sage: [B3.irr_repr(v) for v in B3.fundamental_weights()]
['B3(1,0,0)', 'B3(1,1,0)', 'B3(1/2,1/2,1/2)']
sage: B3 = WeylCharacterRing("B3", style="coroots")
sage: [B3.irr_repr(v) for v in B3.fundamental_weights()]
['B3(1,0,0)', 'B3(0,1,0)', 'B3(0,0,1)']
"""
return self._prefix+self._wt_repr(hwv)
def level(self, wt):
"""
Return the level of the weight, defined to be the value of
the weight on the coroot associated with the highest root.
EXAMPLES::
sage: R = FusionRing("F4",2); [R.level(x) for x in R.fundamental_weights()]
[2, 3, 2, 1]
sage: [CartanType("F4~").dual().a()[x] for x in [1..4]]
[2, 3, 2, 1]
"""
return ZZ(2*wt.inner_product(self._highest)/self._hip)
def _dual_helper(self, wt):
"""
If `w_0` is the long Weyl group element and `wt` is an
element of the weight lattice, this returns `-w_0(wt)`.
EXAMPLES::
sage: A3=WeylCharacterRing("A3")
sage: [A3._dual_helper(x) for x in A3.fundamental_weights()]
[(0, 0, 0, -1), (0, 0, -1, -1), (0, -1, -1, -1)]
"""
if self.cartan_type()[0] == 'A': # handled separately for GL(n) compatibility
return self.space()([-x for x in reversed(wt.to_vector().list())])
ret = 0
alphacheck = self._space.simple_coroots()
fw = self._space.fundamental_weights()
for i in self._space.index_set():
ret += wt.inner_product(alphacheck[i])*fw[self._opposition[i]]
return ret
def _wt_repr(self, wt):
"""
Produce a representation of a vector in either coweight or
lattice notation (following the appendices in Bourbaki, Lie Groups and
Lie Algebras, Chapters 4,5,6), depending on whether the parent
:class:`WeylCharacterRing` is created with ``style="coweights"``
or not.
EXAMPLES::
sage: [fw1,fw2]=RootSystem("G2").ambient_space().fundamental_weights(); fw1,fw2
((1, 0, -1), (2, -1, -1))
sage: [WeylCharacterRing("G2")._wt_repr(v) for v in [fw1,fw2]]
['(1,0,-1)', '(2,-1,-1)']
sage: [WeylCharacterRing("G2",style="coroots")._wt_repr(v) for v in [fw1,fw2]]
['(1,0)', '(0,1)']
"""
if self._style == "lattice":
vec = wt.to_vector()
elif self._style == "coroots":
vec = [wt.inner_product(x) for x in self.simple_coroots()]
else:
raise ValueError("unknown style")
hstring = str(vec[0])
for i in range(1,len(vec)):
hstring=hstring+","+str(vec[i])
return "("+hstring+")"
def _repr_term(self, t):
"""
Representation of the monomial corresponding to a weight ``t``.
EXAMPLES::
sage: G2 = WeylCharacterRing("G2") # indirect doctest
sage: [G2._repr_term(x) for x in G2.fundamental_weights()]
['G2(1,0,-1)', 'G2(2,-1,-1)']
"""
if self._fusion_labels is not None:
t = tuple([t.inner_product(x) for x in self.simple_coroots()])
return self._fusion_labels[t]
else:
return self.irr_repr(t)
def cartan_type(self):
"""
Return the Cartan type of ``self``.
EXAMPLES::
sage: WeylCharacterRing("A2").cartan_type()
['A', 2]
"""
return self._cartan_type
def fundamental_weights(self):
"""
Return the fundamental weights.
EXAMPLES::
sage: WeylCharacterRing("G2").fundamental_weights()
Finite family {1: (1, 0, -1), 2: (2, -1, -1)}
"""
return self._space.fundamental_weights()
def simple_roots(self):
"""
Return the simple roots.
EXAMPLES::
sage: WeylCharacterRing("G2").simple_roots()
Finite family {1: (0, 1, -1), 2: (1, -2, 1)}
"""
return self._space.simple_roots()
def simple_coroots(self):
"""
Return the simple coroots.
EXAMPLES::
sage: WeylCharacterRing("G2").simple_coroots()
Finite family {1: (0, 1, -1), 2: (1/3, -2/3, 1/3)}
"""
return self._space.simple_coroots()
def highest_root(self):
"""
Return the highest_root.
EXAMPLES::
sage: WeylCharacterRing("G2").highest_root()
(2, -1, -1)
"""
return self._space.highest_root()
def positive_roots(self):
"""
Return the positive roots.
EXAMPLES::
sage: WeylCharacterRing("G2").positive_roots()
[(0, 1, -1), (1, -2, 1), (1, -1, 0), (1, 0, -1), (1, 1, -2), (2, -1, -1)]
"""
return self._space.positive_roots()
def dynkin_diagram(self):
"""
Return the Dynkin diagram of ``self``.
EXAMPLES::
sage: WeylCharacterRing("E7").dynkin_diagram()
O 2
|
|
O---O---O---O---O---O
1 3 4 5 6 7
E7
"""
return self.space().dynkin_diagram()
def extended_dynkin_diagram(self):
"""
Return the extended Dynkin diagram, which is the Dynkin diagram
of the corresponding untwisted affine type.
EXAMPLES::
sage: WeylCharacterRing("E7").extended_dynkin_diagram()
O 2
|
|
O---O---O---O---O---O---O
0 1 3 4 5 6 7
E7~
"""
return self.cartan_type().affine().dynkin_diagram()
def rank(self):
"""
Return the rank.
EXAMPLES::
sage: WeylCharacterRing("G2").rank()
2
"""
return self._rank
def space(self):
"""
Return the weight space associated to ``self``.
EXAMPLES::
sage: WeylCharacterRing(['E',8]).space()
Ambient space of the Root system of type ['E', 8]
"""
return self._space
def char_from_weights(self, mdict):
"""
Construct a Weyl character from an invariant linear combination
of weights.
INPUT:
- ``mdict`` -- a dictionary mapping weights to coefficients,
and representing a linear combination of weights which
shall be invariant under the action of the Weyl group
OUTPUT: the corresponding Weyl character
EXAMPLES::
sage: A2 = WeylCharacterRing("A2")
sage: v = A2._space([3,1,0]); v
(3, 1, 0)
sage: d = dict([(x,1) for x in v.orbit()]); d
{(1, 3, 0): 1,
(1, 0, 3): 1,
(3, 1, 0): 1,
(3, 0, 1): 1,
(0, 1, 3): 1,
(0, 3, 1): 1}
sage: A2.char_from_weights(d)
-A2(2,1,1) - A2(2,2,0) + A2(3,1,0)
"""
return self._from_dict(self._char_from_weights(mdict), coerce=True)
def _char_from_weights(self, mdict):
"""
Helper method for :meth:`char_from_weights`.