schubmult 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- schubmult/__init__.py +1 -0
- schubmult/_base_argparse.py +174 -0
- schubmult/perm_lib.py +999 -0
- schubmult/sage_integration/__init__.py +25 -0
- schubmult/sage_integration/_fast_double_schubert_polynomial_ring.py +528 -0
- schubmult/sage_integration/_fast_schubert_polynomial_ring.py +356 -0
- schubmult/sage_integration/_indexing.py +44 -0
- schubmult/schubmult_double/__init__.py +18 -0
- schubmult/schubmult_double/__main__.py +5 -0
- schubmult/schubmult_double/_funcs.py +1590 -0
- schubmult/schubmult_double/_script.py +407 -0
- schubmult/schubmult_double/_vars.py +16 -0
- schubmult/schubmult_py/__init__.py +10 -0
- schubmult/schubmult_py/__main__.py +5 -0
- schubmult/schubmult_py/_funcs.py +111 -0
- schubmult/schubmult_py/_script.py +115 -0
- schubmult/schubmult_py/_vars.py +3 -0
- schubmult/schubmult_q/__init__.py +12 -0
- schubmult/schubmult_q/__main__.py +5 -0
- schubmult/schubmult_q/_funcs.py +304 -0
- schubmult/schubmult_q/_script.py +157 -0
- schubmult/schubmult_q/_vars.py +18 -0
- schubmult/schubmult_q_double/__init__.py +14 -0
- schubmult/schubmult_q_double/__main__.py +5 -0
- schubmult/schubmult_q_double/_funcs.py +507 -0
- schubmult/schubmult_q_double/_script.py +337 -0
- schubmult/schubmult_q_double/_vars.py +21 -0
- schubmult-2.0.0.dist-info/METADATA +455 -0
- schubmult-2.0.0.dist-info/RECORD +36 -0
- schubmult-2.0.0.dist-info/WHEEL +5 -0
- schubmult-2.0.0.dist-info/entry_points.txt +5 -0
- schubmult-2.0.0.dist-info/licenses/LICENSE +674 -0
- schubmult-2.0.0.dist-info/top_level.txt +2 -0
- tests/__init__.py +0 -0
- tests/test_fast_double_schubert.py +145 -0
- tests/test_fast_schubert.py +38 -0
@@ -0,0 +1,145 @@
|
|
1
|
+
from sage.all import ZZ
|
2
|
+
from schubmult.sage_integration import (
|
3
|
+
FastDoubleSchubertPolynomialRing,
|
4
|
+
FastSchubertPolynomialRing,
|
5
|
+
FastQuantumSchubertPolynomialRing,
|
6
|
+
FastQuantumDoubleSchubertPolynomialRing,
|
7
|
+
)
|
8
|
+
|
9
|
+
|
10
|
+
def test_schub_expand():
|
11
|
+
"""
|
12
|
+
Test expand
|
13
|
+
"""
|
14
|
+
X = FastDoubleSchubertPolynomialRing(ZZ, 100, "x", "y")
|
15
|
+
assert X._base_polynomial_ring(X([3, 1, 2]).expand()) == X._base_polynomial_ring(
|
16
|
+
"(x1 - y1)*(x1 - y2)"
|
17
|
+
)
|
18
|
+
assert X(X([3, 4, 1, 2]).expand() * X([4, 1, 2, 3]).expand()) == X(
|
19
|
+
[3, 4, 1, 2]
|
20
|
+
) * X([4, 1, 2, 3])
|
21
|
+
assert (
|
22
|
+
X(X._base_polynomial_ring("x1")) * X([3, 4, 1, 2])
|
23
|
+
).expand() == X._base_polynomial_ring("y3") * (X([3, 4, 1, 2]).expand()) + X(
|
24
|
+
[4, 3, 1, 2]
|
25
|
+
).expand()
|
26
|
+
|
27
|
+
|
28
|
+
def test_coproduct():
|
29
|
+
"""
|
30
|
+
Test coproduct
|
31
|
+
"""
|
32
|
+
X = FastDoubleSchubertPolynomialRing(ZZ, 100, "x", "y")
|
33
|
+
R = X._base_polynomial_ring
|
34
|
+
indices = [0, 1, 3]
|
35
|
+
indices2 = [0, 2, 4]
|
36
|
+
X.set_coproduct_indices(indices[1:])
|
37
|
+
subs_dict1 = {R.gens()[i]: R.gens()[indices[i]] for i in range(len(indices))}
|
38
|
+
subs_dict2 = {R.gens()[i]: R.gens()[indices2[i]] for i in range(len(indices))}
|
39
|
+
|
40
|
+
perm = [3, 5, 1, 4, 2]
|
41
|
+
assert X(perm) == X(
|
42
|
+
sum(
|
43
|
+
[
|
44
|
+
X._base_polynomial_ring(v)
|
45
|
+
* (X(*k[0]).expand().subs(subs_dict1))
|
46
|
+
* (X(*k[1]).expand().subs(subs_dict2))
|
47
|
+
for k, v in X(perm).coproduct().monomial_coefficients().items()
|
48
|
+
]
|
49
|
+
)
|
50
|
+
)
|
51
|
+
|
52
|
+
# double coproduct
|
53
|
+
X = FastDoubleSchubertPolynomialRing(ZZ, 100, "x", ("y", "z"))
|
54
|
+
R = X._base_polynomial_ring
|
55
|
+
X.set_coproduct_indices(indices[1:])
|
56
|
+
subs_dict1 = {R.gens()[i]: R.gens()[indices[i]] for i in range(len(indices))}
|
57
|
+
subs_dict2 = {R.gens()[i]: R.gens()[indices2[i]] for i in range(len(indices))}
|
58
|
+
assert X(perm) == X(
|
59
|
+
sum(
|
60
|
+
[
|
61
|
+
X._base_polynomial_ring(v)
|
62
|
+
* (X(*k[0]).expand().subs(subs_dict1))
|
63
|
+
* (X(*k[1]).expand().subs(subs_dict2))
|
64
|
+
for k, v in X(perm).coproduct().monomial_coefficients().items()
|
65
|
+
]
|
66
|
+
)
|
67
|
+
)
|
68
|
+
|
69
|
+
|
70
|
+
def test_associative():
|
71
|
+
"""
|
72
|
+
Test associative on some large perms
|
73
|
+
"""
|
74
|
+
X = FastDoubleSchubertPolynomialRing(ZZ, 100, "x", "y")
|
75
|
+
perm1 = [1, 5, 3, 4, 2]
|
76
|
+
perm2 = [1, 3, 2, 5, 4]
|
77
|
+
perm3 = [3, 1, 4, 2, 5]
|
78
|
+
assert (X(perm1) * X(perm2)) * X(perm3) == X(perm1) * (X(perm2) * X(perm3))
|
79
|
+
|
80
|
+
X = FastDoubleSchubertPolynomialRing(ZZ, 100, "x", ("y", "z"))
|
81
|
+
assert (X(perm1) * X(perm2)) * X(perm3, "z") == X(perm1) * (
|
82
|
+
X(perm2) * X(perm3, "z")
|
83
|
+
)
|
84
|
+
|
85
|
+
|
86
|
+
def test_coerce():
|
87
|
+
XD = FastDoubleSchubertPolynomialRing(ZZ, 100, "x", ("y", "z"))
|
88
|
+
XDQ = FastQuantumDoubleSchubertPolynomialRing(ZZ, 100, "x", ("y", "z"))
|
89
|
+
XS = FastSchubertPolynomialRing(ZZ, 100, "x")
|
90
|
+
XSQ = FastQuantumSchubertPolynomialRing(ZZ, 100, "x")
|
91
|
+
R = XD._base_polynomial_ring
|
92
|
+
|
93
|
+
assert (
|
94
|
+
XD([2, 3, 5, 4, 1], "z") * R("x2^2") - R("x2^2") * XD([2, 3, 5, 4, 1], "z") == 0
|
95
|
+
)
|
96
|
+
|
97
|
+
assert XS([3,1,4,2]) * XD([4,1,3,2], "z") == XD([4,1,3,2], "z") * XS([3,1,4,2])
|
98
|
+
assert XS([3,1,4,2]) * XDQ([1], "z") == XSQ([1]) * XS([3,1,4,2])
|
99
|
+
|
100
|
+
def test_mixed_equal():
|
101
|
+
"""
|
102
|
+
Test mixed equality
|
103
|
+
"""
|
104
|
+
X = FastDoubleSchubertPolynomialRing(ZZ, 100, "x", ("y", "z"))
|
105
|
+
R = X._coeff_polynomial_ring
|
106
|
+
perms = [
|
107
|
+
[1],
|
108
|
+
[1, 2, 4, 3],
|
109
|
+
[2, 1],
|
110
|
+
[1, 2, 5, 3, 4],
|
111
|
+
[2, 1, 4, 3],
|
112
|
+
[2, 1, 5, 3, 4],
|
113
|
+
[3, 1, 4, 2],
|
114
|
+
[3, 1, 5, 2, 4],
|
115
|
+
]
|
116
|
+
coeffs = [
|
117
|
+
"(y1 - z3)*((y1 - z1)*(y1 - z2)*(y3 - z2) + (y2 - z1)*(y1 - z1)*(y1 - z2)) + (y3 - z4)*((y1 - z1)*(y1 - z2)*(y3 - z2) + (y2 - z1)*(y1 - z1)*(y1 - z2)) + (y2 - z1)*(y1 - z1)*(y1 - z2)*(y2 - z2)",
|
118
|
+
"(y1 - z1)*(y1 - z2)*(y3 - z2) + (y1 - z1)*(y1 - z2)*(y4 - z4) + (y1 - z1)*(y1 - z3)*(y1 - z2) + (y2 - z1)*(y1 - z1)*(y1 - z2)",
|
119
|
+
"(y2 - z3)*((y1 - z1)*(y3 - z2) + (y2 - z1)*(y1 - z1) + (y3 - z2)*(y2 - z2)) + (y3 - z4)*((y1 - z1)*(y3 - z2) + (y2 - z1)*(y1 - z1) + (y3 - z2)*(y2 - z2)) + (y1 - z1)*(y1 - z2)*(y3 - z2) + (y2 - z1)*(y1 - z1)*(y1 - z2)",
|
120
|
+
"(y1 - z1)*(y1 - z2)",
|
121
|
+
"(y1 - z1)*(y1 - z2) + (y1 - z1)*(y3 - z2) + (y2 - z1)*(y1 - z1) + (y3 - z2)*(y2 - z2) + (y1 + y2 - z1 - z2)*(y2 - z3) + (y1 + y2 - z1 - z2)*(y4 - z4)",
|
122
|
+
"y1 + y2 - z1 - z2",
|
123
|
+
"y1 + y2 + y3 + y4 - z1 - z2 - z3 - z4",
|
124
|
+
1,
|
125
|
+
]
|
126
|
+
|
127
|
+
other_perm = [3, 1, 5, 2, 4]
|
128
|
+
|
129
|
+
assert len(perms) == len(coeffs)
|
130
|
+
|
131
|
+
assert sum([R(coeffs[i]) * X(perms[i]) for i in range(len(coeffs))]) == X(
|
132
|
+
other_perm, "z"
|
133
|
+
)
|
134
|
+
|
135
|
+
assert X([3, 1, 5, 2, 4]) * X([5, 3, 1, 2, 4], "z") == X([5, 3, 1, 2, 4], "z") * X(
|
136
|
+
[3, 1, 5, 2, 4]
|
137
|
+
)
|
138
|
+
|
139
|
+
assert X([3, 1, 5, 2, 4], "z") * X([5, 3, 1, 2, 4], "z") != X(
|
140
|
+
[5, 3, 1, 2, 4], "z"
|
141
|
+
) * X([3, 1, 5, 2, 4])
|
142
|
+
|
143
|
+
assert X([3, 1, 5, 2, 4], "z") * X([5, 3, 1, 2, 4]) == X([5, 3, 1, 2, 4]) * X(
|
144
|
+
[3, 1, 5, 2, 4], "z"
|
145
|
+
)
|
@@ -0,0 +1,38 @@
|
|
1
|
+
from sage.all import ZZ
|
2
|
+
from schubmult.sage_integration import FastSchubertPolynomialRing
|
3
|
+
|
4
|
+
|
5
|
+
def test_schub_expand():
|
6
|
+
"""
|
7
|
+
Test expand
|
8
|
+
"""
|
9
|
+
X = FastSchubertPolynomialRing(ZZ, 100, "x")
|
10
|
+
R = X._polynomial_ring
|
11
|
+
assert X([3,1,2]).expand() == R("x1^2")
|
12
|
+
assert X([5,3,4,1,2]).expand() * X([4,1,5,2,3]).expand() - X([5,3,4,1,2]) * X([4,1,5,2,3]) == 0
|
13
|
+
assert R("x1")*X([3,4,1,2]) == R("x1^3*x2^2")
|
14
|
+
|
15
|
+
def test_coproduct():
|
16
|
+
"""
|
17
|
+
Test coproduct
|
18
|
+
"""
|
19
|
+
X = FastSchubertPolynomialRing(ZZ, 100, "x")
|
20
|
+
R = X._polynomial_ring
|
21
|
+
indices = [0, 1, 3, 5]
|
22
|
+
indices2 = [0, 2, 4, 6]
|
23
|
+
X.set_coproduct_indices(indices[1:])
|
24
|
+
subs_dict1 = {R.gens()[i]: R.gens()[indices[i]] for i in range(len(indices))}
|
25
|
+
subs_dict2 = {R.gens()[i]: R.gens()[indices2[i]] for i in range(len(indices))}
|
26
|
+
|
27
|
+
perm = [3,6,5,1,4,7,2]
|
28
|
+
assert X(perm) == X(sum([v*X(list(k[0])).expand().subs(subs_dict1)*(X(list(k[1])).expand().subs(subs_dict2)) for k,v in X(perm).coproduct().monomial_coefficients().items()]))
|
29
|
+
|
30
|
+
def test_associative():
|
31
|
+
"""
|
32
|
+
Test associative on some large perms
|
33
|
+
"""
|
34
|
+
X = FastSchubertPolynomialRing(ZZ, 100, "x")
|
35
|
+
perm1 = [6,7,1,5,3,4,2]
|
36
|
+
perm2 = [1,3,2,7,6,5,4]
|
37
|
+
perm3 = [3,7,1,6,4,2,5]
|
38
|
+
assert (X(perm1)*X(perm2))*X(perm3) == X(perm1)*(X(perm2)*X(perm3))
|