def test_strict_symmetric_functions():
    nn = 5
    for mu in Partition.all(nn, strict=True):
        for nu in Partition.all(nn, strict=True):
            for n in range(nn):
                print(n, mu, nu)
                print()

                # Schur-P and GP

                f = SymmetricPolynomial.schur_p(n, mu, nu)
                g = SymmetricPolynomial.stable_grothendieck_p(n, mu, nu)
                h = SymmetricPolynomial.dual_stable_grothendieck_p(n, mu, nu)

                fs = SymmetricPolynomial._slow_schur_p(n, mu, nu)
                gs = SymmetricPolynomial._slow_stable_grothendieck_p(n, mu, nu)
                hs = SymmetricPolynomial._slow_dual_stable_grothendieck_p(
                    n, mu, nu)

                if f != fs:
                    print(f)
                    print(fs)
                    print()

                if g != gs:
                    print(g)
                    print(gs)
                    print()

                if h != hs:
                    print(h)
                    print(hs)
                    print()
                    print()
                    print()

                assert f == fs
                assert g == gs
                assert h == hs

                if mu == nu:
                    assert f == 1
                    assert g == 1
                    assert h == 1
                    assert fs == 1
                    assert gs == 1
                    assert hs == 1

                if not Partition.contains(mu, nu):
                    assert f == 0
                    assert g == 0
                    assert h == 0
                    assert fs == 0
                    assert gs == 0
                    assert hs == 0

                # Schur-Q and GQ

                f = SymmetricPolynomial.schur_q(n, mu, nu)
                g = SymmetricPolynomial.stable_grothendieck_q(n, mu, nu)
                h = SymmetricPolynomial.dual_stable_grothendieck_q(n, mu, nu)

                fs = SymmetricPolynomial._slow_schur_q(n, mu, nu)
                gs = SymmetricPolynomial._slow_stable_grothendieck_q(n, mu, nu)
                hs = SymmetricPolynomial._slow_dual_stable_grothendieck_q(
                    n, mu, nu)

                if f != fs:
                    print(f)
                    print(fs)
                    print()

                if g != gs:
                    print(g)
                    print(gs)
                    print()

                if h != hs:
                    print(h)
                    print(hs)
                    print()
                    print()
                    print()

                assert f == fs
                assert g == gs
                assert h == hs

                if mu == nu:
                    assert f == 1
                    assert g == 1
                    assert h == 1
                    assert fs == 1
                    assert gs == 1
                    assert hs == 1

                if not Partition.contains(mu, nu):
                    assert f == 0
                    assert g == 0
                    assert h == 0
                    assert fs == 0
                    assert gs == 0
                    assert hs == 0
示例#2
0
def schur_P(num_variables, mu, nu=()):  # noqa
    return SymmetricPolynomial.schur_p(num_variables, mu, nu)