Skip to content

Commit

Permalink
added tableaux factorise
Browse files Browse the repository at this point in the history
William Price authored and William Price committed Feb 6, 2020
1 parent 8dad563 commit 675dca7
Showing 4 changed files with 14 additions and 15 deletions.
7 changes: 0 additions & 7 deletions magma/__main__.py
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
from magma import RS34

for m in range(1,6):
print('norm:', m)
print('---------------------------')
for path in RS34.products(m):
print(RS34.to_ascii(path))
Empty file.
22 changes: 14 additions & 8 deletions magma/catalan_families/tableaux.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from magma import Catalan

# TODO inherit from Catalan once factorise implemented
class RS168:
class RS168(Catalan):
"""
Standard Young Tableaux of shape (m-1,m-1)
@@ -37,24 +36,31 @@ def product(cls, fst, snd):

@classmethod
def factorise(cls, tableaux):
# TODO implement tableaux factorise
pass
top, bot = tableaux
for i in reversed(range(len(top))):
if i==0 or bot[i-1] + 1 == top[i]:
break

fst = (top[:i], bot[:i])
shift = lambda x: x - 2 * len(fst[0]) - 1
snd = (tuple(map(shift, top[i+1:])), tuple(map(shift, bot[i:-1])))
return (fst, snd)

@classmethod
def direct_norm(cls, tableaux):
return len(tableaux[0])+1

@classmethod
def to_ascii(cls, tableaux):
if tableaux == cls.generator():
return '+\n|\n+\n|\n+'
# if tableaux == cls.generator():
# return '+\n|\n+\n|\n+'
num_cols = len(tableaux[0])
max_digits = len(str(num_cols*2))

row_sep = ('+' + '-' * max_digits) * num_cols + '+'

ascii_table = row_sep
for row in tableaux:
ascii_table += '\n|' + '|'.join(f'{x:<{max_digits}}' for x in row) + '|\n' + row_sep
ascii_table += '\n|' + ''.join(f'{x:<{max_digits}}|' for x in row) + '\n' + row_sep

return ascii_table
return ascii_table
Empty file.

0 comments on commit 675dca7

Please sign in to comment.