1 | initial version |
Here is a quick'n'dirty generator for semistandard tableaux
def gent(shape,content,frontline=None):
if frontline is None:
frontline = [0] * len(shape)
if len(content)==0:
yield [[0]*s for s in shape]
return
e = content[0]
for row,col in enumerate(frontline):
if col>=shape[row] or (row>0 and frontline[row-1]<=col):
continue
frontline[row] += 1
for t in gent(shape,content[1:],frontline):
if row+1==len(shape) or col>=shape[row+1] or e<t[row+1][col]:
t[row][col] = e
yield t
frontline[row] -= 1
list(gent([3,3],[1,2,3,4,5,9]))
If given content contains duplicated elements, it may produce the same tableau several times, and so additional filtering may be needed.
2 | No.2 Revision |
Here is a quick'n'dirty generator for semistandard tableaux of given shape
and with given content
:
def gent(shape,content,frontline=None):
if frontline is None:
frontline = [0] * len(shape)
if len(content)==0:
yield [[0]*s for s in shape]
return
e = content[0]
for row,col in enumerate(frontline):
if col>=shape[row] or (row>0 and frontline[row-1]<=col):
continue
frontline[row] += 1
for t in gent(shape,content[1:],frontline):
if row+1==len(shape) or col>=shape[row+1] or e<t[row+1][col]:
t[row][col] = e
yield t
frontline[row] -= 1
list(gent([3,3],[1,2,3,4,5,9]))
If given content contains duplicated elements, it may produce the same tableau several times, and so additional filtering may be needed.
3 | No.3 Revision |
Here is a quick'n'dirty generator for semistandard tableaux of given shape
and with given content
:
def gent(shape,content,frontline=None):
if frontline is None:
frontline = [0] * len(shape)
if len(content)==0:
yield [[0]*s for s in shape]
return
e = content[0]
for row,col in enumerate(frontline):
if col>=shape[row] or (row>0 and frontline[row-1]<=col):
continue
frontline[row] += 1
for t in gent(shape,content[1:],frontline):
if row+1==len(shape) or col>=shape[row+1] or e<t[row+1][col]:
t[row][col] = e
yield t
frontline[row] -= 1
return
list(gent([3,3],[1,2,3,4,5,9]))
If given content contains duplicated elements, it may produce the same tableau several times, and so additional filtering may be needed.