def print_mn_operators(n=8):
    def wstr(w):
        return ' $\\barr{c}' + str(
            w) + ' \\\\ ' + w.oneline_repr() + ' \\earr$ '

    ans = []
    for n in range(2, n + 1, 2):
        for mu in Partition.generate(n):
            s = []
            i = 0
            for t in Tableau.standard(mu):
                u = dual_irsk(irsk_inverse(t), n).transpose()
                s += ['\n&\n'.join([t.tex(), u.tex()])]
                i += 1
                if i * t.max_row() >= 24:
                    s += [
                        '\n\\end{tabular} \\newpage \\begin{tabular}{ccccc}  Tableau &  Tableau \\\\ \\hline '
                    ]
                    i = 0
            s = '\n \\\\ \\\\ \n'.join(s)
            ans += [
                '\\begin{tabular}{ccccc} Tableau &  Tableau \\\\ \\hline \\\\ \\\\ \n'
                + s + '\n\\end{tabular}'
            ]

    ans = '\n\n\\newpage\n\n'.join(ans + [''])
    with open(
            '/Users/emarberg/Dropbox/projects/affine-transitions/notes/eric_notes/examples.tex',
            'w') as f:
        f.write(ans)
        f.close()
def print_tableau_operation(n=6):
    mapping = {}
    for mu in Partition.generate(n):
        for tab in Tableau.standard(mu):
            w = irsk_inverse(tab)
            ntab = dual_irsk(w, sum(mu)).transpose()
            mapping[tab] = ntab
            print(tab)
            print('w =', w)
            print(ntab)
            #lines = str(tab).split('\n')
            #nlines = str(ntab).split('\n')
            #assert len(lines) == len(nlines)
            #print('\n'.join([lines[i] + ' -> ' + nlines[i] for i in range(len(lines))]))
            print()
            print()
            print()
            print()
    orders = {}
    for tab in mapping:
        o = 1
        x = mapping[tab]
        while x != tab:
            o += 1
            x = mapping[x]
        orders[tab] = o
    return orders, mapping