@@ -512,16 +512,21 @@ def generating_function_of_integral_points(polyhedron, split=False,
512
512
513
513
parts = None
514
514
if split is True :
515
- split = (
516
- (Polyhedron (
517
- ieqs = [tuple (1 if i == b else (- 1 if i == a or i == 0 and a > b else 0 )
518
- for i in range (d + 1 ))
519
- for a , b in zip (pi [:- 1 ], pi [1 :])]),
520
- 'b{}' .format (pi [0 ]- 1 ) +
521
- '' .join ((' <= ' if a < b else ' < ' ) +
522
- 'b{}' .format (b - 1 )
523
- for a , b in zip (pi [:- 1 ], pi [1 :])))
524
- for pi in Permutations (d ))
515
+ def polyhedron_from_permutation (pi ):
516
+ def ieq (a , b ):
517
+ return ((0 if a < b else - 1 ,) +
518
+ tuple (1 if i == b else (- 1 if i == a else 0 )
519
+ for i in range (1 , d + 1 )))
520
+ def ieq_repr_rhs (a , b ):
521
+ return (' <= ' if a < b else ' < ' ) + 'b{}' .format (b - 1 )
522
+ def ieqs_repr_lhs (pi ):
523
+ return 'b{}' .format (pi [0 ]- 1 )
524
+
525
+ ieqs , repr_rhss = zip (* [(ieq (a , b ), ieq_repr_rhs (a , b ))
526
+ for a , b in zip (pi [:- 1 ], pi [1 :])])
527
+ return Polyhedron (ieqs = ieqs ), ieqs_repr_lhs (pi ) + '' .join (repr_rhss )
528
+
529
+ split = (polyhedron_from_permutation (pi ) for pi in Permutations (d ))
525
530
parts = ZZ (d ).factorial ()
526
531
else :
527
532
if isinstance (split , (list , tuple )):
0 commit comments