schubmult 2.0.4__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.
Files changed (58) hide show
  1. schubmult/__init__.py +94 -1
  2. schubmult/perm_lib.py +232 -819
  3. schubmult/poly_lib/__init__.py +31 -0
  4. schubmult/poly_lib/poly_lib.py +244 -0
  5. schubmult/poly_lib/schub_poly.py +148 -0
  6. schubmult/poly_lib/variables.py +204 -0
  7. schubmult/rings/__init__.py +17 -0
  8. schubmult/rings/_quantum_schubert_polynomial_ring.py +788 -0
  9. schubmult/rings/_schubert_polynomial_ring.py +1006 -0
  10. schubmult/rings/_tensor_schub_ring.py +128 -0
  11. schubmult/rings/_utils.py +55 -0
  12. schubmult/{sage_integration → sage}/__init__.py +4 -1
  13. schubmult/{sage_integration → sage}/_fast_double_schubert_polynomial_ring.py +67 -109
  14. schubmult/{sage_integration → sage}/_fast_schubert_polynomial_ring.py +33 -28
  15. schubmult/{sage_integration → sage}/_indexing.py +9 -5
  16. schubmult/schub_lib/__init__.py +51 -0
  17. schubmult/{schubmult_double/_funcs.py → schub_lib/double.py} +532 -596
  18. schubmult/{schubmult_q/_funcs.py → schub_lib/quantum.py} +54 -53
  19. schubmult/schub_lib/quantum_double.py +954 -0
  20. schubmult/schub_lib/schub_lib.py +659 -0
  21. schubmult/{schubmult_py/_funcs.py → schub_lib/single.py} +45 -35
  22. schubmult/schub_lib/tests/__init__.py +0 -0
  23. schubmult/schub_lib/tests/legacy_perm_lib.py +946 -0
  24. schubmult/schub_lib/tests/test_vs_old.py +109 -0
  25. schubmult/scripts/__init__.py +0 -0
  26. schubmult/scripts/schubmult_double.py +378 -0
  27. schubmult/scripts/schubmult_py.py +84 -0
  28. schubmult/scripts/schubmult_q.py +109 -0
  29. schubmult/scripts/schubmult_q_double.py +207 -0
  30. schubmult/utils/__init__.py +0 -0
  31. schubmult/{_base_argparse.py → utils/argparse.py} +29 -5
  32. schubmult/utils/logging.py +16 -0
  33. schubmult/utils/parsing.py +20 -0
  34. schubmult/utils/perm_utils.py +135 -0
  35. schubmult/utils/test_utils.py +65 -0
  36. schubmult-3.0.0.dist-info/METADATA +1234 -0
  37. schubmult-3.0.0.dist-info/RECORD +41 -0
  38. {schubmult-2.0.4.dist-info → schubmult-3.0.0.dist-info}/WHEEL +1 -1
  39. schubmult-3.0.0.dist-info/entry_points.txt +5 -0
  40. schubmult/_tests.py +0 -24
  41. schubmult/schubmult_double/__init__.py +0 -12
  42. schubmult/schubmult_double/__main__.py +0 -6
  43. schubmult/schubmult_double/_script.py +0 -474
  44. schubmult/schubmult_py/__init__.py +0 -12
  45. schubmult/schubmult_py/__main__.py +0 -6
  46. schubmult/schubmult_py/_script.py +0 -97
  47. schubmult/schubmult_q/__init__.py +0 -8
  48. schubmult/schubmult_q/__main__.py +0 -6
  49. schubmult/schubmult_q/_script.py +0 -166
  50. schubmult/schubmult_q_double/__init__.py +0 -10
  51. schubmult/schubmult_q_double/__main__.py +0 -6
  52. schubmult/schubmult_q_double/_funcs.py +0 -540
  53. schubmult/schubmult_q_double/_script.py +0 -396
  54. schubmult-2.0.4.dist-info/METADATA +0 -542
  55. schubmult-2.0.4.dist-info/RECORD +0 -30
  56. schubmult-2.0.4.dist-info/entry_points.txt +0 -5
  57. {schubmult-2.0.4.dist-info → schubmult-3.0.0.dist-info}/licenses/LICENSE +0 -0
  58. {schubmult-2.0.4.dist-info → schubmult-3.0.0.dist-info}/top_level.txt +0 -0
@@ -1,28 +1,28 @@
1
1
  from functools import cached_property
2
2
 
3
- from symengine import Add, Mul, Pow, symarray
3
+ from symengine import Add, Mul, Pow
4
4
 
5
5
  from schubmult.perm_lib import (
6
- add_perm_dict,
7
- compute_vpathdicts,
8
- elem_sym_perms,
6
+ Permutation,
9
7
  inv,
10
- inverse,
11
- mulperm,
12
8
  permtrim,
13
9
  theta,
14
10
  uncode,
15
11
  )
12
+ from schubmult.poly_lib.variables import CustomGeneratingSet, GeneratingSet, GeneratingSet_base
13
+ from schubmult.schub_lib.schub_lib import (
14
+ compute_vpathdicts,
15
+ elem_sym_perms,
16
+ )
17
+ from schubmult.utils.perm_utils import (
18
+ add_perm_dict,
19
+ )
16
20
 
17
21
 
18
22
  class _gvars:
19
- @cached_property
20
- def n(self):
21
- return 100
22
-
23
23
  @cached_property
24
24
  def var_x(self):
25
- return tuple(symarray("x", self.n).tolist())
25
+ return GeneratingSet("x")
26
26
 
27
27
 
28
28
  _vars = _gvars()
@@ -44,25 +44,31 @@ def single_variable(coeff_dict, varnum):
44
44
  return ret
45
45
 
46
46
 
47
- def mult_poly(coeff_dict, poly, var_x=_vars.var_x):
48
- if poly in var_x:
47
+ # TODO: if need indexes, CustomGeneratingSet
48
+ def mult_poly_py(coeff_dict, poly, var_x=_vars.var_x):
49
+ if not isinstance(var_x, GeneratingSet_base):
50
+ var_x = CustomGeneratingSet(var_x)
51
+
52
+ if var_x.index(poly) != -1:
53
+ # print(f"{poly=} {var_x._symbols_arr=} {var_x._symbols_arr.index(poly)=}")
49
54
  return single_variable(coeff_dict, var_x.index(poly))
55
+
50
56
  if isinstance(poly, Mul):
51
57
  ret = coeff_dict
52
58
  for a in poly.args:
53
- ret = mult_poly(ret, a, var_x)
59
+ ret = mult_poly_py(ret, a, var_x)
54
60
  return ret
55
61
  if isinstance(poly, Pow):
56
62
  base = poly.args[0]
57
63
  exponent = int(poly.args[1])
58
64
  ret = coeff_dict
59
65
  for i in range(int(exponent)):
60
- ret = mult_poly(ret, base, var_x)
66
+ ret = mult_poly_py(ret, base, var_x)
61
67
  return ret
62
68
  if isinstance(poly, Add):
63
69
  ret = {}
64
70
  for a in poly.args:
65
- ret = add_perm_dict(ret, mult_poly(coeff_dict, a, var_x))
71
+ ret = add_perm_dict(ret, mult_poly_py(coeff_dict, a, var_x))
66
72
  return ret
67
73
  ret = {}
68
74
  for perm in coeff_dict:
@@ -70,20 +76,21 @@ def mult_poly(coeff_dict, poly, var_x=_vars.var_x):
70
76
  return ret
71
77
 
72
78
 
73
- def schubmult(perm_dict, v):
74
- vn1 = inverse(v)
79
+ def schubmult_py(perm_dict, v):
80
+ v = Permutation(v)
81
+ # print(f"{v=}")
82
+ vn1 = ~v
75
83
  th = theta(vn1)
76
- if th[0] == 0:
84
+ if len(th) == 0 or th[0] == 0:
77
85
  return perm_dict
78
- mu = permtrim(uncode(th))
79
- vmu = permtrim(mulperm(list(v), mu))
86
+ mu = uncode(th)
87
+ vmu = v * mu
80
88
  inv_vmu = inv(vmu)
81
89
  inv_mu = inv(mu)
82
90
  ret_dict = {}
83
91
  while th[-1] == 0:
84
92
  th.pop()
85
93
  vpathdicts = compute_vpathdicts(th, vmu)
86
-
87
94
  mx_th = [0 for i in range(len(th))]
88
95
  for index in range(len(th)):
89
96
  for vp in vpathdicts[index]:
@@ -92,7 +99,7 @@ def schubmult(perm_dict, v):
92
99
 
93
100
  for u, val in perm_dict.items():
94
101
  inv_u = inv(u)
95
- vpathsums = {u: {(1, 2): val}}
102
+ vpathsums = {Permutation(u): {Permutation([1, 2]): val}}
96
103
 
97
104
  for index in range(len(th)):
98
105
  newpathsums = {}
@@ -103,7 +110,10 @@ def schubmult(perm_dict, v):
103
110
  min(mx_th[index], inv_mu - inv_vmu - (inv_up - inv_u)),
104
111
  th[index],
105
112
  )
113
+ # print(f"{up=}")
106
114
  for vp in vpathsums[up]:
115
+ # print(f"{vp=} {type(vp)=} {hash(vp)=}")
116
+ # print(f"{vpathsums[up]=} {vpathdicts[index]=}")
107
117
  sumval = vpathsums[up][vp]
108
118
  if sumval == 0:
109
119
  continue
@@ -115,13 +125,13 @@ def schubmult(perm_dict, v):
115
125
  newpathsums[up2] = {}
116
126
  newpathsums[up2][v2] = newpathsums[up2].get(v2, 0) + addsumval
117
127
  vpathsums = newpathsums
118
- toget = tuple(vmu)
128
+ toget = vmu
119
129
  ret_dict = add_perm_dict({ep: vpathsums[ep].get(toget, 0) for ep in vpathsums}, ret_dict)
120
130
  return ret_dict
121
131
 
122
132
 
123
- def schub_coprod(perm, indices):
124
- mperm = tuple(perm)
133
+ def schub_coprod_py(perm, indices):
134
+ mperm = perm
125
135
  indices = sorted(indices)
126
136
  ret_dict = {}
127
137
  k = len(indices)
@@ -130,19 +140,19 @@ def schub_coprod(perm, indices):
130
140
  max_required = max([kcd[i] + i for i in range(len(kcd))])
131
141
  kcd2 = kcd + [0 for i in range(len(kcd), max_required)] + [0]
132
142
  N = len(kcd)
133
- kperm = permtrim(inverse(uncode(kcd2)))
134
- coeff_dict = {tuple(kperm): 1}
135
- coeff_dict = schubmult(coeff_dict, tuple(mperm))
143
+ kperm = ~(uncode(kcd2))
144
+ coeff_dict = {kperm: 1}
145
+ coeff_dict = schubmult_py(coeff_dict, mperm)
136
146
 
137
147
  inv_kperm = inv(kperm)
138
- inverse_kperm = inverse(kperm)
148
+ inverse_kperm = ~kperm
139
149
  # total_sum = 0
140
150
  for perm, val in coeff_dict.items():
141
151
  if val == 0:
142
152
  continue
143
- pperm = [*perm]
144
- downperm = mulperm(pperm, inverse_kperm)
145
- if inv(downperm) == inv(pperm) - inv_kperm:
153
+ # pperm = [*perm]
154
+ downperm = perm * inverse_kperm
155
+ if inv(downperm) == inv(perm) - inv_kperm:
146
156
  flag = True
147
157
  for i in range(N):
148
158
  if downperm[i] > N:
@@ -150,7 +160,7 @@ def schub_coprod(perm, indices):
150
160
  break
151
161
  if not flag:
152
162
  continue
153
- firstperm = tuple(permtrim(list(downperm[0:N])))
154
- secondperm = tuple(permtrim([downperm[i] - N for i in range(N, len(downperm))]))
163
+ firstperm = permtrim(list(downperm[0:N]))
164
+ secondperm = permtrim([downperm[i] - N for i in range(N, len(downperm))])
155
165
  ret_dict[(firstperm, secondperm)] = val
156
166
  return ret_dict
File without changes