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