schubmult 2.0.4__py3-none-any.whl → 3.0.1__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 +96 -1
- schubmult/perm_lib.py +254 -819
- schubmult/poly_lib/__init__.py +31 -0
- schubmult/poly_lib/poly_lib.py +276 -0
- schubmult/poly_lib/schub_poly.py +148 -0
- schubmult/poly_lib/variables.py +204 -0
- schubmult/rings/__init__.py +18 -0
- schubmult/rings/_quantum_schubert_polynomial_ring.py +752 -0
- schubmult/rings/_schubert_polynomial_ring.py +1031 -0
- schubmult/rings/_tensor_schub_ring.py +128 -0
- schubmult/rings/_utils.py +55 -0
- schubmult/{sage_integration → sage}/__init__.py +4 -1
- schubmult/{sage_integration → sage}/_fast_double_schubert_polynomial_ring.py +67 -109
- schubmult/{sage_integration → sage}/_fast_schubert_polynomial_ring.py +33 -28
- schubmult/{sage_integration → sage}/_indexing.py +9 -5
- schubmult/schub_lib/__init__.py +51 -0
- schubmult/{schubmult_double/_funcs.py → schub_lib/double.py} +532 -596
- schubmult/{schubmult_q/_funcs.py → schub_lib/quantum.py} +54 -53
- schubmult/schub_lib/quantum_double.py +954 -0
- schubmult/schub_lib/schub_lib.py +659 -0
- schubmult/{schubmult_py/_funcs.py → schub_lib/single.py} +45 -35
- schubmult/schub_lib/tests/__init__.py +0 -0
- schubmult/schub_lib/tests/legacy_perm_lib.py +946 -0
- schubmult/schub_lib/tests/test_vs_old.py +109 -0
- schubmult/scripts/__init__.py +0 -0
- schubmult/scripts/schubmult_double.py +378 -0
- schubmult/scripts/schubmult_py.py +84 -0
- schubmult/scripts/schubmult_q.py +109 -0
- schubmult/scripts/schubmult_q_double.py +207 -0
- schubmult/utils/__init__.py +0 -0
- schubmult/{_base_argparse.py → utils/argparse.py} +29 -5
- schubmult/utils/logging.py +16 -0
- schubmult/utils/parsing.py +20 -0
- schubmult/utils/perm_utils.py +135 -0
- schubmult/utils/test_utils.py +65 -0
- schubmult-3.0.1.dist-info/METADATA +1234 -0
- schubmult-3.0.1.dist-info/RECORD +41 -0
- {schubmult-2.0.4.dist-info → schubmult-3.0.1.dist-info}/WHEEL +1 -1
- schubmult-3.0.1.dist-info/entry_points.txt +5 -0
- schubmult/_tests.py +0 -24
- schubmult/schubmult_double/__init__.py +0 -12
- schubmult/schubmult_double/__main__.py +0 -6
- schubmult/schubmult_double/_script.py +0 -474
- schubmult/schubmult_py/__init__.py +0 -12
- schubmult/schubmult_py/__main__.py +0 -6
- schubmult/schubmult_py/_script.py +0 -97
- schubmult/schubmult_q/__init__.py +0 -8
- schubmult/schubmult_q/__main__.py +0 -6
- schubmult/schubmult_q/_script.py +0 -166
- schubmult/schubmult_q_double/__init__.py +0 -10
- schubmult/schubmult_q_double/__main__.py +0 -6
- schubmult/schubmult_q_double/_funcs.py +0 -540
- schubmult/schubmult_q_double/_script.py +0 -396
- schubmult-2.0.4.dist-info/METADATA +0 -542
- schubmult-2.0.4.dist-info/RECORD +0 -30
- schubmult-2.0.4.dist-info/entry_points.txt +0 -5
- {schubmult-2.0.4.dist-info → schubmult-3.0.1.dist-info}/licenses/LICENSE +0 -0
- {schubmult-2.0.4.dist-info → schubmult-3.0.1.dist-info}/top_level.txt +0 -0
@@ -1,21 +1,22 @@
|
|
1
1
|
from functools import cached_property
|
2
2
|
|
3
|
-
from symengine import Add, Mul, Pow
|
3
|
+
from symengine import Add, Mul, Pow
|
4
4
|
|
5
|
+
import schubmult.poly_lib.variables as spl
|
6
|
+
import schubmult.schub_lib.schub_lib as sss
|
5
7
|
from schubmult.perm_lib import (
|
6
|
-
|
8
|
+
Permutation,
|
7
9
|
code,
|
8
|
-
compute_vpathdicts,
|
9
|
-
double_elem_sym_q,
|
10
|
-
elem_sym_perms_q,
|
11
10
|
inv,
|
12
|
-
inverse,
|
13
11
|
medium_theta,
|
14
|
-
mulperm,
|
15
12
|
permtrim,
|
16
13
|
strict_theta,
|
17
14
|
uncode,
|
18
15
|
)
|
16
|
+
from schubmult.utils.logging import get_logger
|
17
|
+
from schubmult.utils.perm_utils import add_perm_dict
|
18
|
+
|
19
|
+
logger = get_logger(__name__)
|
19
20
|
|
20
21
|
|
21
22
|
class _gvars:
|
@@ -25,21 +26,23 @@ class _gvars:
|
|
25
26
|
|
26
27
|
@cached_property
|
27
28
|
def var_x(self):
|
28
|
-
return
|
29
|
+
return spl.GeneratingSet("x")
|
29
30
|
|
30
31
|
@cached_property
|
31
32
|
def q_var(self):
|
32
|
-
return
|
33
|
+
return spl.GeneratingSet("q")
|
34
|
+
|
33
35
|
|
34
36
|
_vars = _gvars()
|
35
37
|
|
38
|
+
|
36
39
|
def single_variable(coeff_dict, varnum, var_q=_vars.q_var):
|
37
40
|
ret = {}
|
38
41
|
for u in coeff_dict:
|
39
|
-
new_perms_k = elem_sym_perms_q(u, 1, varnum, var_q)
|
42
|
+
new_perms_k = sss.elem_sym_perms_q(u, 1, varnum, var_q)
|
40
43
|
new_perms_km1 = []
|
41
44
|
if varnum > 1:
|
42
|
-
new_perms_km1 = elem_sym_perms_q(u, 1, varnum - 1, var_q)
|
45
|
+
new_perms_km1 = sss.elem_sym_perms_q(u, 1, varnum - 1, var_q)
|
43
46
|
for perm, udiff, mul_val in new_perms_k:
|
44
47
|
if udiff == 1:
|
45
48
|
ret[perm] = ret.get(perm, 0) + coeff_dict[u] * mul_val
|
@@ -49,41 +52,47 @@ def single_variable(coeff_dict, varnum, var_q=_vars.q_var):
|
|
49
52
|
return ret
|
50
53
|
|
51
54
|
|
52
|
-
def
|
53
|
-
if
|
55
|
+
def mult_poly_q(coeff_dict, poly, var_x=_vars.var_x, var_q=_vars.q_var):
|
56
|
+
if not isinstance(var_x, spl.GeneratingSet_base):
|
57
|
+
var_x = spl.CustomGeneratingSet(var_x)
|
58
|
+
# logger.debug(f"{poly=} {type(poly)=} {list(var_x)}")
|
59
|
+
# logger.debug(f"{[type(v) for v in var_x]}")
|
60
|
+
if var_x.index(poly) != -1:
|
61
|
+
# logger.debug(f"Found {var_x.index(poly)=}")
|
54
62
|
return single_variable(coeff_dict, var_x.index(poly), var_q=var_q)
|
55
63
|
if isinstance(poly, Mul):
|
56
64
|
ret = coeff_dict
|
57
65
|
for a in poly.args:
|
58
|
-
ret =
|
66
|
+
ret = mult_poly_q(ret, a, var_x, var_q=var_q)
|
59
67
|
return ret
|
60
68
|
if isinstance(poly, Pow):
|
61
69
|
base = poly.args[0]
|
62
70
|
exponent = int(poly.args[1])
|
63
71
|
ret = coeff_dict
|
64
72
|
for i in range(int(exponent)):
|
65
|
-
ret =
|
73
|
+
ret = mult_poly_q(ret, base, var_x, var_q=var_q)
|
66
74
|
return ret
|
67
75
|
if isinstance(poly, Add):
|
68
76
|
ret = {}
|
69
77
|
for a in poly.args:
|
70
|
-
ret = add_perm_dict(ret,
|
78
|
+
ret = add_perm_dict(ret, mult_poly_q(coeff_dict, a, var_x, var_q=var_q))
|
71
79
|
return ret
|
72
80
|
ret = {}
|
73
81
|
for perm in coeff_dict:
|
74
82
|
ret[perm] = poly * coeff_dict[perm]
|
75
83
|
return ret
|
76
84
|
|
77
|
-
|
78
|
-
|
85
|
+
|
86
|
+
def schubmult_q_fast(perm_dict, v, q_var=_vars.q_var):
|
87
|
+
if inv(v) == 0:
|
79
88
|
return perm_dict
|
80
|
-
th = medium_theta(
|
89
|
+
th = medium_theta(~v)
|
81
90
|
if len(th) == 0:
|
82
91
|
return perm_dict
|
83
92
|
while th[-1] == 0:
|
84
93
|
th.pop()
|
85
94
|
mu = permtrim(uncode(th))
|
86
|
-
vmu = permtrim(
|
95
|
+
vmu = permtrim(v * mu)
|
87
96
|
inv_vmu = inv(vmu)
|
88
97
|
inv_mu = inv(mu)
|
89
98
|
ret_dict = {}
|
@@ -91,11 +100,11 @@ def schubmult_db(perm_dict, v, q_var=_vars.q_var):
|
|
91
100
|
thL = len(th)
|
92
101
|
# if thL!=2 and len(set(thL))!=1:
|
93
102
|
# raise ValueError("Not what I can do")
|
94
|
-
vpathdicts = compute_vpathdicts(th, vmu, True)
|
103
|
+
vpathdicts = sss.compute_vpathdicts(th, vmu, True)
|
95
104
|
# print(f"{vpathdicts=}")
|
96
105
|
for u, val in perm_dict.items():
|
97
106
|
inv_u = inv(u)
|
98
|
-
vpathsums = {u: {(1, 2): val}}
|
107
|
+
vpathsums = {u: {Permutation([1, 2]): val}}
|
99
108
|
for index in range(thL):
|
100
109
|
if index > 0 and th[index - 1] == th[index]:
|
101
110
|
continue
|
@@ -112,7 +121,7 @@ def schubmult_db(perm_dict, v, q_var=_vars.q_var):
|
|
112
121
|
for up in vpathsums:
|
113
122
|
newpathsums0 = {}
|
114
123
|
inv_up = inv(up)
|
115
|
-
newperms = double_elem_sym_q(up, mx_th, mx_th1, th[index], q_var)
|
124
|
+
newperms = sss.double_elem_sym_q(up, mx_th, mx_th1, th[index], q_var)
|
116
125
|
for v in vpathdicts[index]:
|
117
126
|
sumval = vpathsums[up].get(v, 0)
|
118
127
|
if sumval == 0:
|
@@ -124,7 +133,8 @@ def schubmult_db(perm_dict, v, q_var=_vars.q_var):
|
|
124
133
|
if udiff1 + vdiff2 == th[index]:
|
125
134
|
newpathsums0[(up1, udiff1, mul_val1)][v2] = (
|
126
135
|
newpathsums0[(up1, udiff1, mul_val1)].get(
|
127
|
-
v2,
|
136
|
+
v2,
|
137
|
+
0,
|
128
138
|
)
|
129
139
|
+ s2 * sumval * mul_val1
|
130
140
|
)
|
@@ -135,21 +145,16 @@ def schubmult_db(perm_dict, v, q_var=_vars.q_var):
|
|
135
145
|
if sumval == 0:
|
136
146
|
continue
|
137
147
|
for v2, vdiff2, s2 in vpathdicts[index + 1][v]:
|
138
|
-
for up2, udiff2, mul_val2 in newperms[
|
139
|
-
(up1, udiff1, mul_val1)
|
140
|
-
]:
|
148
|
+
for up2, udiff2, mul_val2 in newperms[(up1, udiff1, mul_val1)]:
|
141
149
|
if up2 not in newpathsums:
|
142
150
|
newpathsums[up2] = {}
|
143
151
|
if udiff2 + vdiff2 == th[index + 1]:
|
144
|
-
newpathsums[up2][v2] = (
|
145
|
-
newpathsums[up2].get(v2, 0)
|
146
|
-
+ s2 * sumval * mul_val2
|
147
|
-
)
|
152
|
+
newpathsums[up2][v2] = newpathsums[up2].get(v2, 0) + s2 * sumval * mul_val2
|
148
153
|
else:
|
149
154
|
newpathsums = {}
|
150
155
|
for up in vpathsums:
|
151
156
|
inv_up = inv(up)
|
152
|
-
newperms = elem_sym_perms_q(
|
157
|
+
newperms = sss.elem_sym_perms_q(
|
153
158
|
up,
|
154
159
|
min(mx_th, (inv_mu - (inv_up - inv_u)) - inv_vmu),
|
155
160
|
th[index],
|
@@ -164,22 +169,20 @@ def schubmult_db(perm_dict, v, q_var=_vars.q_var):
|
|
164
169
|
continue
|
165
170
|
for v2, vdiff, s in vpathdicts[index][v]:
|
166
171
|
if udiff + vdiff == th[index]:
|
167
|
-
newpathsums[up2][v2] = (
|
168
|
-
newpathsums[up2].get(v2, 0)
|
169
|
-
+ s * sumval * mul_val
|
170
|
-
)
|
172
|
+
newpathsums[up2][v2] = newpathsums[up2].get(v2, 0) + s * sumval * mul_val
|
171
173
|
vpathsums = newpathsums
|
172
|
-
toget =
|
174
|
+
toget = vmu
|
173
175
|
ret_dict = add_perm_dict(
|
174
|
-
{ep: vpathsums[ep].get(toget, 0) for ep in vpathsums},
|
176
|
+
{ep: vpathsums[ep].get(toget, 0) for ep in vpathsums},
|
177
|
+
ret_dict,
|
175
178
|
)
|
176
179
|
return ret_dict
|
177
180
|
|
178
181
|
|
179
|
-
def
|
180
|
-
th = strict_theta(
|
182
|
+
def schubmult_q(perm_dict, v):
|
183
|
+
th = strict_theta(~v)
|
181
184
|
mu = permtrim(uncode(th))
|
182
|
-
vmu =
|
185
|
+
vmu = v * mu
|
183
186
|
inv_vmu = inv(vmu)
|
184
187
|
inv_mu = inv(mu)
|
185
188
|
ret_dict = {}
|
@@ -188,10 +191,10 @@ def schubmult(perm_dict, v):
|
|
188
191
|
while th[-1] == 0:
|
189
192
|
th.pop()
|
190
193
|
thL = len(th)
|
191
|
-
vpathdicts = compute_vpathdicts(th, vmu, True)
|
194
|
+
vpathdicts = sss.compute_vpathdicts(th, vmu, True)
|
192
195
|
for u, val in perm_dict.items():
|
193
196
|
inv_u = inv(u)
|
194
|
-
vpathsums = {u: {(
|
197
|
+
vpathsums = {u: {Permutation([]): val}}
|
195
198
|
for index in range(thL):
|
196
199
|
mx_th = 0
|
197
200
|
for vp in vpathdicts[index]:
|
@@ -200,8 +203,10 @@ def schubmult(perm_dict, v):
|
|
200
203
|
newpathsums = {}
|
201
204
|
for up in vpathsums:
|
202
205
|
inv_up = inv(up)
|
203
|
-
newperms = elem_sym_perms_q(
|
204
|
-
up,
|
206
|
+
newperms = sss.elem_sym_perms_q(
|
207
|
+
up,
|
208
|
+
min(mx_th, (inv_mu - (inv_up - inv_u)) - inv_vmu),
|
209
|
+
th[index],
|
205
210
|
)
|
206
211
|
for up2, udiff, mul_val in newperms:
|
207
212
|
if up2 not in newpathsums:
|
@@ -212,20 +217,16 @@ def schubmult(perm_dict, v):
|
|
212
217
|
continue
|
213
218
|
for v2, vdiff, s in vpathdicts[index][v]:
|
214
219
|
if udiff + vdiff == th[index]:
|
215
|
-
newpathsums[up2][v2] = (
|
216
|
-
newpathsums[up2].get(v2, 0)
|
217
|
-
+ s * sumval * mul_val
|
218
|
-
)
|
220
|
+
newpathsums[up2][v2] = newpathsums[up2].get(v2, 0) + s * sumval * mul_val
|
219
221
|
vpathsums = newpathsums
|
220
|
-
toget =
|
222
|
+
toget = vmu
|
221
223
|
ret_dict = add_perm_dict(
|
222
|
-
{ep: vpathsums[ep].get(toget, 0) for ep in vpathsums},
|
224
|
+
{ep: vpathsums[ep].get(toget, 0) for ep in vpathsums},
|
225
|
+
ret_dict,
|
223
226
|
)
|
224
227
|
return ret_dict
|
225
228
|
|
226
229
|
|
227
|
-
|
228
|
-
|
229
230
|
def grass_q_replace(perm, k, d, n):
|
230
231
|
if k - d < 0:
|
231
232
|
return None
|