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.
Files changed (59) hide show
  1. schubmult/__init__.py +94 -1
  2. schubmult/perm_lib.py +233 -880
  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 +17 -15
  13. schubmult/{sage_integration → sage}/_fast_double_schubert_polynomial_ring.py +142 -220
  14. schubmult/{sage_integration → sage}/_fast_schubert_polynomial_ring.py +78 -72
  15. schubmult/sage/_indexing.py +51 -0
  16. schubmult/schub_lib/__init__.py +51 -0
  17. schubmult/{schubmult_double/_funcs.py → schub_lib/double.py} +618 -798
  18. schubmult/{schubmult_q/_funcs.py → schub_lib/quantum.py} +70 -72
  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} +58 -48
  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} +40 -11
  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.3.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 -9
  41. schubmult/sage_integration/_indexing.py +0 -51
  42. schubmult/schubmult_double/__init__.py +0 -22
  43. schubmult/schubmult_double/__main__.py +0 -5
  44. schubmult/schubmult_double/_script.py +0 -474
  45. schubmult/schubmult_py/__init__.py +0 -13
  46. schubmult/schubmult_py/__main__.py +0 -5
  47. schubmult/schubmult_py/_script.py +0 -96
  48. schubmult/schubmult_q/__init__.py +0 -13
  49. schubmult/schubmult_q/__main__.py +0 -5
  50. schubmult/schubmult_q/_script.py +0 -160
  51. schubmult/schubmult_q_double/__init__.py +0 -17
  52. schubmult/schubmult_q_double/__main__.py +0 -5
  53. schubmult/schubmult_q_double/_funcs.py +0 -540
  54. schubmult/schubmult_q_double/_script.py +0 -398
  55. schubmult-2.0.3.dist-info/METADATA +0 -455
  56. schubmult-2.0.3.dist-info/RECORD +0 -30
  57. schubmult-2.0.3.dist-info/entry_points.txt +0 -5
  58. {schubmult-2.0.3.dist-info → schubmult-3.0.0.dist-info}/licenses/LICENSE +0 -0
  59. {schubmult-2.0.3.dist-info → schubmult-3.0.0.dist-info}/top_level.txt +0 -0
@@ -1,26 +1,28 @@
1
+ from functools import cached_property
2
+
3
+ from symengine import Add, Mul, Pow
4
+
1
5
  from schubmult.perm_lib import (
2
- elem_sym_perms,
3
- add_perm_dict,
4
- compute_vpathdicts,
5
- inverse,
6
- theta,
7
- permtrim,
6
+ Permutation,
8
7
  inv,
9
- mulperm,
8
+ permtrim,
9
+ theta,
10
10
  uncode,
11
11
  )
12
- from symengine import Add, Mul, Pow, symarray
13
- from functools import cached_property
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
+ )
14
20
 
15
21
 
16
22
  class _gvars:
17
- @cached_property
18
- def n(self):
19
- return 100
20
-
21
23
  @cached_property
22
24
  def var_x(self):
23
- return tuple(symarray("x", self.n).tolist())
25
+ return GeneratingSet("x")
24
26
 
25
27
 
26
28
  _vars = _gvars()
@@ -42,57 +44,62 @@ def single_variable(coeff_dict, varnum):
42
44
  return ret
43
45
 
44
46
 
45
- def mult_poly(coeff_dict, poly, var_x=_vars.var_x):
46
- 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)=}")
47
54
  return single_variable(coeff_dict, var_x.index(poly))
48
- elif isinstance(poly, Mul):
55
+
56
+ if isinstance(poly, Mul):
49
57
  ret = coeff_dict
50
58
  for a in poly.args:
51
- ret = mult_poly(ret, a, var_x)
59
+ ret = mult_poly_py(ret, a, var_x)
52
60
  return ret
53
- elif isinstance(poly, Pow):
61
+ if isinstance(poly, Pow):
54
62
  base = poly.args[0]
55
63
  exponent = int(poly.args[1])
56
64
  ret = coeff_dict
57
65
  for i in range(int(exponent)):
58
- ret = mult_poly(ret, base, var_x)
66
+ ret = mult_poly_py(ret, base, var_x)
59
67
  return ret
60
- elif isinstance(poly, Add):
68
+ if isinstance(poly, Add):
61
69
  ret = {}
62
70
  for a in poly.args:
63
- ret = add_perm_dict(ret, mult_poly(coeff_dict, a, var_x))
64
- return ret
65
- else:
66
- ret = {}
67
- for perm in coeff_dict:
68
- ret[perm] = poly * coeff_dict[perm]
71
+ ret = add_perm_dict(ret, mult_poly_py(coeff_dict, a, var_x))
69
72
  return ret
73
+ ret = {}
74
+ for perm in coeff_dict:
75
+ ret[perm] = poly * coeff_dict[perm]
76
+ return ret
70
77
 
71
78
 
72
- def schubmult(perm_dict, v):
73
- vn1 = inverse(v)
79
+ def schubmult_py(perm_dict, v):
80
+ v = Permutation(v)
81
+ # print(f"{v=}")
82
+ vn1 = ~v
74
83
  th = theta(vn1)
75
- if th[0] == 0:
84
+ if len(th) == 0 or th[0] == 0:
76
85
  return perm_dict
77
- mu = permtrim(uncode(th))
78
- vmu = permtrim(mulperm(list(v), mu))
86
+ mu = uncode(th)
87
+ vmu = v * mu
79
88
  inv_vmu = inv(vmu)
80
89
  inv_mu = inv(mu)
81
90
  ret_dict = {}
82
91
  while th[-1] == 0:
83
92
  th.pop()
84
93
  vpathdicts = compute_vpathdicts(th, vmu)
85
-
86
94
  mx_th = [0 for i in range(len(th))]
87
95
  for index in range(len(th)):
88
96
  for vp in vpathdicts[index]:
89
97
  for v2, vdiff, s in vpathdicts[index][vp]:
90
- if th[index] - vdiff > mx_th[index]:
91
- mx_th[index] = th[index] - vdiff
98
+ mx_th[index] = max(mx_th[index], th[index] - vdiff)
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