|
37 | 37 |
|
38 | 38 | Hrepresentation_str_options = {'prefix': 'b', 'style': 'positive'}
|
39 | 39 |
|
| 40 | + |
40 | 41 | def generating_function_of_integral_points(polyhedron, split=False,
|
41 | 42 | result_as_tuple=None,
|
42 | 43 | name=None, names=None,
|
@@ -517,18 +518,22 @@ def generating_function_of_integral_points(polyhedron, split=False,
|
517 | 518 |
|
518 | 519 | parts = None
|
519 | 520 | if split is True:
|
| 521 | + |
520 | 522 | def polyhedron_from_permutation(pi):
|
| 523 | + |
521 | 524 | def ieq(a, b):
|
522 | 525 | return ((0 if a < b else -1,) +
|
523 |
| - tuple(1 if i==b else (-1 if i==a else 0) |
524 |
| - for i in range(1, d+1))) |
| 526 | + tuple(1 if i == b else (-1 if i == a else 0) |
| 527 | + for i in range(1, d + 1))) |
| 528 | + |
525 | 529 | def ieq_repr_rhs(a, b):
|
526 | 530 | return (' <= ' if a < b else ' < ') + 'b{}'.format(b-1)
|
| 531 | + |
527 | 532 | def ieqs_repr_lhs(pi):
|
528 | 533 | return 'b{}'.format(pi[0]-1)
|
529 | 534 |
|
530 | 535 | ieqs, repr_rhss = zip(*[(ieq(a, b), ieq_repr_rhs(a, b))
|
531 |
| - for a, b in zip(pi[:-1], pi[1:])]) |
| 536 | + for a, b in zip(pi[:-1], pi[1:])]) |
532 | 537 | return Polyhedron(ieqs=ieqs), ieqs_repr_lhs(pi) + ''.join(repr_rhss)
|
533 | 538 |
|
534 | 539 | split = (polyhedron_from_permutation(pi) for pi in Permutations(d))
|
@@ -644,13 +649,12 @@ def __generating_function_of_integral_points__(
|
644 | 649 | from sage.rings.polynomial.laurent_polynomial_ring import LaurentPolynomialRing
|
645 | 650 | from sage.structure.factorization import Factorization
|
646 | 651 |
|
647 |
| - B = LaurentPolynomialRing( |
648 |
| - ZZ, |
649 |
| - tuple(name + str(k) for k in indices), |
650 |
| - len(indices)) |
| 652 | + B = LaurentPolynomialRing(ZZ, |
| 653 | + tuple(name + str(k) for k in indices), |
| 654 | + len(indices)) |
651 | 655 |
|
652 | 656 | logger.info('preprocessing %s inequalities and %s equations...',
|
653 |
| - len(inequalities), len(equations)) |
| 657 | + len(inequalities), len(equations)) |
654 | 658 |
|
655 | 659 | T_mod = _TransformMod(inequalities, equations, B, mod)
|
656 | 660 | inequalities = T_mod.inequalities
|
@@ -1175,9 +1179,9 @@ def _transform_(self):
|
1175 | 1179 | inequalities_extra.append(tuple(coeffs))
|
1176 | 1180 | T = matrix(ZZ, dim, dim, D)
|
1177 | 1181 |
|
1178 |
| - self.inequalities = list(tuple(T*vector(ieq)) |
1179 |
| - for ieq in inequalities_filtered) + \ |
1180 |
| - inequalities_extra |
| 1182 | + self.inequalities = (list(tuple(T*vector(ieq)) |
| 1183 | + for ieq in inequalities_filtered) |
| 1184 | + + inequalities_extra) |
1181 | 1185 |
|
1182 | 1186 | rules_pre = ((y, B({tuple(row[1:]): 1}))
|
1183 | 1187 | for y, row in zip((1,) + B.gens(), T.rows()))
|
@@ -1478,7 +1482,7 @@ def generate_mods(equations):
|
1478 | 1482 | OUTPUT:
|
1479 | 1483 |
|
1480 | 1484 | A tuple where each entry represents one possible configuration.
|
1481 |
| - Each entry is a dictionary mapping ``i`` to ``(m, r)`` with the following |
| 1485 | + Each entry is a dictionary mapping ``i`` to ``(m, r)`` with the following |
1482 | 1486 | meaning: The ``i``-th coordinate of each element of the polyhedron
|
1483 | 1487 | has to be congruent to ``r`` modulo ``m``.
|
1484 | 1488 |
|
|
0 commit comments