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,32 +1,32 @@
|
|
1
|
+
from functools import cache
|
2
|
+
|
3
|
+
# from sage.misc.parser import Parser
|
4
|
+
import symengine as syme
|
1
5
|
from sage.all import * # noqa: F403
|
2
|
-
from sage.categories.graded_bialgebras_with_basis import GradedBialgebrasWithBasis
|
3
6
|
from sage.categories.graded_algebras_with_basis import GradedAlgebrasWithBasis
|
4
|
-
from sage.
|
5
|
-
|
6
|
-
from sage.combinat.permutation import Permutations, Permutation, from_lehmer_code
|
7
|
+
from sage.categories.graded_bialgebras_with_basis import GradedBialgebrasWithBasis
|
7
8
|
from sage.combinat.composition import (
|
8
|
-
Compositions,
|
9
9
|
Composition,
|
10
|
+
Compositions,
|
10
11
|
)
|
12
|
+
from sage.combinat.free_module import CombinatorialFreeModule
|
13
|
+
from sage.combinat.permutation import Permutation, Permutations, from_lehmer_code
|
11
14
|
from sage.misc.cachefunc import cached_method
|
12
|
-
from sage.rings.polynomial.multi_polynomial_ring import MPolynomialRing_base
|
13
15
|
from sage.rings.polynomial.multi_polynomial import MPolynomial
|
16
|
+
from sage.rings.polynomial.multi_polynomial_ring import MPolynomialRing_base
|
14
17
|
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
|
15
|
-
from
|
18
|
+
from sympy import sympify
|
16
19
|
|
20
|
+
import schubmult.perm_lib as pl
|
21
|
+
import schubmult.sage._fast_double_schubert_polynomial_ring as bork
|
22
|
+
import schubmult.schub_lib.double as yz
|
23
|
+
import schubmult.schub_lib.quantum as sq
|
24
|
+
import schubmult.schub_lib.quantum_double as qyz
|
25
|
+
import schubmult.schub_lib.single as py
|
17
26
|
from schubmult.perm_lib import permtrim
|
18
|
-
import schubmult.schubmult_q as sq
|
19
|
-
import schubmult.schubmult_q_double as qyz
|
20
|
-
import schubmult.schubmult_py as py
|
21
|
-
import schubmult.schubmult_double as yz
|
22
27
|
|
28
|
+
from ._indexing import _coerce_index
|
23
29
|
|
24
|
-
from sympy import sympify
|
25
|
-
|
26
|
-
# from sage.misc.parser import Parser
|
27
|
-
import symengine as syme
|
28
|
-
import schubmult.sage_integration._fast_double_schubert_polynomial_ring as bork
|
29
|
-
from functools import cache
|
30
30
|
# FastQuantumDoubleSchubertPolynomialRing = bork.FastQuantumDoubleSchubertPolynomialRing
|
31
31
|
|
32
32
|
|
@@ -38,9 +38,10 @@ def FastSchubertPolynomialRing(
|
|
38
38
|
code_display: bool = False,
|
39
39
|
q_varname: str = "q",
|
40
40
|
is_quantum: bool = False,
|
41
|
-
indices: tuple[int] =
|
41
|
+
indices: tuple[int] = (1,),
|
42
42
|
):
|
43
|
-
"""
|
43
|
+
"""
|
44
|
+
Wrapper function to return a double Schubert polynomial Ring
|
44
45
|
|
45
46
|
Calls the _xbasis class to return a (quantum) Schubert
|
46
47
|
polynomial ring with the indicated base ring, number of variables,
|
@@ -67,6 +68,7 @@ def FastSchubertPolynomialRing(
|
|
67
68
|
|
68
69
|
Returns:
|
69
70
|
FastSchubertPolynomialRing_xbasis: Element constructor of the ring
|
71
|
+
|
70
72
|
"""
|
71
73
|
if is_quantum:
|
72
74
|
QR = PolynomialRing(R, num_vars, q_varname)
|
@@ -91,7 +93,8 @@ def FastQuantumSchubertPolynomialRing(
|
|
91
93
|
q_varname: str = "q",
|
92
94
|
code_display: bool = False,
|
93
95
|
):
|
94
|
-
"""
|
96
|
+
"""
|
97
|
+
Quantum Schubert ring generator
|
95
98
|
|
96
99
|
Wraps FastSchubertPolynomialRing(), omitting indices and setting
|
97
100
|
is_quantum to True.
|
@@ -106,6 +109,7 @@ def FastQuantumSchubertPolynomialRing(
|
|
106
109
|
|
107
110
|
Returns:
|
108
111
|
FastSchubertPolynomialRing_xbasis: Element constructor of the ring
|
112
|
+
|
109
113
|
"""
|
110
114
|
return FastSchubertPolynomialRing(
|
111
115
|
R,
|
@@ -140,30 +144,36 @@ class FastSchubertPolynomial_class(CombinatorialFreeModule.Element):
|
|
140
144
|
[
|
141
145
|
self.parent()._polynomial_ring(
|
142
146
|
qyz.schubpoly_quantum(
|
143
|
-
|
147
|
+
pl.Permutation(_coerce_index(k, self.parent()._ascode, False)),
|
144
148
|
self.parent()._polynomial_ring.gens(),
|
145
149
|
[0 for i in range(100)],
|
146
150
|
self.parent()._q_ring.gens(),
|
147
151
|
v,
|
148
|
-
)
|
149
|
-
)
|
150
|
-
for k, v in self.monomial_coefficients().items()
|
151
|
-
]
|
152
|
-
)
|
153
|
-
else:
|
154
|
-
return sum(
|
155
|
-
[
|
156
|
-
self.parent()._polynomial_ring(
|
157
|
-
yz.schubmult(
|
158
|
-
{(1, 2): v},
|
159
|
-
tuple(_coerce_index(k, self.parent()._ascode, False)),
|
160
|
-
self.parent()._polynomial_ring.gens(),
|
161
|
-
[0 for i in range(100)],
|
162
|
-
).get((1, 2), 0)
|
152
|
+
),
|
163
153
|
)
|
164
154
|
for k, v in self.monomial_coefficients().items()
|
165
|
-
]
|
155
|
+
],
|
166
156
|
)
|
157
|
+
return sum(
|
158
|
+
[
|
159
|
+
self.parent()._polynomial_ring(
|
160
|
+
yz.schubmult_double(
|
161
|
+
{pl.Permutation([]): v},
|
162
|
+
pl.Permutation(_coerce_index(k, self.parent()._ascode, False)),
|
163
|
+
self.parent()._polynomial_ring.gens(),
|
164
|
+
[0 for i in range(100)],
|
165
|
+
).get(pl.Permutation([]), 0),
|
166
|
+
)
|
167
|
+
for k, v in self.monomial_coefficients().items()
|
168
|
+
],
|
169
|
+
)
|
170
|
+
|
171
|
+
# PDB STEP WHEN LATEX CALLED
|
172
|
+
# def _latex_(self):
|
173
|
+
# rep = "\\mathfrak{S}"
|
174
|
+
# if self.is_quantum:
|
175
|
+
# rep+=f"^{'{'}{self.q_varname}{'}'}"
|
176
|
+
# rep+="_{"+str(()"
|
167
177
|
|
168
178
|
|
169
179
|
@cache
|
@@ -185,12 +195,12 @@ def _single_schub_parser(passed):
|
|
185
195
|
|
186
196
|
class FastSchubertPolynomialRing_xbasis(CombinatorialFreeModule):
|
187
197
|
Element = FastSchubertPolynomial_class
|
188
|
-
|
198
|
+
|
189
199
|
def parser(self):
|
190
200
|
if self._parser is None:
|
191
201
|
self._parser = _single_schub_parser(self)
|
192
202
|
return self._parser
|
193
|
-
|
203
|
+
|
194
204
|
|
195
205
|
def __init__(
|
196
206
|
self,
|
@@ -263,15 +273,10 @@ class FastSchubertPolynomialRing_xbasis(CombinatorialFreeModule):
|
|
263
273
|
def _element_constructor_(self, x):
|
264
274
|
if isinstance(x, str):
|
265
275
|
return self.parser().parse(x)
|
266
|
-
|
267
|
-
isinstance(x, list)
|
268
|
-
or isinstance(x, tuple)
|
269
|
-
or isinstance(x, Composition)
|
270
|
-
or isinstance(x, Permutation)
|
271
|
-
):
|
276
|
+
if isinstance(x, (list, tuple, Composition, Permutation, pl.Permutation)):
|
272
277
|
# checking the input to avoid symmetrica crashing Sage, see trac 12924
|
273
278
|
elem = self._from_dict(
|
274
|
-
{_coerce_index(x, self._ascode, self._ascode): self.base_ring().one()}
|
279
|
+
{_coerce_index(x, self._ascode, self._ascode): self.base_ring().one()},
|
275
280
|
)
|
276
281
|
elif isinstance(x, FastSchubertPolynomial):
|
277
282
|
if (
|
@@ -283,7 +288,7 @@ class FastSchubertPolynomialRing_xbasis(CombinatorialFreeModule):
|
|
283
288
|
{
|
284
289
|
_coerce_index(k, x.parent()._ascode, self._ascode): v
|
285
290
|
for k, v in x.monomial_coefficients().items()
|
286
|
-
}
|
291
|
+
},
|
287
292
|
)
|
288
293
|
else:
|
289
294
|
return self(x.expand())
|
@@ -294,15 +299,15 @@ class FastSchubertPolynomialRing_xbasis(CombinatorialFreeModule):
|
|
294
299
|
sympy_floff = sympify(str(x))
|
295
300
|
val = syme.sympify(sympy_floff)
|
296
301
|
if self._quantum:
|
297
|
-
result = sq.
|
298
|
-
{(
|
302
|
+
result = sq.mult_poly_q(
|
303
|
+
{pl.Permutation([]): 1},
|
299
304
|
val,
|
300
305
|
[syme.Symbol(str(g)) for g in self._polynomial_ring.gens()],
|
301
306
|
[syme.Symbol(str(g)) for g in self._q_ring.gens()],
|
302
307
|
)
|
303
308
|
else:
|
304
|
-
result = py.
|
305
|
-
{(
|
309
|
+
result = py.mult_poly_py(
|
310
|
+
{pl.Permutation([]): 1},
|
306
311
|
val,
|
307
312
|
[syme.Symbol(str(g)) for g in self._polynomial_ring.gens()],
|
308
313
|
)
|
@@ -312,7 +317,7 @@ class FastSchubertPolynomialRing_xbasis(CombinatorialFreeModule):
|
|
312
317
|
if self._quantum
|
313
318
|
else self.base_ring()(str(v))
|
314
319
|
for k, v in result.items()
|
315
|
-
}
|
320
|
+
},
|
316
321
|
)
|
317
322
|
else:
|
318
323
|
raise TypeError(f"Could not convert {x=} to {self}")
|
@@ -332,23 +337,22 @@ class FastSchubertPolynomialRing_xbasis(CombinatorialFreeModule):
|
|
332
337
|
return sum(
|
333
338
|
[
|
334
339
|
self.base_ring()(str(v)) * self(_coerce_index(k, False, self._ascode))
|
335
|
-
for k, v in sq.
|
336
|
-
{
|
337
|
-
|
338
|
-
|
340
|
+
for k, v in sq.schubmult_q_fast(
|
341
|
+
{pl.Permutation(_coerce_index(left, self._ascode, False)): 1},
|
342
|
+
pl.Permutation(_coerce_index(right, self._ascode, False)),
|
343
|
+
[syme.sympify(str(g)) for g in self._q_ring.gens()],
|
339
344
|
).items()
|
340
|
-
]
|
341
|
-
)
|
342
|
-
else:
|
343
|
-
return sum(
|
344
|
-
[
|
345
|
-
self.base_ring()(v) * self(_coerce_index(k, False, self._ascode))
|
346
|
-
for k, v in py.schubmult(
|
347
|
-
{tuple(_coerce_index(left, self._ascode, False)): 1},
|
348
|
-
tuple(_coerce_index(right, self._ascode, False)),
|
349
|
-
).items()
|
350
|
-
]
|
345
|
+
],
|
351
346
|
)
|
347
|
+
return sum(
|
348
|
+
[
|
349
|
+
self.base_ring()(v) * self(_coerce_index(k, False, self._ascode))
|
350
|
+
for k, v in py.schubmult_py(
|
351
|
+
{tuple(_coerce_index(left, self._ascode, False)): 1},
|
352
|
+
tuple(_coerce_index(right, self._ascode, False)),
|
353
|
+
).items()
|
354
|
+
],
|
355
|
+
)
|
352
356
|
|
353
357
|
def coproduct_on_basis(self, mperm):
|
354
358
|
if self._quantum:
|
@@ -364,7 +368,7 @@ class FastSchubertPolynomialRing_xbasis(CombinatorialFreeModule):
|
|
364
368
|
N = len(kcd)
|
365
369
|
kperm = from_lehmer_code(kcd2).inverse()
|
366
370
|
coeff_dict = {tuple(kperm): 1}
|
367
|
-
coeff_dict = py.
|
371
|
+
coeff_dict = py.schubmult_py(coeff_dict, tuple(mperm))
|
368
372
|
|
369
373
|
inv_kperm = kperm.number_of_inversions()
|
370
374
|
inverse_kperm = kperm.inverse()
|
@@ -382,16 +386,18 @@ class FastSchubertPolynomialRing_xbasis(CombinatorialFreeModule):
|
|
382
386
|
continue
|
383
387
|
firstperm = Permutation(permtrim(list(downperm[0:N])))
|
384
388
|
secondperm = Permutation(
|
385
|
-
permtrim([downperm[i] - N for i in range(N, len(downperm))])
|
389
|
+
permtrim([downperm[i] - N for i in range(N, len(downperm))]),
|
386
390
|
)
|
387
391
|
total_sum += self.base_ring()(val) * self(
|
388
|
-
_coerce_index(firstperm, False, self._ascode)
|
392
|
+
_coerce_index(firstperm, False, self._ascode),
|
389
393
|
).tensor(self(_coerce_index(secondperm, False, self._ascode)))
|
390
394
|
return total_sum
|
391
395
|
|
396
|
+
def _latex_(self, S):
|
397
|
+
return f"Boobfucker {S}"
|
392
398
|
|
393
|
-
def _repr_(self):
|
394
|
-
|
399
|
+
def _repr_(self):
|
400
|
+
return f"Ring of Schubert polynomials in {self._base_varname} with {len(self._polynomial_ring.gens())} variables over {self._q_ring.base_ring()}"
|
395
401
|
|
396
402
|
|
397
403
|
FastSchubertPolynomial = FastSchubertPolynomial_class
|
@@ -0,0 +1,51 @@
|
|
1
|
+
from sage.combinat.composition import Composition
|
2
|
+
from sage.combinat.permutation import Permutation
|
3
|
+
|
4
|
+
import schubmult.perm_lib as pl
|
5
|
+
from schubmult.perm_lib import permtrim, trimcode, uncode
|
6
|
+
|
7
|
+
|
8
|
+
def _coerce_index(indexed_obj, is_comp, should_be_comp):
|
9
|
+
if is_comp == should_be_comp:
|
10
|
+
if isinstance(indexed_obj, (list, tuple, pl.Permutation)):
|
11
|
+
if is_comp:
|
12
|
+
return Composition(trimcode(permtrim(uncode(list(indexed_obj)))))
|
13
|
+
return Permutation(list(permtrim(list(indexed_obj))))
|
14
|
+
if not is_comp:
|
15
|
+
if isinstance(indexed_obj, Permutation):
|
16
|
+
return indexed_obj.remove_extra_fixed_points()
|
17
|
+
if isinstance(indexed_obj, pl.Permutation):
|
18
|
+
return Permutation(list(indexed_obj))
|
19
|
+
if isinstance(indexed_obj, dict):
|
20
|
+
{
|
21
|
+
Permutation(list(permtrim(list(k)))): v
|
22
|
+
for k, v in indexed_obj.items()
|
23
|
+
}
|
24
|
+
elif is_comp:
|
25
|
+
if (
|
26
|
+
isinstance(indexed_obj, list)
|
27
|
+
or isinstance(indexed_obj, tuple)
|
28
|
+
or isinstance(indexed_obj, Composition)
|
29
|
+
):
|
30
|
+
return Permutation(list(permtrim(uncode(list(indexed_obj)))))
|
31
|
+
|
32
|
+
if isinstance(indexed_obj, dict): # keys are comps
|
33
|
+
return {
|
34
|
+
Permutation(list(permtrim(uncode(list(k))))): v
|
35
|
+
for k, v in indexed_obj.items()
|
36
|
+
}
|
37
|
+
else:
|
38
|
+
if (
|
39
|
+
isinstance(indexed_obj, list)
|
40
|
+
or isinstance(indexed_obj, tuple)
|
41
|
+
or isinstance(indexed_obj, Permutation)
|
42
|
+
or isinstance(indexed_obj, pl.Permutation)
|
43
|
+
):
|
44
|
+
return Composition(trimcode(list(indexed_obj)))
|
45
|
+
|
46
|
+
if isinstance(indexed_obj, dict): # keys are comps
|
47
|
+
return {
|
48
|
+
Composition(trimcode(permtrim(list(k)))): v
|
49
|
+
for k, v in indexed_obj.items()
|
50
|
+
}
|
51
|
+
raise TypeError
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# from .quantum_double import (
|
2
|
+
# schubpoly_quantum,
|
3
|
+
# )
|
4
|
+
# from .schub_lib import (
|
5
|
+
# check_blocks,
|
6
|
+
# compute_vpathdicts,
|
7
|
+
# divdiffable,
|
8
|
+
# double_elem_sym_q,
|
9
|
+
# elem_sym_perms,
|
10
|
+
# elem_sym_perms_op,
|
11
|
+
# elem_sym_perms_q,
|
12
|
+
# elem_sym_perms_q_op,
|
13
|
+
# is_coeff_irreducible,
|
14
|
+
# is_hook,
|
15
|
+
# is_reducible,
|
16
|
+
# is_split_two,
|
17
|
+
# kdown_perms,
|
18
|
+
# pull_out_var,
|
19
|
+
# reduce_coeff,
|
20
|
+
# reduce_descents,
|
21
|
+
# reduce_q_coeff,
|
22
|
+
# reduce_q_coeff_u_only,
|
23
|
+
# try_reduce_u,
|
24
|
+
# try_reduce_v,
|
25
|
+
# will_formula_work,
|
26
|
+
# )
|
27
|
+
|
28
|
+
# __all__ = [
|
29
|
+
# "check_blocks",
|
30
|
+
# "compute_vpathdicts",
|
31
|
+
# "divdiffable",
|
32
|
+
# "double_elem_sym_q",
|
33
|
+
# "elem_sym_perms",
|
34
|
+
# "elem_sym_perms_op",
|
35
|
+
# "elem_sym_perms_q",
|
36
|
+
# "elem_sym_perms_q_op",
|
37
|
+
# "is_coeff_irreducible",
|
38
|
+
# "is_hook",
|
39
|
+
# "is_reducible",
|
40
|
+
# "is_split_two",
|
41
|
+
# "kdown_perms",
|
42
|
+
# "pull_out_var",
|
43
|
+
# "reduce_coeff",
|
44
|
+
# "reduce_descents",
|
45
|
+
# "reduce_q_coeff",
|
46
|
+
# "reduce_q_coeff_u_only",
|
47
|
+
# "schubpoly_quantum",
|
48
|
+
# "try_reduce_u",
|
49
|
+
# "try_reduce_v",
|
50
|
+
# "will_formula_work",
|
51
|
+
# ]
|