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/methods-15560' in…
Browse files Browse the repository at this point in the history
…to u/tscrim/rc_crystals

Conflicts:
	src/sage/combinat/rigged_configurations/rigged_configuration_element.py
  • Loading branch information
Travis Scrimshaw committed Jul 26, 2014
2 parents c7b1e01 + 1e15993 commit 7eecbbe
Show file tree
Hide file tree
Showing 7 changed files with 363 additions and 48 deletions.
39 changes: 34 additions & 5 deletions src/sage/combinat/rigged_configurations/bij_abstract_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ def __init__(self, RC_element):
# TODO: Convert from cur_partitions to rigged_con
self.cur_partitions = deepcopy(list(self.rigged_con)[:])

# This is a dummy edge to start the process
cp = RC_element.__copy__()
cp.set_immutable()
self._graph = [ [[], (cp, 0)] ]

# Compute the current L matrix
# self.L = {}
# for dim in self.rigged_con.parent().dims:
Expand Down Expand Up @@ -341,22 +346,30 @@ def __eq__(self, rhs):
"""
return isinstance(rhs, RCToKRTBijectionAbstract)

def run(self, verbose=False):
def run(self, verbose=False, build_graph=False):
"""
Run the bijection from rigged configurations to tensor product of KR
tableaux.
INPUT:
- ``verbose`` -- (Default: ``False``) Display each step in the
- ``verbose`` -- (default: ``False``) display each step in the
bijection
- ``build_graph`` -- (default: ``False``) build the graph of each
step of the bijection
EXAMPLES::
sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 1]])
sage: x = RC(partition_list=[[1],[1],[1],[1]])
sage: from sage.combinat.rigged_configurations.bij_type_A import RCToKRTBijectionTypeA
sage: RCToKRTBijectionTypeA(RC(partition_list=[[1],[1],[1],[1]])).run()
sage: RCToKRTBijectionTypeA(x).run()
[[2], [5]]
sage: bij = RCToKRTBijectionTypeA(x)
sage: bij.run(build_graph=True)
[[2], [5]]
sage: bij._graph
Digraph on 3 vertices
"""
from sage.combinat.crystals.letters import CrystalOfLetters
letters = CrystalOfLetters(self.rigged_con.parent()._cartan_type.classical())
Expand All @@ -376,7 +389,7 @@ def run(self, verbose=False):
if self.cur_dims[0][1] > 1:
if verbose:
print("====================")
print(repr(self.rigged_con.parent()(*self.cur_partitions)))
print(repr(self.rigged_con.parent()(*self.cur_partitions, use_vacancy_numbers=True)))
print("--------------------")
print(ret_crystal_path)
print("--------------------\n")
Expand All @@ -390,10 +403,14 @@ def run(self, verbose=False):
for a in range(self.n):
self._update_vacancy_numbers(a)

if build_graph:
y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions], use_vacancy_numbers=True)
self._graph.append([self._graph[-1][1], (y, len(self._graph)), 'ls'])

while self.cur_dims[0][0] > 0:
if verbose:
print("====================")
print(repr(self.rigged_con.parent()(*self.cur_partitions)))
print(repr(self.rigged_con.parent()(*self.cur_partitions, use_vacancy_numbers=True)))
print("--------------------")
print(ret_crystal_path)
print("--------------------\n")
Expand All @@ -404,8 +421,20 @@ def run(self, verbose=False):
# Make sure we have a crystal letter
ret_crystal_path[-1].append(letters(b)) # Append the rank

if build_graph:
y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions], use_vacancy_numbers=True)
self._graph.append([self._graph[-1][1], (y, len(self._graph)), letters(b)])

self.cur_dims.pop(0) # Pop off the leading column

if build_graph:
self._graph.pop(0) # Remove the dummy at the start
from sage.graphs.digraph import DiGraph
from sage.graphs.dot2tex_utils import have_dot2tex
self._graph = DiGraph(self._graph)
if have_dot2tex():
self._graph.set_latex_options(format="dot2tex", edge_labels=True)

# Basic check to make sure we end with the empty configuration
#tot_len = sum([len(rp) for rp in self.cur_partitions])
#if tot_len != 0:
Expand Down
60 changes: 50 additions & 10 deletions src/sage/combinat/rigged_configurations/bij_type_B.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def run(self, verbose=False):
self.ret_rig_con[-1].rigging,
self.ret_rig_con[-1].vacancy_numbers)
bij = KRTToRCBijectionTypeA2Odd(KRT.module_generators[0]) # Placeholder element
bij.ret_rig_con = KRT.rigged_configurations()(*self.ret_rig_con)
bij.ret_rig_con = KRT.rigged_configurations()(*self.ret_rig_con, use_vacancy_numbers=True)
bij.cur_path = self.cur_path
bij.cur_dims = self.cur_dims
for i in range(len(self.cur_dims)):
Expand Down Expand Up @@ -524,26 +524,34 @@ class RCToKRTBijectionTypeB(RCToKRTBijectionTypeC):
Specific implementation of the bijection from rigged configurations to
tensor products of KR tableaux for type `B_n^{(1)}`.
"""
def run(self, verbose=False):
def run(self, verbose=False, build_graph=False):
"""
Run the bijection from rigged configurations to tensor product of KR
tableaux for type `B_n^{(1)}`.
INPUT:
- ``verbose`` -- (Default: ``False``) Display each step in the
- ``verbose`` -- (default: ``False``) display each step in the
bijection
- ``build_graph`` -- (default: ``False``) build the graph of each
step of the bijection
EXAMPLES::
sage: RC = RiggedConfigurations(['B', 3, 1], [[2, 1]])
sage: from sage.combinat.rigged_configurations.bij_type_B import RCToKRTBijectionTypeB
sage: RCToKRTBijectionTypeB(RC(partition_list=[[1],[1,1],[1]])).run()
[[3], [0]]
sage: RC = RiggedConfigurations(['B', 3, 1], [[3, 1]])
sage: from sage.combinat.rigged_configurations.bij_type_B import RCToKRTBijectionTypeB
sage: RCToKRTBijectionTypeB(RC(partition_list=[[],[1],[1]])).run()
sage: x = RC(partition_list=[[],[1],[1]])
sage: RCToKRTBijectionTypeB(x).run()
[[1], [3], [-2]]
sage: bij = RCToKRTBijectionTypeB(x)
sage: bij.run(build_graph=True)
[[1], [3], [-2]]
sage: bij._graph
Digraph on 6 vertices
"""
from sage.combinat.crystals.letters import CrystalOfLetters
letters = CrystalOfLetters(self.rigged_con.parent()._cartan_type.classical())
Expand All @@ -570,7 +578,7 @@ def run(self, verbose=False):
RC = RiggedConfigurations(['A', 2*self.n-1, 2], self.cur_dims)
if verbose:
print("====================")
print(repr(RC(*self.cur_partitions)))
print(repr(RC(*self.cur_partitions, use_vacancy_numbers=True)))
print("--------------------")
print(ret_crystal_path)
print("--------------------\n")
Expand All @@ -589,6 +597,10 @@ def run(self, verbose=False):
bij.cur_partitions[i]._list[j] *= 2
bij.cur_partitions[i].rigging[j] *= 2
bij.cur_partitions[i].vacancy_numbers[j] *= 2

if build_graph:
y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions], use_vacancy_numbers=True)
self._graph.append([self._graph[-1][1], (y, len(self._graph)), '2x'])

# Perform the type A_{2n-1}^{(2)} bijection

Expand All @@ -603,11 +615,15 @@ def run(self, verbose=False):
# All it does is update the vacancy numbers on the RC side
for a in range(self.n):
bij._update_vacancy_numbers(a)

if build_graph:
y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions], use_vacancy_numbers=True)
self._graph.append([self._graph[-1][1], (y, len(self._graph)), 'ls'])

while bij.cur_dims[0][0] > 0:
if verbose:
print("====================")
print(repr(RC(*bij.cur_partitions)))
print(repr(RC(*bij.cur_partitions, use_vacancy_numbers=True)))
print("--------------------")
print(ret_crystal_path)
print("--------------------\n")
Expand All @@ -617,6 +633,10 @@ def run(self, verbose=False):
# Make sure we have a crystal letter
ret_crystal_path[-1].append(letters(b)) # Append the rank

if build_graph:
y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions], use_vacancy_numbers=True)
self._graph.append([self._graph[-1][1], (y, len(self._graph)), letters(b)])

bij.cur_dims.pop(0) # Pop off the leading column

self.cur_dims.pop(0) # Pop off the spin rectangle
Expand All @@ -628,7 +648,7 @@ def run(self, verbose=False):
# Convert back to a type B_n^{(1)}
if verbose:
print("====================")
print(repr(self.rigged_con.parent()(*bij.cur_partitions)))
print(repr(self.rigged_con.parent()(*bij.cur_partitions, use_vacancy_numbers=True)))
print("--------------------")
print(ret_crystal_path)
print("--------------------\n")
Expand All @@ -639,6 +659,10 @@ def run(self, verbose=False):
self.cur_partitions[i]._list[j] //= 2
self.cur_partitions[i].rigging[j] //= 2
self.cur_partitions[i].vacancy_numbers[j] //= 2

if build_graph:
y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions], use_vacancy_numbers=True)
self._graph.append([self._graph[-1][1], (y, len(self._graph)), '1/2x'])
else:
# Perform the regular type B_n^{(1)} bijection

Expand All @@ -648,7 +672,7 @@ def run(self, verbose=False):
if self.cur_dims[0][1] > 1:
if verbose:
print("====================")
print(repr(self.rigged_con.parent()(*self.cur_partitions)))
print(repr(self.rigged_con.parent()(*self.cur_partitions, use_vacancy_numbers=True)))
print("--------------------")
print(ret_crystal_path)
print("--------------------\n")
Expand All @@ -662,10 +686,14 @@ def run(self, verbose=False):
for a in range(self.n):
self._update_vacancy_numbers(a)

if build_graph:
y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions], use_vacancy_numbers=True)
self._graph.append([self._graph[-1][1], (y, len(self._graph)), '2x'])

while self.cur_dims[0][0] > 0:
if verbose:
print("====================")
print(repr(self.rigged_con.parent()(*self.cur_partitions)))
print(repr(self.rigged_con.parent()(*self.cur_partitions, use_vacancy_numbers=True)))
print("--------------------")
print(ret_crystal_path)
print("--------------------\n")
Expand All @@ -676,8 +704,20 @@ def run(self, verbose=False):
# Make sure we have a crystal letter
ret_crystal_path[-1].append(letters(b)) # Append the rank

if build_graph:
y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions], use_vacancy_numbers=True)
self._graph.append([self._graph[-1][1], (y, len(self._graph)), letters(b)])

self.cur_dims.pop(0) # Pop off the leading column

if build_graph:
self._graph.pop(0) # Remove the dummy at the start
from sage.graphs.digraph import DiGraph
from sage.graphs.dot2tex_utils import have_dot2tex
self._graph = DiGraph(self._graph)
if have_dot2tex():
self._graph.set_latex_options(format="dot2tex", edge_labels=True)

return self.KRT(pathlist=ret_crystal_path)

def next_state(self, height):
Expand Down
52 changes: 45 additions & 7 deletions src/sage/combinat/rigged_configurations/bij_type_D.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,22 +414,30 @@ class RCToKRTBijectionTypeD(RCToKRTBijectionTypeA):
r"""
Specific implementation of the bijection from rigged configurations to tensor products of KR tableaux for type `D_n^{(1)}`.
"""
def run(self, verbose=False):
def run(self, verbose=False, build_graph=False):
"""
Run the bijection from rigged configurations to tensor product of KR
tableaux for type `D_n^{(1)}`.
INPUT:
- ``verbose`` -- (Default: ``False``) Display each step in the
- ``verbose`` -- (default: ``False``) display each step in the
bijection
- ``build_graph`` -- (default: ``False``) build the graph of each
step of the bijection
EXAMPLES::
sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 1]])
sage: x = RC(partition_list=[[1],[1],[1],[1]])
sage: from sage.combinat.rigged_configurations.bij_type_D import RCToKRTBijectionTypeD
sage: RCToKRTBijectionTypeD(RC(partition_list=[[1],[1],[1],[1]])).run()
sage: RCToKRTBijectionTypeD(x).run()
[[2], [-3]]
sage: bij = RCToKRTBijectionTypeD(x)
sage: bij.run(build_graph=True)
[[2], [-3]]
sage: bij._graph
Digraph on 3 vertices
"""
from sage.combinat.crystals.letters import CrystalOfLetters
letters = CrystalOfLetters(self.rigged_con.parent()._cartan_type.classical())
Expand All @@ -455,20 +463,29 @@ def run(self, verbose=False):
for a in range(self.n):
self._update_vacancy_numbers(a)

if build_graph:
y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions], use_vacancy_numbers=True)
self._graph.append([self._graph[-1][1], (y, len(self._graph)), 'ls'])

# Check to see if we are a spinor
if dim[0] >= self.n - 1:
if verbose:
print("====================")
print(repr(self.rigged_con.parent()(*self.cur_partitions)))
print(repr(self.rigged_con.parent()(*self.cur_partitions, use_vacancy_numbers=True)))
print("--------------------")
print(ret_crystal_path)
print("--------------------\n")
print("Applying doubling map")
self.doubling_map()

if build_graph:
y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions], use_vacancy_numbers=True)
self._graph.append([self._graph[-1][1], (y, len(self._graph)), '2x'])

if dim[0] == self.n - 1:
if verbose:
print("====================")
print(repr(self.rigged_con.parent()(*self.cur_partitions)))
print(repr(self.rigged_con.parent()(*self.cur_partitions, use_vacancy_numbers=True)))
print("--------------------")
print(ret_crystal_path)
print("--------------------\n")
Expand All @@ -477,10 +494,14 @@ def run(self, verbose=False):
b = -self.n
ret_crystal_path[-1].append(letters(b)) # Append the rank

if build_graph:
y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions], use_vacancy_numbers=True)
self._graph.append([self._graph[-1][1], (y, len(self._graph)), letters(b)])

while self.cur_dims[0][0] > 0:
if verbose:
print("====================")
print(repr(self.rigged_con.parent()(*self.cur_partitions)))
print(repr(self.rigged_con.parent()(*self.cur_partitions, use_vacancy_numbers=True)))
print("--------------------")
print(ret_crystal_path)
print("--------------------\n")
Expand All @@ -496,18 +517,35 @@ def run(self, verbose=False):
# Make sure we have a crystal letter
ret_crystal_path[-1].append(letters(b)) # Append the rank

if build_graph:
y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions], use_vacancy_numbers=True)
self._graph.append([self._graph[-1][1], (y, len(self._graph)), letters(b)])

self.cur_dims.pop(0) # Pop off the leading column

# Check to see if we were a spinor
if dim[0] >= self.n-1:
if verbose:
print("====================")
print(repr(self.rigged_con.parent()(*self.cur_partitions)))
print(repr(self.rigged_con.parent()(*self.cur_partitions, use_vacancy_numbers=True)))
print("--------------------")
print(ret_crystal_path)
print("--------------------\n")
print("Applying halving map")
self.halving_map()

if build_graph:
y = self.rigged_con.parent()(*[x._clone() for x in self.cur_partitions], use_vacancy_numbers=True)
self._graph.append([self._graph[-1][1], (y, len(self._graph)), '1/2x'])

if build_graph:
self._graph.pop(0) # Remove the dummy at the start
from sage.graphs.digraph import DiGraph
from sage.graphs.dot2tex_utils import have_dot2tex
self._graph = DiGraph(self._graph)
if have_dot2tex():
self._graph.set_latex_options(format="dot2tex", edge_labels=True)

return self.KRT(pathlist=ret_crystal_path)

def next_state(self, height):
Expand Down
Loading

0 comments on commit 7eecbbe

Please sign in to comment.