schubmult 1.3.7__tar.gz → 1.3.9__tar.gz

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 (31) hide show
  1. {schubmult-1.3.7 → schubmult-1.3.9}/PKG-INFO +1 -1
  2. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult/perm_lib.py +29 -0
  3. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult/schubmult_double/schubmult_double.py +15 -4
  4. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult/schubmult_py/schubmult_py.py +60 -4
  5. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult/schubmult_q/schubmult_q.py +56 -0
  6. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult/schubmult_q_double/schubmult_q_double.py +13 -2
  7. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult/schubmult_q_yz/schubmult_q_yz.py +118 -15
  8. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult/schubmult_yz/schubmult_yz.py +200 -11
  9. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult.egg-info/PKG-INFO +1 -1
  10. {schubmult-1.3.7 → schubmult-1.3.9}/setup.py +1 -1
  11. {schubmult-1.3.7 → schubmult-1.3.9}/LICENSE +0 -0
  12. {schubmult-1.3.7 → schubmult-1.3.9}/README.md +0 -0
  13. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult/__init__.py +0 -0
  14. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult/schubmult_double/__init__.py +0 -0
  15. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult/schubmult_double/__main__.py +0 -0
  16. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult/schubmult_py/__init__.py +0 -0
  17. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult/schubmult_py/__main__.py +0 -0
  18. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult/schubmult_q/__init__.py +0 -0
  19. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult/schubmult_q/__main__.py +0 -0
  20. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult/schubmult_q_double/__init__.py +0 -0
  21. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult/schubmult_q_double/__main__.py +0 -0
  22. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult/schubmult_q_yz/__init__.py +0 -0
  23. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult/schubmult_q_yz/__main__.py +0 -0
  24. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult/schubmult_yz/__init__.py +0 -0
  25. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult/schubmult_yz/__main__.py +0 -0
  26. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult.egg-info/SOURCES.txt +0 -0
  27. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult.egg-info/dependency_links.txt +0 -0
  28. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult.egg-info/entry_points.txt +0 -0
  29. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult.egg-info/requires.txt +0 -0
  30. {schubmult-1.3.7 → schubmult-1.3.9}/schubmult.egg-info/top_level.txt +0 -0
  31. {schubmult-1.3.7 → schubmult-1.3.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: schubmult
3
- Version: 1.3.7
3
+ Version: 1.3.9
4
4
  Summary: Computing Littlewood-Richardson coefficients of Schubert polynomials
5
5
  Home-page: https://github.com/matthematics/schubmult
6
6
  Author: Matt Samuel
@@ -139,6 +139,28 @@ def elem_sym_perms(orig_perm,p,k):
139
139
  up_perm_list = perm_list
140
140
  return total_list
141
141
 
142
+ def elem_sym_perms_op(orig_perm,p,k):
143
+ total_list = [(orig_perm,0)]
144
+ up_perm_list = [(orig_perm,k)]
145
+ for pp in range(p):
146
+ perm_list = []
147
+ for up_perm, last in up_perm_list:
148
+ up_perm2 = [*up_perm]
149
+ if len(up_perm2) < k + 1:
150
+ up_perm2 += [i+1 for i in range(len(up_perm2),k+2)]
151
+ pos_list = [i for i in range(k) if up_perm2[i] == orig_perm[i]]
152
+ for j in range(last,len(up_perm2)):
153
+ for i in pos_list:
154
+ if has_bruhat_descent(up_perm2,i,j):
155
+ new_perm = [*up_perm2]
156
+ new_perm[i],new_perm[j] = new_perm[j],new_perm[i]
157
+ new_perm_add = tuple(permtrim(new_perm))
158
+ perm_list += [(new_perm_add,j)]
159
+ total_list+=[(new_perm_add,pp+1)]
160
+ up_perm_list = perm_list
161
+ return total_list
162
+
163
+
142
164
  def strict_theta(u):
143
165
  ret = [*trimcode(u)]
144
166
  did_one = True
@@ -300,6 +322,13 @@ def add_perm_dict(d1,d2):
300
322
  zero = sympify(0)
301
323
  one = sympify(1)
302
324
 
325
+ def elem_sym_poly_q(p,k,varl1,varl2):
326
+ if p == 0 and k>=0:
327
+ return one
328
+ if p<0 or p>k:
329
+ return zero
330
+ return (varl1[k-1] - varl2[k-p])*elem_sym_poly_q(p-1,k-1,varl1,varl2)+elem_sym_poly_q(p,k-1,varl1,varl2)+q_var[k-1]*elem_sym_poly_q(p-2,k-2,varl1,varl2)
331
+
303
332
  def elem_sym_poly(p,k,varl1,varl2,xstart=0,ystart=0):
304
333
  global zero, one
305
334
  if p>k:
@@ -2,7 +2,7 @@ from symengine import *
2
2
  from functools import cache
3
3
  from itertools import chain
4
4
  from schubmult.perm_lib import *
5
- from schubmult.schubmult_yz import schubmult
5
+ from schubmult.schubmult_yz import schubmult, mult_poly
6
6
  import sys
7
7
 
8
8
  n = 100
@@ -17,7 +17,7 @@ var_q = Symbol("q")
17
17
  subs_dict = {}
18
18
 
19
19
  for i in range(1,n):
20
- sm = var_r[0]
20
+ sm = var2[1]
21
21
  for j in range(1,i):
22
22
  sm += var_r[j]
23
23
  subs_dict[var2[i]] = sm
@@ -32,11 +32,16 @@ def main():
32
32
  pr = True
33
33
  ascode = False
34
34
  coprod = False
35
+ mult = False
36
+ mulstring = ""
35
37
  try:
36
38
  for s in sys.argv[1:]:
37
39
  if s == "-np" or s == "--no-print":
38
40
  pr = False
39
41
  continue
42
+ if mult:
43
+ mulstring+=s
44
+ continue
40
45
  if s == "-code":
41
46
  ascode = True
42
47
  continue
@@ -47,11 +52,14 @@ def main():
47
52
  perms += [curperm]
48
53
  curperm = []
49
54
  continue
55
+ if s == "-mult":
56
+ mult = True
57
+ continue
50
58
  curperm += [int(s)]
51
59
  except Exception:
52
60
  print("**** schubmult_double ****")
53
61
  print("Purpose: Compute products (and coproducts) of double Schubert polynomials in the same set of variables")
54
- print("Usage: schubmult_double <-np|--no-print> <-code> perm1 - perm2 < - perm 3 ... >")
62
+ print("Usage: schubmult_double <-np|--no-print> <-code> perm1 - perm2 < - perm 3 ... > <-mult poly>")
55
63
  print("Alternative usage: schubmult_double <-code> -coprod perm - indexlist")
56
64
  exit(1)
57
65
 
@@ -145,7 +153,10 @@ def main():
145
153
 
146
154
  for perm in perms[1:]:
147
155
  coeff_dict = schubmult(coeff_dict,tuple(permtrim([*perm])),var2,var2)
148
-
156
+ if mult:
157
+ mul_exp = sympify(mulstring)
158
+ coeff_dict = mult_poly(coeff_dict,mul_exp)
159
+
149
160
  if pr:
150
161
  if ascode:
151
162
  width = max([len(str(trimcode(perm))) for perm in coeff_dict.keys()])
@@ -2,6 +2,50 @@ import sys
2
2
  from functools import cache
3
3
  from itertools import chain
4
4
  from schubmult.perm_lib import *
5
+ from symengine import *
6
+
7
+ var_x = symarray("x",100).tolist()
8
+
9
+ def single_variable(coeff_dict,varnum):
10
+ ret = {}
11
+ for u in coeff_dict:
12
+ new_perms_k = elem_sym_perms(u,1,varnum)
13
+ new_perms_km1 = []
14
+ if varnum > 1:
15
+ new_perms_km1 = elem_sym_perms(u,1,varnum-1)
16
+ for perm, udiff in new_perms_k:
17
+ if udiff == 1:
18
+ ret[perm] = ret.get(perm,0) + coeff_dict[u]
19
+ for perm, udiff in new_perms_km1:
20
+ if udiff == 1:
21
+ ret[perm] = ret.get(perm,0) - coeff_dict[u]
22
+ return ret
23
+
24
+ def mult_poly(coeff_dict,poly):
25
+ if poly in var_x:
26
+ return single_variable(coeff_dict,var_x.index(poly))
27
+ elif isinstance(poly,Mul):
28
+ ret = coeff_dict
29
+ for a in poly.args:
30
+ ret = mult_poly(ret,a)
31
+ return ret
32
+ elif isinstance(poly,Pow):
33
+ base = poly.args[0]
34
+ exponent = int(poly.args[1])
35
+ ret = coeff_dict
36
+ for i in range(int(exponent)):
37
+ ret = mult_poly(ret,base)
38
+ return ret
39
+ elif isinstance(poly,Add):
40
+ ret = {}
41
+ for a in poly.args:
42
+ ret = add_perm_dict(ret,mult_poly(coeff_dict,a))
43
+ return ret
44
+ else:
45
+ ret = {}
46
+ for perm in coeff_dict:
47
+ ret[perm] = poly*coeff_dict[perm]
48
+ return ret
5
49
 
6
50
  def schubmult(perm_dict,v):
7
51
  vn1 = inverse(v)
@@ -58,9 +102,17 @@ def main():
58
102
  pr = True
59
103
  coprod = False
60
104
  ascode = False
105
+ mult = False
106
+ mulstring = ""
61
107
 
62
108
  try:
63
109
  for s in sys.argv[1:]:
110
+ if mult:
111
+ mulstring += s
112
+ continue
113
+ if s == "-mult":
114
+ mult = True
115
+ continue
64
116
  if s == "-np" or s == "--no-print":
65
117
  pr = False
66
118
  continue
@@ -73,8 +125,9 @@ def main():
73
125
  if s == "-":
74
126
  perms += [tuple(curperm)]
75
127
  curperm = []
76
- continue
77
- curperm += [int(s)]
128
+ continue
129
+ else:
130
+ curperm += [int(s)]
78
131
  except Exception:
79
132
  print("**** schubmult_py ****")
80
133
  print("Purpose: Compute products (and coproducts) of ordinary Schubert polynomials")
@@ -138,11 +191,14 @@ def main():
138
191
 
139
192
 
140
193
  perms.sort(reverse=True,key=lambda x: sum(theta(inverse(x)))-inv(x))
141
-
194
+
142
195
  coeff_dict = {tuple(permtrim([*perms[0]])): 1}
143
-
196
+
144
197
  for perm in perms[1:]:
145
198
  coeff_dict = schubmult(coeff_dict,tuple(permtrim([*perm])))
199
+ if mult:
200
+ mul_exp = sympify(mulstring)
201
+ coeff_dict = mult_poly(coeff_dict,mul_exp)
146
202
 
147
203
  if pr:
148
204
  for perm, val in coeff_dict.items():
@@ -14,6 +14,49 @@ var_q = Symbol("q")
14
14
 
15
15
  subs_dict = {}
16
16
 
17
+ var_x = symarray("x",100).tolist()
18
+
19
+ def single_variable(coeff_dict,varnum):
20
+ ret = {}
21
+ for u in coeff_dict:
22
+ new_perms_k = elem_sym_perms_q(u,1,varnum)
23
+ new_perms_km1 = []
24
+ if varnum > 1:
25
+ new_perms_km1 = elem_sym_perms_q(u,1,varnum-1)
26
+ for perm, udiff, mul_val in new_perms_k:
27
+ if udiff == 1:
28
+ ret[perm] = ret.get(perm,0) + coeff_dict[u]*mul_val
29
+ for perm, udiff, mul_val in new_perms_km1:
30
+ if udiff == 1:
31
+ ret[perm] = ret.get(perm,0) - coeff_dict[u]*mul_val
32
+ return ret
33
+
34
+ def mult_poly(coeff_dict,poly):
35
+ if poly in var_x:
36
+ return single_variable(coeff_dict,var_x.index(poly))
37
+ elif isinstance(poly,Mul):
38
+ ret = coeff_dict
39
+ for a in poly.args:
40
+ ret = mult_poly(ret,a)
41
+ return ret
42
+ elif isinstance(poly,Pow):
43
+ base = poly.args[0]
44
+ exponent = int(poly.args[1])
45
+ ret = coeff_dict
46
+ for i in range(int(exponent)):
47
+ ret = mult_poly(ret,base)
48
+ return ret
49
+ elif isinstance(poly,Add):
50
+ ret = {}
51
+ for a in poly.args:
52
+ ret = add_perm_dict(ret,mult_poly(coeff_dict,a))
53
+ return ret
54
+ else:
55
+ ret = {}
56
+ for perm in coeff_dict:
57
+ ret[perm] = poly*coeff_dict[perm]
58
+ return ret
59
+
17
60
  for i in range(1,n):
18
61
  sm = var_r[0]
19
62
  for j in range(1,i):
@@ -132,11 +175,17 @@ def main():
132
175
  grass = False
133
176
  grass_q_n = 0
134
177
  equiv = False
178
+ mult = False
179
+ mulstring = ""
180
+
135
181
  try:
136
182
  for s in sys.argv[1:]:
137
183
  if s == "-np" or s == "--no-print":
138
184
  pr = False
139
185
  continue
186
+ if mult:
187
+ mulstring += s
188
+ continue
140
189
  if s == "-code":
141
190
  ascode = True
142
191
  continue
@@ -150,6 +199,9 @@ def main():
150
199
  grass = True
151
200
  grass_q_n = int(s)
152
201
  continue
202
+ if s == "-mult":
203
+ mult = True
204
+ continue
153
205
  if s == "-":
154
206
  perms += [curperm]
155
207
  curperm = []
@@ -294,6 +346,10 @@ def main():
294
346
 
295
347
  for perm in perms[1:]:
296
348
  coeff_dict = schubmult(coeff_dict,tuple(permtrim([*perm])))
349
+
350
+ if mult:
351
+ mul_exp = sympify(mulstring)
352
+ coeff_dict = mult_poly(coeff_dict,mul_exp)
297
353
 
298
354
  if pr:
299
355
  if ascode:
@@ -1,5 +1,5 @@
1
1
  from schubmult.perm_lib import *
2
- from schubmult.schubmult_q_yz import schubmult
2
+ from schubmult.schubmult_q_yz import schubmult, mult_poly
3
3
  from symengine import *
4
4
  import sys
5
5
 
@@ -15,7 +15,7 @@ var_r = symarray('r',100)
15
15
  subs_dict = {}
16
16
 
17
17
  for i in range(1,100):
18
- sm = var_r[0]
18
+ sm = var2[1]
19
19
  for j in range(1,i):
20
20
  sm += var_r[j]
21
21
  subs_dict[var2[i]] = sm
@@ -36,11 +36,19 @@ def main():
36
36
  coprod = False
37
37
  check = True
38
38
  msg = False
39
+ mult = False
40
+ mulstring = ""
39
41
  try:
40
42
  for s in sys.argv[1:]:
41
43
  if s == "-np" or s == "--no-print":
42
44
  pr = False
43
45
  continue
46
+ if mult:
47
+ mulstring += s
48
+ continue
49
+ if s == "-mult":
50
+ mult = True
51
+ continue
44
52
  if s == "-nocheck":
45
53
  check = False
46
54
  continue
@@ -89,6 +97,9 @@ def main():
89
97
  coeff_dict = {perms[0]: 1}
90
98
  for perm in perms[1:]:
91
99
  coeff_dict = schubmult(coeff_dict,perm,var2,var2)
100
+ if mult:
101
+ mul_exp = sympify(mulstring)
102
+ coeff_dict = mult_poly(coeff_dict,mul_exp)
92
103
 
93
104
  if pr:
94
105
  if ascode:
@@ -6,9 +6,66 @@ import sys
6
6
  var2 = symarray("y",100)
7
7
  var3 = symarray("z",100)
8
8
 
9
- var_x = symarray("x",100)
9
+ var_y = var2.tolist()
10
+ var_z = var3.tolist()
11
+ var_x = symarray("x",100).tolist()
12
+
13
+ x = var_x
14
+ y = var_y
15
+ z = var_z
16
+
17
+ def E(p,k,varl=var_y[1:]):
18
+ return elem_sym_poly_q(p,k,var_x[1:],varl)
19
+
20
+ def single_variable(coeff_dict,varnum):
21
+ ret = {}
22
+ for u in coeff_dict:
23
+ if varnum -1 < len(u):
24
+ ret[u] = ret.get(u,0) + var2[u[varnum-1]]*coeff_dict[u]
25
+ else:
26
+ ret[u] = ret.get(u,0) + var2[varnum]*coeff_dict[u]
27
+ new_perms_k = elem_sym_perms_q(u,1,varnum)
28
+ new_perms_km1 = []
29
+ if varnum > 1:
30
+ new_perms_km1 = elem_sym_perms_q(u,1,varnum-1)
31
+ for perm, udiff, mul_val in new_perms_k:
32
+ if udiff == 1:
33
+ ret[perm] = ret.get(perm,0) + coeff_dict[u]*mul_val
34
+ for perm, udiff, mul_val in new_perms_km1:
35
+ if udiff == 1:
36
+ ret[perm] = ret.get(perm,0) - coeff_dict[u]*mul_val
37
+ return ret
38
+
39
+ def mult_poly(coeff_dict,poly):
40
+ if poly in var_x:
41
+ return single_variable(coeff_dict,var_x.index(poly))
42
+ elif isinstance(poly,Mul):
43
+ ret = coeff_dict
44
+ for a in poly.args:
45
+ ret = mult_poly(ret,a)
46
+ return ret
47
+ elif isinstance(poly,Pow):
48
+ base = poly.args[0]
49
+ exponent = int(poly.args[1])
50
+ ret = coeff_dict
51
+ for i in range(int(exponent)):
52
+ ret = mult_poly(ret,base)
53
+ return ret
54
+ elif isinstance(poly,Add):
55
+ ret = {}
56
+ for a in poly.args:
57
+ ret = add_perm_dict(ret,mult_poly(coeff_dict,a))
58
+ return ret
59
+ else:
60
+ ret = {}
61
+ for perm in coeff_dict:
62
+ ret[perm] = poly*coeff_dict[perm]
63
+ return ret
64
+
10
65
 
11
66
  def nil_hecke(perm_dict,v,n,var2=var2,var3=var3):
67
+ if v == (1,2):
68
+ return perm_dict
12
69
  th = strict_theta(inverse(v))
13
70
  mu = permtrim(uncode(th))
14
71
  vmu = permtrim(mulperm([*v],mu))
@@ -51,6 +108,8 @@ def nil_hecke(perm_dict,v,n,var2=var2,var3=var3):
51
108
 
52
109
 
53
110
  def schubmult(perm_dict,v,var2=var2,var3=var3):
111
+ if v == (1,2):
112
+ return perm_dict
54
113
  th = strict_theta(inverse(v))
55
114
  mu = permtrim(uncode(th))
56
115
  vmu = permtrim(mulperm([*v],mu))
@@ -189,7 +248,7 @@ var3_t = tuple(var3.tolist())
189
248
  def print_usage():
190
249
  print("**** schubmult_q_yz ****")
191
250
  print("Purpose: Compute Molev-Sagan coefficients of quantum double Schubert polynomials")
192
- print("Usage: schubmult_q_yz <-np|--no-print> <-code> <--display-positive> <--optimizer-message> perm1 - perm2 < - perm3 .. >")
251
+ print("Usage: schubmult_q_yz <-np|--no-print> <-code> <--display-positive> <--optimizer-message> perm1 - perm2 < - perm3 .. > <-mult poly_expression>")
193
252
  print(" *** Computes products")
194
253
  print("Alternative usage: schubmult_q_yz -nil-hecke n <-code> <--display-positive> perm")
195
254
  print(" *** Computes nil-Hecke representation of quantum double Schubert polynomial, limiting to the group S_n")
@@ -210,18 +269,35 @@ def main():
210
269
  check = True
211
270
  msg = False
212
271
  just_nil = False
272
+ mult = False
213
273
 
214
274
  nil_N = 0
215
275
 
276
+ mulstring = ""
277
+ norep = False
278
+ expa = False
279
+
216
280
  try:
217
281
  for s in sys.argv[1:]:
218
282
  if just_nil:
219
283
  just_nil = False
220
284
  nil_N = int(s)
221
285
  continue
286
+ if s == "--norep":
287
+ norep = True
288
+ continue
289
+ if s == "--expand":
290
+ expa = True
291
+ continue
222
292
  if s == "-np" or s == "--no-print":
223
293
  pr = False
224
294
  continue
295
+ if mult:
296
+ mulstring += s
297
+ continue
298
+ if s == "-mult":
299
+ mult = True
300
+ continue
225
301
  if s == "-nocheck":
226
302
  check = False
227
303
  continue
@@ -243,11 +319,11 @@ def main():
243
319
  continue
244
320
  if s == "--usage" or s == "--help":
245
321
  print_usage()
246
- exit(0)
322
+ exit(0)
247
323
  if s == "-":
248
324
  perms += [curperm]
249
325
  curperm = []
250
- continue
326
+ continue
251
327
  curperm += [int(s)]
252
328
  except Exception:
253
329
  print_usage()
@@ -261,6 +337,8 @@ def main():
261
337
  perms[i] = tuple(permtrim(uncode(perms[i])))
262
338
  else:
263
339
  for i in range(len(perms)):
340
+ if len(perms[i])<2 and (len(perms[i])==0 or perms[i][0]==1):
341
+ perms[i] = (1,2)
264
342
  perms[i] = tuple(permtrim([*perms[i]]))
265
343
 
266
344
  size = 0
@@ -268,12 +346,21 @@ def main():
268
346
 
269
347
  if nilhecke:
270
348
  coeff_dict = nil_hecke({(1,2): 1},perms[0],nil_N)
271
- rep = ("y","x")
349
+ rep = ("y","x")
272
350
  else:
273
351
  coeff_dict = {perms[0]: 1}
274
352
  for perm in perms[1:]:
275
353
  coeff_dict = schubmult(coeff_dict,perm)
276
- rep = ("","")
354
+ if mult:
355
+ for v in var2:
356
+ globals()[str(v)] = v
357
+ for v in var3:
358
+ globals()[str(v)] = v
359
+ for v in var_x:
360
+ globals()[str(v)] = v
361
+ mul_exp = eval(mulstring)
362
+ coeff_dict = mult_poly(coeff_dict,mul_exp)
363
+ rep = ("","")
277
364
 
278
365
  if pr:
279
366
  if ascode:
@@ -301,11 +388,11 @@ def main():
301
388
  val2 += q_part*int(q_dict[q_part])
302
389
  except Exception:
303
390
  try:
304
- if len(perms) == 2 and q_part == 1:
391
+ if len(perms) == 2 and q_part == 1 and not mult:
305
392
  u = permtrim([*perms[0]])
306
393
  v = permtrim([*perms[1]])
307
394
  val2 += posify(q_dict[q_part],tuple(u),tuple(v),perm,var2_t,var3_t,msg,False)
308
- elif len(perms) == 2 and q_part in q_var2:
395
+ elif len(perms) == 2 and q_part in q_var2 and not mult:
309
396
  i = q_var2.index(q_part)
310
397
  u = permtrim([*perms[0]])
311
398
  v = permtrim([*perms[1]])
@@ -318,18 +405,34 @@ def main():
318
405
  else:
319
406
  val2 += q_part*compute_positive_rep(q_dict[q_part],var2_t,var3_t,msg,False)
320
407
  except Exception as e:
321
- print(f"error; write to schubmult@gmail.com with the case {perms=} {perm=} {val=} {coeff_dict.get(perm,0)=}")
322
- print(f"Exception: {e}")
323
- exit(1)
408
+ if mult:
409
+ print("warning; --display-positive is on but result is not positive",file=sys.stderr)
410
+ val2 = val
411
+ break
412
+ else:
413
+ print(f"error; write to schubmult@gmail.com with the case {perms=} {perm=} {val=} {coeff_dict.get(perm,0)=}")
414
+ print(f"Exception: {e}")
415
+ exit(1)
324
416
  if check and expand(val - val2)!=0:
325
- print(f"error: value not equal; write to schubmult@gmail.com with the case {perms=} {perm=} {val=} {coeff_dict.get(perm,0)=}")
326
- exit(1)
417
+ if mult:
418
+ val2 = val
419
+ else:
420
+ print(f"error: value not equal; write to schubmult@gmail.com with the case {perms=} {perm=} {val=} {coeff_dict.get(perm,0)=}")
421
+ exit(1)
327
422
  val = val2
423
+ if expa:
424
+ val = expand(val)
328
425
  if val!=0:
329
426
  if ascode:
330
- print(f"{str(trimcode(perm)):>{width}} {str(val).replace('**','^').replace('*',' ').replace(*rep)}")
427
+ if norep:
428
+ print(f"{str(trimcode(perm)):>{width}} {str(val).replace(*rep)}")
429
+ else:
430
+ print(f"{str(trimcode(perm)):>{width}} {str(val).replace('**','^').replace('*',' ').replace(*rep)}")
331
431
  else:
332
- print(f"{str(perm):>{width}} {str(val).replace('**','^').replace('*',' ').replace(*rep)}")
432
+ if norep:
433
+ print(f"{str(perm):>{width}} {str(val).replace(*rep)}")
434
+ else:
435
+ print(f"{str(perm):>{width}} {str(val).replace('**','^').replace('*',' ').replace(*rep)}")
333
436
  except BrokenPipeError:
334
437
  pass
335
438
 
@@ -27,6 +27,108 @@ var = tuple(symarray('x',n).tolist())
27
27
  var2 = tuple(symarray('y',n).tolist())
28
28
  var3 = tuple(symarray('z',n).tolist())
29
29
 
30
+ var_x = symarray("x",100).tolist()
31
+ var_y = var2
32
+ var_z = var3
33
+
34
+ x = var_x
35
+ y = var_y
36
+ z = var_z
37
+
38
+ def E(p,k,varl=var_y[1:]):
39
+ return elem_sym_poly(p,k,var_x[1:],varl)
40
+
41
+ def single_variable(coeff_dict,varnum):
42
+ ret = {}
43
+ for u in coeff_dict:
44
+ if varnum -1 < len(u):
45
+ ret[u] = ret.get(u,0) + var2[u[varnum-1]]*coeff_dict[u]
46
+ else:
47
+ ret[u] = ret.get(u,0) + var2[varnum]*coeff_dict[u]
48
+ new_perms_k = elem_sym_perms(u,1,varnum)
49
+ new_perms_km1 = []
50
+ if varnum > 1:
51
+ new_perms_km1 = elem_sym_perms(u,1,varnum-1)
52
+ for perm, udiff in new_perms_k:
53
+ if udiff == 1:
54
+ ret[perm] = ret.get(perm,0) + coeff_dict[u]
55
+ for perm, udiff in new_perms_km1:
56
+ if udiff == 1:
57
+ ret[perm] = ret.get(perm,0) - coeff_dict[u]
58
+ return ret
59
+
60
+ def single_variable_down(coeff_dict,varnum):
61
+ ret = {}
62
+ for u in coeff_dict:
63
+ if varnum -1 < len(u):
64
+ ret[u] = ret.get(u,0) + var2[u[varnum-1]]*coeff_dict[u]
65
+ else:
66
+ ret[u] = ret.get(u,0) + var2[varnum]*coeff_dict[u]
67
+ new_perms_k = elem_sym_perms_op(u,1,varnum)
68
+ new_perms_km1 = []
69
+ if varnum > 1:
70
+ new_perms_km1 = elem_sym_perms_op(u,1,varnum-1)
71
+ for perm, udiff in new_perms_k:
72
+ if udiff == 1:
73
+ ret[perm] = ret.get(perm,0) + coeff_dict[u]
74
+ for perm, udiff in new_perms_km1:
75
+ if udiff == 1:
76
+ ret[perm] = ret.get(perm,0) - coeff_dict[u]
77
+ return ret
78
+
79
+
80
+ def mult_poly(coeff_dict,poly):
81
+ if poly in var_x:
82
+ return single_variable(coeff_dict,var_x.index(poly))
83
+ elif isinstance(poly,Mul):
84
+ ret = coeff_dict
85
+ for a in poly.args:
86
+ ret = mult_poly(ret,a)
87
+ return ret
88
+ elif isinstance(poly,Pow):
89
+ base = poly.args[0]
90
+ exponent = int(poly.args[1])
91
+ ret = coeff_dict
92
+ for i in range(int(exponent)):
93
+ ret = mult_poly(ret,base)
94
+ return ret
95
+ elif isinstance(poly,Add):
96
+ ret = {}
97
+ for a in poly.args:
98
+ ret = add_perm_dict(ret,mult_poly(coeff_dict,a))
99
+ return ret
100
+ else:
101
+ ret = {}
102
+ for perm in coeff_dict:
103
+ ret[perm] = poly*coeff_dict[perm]
104
+ return ret
105
+
106
+ def mult_poly_down(coeff_dict,poly):
107
+ if poly in var_x:
108
+ return single_variable_down(coeff_dict,var_x.index(poly))
109
+ elif isinstance(poly,Mul):
110
+ ret = coeff_dict
111
+ for a in poly.args:
112
+ ret = mult_poly_down(ret,a)
113
+ return ret
114
+ elif isinstance(poly,Pow):
115
+ base = poly.args[0]
116
+ exponent = int(poly.args[1])
117
+ ret = coeff_dict
118
+ for i in range(int(exponent)):
119
+ ret = mult_poly_down(ret,base)
120
+ return ret
121
+ elif isinstance(poly,Add):
122
+ ret = {}
123
+ for a in poly.args:
124
+ ret = add_perm_dict(ret,mult_poly_down(coeff_dict,a))
125
+ return ret
126
+ else:
127
+ ret = {}
128
+ for perm in coeff_dict:
129
+ ret[perm] = poly*coeff_dict[perm]
130
+ return ret
131
+
30
132
 
31
133
  def forwardcoeff(u,v,perm,var2=var2,var3=var3):
32
134
  th = theta(v)
@@ -160,6 +262,49 @@ def schubmult(perm_dict,v,var2=var2,var3=var3):
160
262
  ret_dict = add_perm_dict({ep: vpathsums[ep].get(toget,0) for ep in vpathsums},ret_dict)
161
263
  return ret_dict
162
264
 
265
+ def schubmult_down(perm_dict,v,var2=var2,var3=var3):
266
+ vn1 = inverse(v)
267
+ th = theta(vn1)
268
+ if th[0]==0:
269
+ return perm_dict
270
+ mu = permtrim(uncode(th))
271
+ vmu = permtrim(mulperm([*v],mu))
272
+ inv_vmu = inv(vmu)
273
+ inv_mu = inv(mu)
274
+ ret_dict = {}
275
+ vpaths = [([(vmu,0)],1)]
276
+ while th[-1] == 0:
277
+ th.pop()
278
+ thL = len(th)
279
+ vpathdicts = compute_vpathdicts(th,vmu,True)
280
+ for u,val in perm_dict.items():
281
+ inv_u = inv(u)
282
+ vpathsums = {u: {(1,2): val}}
283
+ for index in range(thL):
284
+ mx_th = 0
285
+ for vp in vpathdicts[index]:
286
+ for v2,vdiff,s in vpathdicts[index][vp]:
287
+ if th[index]-vdiff > mx_th:
288
+ mx_th = th[index] - vdiff
289
+ newpathsums = {}
290
+ for up in vpathsums:
291
+ inv_up = inv(up)
292
+ newperms = elem_sym_perms_op(up,mx_th,th[index])
293
+ for up2, udiff in newperms:
294
+ if up2 not in newpathsums:
295
+ newpathsums[up2]={}
296
+ for v in vpathdicts[index]:
297
+ sumval = vpathsums[up].get(v,zero)
298
+ if sumval == 0:
299
+ continue
300
+ for v2,vdiff,s in vpathdicts[index][v]:
301
+ newpathsums[up2][v2] = newpathsums[up2].get(v2,zero)+s*sumval*elem_sym_func(th[index],index+1,up2,up,v,v2,udiff,vdiff,var2,var3)
302
+ vpathsums = newpathsums
303
+ toget = tuple(vmu)
304
+ ret_dict = add_perm_dict({ep: vpathsums[ep].get(toget,0) for ep in vpathsums},ret_dict)
305
+ return ret_dict
306
+
307
+
163
308
  fvar = 0
164
309
 
165
310
  def poly_to_vec(poly,vec0=None):
@@ -1294,11 +1439,24 @@ def main():
1294
1439
  coprod = False
1295
1440
  check = True
1296
1441
  msg = False
1442
+ mult = False
1443
+ mulstring = ""
1444
+ down = False
1445
+
1297
1446
  try:
1298
1447
  for s in sys.argv[1:]:
1299
1448
  if s == "-np" or s == "--no-print":
1300
1449
  pr = False
1301
1450
  continue
1451
+ if mult:
1452
+ mulstring += s
1453
+ continue
1454
+ if s == "-mult":
1455
+ mult = True
1456
+ continue
1457
+ if s == "-down":
1458
+ down = True
1459
+ continue
1302
1460
  if s == "-coprod":
1303
1461
  coprod = True
1304
1462
  continue
@@ -1318,7 +1476,7 @@ def main():
1318
1476
  ascode = True
1319
1477
  continue
1320
1478
  if s == "--usage":
1321
- print("Usage: schubmult_yz <-np|--no-print> <-code> <--display-positive> <--optimizer-message> perm1 - perm2 < - perm3 .. >")
1479
+ print("Usage: schubmult_yz <-np|--no-print> <-code> <--display-positive> <--optimizer-message> perm1 - perm2 < - perm3 .. > <-mult poly_expression>")
1322
1480
  print("Alternative usage: schubmult_yz <-code> <--display-positive> -coprod perm - indexlist")
1323
1481
  exit(0)
1324
1482
  if s == "-":
@@ -1451,6 +1609,8 @@ def main():
1451
1609
  perms[i] = tuple(permtrim(uncode(perms[i])))
1452
1610
  else:
1453
1611
  for i in range(len(perms)):
1612
+ if len(perms[i])<2 and (len(perms[i])==0 or perms[i][0]==1):
1613
+ perms[i] = (1,2)
1454
1614
  perms[i] = tuple(permtrim([*perms[i]]))
1455
1615
 
1456
1616
  size = 0
@@ -1462,9 +1622,30 @@ def main():
1462
1622
 
1463
1623
  coeff_dict = {perms[0]: 1}
1464
1624
  check_coeff_dict = {perms[0]: 1}
1465
- for perm in orig_perms[1:]:
1466
- check_coeff_dict = schubmult(check_coeff_dict,perm)
1467
- if display_positive and len(perms)==2 and will_formula_work(perms[0],perms[1]):
1625
+
1626
+ if mult:
1627
+ for v in var2:
1628
+ globals()[str(v)] = v
1629
+ for v in var3:
1630
+ globals()[str(v)] = v
1631
+ for v in var_x:
1632
+ globals()[str(v)] = v
1633
+
1634
+ if down:
1635
+ for perm in orig_perms[1:]:
1636
+ check_coeff_dict = schubmult_down(check_coeff_dict,perm)
1637
+ if mult:
1638
+ mul_exp = eval(mulstring)
1639
+ check_coeff_dict = mult_poly_down(check_coeff_dict,mul_exp)
1640
+ else:
1641
+ for perm in orig_perms[1:]:
1642
+ check_coeff_dict = schubmult(check_coeff_dict,perm)
1643
+ if mult:
1644
+ mul_exp = eval(mulstring)
1645
+ check_coeff_dict = mult_poly(check_coeff_dict,mul_exp)
1646
+
1647
+
1648
+ if display_positive and len(perms)==2 and will_formula_work(perms[0],perms[1]) and not mult and not down:
1468
1649
  coeff_dict = {}
1469
1650
  th = theta(perms[1])
1470
1651
  muv = uncode(th)
@@ -1477,7 +1658,7 @@ def main():
1477
1658
  coeff_dict[tuple(permtrim(w))] = val
1478
1659
  posified = True
1479
1660
 
1480
- if display_positive and len(perms)>2:
1661
+ if display_positive and len(perms)>2 and not mult:
1481
1662
  coeff_dict2 = dict(coeff_dict)
1482
1663
  for perm in perms[1:]:
1483
1664
  coeff_dict3 = {}
@@ -1513,13 +1694,21 @@ def main():
1513
1694
  if notint and display_positive:
1514
1695
  valu = val
1515
1696
  try:
1516
- if len(perms) == 2 and not posified:
1517
- val = posify(val,perms[0],perms[1],perm,var2,var3,msg)
1518
- elif not posified:
1697
+ if len(perms) == 2 and not posified and not mult:
1698
+ if not down:
1699
+ val = posify(val,perms[0],perms[1],perm,var2,var3,msg)
1700
+ else:
1701
+ val = posify(val,perm,perms[1],perms[0],var2,var3,msg)
1702
+ elif not posified and not mult:
1519
1703
  val = compute_positive_rep(val,var2,var3,msg)
1520
- except TypeError:
1521
- print(f"error; write to schubmult@gmail.com with the case {perms=} {perm=} {val=} {check_coeff_dict.get(perm,0)=}")
1522
- exit(1)
1704
+ elif not posified:
1705
+ val = compute_positive_rep(val,var2,var3,msg,do_pos_neg=False)
1706
+ except Exception:
1707
+ if mult:
1708
+ print(f"warning; --display-positive is on but result is not positive",file=sys.stderr)
1709
+ else:
1710
+ print(f"error; write to schubmult@gmail.com with the case {perms=} {perm=} {val=} {check_coeff_dict.get(perm,0)=}")
1711
+ exit(1)
1523
1712
  if check and expand(val - check_coeff_dict.get(perm,0))!=0:
1524
1713
  print(f"error; write to schubmult@gmail.com with the case {perms=} {perm=} {val=} {check_coeff_dict.get(perm,0)=}")
1525
1714
  exit(1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: schubmult
3
- Version: 1.3.7
3
+ Version: 1.3.9
4
4
  Summary: Computing Littlewood-Richardson coefficients of Schubert polynomials
5
5
  Home-page: https://github.com/matthematics/schubmult
6
6
  Author: Matt Samuel
@@ -6,7 +6,7 @@ long_description = (this_directory / "README.md").read_text()
6
6
 
7
7
  setup(
8
8
  name="schubmult",
9
- version="1.3.7",
9
+ version="1.3.9",
10
10
  description="Computing Littlewood-Richardson coefficients of Schubert polynomials",
11
11
  long_description=long_description,
12
12
  long_description_content_type='text/markdown',
File without changes
File without changes
File without changes