Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge branch 'public/combinat/rigged_configurations/bijections-13872'…
Browse files Browse the repository at this point in the history
… into public/combinat/rigged_configurations/improvements
  • Loading branch information
Travis Scrimshaw committed Dec 21, 2013
2 parents 3735dfd + 85b6446 commit c1cda2b
Show file tree
Hide file tree
Showing 22 changed files with 6,512 additions and 1,854 deletions.
17 changes: 17 additions & 0 deletions src/doc/en/reference/combinat/rc_bijections.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Rigged Configuration Bijections
===============================

.. toctree::
:maxdepth: 1

../sage/combinat/rigged_configurations/bijection
../sage/combinat/rigged_configurations/bij_abstract_class
../sage/combinat/rigged_configurations/bij_type_A
../sage/combinat/rigged_configurations/bij_type_B
../sage/combinat/rigged_configurations/bij_type_C
../sage/combinat/rigged_configurations/bij_type_D
../sage/combinat/rigged_configurations/bij_type_A2_odd
../sage/combinat/rigged_configurations/bij_type_A2_even
../sage/combinat/rigged_configurations/bij_type_A2_dual
../sage/combinat/rigged_configurations/bij_type_D_twisted

7 changes: 2 additions & 5 deletions src/doc/en/reference/combinat/rigged_configurations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Rigged Configurations
=====================

.. toctree::
:maxdepth: 2
:maxdepth: 1

../sage/combinat/rigged_configurations/rigged_configurations
../sage/combinat/rigged_configurations/rigged_configuration_element
Expand All @@ -15,8 +15,5 @@ Rigged Configurations

../sage/combinat/rigged_configurations/rigged_partition

../sage/combinat/rigged_configurations/bijection
../sage/combinat/rigged_configurations/bij_abstract_class
../sage/combinat/rigged_configurations/bij_type_A
../sage/combinat/rigged_configurations/bij_type_D
rc_bijections

79 changes: 57 additions & 22 deletions src/sage/combinat/crystals/kirillov_reshetikhin.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,9 @@ def _repr_(self):
"""
return "Kirillov-Reshetikhin crystal of type %s with (r,s)=(%d,%d)" % (self.cartan_type(), self.r(), self.s())

def _element_constructor_(self, *value, **options):
def _element_constructor_(self, *args, **options):
"""
Construct an element of ``self`` from ``elt``.
Construct an element of ``self`` from the input.
EXAMPLES::
Expand All @@ -408,10 +408,10 @@ def _element_constructor_(self, *value, **options):
[[1], [2]]
"""
from sage.combinat.rigged_configurations.kr_tableaux import KirillovReshetikhinTableauxElement
if isinstance(value[0], KirillovReshetikhinTableauxElement):
elt = value[0]
if isinstance(args[0], KirillovReshetikhinTableauxElement):
elt = args[0]
# Check to make sure it can be converted
if elt.cartan_type().affine() != self.cartan_type() \
if elt.cartan_type() != self.cartan_type() \
or elt.parent().r() != self._r or elt.parent().s() != self._s:
raise ValueError("The Kirillov-Reshetikhin tableau must have the same Cartan type and shape")

Expand All @@ -424,7 +424,7 @@ def _element_constructor_(self, *value, **options):
hw_elt = self(rows=rows)
f_str = reversed(to_hw[1])
return hw_elt.f_string(f_str)
return AffineCrystalFromClassical._element_constructor_(self, *value, **options)
return AffineCrystalFromClassical._element_constructor_(self, *args, **options)

@abstract_method
def classical_decomposition(self):
Expand Down Expand Up @@ -614,14 +614,15 @@ def R_matrix(self, K):
g = { gen1 : gen2 }
return T1.crystal_morphism(g, acyclic = False)

def Kirillov_Reshetikhin_tableaux(self):
@cached_method
def kirillov_reshetikhin_tableaux(self):
"""
Return the corresponding set of :class:`KirillovReshetikhinTableaux`.
EXAMPLES::
sage: KRC = KirillovReshetikhinCrystal(['D', 4, 1], 2, 2)
sage: KRC.Kirillov_Reshetikhin_tableaux()
sage: KRC.kirillov_reshetikhin_tableaux()
Kirillov-Reshetikhin tableaux of type ['D', 4, 1] and shape (2, 2)
"""
from sage.combinat.rigged_configurations.kr_tableaux import KirillovReshetikhinTableaux
Expand All @@ -631,7 +632,8 @@ class KirillovReshetikhinGenericCrystalElement(AffineCrystalFromClassicalElement
"""
Abstract class for all Kirillov-Reshetikhin crystal elements.
"""
def to_Kirillov_Reshetikhin_tableau(self):
@cached_method
def to_kirillov_reshetikhin_tableau(self):
r"""
Construct the corresponding
:class:`KirillovReshetikhinTableauxElement` from ``self``.
Expand All @@ -647,13 +649,13 @@ def to_Kirillov_Reshetikhin_tableau(self):
EXAMPLES::
sage: KRC = KirillovReshetikhinCrystal(['A', 4, 1], 2, 1)
sage: KRC(columns=[[2,1]]).to_Kirillov_Reshetikhin_tableau()
sage: KRC(columns=[[2,1]]).to_kirillov_reshetikhin_tableau()
[[1], [2]]
sage: KRC = KirillovReshetikhinCrystal(['D', 4, 1], 2, 1)
sage: KRC(rows=[]).to_Kirillov_Reshetikhin_tableau()
sage: KRC(rows=[]).to_kirillov_reshetikhin_tableau()
[[1], [-1]]
"""
return self.parent().Kirillov_Reshetikhin_tableaux()(self)
return self.parent().kirillov_reshetikhin_tableaux()(self)

KirillovReshetikhinGenericCrystal.Element = KirillovReshetikhinGenericCrystalElement

Expand Down Expand Up @@ -1638,7 +1640,7 @@ def from_ambient_crystal(self):
return self.crystal_morphism( pdict_inv, index_set = [j+1 for j in self.cartan_type().classical().index_set()],
automorphism = lambda i : i-1 )

class KR_type_A2Element(AffineCrystalFromClassicalElement):
class KR_type_A2Element(KirillovReshetikhinGenericCrystalElement):
r"""
Class for the elements in the Kirillov-Reshetikhin crystals `B^{r,s}` of type `A_{2n}^{(2)}` for `r<n`
with underlying classcial algebra `B_n`.
Expand Down Expand Up @@ -1985,6 +1987,39 @@ class KR_type_Bn(KirillovReshetikhinGenericCrystal):
sage: [b.weight() for b in K if b.is_highest_weight([0,2,3])]
[Lambda[0] - Lambda[1], -2*Lambda[1] + 2*Lambda[3]]
"""
def _element_constructor_(self, *args, **options):
"""
Construct an element of ``self``.
TESTS::
sage: KRC = KirillovReshetikhinCrystal(['B',3,1], 3, 3)
sage: KRT = KirillovReshetikhinTableaux(['B',3,1], 3, 3)
sage: elt = KRC.module_generators[1].f_string([3,2,3,1,3,3]); elt
[++-, [[2], [0], [-3]]]
sage: ret = KRT(elt); ret
[[1, 1, 2], [2, 2, -3], [-3, -3, -1]]
sage: test = KRC(ret); test
[++-, [[2], [0], [-3]]]
sage: test == elt
True
"""
from sage.combinat.rigged_configurations.kr_tableaux import KirillovReshetikhinTableauxElement
if isinstance(args[0], KirillovReshetikhinTableauxElement):
elt = args[0]
# Check to make sure it can be converted
if elt.cartan_type() != self.cartan_type() \
or elt.parent().r() != self._r or elt.parent().s() != self._s:
raise ValueError("The Kirillov-Reshetikhin tableau must have the same Cartan type and shape")

to_hw = elt.to_classical_highest_weight()
wt = to_hw[0].classical_weight() / 2
f_str = reversed(to_hw[1])
for x in self.module_generators:
if x.classical_weight() == wt:
return x.f_string(f_str)
raise ValueError("No matching highest weight element found")
return KirillovReshetikhinGenericCrystal._element_constructor_(self, *args, **options)

def classical_decomposition(self):
r"""
Expand Down Expand Up @@ -2276,7 +2311,7 @@ def from_pm_diagram_to_highest_weight_vector(self, pm):
u = u.f(i)
return u

class KR_type_CnElement(AffineCrystalFromClassicalElement):
class KR_type_CnElement(KirillovReshetikhinGenericCrystalElement):
r"""
Class for the elements in the Kirillov-Reshetikhin crystals `B^{n,s}` of type `C_n^{(1)}`.
Expand Down Expand Up @@ -2519,7 +2554,7 @@ def from_pm_diagram_to_highest_weight_vector(self, pm):
u = u.f(i)
return u

class KR_type_Dn_twistedElement(AffineCrystalFromClassicalElement):
class KR_type_Dn_twistedElement(KirillovReshetikhinGenericCrystalElement):
r"""
Class for the elements in the Kirillov-Reshetikhin crystals `B^{n,s}` of type `D_{n+1}^{(2)}`.
Expand Down Expand Up @@ -2679,15 +2714,15 @@ class KR_type_spin(KirillovReshetikhinCrystalFromPromotion):
sage: all(b.f(0).e(0) == b for b in K if b.phi(0)>0)
True
"""
def _element_constructor_(self, *value, **options):
def _element_constructor_(self, *args, **options):
"""
Construct an element of ``self`` from ``elt``.
Construct an element of ``self`` from the input.
EXAMPLES::
sage: KRT = KirillovReshetikhinTableaux(['D',4,1], 4, 3)
sage: KRC = KirillovReshetikhinCrystal(['D',4,1], 4, 3)
sage: elt = KRT([-3,-4,2,1,-3,-4,2,1,-2,-4,3,1]); elt
sage: elt = KRT(-3,-4,2,1,-3,-4,2,1,-2,-4,3,1); elt
[[1, 1, 1], [2, 2, 3], [-4, -4, -4], [-3, -3, -2]]
sage: KRC(elt) # indirect doctest
[++--, [[1], [3], [-4], [-3]]]
Expand All @@ -2708,17 +2743,17 @@ def _element_constructor_(self, *value, **options):
True
"""
from sage.combinat.rigged_configurations.kr_tableaux import KirillovReshetikhinTableauxElement
if isinstance(value[0], KirillovReshetikhinTableauxElement):
elt = value[0]
if isinstance(args[0], KirillovReshetikhinTableauxElement):
elt = args[0]
# Check to make sure it can be converted
if elt.cartan_type().affine() != self.cartan_type() \
if elt.cartan_type() != self.cartan_type() \
or elt.parent().r() != self._r or elt.parent().s() != self._s:
raise ValueError("The Kirillov-Reshetikhin tableau must have the same Cartan type and shape")

to_hw = elt.to_classical_highest_weight()
f_str = reversed(to_hw[1])
return self.module_generator().f_string(f_str)
KirillovReshetikhinCrystalFromPromotion._element_constructor_(self, *value, **options)
return KirillovReshetikhinCrystalFromPromotion._element_constructor_(self, *args, **options)

def classical_decomposition(self):
r"""
Expand Down
85 changes: 82 additions & 3 deletions src/sage/combinat/crystals/letters.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,24 @@ cdef class Letter(Element):
True
sage: C(4) == C(4)
True
TESTS::
sage: C = CrystalOfLetters(['C', 3])
sage: C('E') == C(2)
False
sage: C(2) == C('E')
False
sage: C('E') == C('E')
True
"""
# Special case for the empty letter
if isinstance(left, EmptyLetter):
return isinstance(right, EmptyLetter) \
and (op == Py_EQ or op == Py_LE or op == Py_GE)
if isinstance(right, EmptyLetter):
return op == Py_NE

cdef Letter self, x
self = left
x = right
Expand All @@ -462,11 +479,42 @@ cdef class Letter(Element):

cdef class EmptyLetter(Element):
"""
The (affine) letter `\emptyset` thought of as a classical crystal letter
The affine letter `\emptyset` thought of as a classical crystal letter
in classical type `B_n` and `C_n`.
.. WARNING::
This is not a classical letter.
Used in the rigged configuration bijections.
"""
cdef readonly str value

def __init__(self, parent):
"""
Initialize ``xelf``.
EXAMPLES::
sage: C = CrystalOfLetters(['C', 3])
sage: TestSuite(C('E')).run()
"""
self.value = 'E'
Element.__init__(self, parent)

def __reduce__(self):
r"""
Used in pickling crystal of letters elements.
EXAMPLES::
sage: C = CrystalOfLetters(['C',3])
sage: a = C('E')
sage: a.__reduce__()
(The crystal of letters for type ['C', 3], ('E',))
"""
return (self._parent, ('E',))

def _repr_(self):
"""
Return a string representation of ``self``.
Expand All @@ -491,6 +539,18 @@ cdef class EmptyLetter(Element):
"""
return "\\emptyset"

def __hash__(self):
"""
Return the hash value of ``self``.
EXAMPLES::
sage: C = CrystalOfLetters(['D', 4])
sage: hash(C('E')) == hash('E')
True
"""
return hash(self.value)

def weight(self):
"""
Return the weight of ``self``.
Expand All @@ -514,7 +574,16 @@ cdef class EmptyLetter(Element):
"""
return None

f = e
cpdef f(self, int i):
"""
Return `f_i` of ``self`` which is ``None``.
EXAMPLES::
sage: C = CrystalOfLetters(['C', 3])
sage: C('E').f(1)
"""
return None

cpdef int epsilon(self, int i):
r"""
Expand All @@ -528,7 +597,17 @@ cdef class EmptyLetter(Element):
"""
return 0

phi = epsilon
cpdef int phi(self, int i):
r"""
Return `\varphi_i` of ``self``.
EXAMPLES::
sage: C = CrystalOfLetters(['C', 3])
sage: C('E').phi(1)
0
"""
return 0

#########################
# Type A
Expand Down
27 changes: 26 additions & 1 deletion src/sage/combinat/crystals/tensor_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,29 @@ def _latex_(self):
"""
return ' \otimes '.join(latex(c) for c in self)

def _ascii_art_(self):
"""
Return an ASCII art representation of ``self``.
EXAMPLES::
sage: KT = TensorProductOfKirillovReshetikhinTableaux(['D',4,1],[[3,3],[2,1],[1,2]])
sage: ascii_art(KT.module_generators[0])
1 1 1
2 2 2 # 1 # 1 1
3 3 3 2
-4 -4 -4
"""
from sage.misc.ascii_art import ascii_art, AsciiArt
s = ascii_art(self[0])
s._baseline = s._h // 2
ret = s
for tableau in self[1:]:
s = ascii_art(tableau)
s._baseline = s._h // 2
ret += AsciiArt([" # "]) + s
return ret

def __lt__(self, other):
"""
Non elements of the crystal are incomparable with elements of the crystal
Expand Down Expand Up @@ -1293,7 +1316,9 @@ def e_string_to_ground_state(self):
sage: y.e_string_to_ground_state()
()
"""
if self.parent().crystals[0].__module__ != 'sage.combinat.crystals.kirillov_reshetikhin':
from sage.combinat.rigged_configurations.kr_tableaux import KirillovReshetikhinTableaux
if self.parent().crystals[0].__module__ != 'sage.combinat.crystals.kirillov_reshetikhin' and \
not isinstance(self.parent().crystals[0], KirillovReshetikhinTableaux):
raise ValueError("All crystals in the tensor product need to be Kirillov-Reshetikhin crystals")
I = self.cartan_type().classical().index_set()
ell = max(ceil(K.s()/K.cartan_type().c()[K.r()]) for K in self.parent().crystals)
Expand Down
Loading

0 comments on commit c1cda2b

Please sign in to comment.