-
-
Notifications
You must be signed in to change notification settings - Fork 405
/
rigged_configuration_element.py
2189 lines (1834 loc) · 74.3 KB
/
rigged_configuration_element.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
r"""
Rigged Configuration Elements
A rigged configuration element is a sequence of
:class:`~sage.combinat.rigged_configurations.rigged_partition.RiggedPartition`
objects.
AUTHORS:
- Travis Scrimshaw (2010-09-26): Initial version
- Travis Scrimshaw (2012-10-25): Added virtual rigged confingurations
"""
#*****************************************************************************
# Copyright (C) 2010-2012 Travis Scrimshaw <tscrim@ucdavis.edu>
#
# Distributed under the terms of the GNU General Public License (GPL)
#
# This code is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# The full text of the GPL is available at:
#
# http://www.gnu.org/licenses/
#*****************************************************************************
from sage.misc.cachefunc import cached_method
from sage.structure.list_clone import ClonableArray
from sage.rings.integer import Integer
from sage.combinat.rigged_configurations.rigged_partition import RiggedPartition, \
RiggedPartitionTypeB
####################################################
## Base classes for rigged configuration elements ##
####################################################
class RiggedConfigurationElement(ClonableArray):
"""
A rigged configuration for simply-laced types.
For more information on rigged configurations, see
:class:`RiggedConfigurations`. For rigged configurations for
non-simply-laced types, use :class:`RCNonSimplyLacedElement`.
Typically to create a specific rigged configuration, the user will pass in
the optional argument ``partition_list`` and if the user wants to specify
the rigging values, give the optional argument ``rigging_list`` as well.
If ``rigging_list`` is not passed, the rigging values are set to the
corresponding vacancy numbers.
INPUT:
- ``parent`` -- the parent of this element
- ``rigged_partitions`` -- a list of rigged partitions
There are two optional arguments to explicitly construct a rigged
configuration. The first is ``partition_list`` which gives a list of
partitions, and the second is ``rigging_list`` which is a list of
corresponding lists of riggings. If only partition_list is specified,
then it sets the rigging equal to the calculated vacancy numbers.
If we are constructing a rigged configuration from a rigged configuration
(say of another type) and we don't want to recompute the vacancy numbers,
we can use the ``use_vacancy_numbers`` to avoid the recomputation.
EXAMPLES:
Type `A_n^{(1)}` examples::
sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 2]])
sage: RC(partition_list=[[2], [2, 2], [2], [2]])
<BLANKLINE>
0[ ][ ]0
<BLANKLINE>
-2[ ][ ]-2
-2[ ][ ]-2
<BLANKLINE>
2[ ][ ]2
<BLANKLINE>
-2[ ][ ]-2
<BLANKLINE>
sage: RC = RiggedConfigurations(['A', 4, 1], [[1, 1], [1, 1]])
sage: RC(partition_list=[[], [], [], []])
<BLANKLINE>
(/)
<BLANKLINE>
(/)
<BLANKLINE>
(/)
<BLANKLINE>
(/)
<BLANKLINE>
Type `D_n^{(1)}` examples::
sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 2]])
sage: RC(partition_list=[[3], [3,2], [4], [3]])
<BLANKLINE>
-1[ ][ ][ ]-1
<BLANKLINE>
1[ ][ ][ ]1
0[ ][ ]0
<BLANKLINE>
-3[ ][ ][ ][ ]-3
<BLANKLINE>
-1[ ][ ][ ]-1
<BLANKLINE>
sage: RC = RiggedConfigurations(['D', 4, 1], [[1, 1], [2, 1]])
sage: RC(partition_list=[[1], [1,1], [1], [1]])
<BLANKLINE>
1[ ]1
<BLANKLINE>
0[ ]0
0[ ]0
<BLANKLINE>
0[ ]0
<BLANKLINE>
0[ ]0
<BLANKLINE>
sage: elt = RC(partition_list=[[1], [1,1], [1], [1]], rigging_list=[[0], [0,0], [0], [0]]); elt
<BLANKLINE>
1[ ]0
<BLANKLINE>
0[ ]0
0[ ]0
<BLANKLINE>
0[ ]0
<BLANKLINE>
0[ ]0
<BLANKLINE>
sage: from sage.combinat.rigged_configurations.rigged_partition import RiggedPartition
sage: RC2 = RiggedConfigurations(['D', 5, 1], [[2, 1], [3, 1]])
sage: l = [RiggedPartition()] + list(elt)
sage: ascii_art(RC2(*l))
(/) 1[ ]0 0[ ]0 0[ ]0 0[ ]0
0[ ]0
sage: ascii_art(RC2(*l, use_vacancy_numbers=True))
(/) 1[ ]0 0[ ]0 0[ ]0 0[ ]0
0[ ]0
"""
def __init__(self, parent, rigged_partitions=[], **options):
r"""
Construct a rigged configuration element.
EXAMPLES::
sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 1]])
sage: RC(partition_list=[[], [], [], []])
<BLANKLINE>
(/)
<BLANKLINE>
(/)
<BLANKLINE>
(/)
<BLANKLINE>
(/)
<BLANKLINE>
sage: RC(partition_list=[[1], [1], [], []])
<BLANKLINE>
-1[ ]-1
<BLANKLINE>
0[ ]0
<BLANKLINE>
(/)
<BLANKLINE>
(/)
<BLANKLINE>
sage: elt = RC(partition_list=[[1], [1], [], []], rigging_list=[[-1], [0], [], []]); elt
<BLANKLINE>
-1[ ]-1
<BLANKLINE>
0[ ]0
<BLANKLINE>
(/)
<BLANKLINE>
(/)
<BLANKLINE>
sage: TestSuite(elt).run()
"""
n = options.get('n', parent._cartan_type.rank())
if "partition_list" in options:
data = options["partition_list"]
if len(data) == 0:
# Create a size n array of empty rigged tableau since no tableau
# were given
nu = []
for i in range(n):
nu.append(RiggedPartition())
else:
if len(data) != n: # otherwise n should be equal to the number of tableaux
raise ValueError("Incorrect number of partitions")
nu = []
if "rigging_list" in options:
rigging_data = options["rigging_list"]
if len(rigging_data) != n:
raise ValueError("Incorrect number of riggings")
for i in range(n):
nu.append(RiggedPartition(tuple(data[i]), \
list(rigging_data[i])))
else:
for partition_data in data:
nu.append(RiggedPartition(tuple(partition_data)))
elif n == len(rigged_partitions) and isinstance(rigged_partitions[0], RiggedPartition):
# The isinstance check is to make sure we are not in the n == 1 special case because
# Parent's __call__ always passes at least 1 argument to the element constructor
if options.get('use_vacancy_numbers', False):
# Special display case
if parent.cartan_type().type() == 'B':
rigged_partitions[-1] = RiggedPartitionTypeB(rigged_partitions[-1])
ClonableArray.__init__(self, parent, rigged_partitions)
return
nu = rigged_partitions
else:
# Otherwise we did not receive any info, create a size n array of
# empty rigged partitions
nu = []
for i in range(n):
nu.append(RiggedPartition())
#raise ValueError("Invalid input")
#raise ValueError("Incorrect number of rigged partitions")
# Set the vacancy numbers
for a, partition in enumerate(nu):
# If the partition is empty, there's nothing to do
if len(partition) <= 0:
continue
# Setup the first block
block_len = partition[0]
vac_num = parent._calc_vacancy_number(nu, a, 0)
for i, row_len in enumerate(partition):
# If we've gone to a different sized block, then update the
# values which change when moving to a new block size
if block_len != row_len:
vac_num = parent._calc_vacancy_number(nu, a, i)
block_len = row_len
partition.vacancy_numbers[i] = vac_num
if partition.rigging[i] is None:
partition.rigging[i] = partition.vacancy_numbers[i]
# Special display case
if parent.cartan_type().type() == 'B':
nu[-1] = RiggedPartitionTypeB(nu[-1])
ClonableArray.__init__(self, parent, nu)
def check(self):
"""
Check the rigged configuration is properly defined.
There is nothing to check here.
EXAMPLES::
sage: RC = crystals.infinity.RiggedConfigurations(['A', 4])
sage: b = RC.module_generators[0].f_string([1,2,1,1,2,4,2,3,3,2])
sage: b.check()
"""
pass
def _repr_(self):
"""
Return a string representation of ``self``.
EXAMPLES::
sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 2]])
sage: elt = RC(partition_list=[[2], [3,1], [3], [3]]); elt
<BLANKLINE>
-1[ ][ ]-1
<BLANKLINE>
2[ ][ ][ ]2
0[ ]0
<BLANKLINE>
-2[ ][ ][ ]-2
<BLANKLINE>
-2[ ][ ][ ]-2
<BLANKLINE>
sage: RC.global_options(display='horizontal')
sage: elt
-1[ ][ ]-1 2[ ][ ][ ]2 -2[ ][ ][ ]-2 -2[ ][ ][ ]-2
0[ ]0
sage: RC.global_options.reset()
"""
return self.parent().global_options.dispatch(self, '_repr_', 'display')
def _repr_vertical(self):
"""
Return the string representation of ``self`` verically.
EXAMPLES::
sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 2]])
sage: print RC(partition_list=[[2], [3,1], [3], [3]])._repr_vertical()
<BLANKLINE>
-1[ ][ ]-1
<BLANKLINE>
2[ ][ ][ ]2
0[ ]0
<BLANKLINE>
-2[ ][ ][ ]-2
<BLANKLINE>
-2[ ][ ][ ]-2
<BLANKLINE>
sage: print RC(partition_list=[[],[],[],[]])._repr_vertical()
<BLANKLINE>
(/)
<BLANKLINE>
(/)
<BLANKLINE>
(/)
<BLANKLINE>
(/)
<BLANKLINE>
"""
ret_str = ""
for tableau in self:
ret_str += "\n" + repr(tableau)
return(ret_str)
def _repr_horizontal(self):
"""
Return the string representation of ``self`` horizontally.
EXAMPLES::
sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 2]])
sage: print RC(partition_list=[[2], [3,1], [3], [3]])._repr_horizontal()
-1[ ][ ]-1 2[ ][ ][ ]2 -2[ ][ ][ ]-2 -2[ ][ ][ ]-2
0[ ]0
sage: print RC(partition_list=[[],[],[],[]])._repr_horizontal()
(/) (/) (/) (/)
"""
tab_str = [repr(x).splitlines() for x in self]
height = max(len(t) for t in tab_str)
widths = [max(len(x) for x in t) for t in tab_str]
ret_str = ''
for i in range(height):
if i != 0:
ret_str += '\n'
for j,t in enumerate(tab_str):
if j != 0:
ret_str += ' '
if i < len(t):
ret_str += t[i] + ' ' * (widths[j]-len(t[i]))
else:
ret_str += ' ' * widths[j]
return ret_str
def _latex_(self):
r"""
Return the LaTeX representation of ``self``.
EXAMPLES::
sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 2]])
sage: latex(RC(partition_list=[[2], [3,1], [3], [3]]))
{
\begin{array}[t]{r|c|c|l}
\cline{2-3} -1 &\phantom{|}&\phantom{|}& -1 \\
\cline{2-3}
\end{array}
}
\quad
{
\begin{array}[t]{r|c|c|c|l}
\cline{2-4} 2 &\phantom{|}&\phantom{|}&\phantom{|}& 2 \\
\cline{2-4} 0 &\phantom{|}& \multicolumn{3 }{l}{ 0 } \\
\cline{2-2}
\end{array}
}
\quad
{
\begin{array}[t]{r|c|c|c|l}
\cline{2-4} -2 &\phantom{|}&\phantom{|}&\phantom{|}& -2 \\
\cline{2-4}
\end{array}
}
\quad
{
\begin{array}[t]{r|c|c|c|l}
\cline{2-4} -2 &\phantom{|}&\phantom{|}&\phantom{|}& -2 \\
\cline{2-4}
\end{array}
}
sage: latex(RC(partition_list=[[],[],[],[]]))
{\emptyset}
\quad
{\emptyset}
\quad
{\emptyset}
\quad
{\emptyset}
"""
ret_string = self[0]._latex_()
for partition in self[1:]:
ret_string += "\n\quad\n" + partition._latex_()
return ret_string
def _ascii_art_(self):
"""
Return an ASCII art representation of ``self``.
EXAMPLES::
sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 2]])
sage: ascii_art(RC(partition_list=[[2], [3,1], [3], [3]]))
-1[ ][ ]-1 2[ ][ ][ ]2 -2[ ][ ][ ]-2 -2[ ][ ][ ]-2
0[ ]0
sage: ascii_art(RC(partition_list=[[],[],[],[]]))
(/) (/) (/) (/)
sage: RC = RiggedConfigurations(['D', 7, 1], [[3,3],[5,2],[4,3],[2,3],[4,4],[3,1],[1,4],[2,2]])
sage: elt = RC(partition_list=[[2],[3,2,1],[2,2,1,1],[2,2,1,1,1,1],[3,2,1,1,1,1],[2,1,1],[2,2]],
....: rigging_list=[[2],[1,0,0],[4,1,2,1],[1,0,0,0,0,0],[0,1,0,0,0,0],[0,0,0],[0,0]])
sage: ascii_art(elt)
3[ ][ ]2 1[ ][ ][ ]1 4[ ][ ]4 2[ ][ ]1 0[ ][ ][ ]0 0[ ][ ]0 0[ ][ ]0
2[ ][ ]0 4[ ][ ]1 2[ ][ ]0 2[ ][ ]1 0[ ]0 0[ ][ ]0
1[ ]0 3[ ]2 0[ ]0 0[ ]0 0[ ]0
3[ ]1 0[ ]0 0[ ]0
0[ ]0 0[ ]0
0[ ]0 0[ ]0
sage: Partitions.global_options(convention='French')
sage: ascii_art(elt)
0[ ]0 0[ ]0
0[ ]0 0[ ]0
3[ ]1 0[ ]0 0[ ]0
1[ ]0 3[ ]2 0[ ]0 0[ ]0 0[ ]0
2[ ][ ]0 4[ ][ ]1 2[ ][ ]0 2[ ][ ]1 0[ ]0 0[ ][ ]0
3[ ][ ]2 1[ ][ ][ ]1 4[ ][ ]4 2[ ][ ]1 0[ ][ ][ ]0 0[ ][ ]0 0[ ][ ]0
sage: Partitions.global_options.reset()
"""
from sage.combinat.partition import PartitionOptions
if PartitionOptions['convention'] == "French":
baseline = lambda s: 0
else:
baseline = lambda s: len(s)
from sage.typeset.ascii_art import AsciiArt
s = repr(self[0]).splitlines()
ret = AsciiArt(s, baseline=baseline(s))
for tableau in self[1:]:
s = repr(tableau).splitlines()
ret += AsciiArt([" "], baseline=baseline(s)) + AsciiArt(s, baseline=baseline(s))
return ret
def nu(self):
r"""
Return the list `\nu` of rigged partitions of this rigged
configuration element.
OUTPUT:
The `\nu` array as a list.
EXAMPLES::
sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 2]])
sage: RC(partition_list=[[2], [2,2], [2], [2]]).nu()
[0[ ][ ]0
, -2[ ][ ]-2
-2[ ][ ]-2
, 2[ ][ ]2
, -2[ ][ ]-2
]
"""
return list(self)
# TODO: Change e/f to work for all types
def e(self, a):
r"""
Return the action of the crystal operator `e_a` on ``self``.
This implements the method defined in [CrysStructSchilling06]_ which
finds the value `k` which is the length of the string with the
smallest negative rigging of smallest length. Then it removes a box
from a string of length `k` in the `a`-th rigged partition, keeping all
colabels fixed and increasing the new label by one. If no such string
exists, then `e_a` is undefined.
INPUT:
- ``a`` -- the index of the partition to remove a box
OUTPUT:
The resulting rigged configuration element.
EXAMPLES::
sage: RC = RiggedConfigurations(['A', 4, 1], [[2,1]])
sage: elt = RC(partition_list=[[1], [1], [1], [1]])
sage: elt.e(3)
sage: elt.e(1)
<BLANKLINE>
(/)
<BLANKLINE>
0[ ]0
<BLANKLINE>
0[ ]0
<BLANKLINE>
-1[ ]-1
<BLANKLINE>
"""
if a not in self.parent()._rc_index:
raise ValueError("{} is not in the index set".format(a))
a = self.parent()._rc_index.index(a)
new_list = self[a][:]
new_vac_nums = self[a].vacancy_numbers[:]
new_rigging = self[a].rigging[:]
# Find k and perform e_a
k = None
num_rows = len(new_list)
cur_rigging = -1
rigging_index = None
for i in range(num_rows):
if new_rigging[i] <= cur_rigging:
cur_rigging = new_rigging[i]
rigging_index = i
# If we've not found a valid k
if rigging_index is None:
return None
# Note that because the riggings are weakly decreasing, we will always
# remove the last box on of a block
k = new_list[rigging_index]
set_vac_num = False
if k == 1:
new_list.pop()
new_vac_nums.pop()
new_rigging.pop()
else:
new_list[rigging_index] -= 1
cur_rigging += 1
# Properly sort the riggings
j = rigging_index + 1
# Update the vacancy number if the row lengths are the same
if j < num_rows and new_list[j] == new_list[rigging_index]:
new_vac_nums[rigging_index] = new_vac_nums[j]
set_vac_num = True
while j < num_rows and new_list[j] == new_list[rigging_index] \
and new_rigging[j] > cur_rigging:
new_rigging[j-1] = new_rigging[j] # Shuffle it along
j += 1
new_rigging[j-1] = cur_rigging
new_partitions = []
for b in range(len(self)):
if b != a:
new_partitions.append(self._generate_partition_e(a, b, k))
else:
# Update the vacancy numbers and the rigging
for i in range(len(new_vac_nums)):
if new_list[i] < k:
break
new_vac_nums[i] += 2
new_rigging[i] += 2
if k != 1 and not set_vac_num: # If we did not remove a row nor found another row of length k-1
new_vac_nums[rigging_index] += 2
new_partitions.append(RiggedPartition(new_list, new_rigging, new_vac_nums))
ret_RC = self.__class__(self.parent(), new_partitions)
if k != 1 and not set_vac_num: # If we did not remove a row nor found another row of length k-1
# Update that row's vacancy number
ret_RC[a].vacancy_numbers[rigging_index] = \
self.parent()._calc_vacancy_number(ret_RC.nu(), a, rigging_index)
return(ret_RC)
def _generate_partition_e(self, a, b, k):
r"""
Generate a new partition for a given value of `a` by updating the
vacancy numbers and preserving co-labels for the map `e_a`.
INPUT:
- ``a`` -- the index of the partition we operated on
- ``b`` -- the index of the partition to generate
- ``k`` -- the length of the string with the smallest negative
rigging of smallest length
OUTPUT:
The constructed rigged partition.
TESTS::
sage: RC = RiggedConfigurations(['A', 4, 1], [[2,1]])
sage: RC(partition_list=[[1], [1], [1], [1]])._generate_partition_e(1, 2, 1)
-1[ ]-1
<BLANKLINE>
"""
# Check to make sure we will do something
if not self.parent()._cartan_matrix[a][b]:
return self[b]
new_list = self[b][:]
new_vac_nums = self[b].vacancy_numbers[:]
new_rigging = self[b].rigging[:]
# Update the vacancy numbers and the rigging
value = self.parent()._cartan_matrix[a][b]
for i in range(len(new_vac_nums)):
if new_list[i] < k:
break
new_vac_nums[i] += value
new_rigging[i] += value
return(RiggedPartition(new_list, new_rigging, new_vac_nums))
def f(self, a):
r"""
Return the action of the crystal operator `f_a` on ``self``.
This implements the method defined in [CrysStructSchilling06]_ which
finds the value `k` which is the length of the string with the
smallest nonpositive rigging of largest length. Then it adds a box from
a string of length `k` in the `a`-th rigged partition, keeping all
colabels fixed and decreasing the new label by one. If no such string
exists, then it adds a new string of length 1 with label `-1`. However
we need to modify the definition to work for `B(\infty)` by removing
the condition that the resulting rigged configuration is valid.
INPUT:
- ``a`` -- the index of the partition to add a box
OUTPUT:
The resulting rigged configuration element.
EXAMPLES::
sage: RC = crystals.infinity.RiggedConfigurations(['A', 3])
sage: nu0 = RC.module_generators[0]
sage: nu0.f(2)
<BLANKLINE>
(/)
<BLANKLINE>
-2[ ]-1
<BLANKLINE>
(/)
<BLANKLINE>
"""
if a not in self.parent()._rc_index:
raise ValueError("{} is not in the index set".format(a))
a = self.parent()._rc_index.index(a)
new_list = self[a][:]
new_vac_nums = self[a].vacancy_numbers[:]
new_rigging = self[a].rigging[:]
# Find k and perform f_a
k = None
add_index = -1 # Index where we will add our row too
rigging_index = None # Index which we will pull the rigging from
cur_rigging = 0
num_rows = len(new_list)
for i in reversed(range(num_rows)):
# If we need to increment a row, look for when we change rows for
# the correct index.
if add_index is None and new_list[i] != new_list[rigging_index]:
add_index = i+1
if new_rigging[i] <= cur_rigging:
cur_rigging = new_rigging[i]
k = new_list[i]
rigging_index = i
add_index = None
# If we've not found a valid k
if k is None:
new_list.append(1)
new_rigging.append(-1)
new_vac_nums.append(None)
k = 0
add_index = num_rows
num_rows += 1 # We've added a row
else:
if add_index is None: # We are adding to the first row in the list
add_index = 0
new_list[add_index] += 1
new_rigging.insert(add_index, new_rigging[rigging_index] - 1)
new_vac_nums.insert(add_index, None)
new_rigging.pop(rigging_index + 1) # add 1 for the insertion
new_vac_nums.pop(rigging_index + 1)
new_partitions = []
for b in range(len(self)):
if b != a:
new_partitions.append(self._generate_partition_f(a, b, k))
else:
# Update the vacancy numbers and the rigging
for i in range(num_rows):
if new_list[i] <= k:
break
if i != add_index:
new_vac_nums[i] -= 2
new_rigging[i] -= 2
new_partitions.append(RiggedPartition(new_list, new_rigging, new_vac_nums))
new_partitions[a].vacancy_numbers[add_index] = \
self.parent()._calc_vacancy_number(new_partitions, a, add_index)
# Note that we do not need to sort the rigging since if there was a
# smaller rigging in a larger row, then `k` would be larger.
return self.__class__(self.parent(), new_partitions)
def _generate_partition_f(self, a, b, k):
r"""
Generate a new partition for a given value of `a` by updating the
vacancy numbers and preserving co-labels for the map `f_a`.
INPUT:
- ``a`` -- the index of the partition we operated on
- ``b`` -- the index of the partition to generate
- ``k`` -- the length of the string with smallest nonpositive rigging
of largest length
OUTPUT:
The constructed rigged partition.
TESTS::
sage: RC = RiggedConfigurations(['A', 4, 1], [[2,1]])
sage: RC(partition_list=[[1], [1], [1], [1]])._generate_partition_f(1, 2, 1)
0[ ]0
<BLANKLINE>
"""
# Check to make sure we will do something
if not self.parent()._cartan_matrix[a][b]:
return self[b]
new_list = self[b][:]
new_vac_nums = self[b].vacancy_numbers[:]
new_rigging = self[b].rigging[:]
# Update the vacancy numbers and the rigging
value = self.parent()._cartan_matrix[a][b]
for i in range(len(new_vac_nums)):
if new_list[i] <= k:
break
new_vac_nums[i] -= value
new_rigging[i] -= value
return(RiggedPartition(new_list, new_rigging, new_vac_nums))
def epsilon(self, a):
r"""
Return `\varepsilon_a` of ``self``.
Let `x_{\ell}` be the smallest string of `\nu^{(a)}` or `0` if
`\nu^{(a)} = \emptyset`, then we have
`\varepsilon_a = -\min(0, x_{\ell})`.
EXAMPLES::
sage: La = RootSystem(['B',2]).weight_lattice().fundamental_weights()
sage: RC = crystals.RiggedConfigurations(La[1]+La[2])
sage: I = RC.index_set()
sage: matrix([[rc.epsilon(i) for i in I] for rc in RC[:4]])
[0 0]
[1 0]
[0 1]
[0 2]
"""
a = self.parent()._rc_index.index(a)
if not self[a]:
return 0
return -min(0, min(self[a].rigging))
def phi(self, a):
r"""
Return `\varphi_a` of ``self``.
Let `x_{\ell}` be the smallest string of `\nu^{(a)}` or `0` if
`\nu^{(a)} = \emptyset`, then we have
`\varepsilon_a = p_{\infty}^{(a)} - \min(0, x_{\ell})`.
EXAMPLES::
sage: La = RootSystem(['B',2]).weight_lattice().fundamental_weights()
sage: RC = crystals.RiggedConfigurations(La[1]+La[2])
sage: I = RC.index_set()
sage: matrix([[rc.phi(i) for i in I] for rc in RC[:4]])
[1 1]
[0 3]
[0 2]
[1 1]
"""
a = self.parent()._rc_index.index(a)
p_inf = self.parent()._calc_vacancy_number(self, a, None)
if not self[a]:
return p_inf
return p_inf - min(0, min(self[a].rigging))
def get_vacancy_numbers(self, a):
r"""
Return the list of all vacancy numbers of the rigged partition
`\nu^{(a)}` (with duplicates).
INPUT:
- ``a`` -- the index of the rigged partition
EXAMPLES::
sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 2]])
sage: RC(partition_list=[[1], [2,1], [1], []]).get_vacancy_numbers(2)
[-2, -1]
"""
a = self.parent()._rc_index.index(a)
return self[a].vacancy_numbers
def get_vacancy_number(self, a, i):
r"""
Return the vacancy number `p_i^{(a)}`.
INPUT:
- ``a`` -- the index of the rigged partition
- ``i`` -- the row of the rigged partition
EXAMPLES::
sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 2]])
sage: elt = RC(partition_list=[[1], [2,1], [1], []])
sage: elt.get_vacancy_number(2, 3)
sage: elt.get_vacancy_number(2, 2)
-2
sage: elt.get_vacancy_number(2, 1)
-1
"""
a = self.parent()._rc_index.index(a)
partition = self[a]
for k, val in enumerate(partition):
if val == i:
return partition.vacancy_numbers[k]
elif val < i:
return None
return None
def partition_rigging_lists(self):
"""
Return the list of partitions and the associated list of riggings
of ``self``.
EXAMPLES::
sage: RC = RiggedConfigurations(['A',3,1], [[1,2],[2,2]])
sage: rc = RC(partition_list=[[2],[1],[1]], rigging_list=[[-1],[0],[-1]]); rc
<BLANKLINE>
-1[ ][ ]-1
<BLANKLINE>
1[ ]0
<BLANKLINE>
-1[ ]-1
<BLANKLINE>
sage: rc.partition_rigging_lists()
[[[2], [1], [1]], [[-1], [0], [-1]]]
"""
partitions = []
riggings = []
for p in self:
partitions.append(list(p))
riggings.append(list(p.rigging))
return [partitions, riggings]
class RCNonSimplyLacedElement(RiggedConfigurationElement):
"""
Rigged configuration elements for non-simply-laced types.
TESTS::
sage: RC = crystals.infinity.RiggedConfigurations(['C',2,1])
sage: elt = RC.module_generators[0].f_string([1,0,2,2,0,1]); elt
<BLANKLINE>
-2[ ][ ]-1
<BLANKLINE>
-2[ ]-1
-2[ ]-1
<BLANKLINE>
-2[ ][ ]-1
<BLANKLINE>
sage: TestSuite(elt).run()
"""
def to_virtual_configuration(self):
"""
Return the corresponding rigged configuration in the virtual crystal.
EXAMPLES::
sage: RC = RiggedConfigurations(['C',2,1], [[1,2],[1,1],[2,1]])
sage: elt = RC(partition_list=[[3],[2]]); elt
<BLANKLINE>
0[ ][ ][ ]0
<BLANKLINE>
0[ ][ ]0
sage: elt.to_virtual_configuration()
<BLANKLINE>
0[ ][ ][ ]0
<BLANKLINE>
0[ ][ ][ ][ ]0
<BLANKLINE>
0[ ][ ][ ]0
"""
return self.parent().to_virtual(self)
def e(self, a):
"""
Return the action of `e_a` on ``self``.
This works by lifting into the virtual configuration, then applying
.. MATH::
e^v_a = \prod_{j \in \iota(a)} \hat{e}_j^{\gamma_j}
and pulling back.
EXAMPLES::
sage: RC = crystals.infinity.RiggedConfigurations(['C',2,1])
sage: elt = RC(partition_list=[[2],[1,1],[2]], rigging_list=[[-1],[-1,-1],[-1]])
sage: ascii_art(elt.e(0))
0[ ]0 -2[ ]-1 -2[ ][ ]-1
-2[ ]-1
sage: ascii_art(elt.e(1))
-3[ ][ ]-2 0[ ]1 -3[ ][ ]-2
sage: ascii_art(elt.e(2))
-2[ ][ ]-1 -2[ ]-1 0[ ]0
-2[ ]-1
"""
vct = self.parent()._folded_ct
L = []
gamma = vct.scaling_factors()
for i in vct.folding_orbit()[a]:
L.extend([i]*gamma[a])
virtual_rc = self.parent().to_virtual(self).e_string(L)
if virtual_rc is None:
return None
return self.parent().from_virtual(virtual_rc)
def f(self, a):
"""
Return the action of `f_a` on ``self``.
This works by lifting into the virtual configuration, then applying
.. MATH::
f^v_a = \prod_{j \in \iota(a)} \hat{f}_j^{\gamma_j}
and pulling back.
EXAMPLES::
sage: RC = crystals.infinity.RiggedConfigurations(['C',2,1])
sage: elt = RC(partition_list=[[2],[1,1],[2]], rigging_list=[[-1],[-1,-1],[-1]])
sage: ascii_art(elt.f(0))
-4[ ][ ][ ]-2 -2[ ]-1 -2[ ][ ]-1
-2[ ]-1
sage: ascii_art(elt.f(1))
-1[ ][ ]0 -2[ ][ ]-2 -1[ ][ ]0
-2[ ]-1
sage: ascii_art(elt.f(2))
-2[ ][ ]-1 -2[ ]-1 -4[ ][ ][ ]-2
-2[ ]-1
"""
vct = self.parent()._folded_ct
L = []
gamma = vct.scaling_factors()
for i in vct.folding_orbit()[a]:
L.extend([i]*gamma[a])
virtual_rc = self.parent().to_virtual(self).f_string(L)