Skip to content

Commit 0a40e08

Browse files
committed
Trac #22067 comment:119: make transform-helper classes internal
1 parent cb021aa commit 0a40e08

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

src/sage/geometry/polyhedron/generating_function.py

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ def _generating_function_of_integral_points_(
594594
raise ValueError('not all coefficient vectors of the equations '
595595
'have the same length')
596596

597-
mods = TransformMod.generate_mods(equations)
597+
mods = _TransformMod.generate_mods(equations)
598598
logger.debug('splitting by moduli %s', mods)
599599

600600
return tuple(__generating_function_of_integral_points__(
@@ -642,15 +642,15 @@ def __generating_function_of_integral_points__(
642642
logger.info('preprocessing %s inequalities and %s equations...',
643643
len(inequalities), len(equations))
644644

645-
T_mod = TransformMod(inequalities, equations, B, mod)
645+
T_mod = _TransformMod(inequalities, equations, B, mod)
646646
inequalities = T_mod.inequalities
647647
equations = T_mod.equations
648648

649-
T_equations = EliminateByEquations(inequalities, equations, B)
649+
T_equations = _EliminateByEquations(inequalities, equations, B)
650650
inequalities = T_equations.inequalities
651651
equations = T_equations.equations
652652

653-
T_inequalities = SplitOffSimpleInequalities(inequalities, equations, B)
653+
T_inequalities = _SplitOffSimpleInequalities(inequalities, equations, B)
654654
inequalities = T_inequalities.inequalities
655655
equations = T_inequalities.equations
656656
assert not equations
@@ -757,7 +757,7 @@ def decode_factor(factor):
757757
return _simplify_(numerator, terms)
758758

759759

760-
class TransformHrepresentation(object):
760+
class _TransformHrepresentation(object):
761761
r"""
762762
An abstract base class for transformations of the
763763
Hrepresentation of a polyhedron together with its
@@ -792,18 +792,18 @@ class TransformHrepresentation(object):
792792
``equations`` is equal to the generating function of the
793793
attributes ``inequalities`` and ``equations`` in which ``rules``
794794
were substituted and ``factor`` was multiplied (via
795-
:meth:`~TransformHrepresentation.apply_rules`).
795+
:meth:`~_TransformHrepresentation.apply_rules`).
796796
"""
797797

798798
def __init__(self, inequalities, equations, B):
799799
r"""
800-
See :class:`TransformHrepresentation` for details.
800+
See :class:`_TransformHrepresentation` for details.
801801
802802
TESTS::
803803
804-
sage: from sage.geometry.polyhedron.generating_function import TransformHrepresentation
804+
sage: from sage.geometry.polyhedron.generating_function import _TransformHrepresentation
805805
sage: B = LaurentPolynomialRing(ZZ, 'y', 2)
806-
sage: TransformHrepresentation([(1, 2, 3)], [(0, -1, 1)], B)
806+
sage: _TransformHrepresentation([(1, 2, 3)], [(0, -1, 1)], B)
807807
Traceback (most recent call last):
808808
...
809809
NotImplementedError
@@ -822,9 +822,9 @@ def _transform_(self):
822822
823823
TESTS::
824824
825-
sage: from sage.geometry.polyhedron.generating_function import TransformHrepresentation
825+
sage: from sage.geometry.polyhedron.generating_function import _TransformHrepresentation
826826
sage: B = LaurentPolynomialRing(ZZ, 'y', 2)
827-
sage: TransformHrepresentation([(1, 2, 3)], [(0, -1, 1)], B)
827+
sage: _TransformHrepresentation([(1, 2, 3)], [(0, -1, 1)], B)
828828
Traceback (most recent call last):
829829
...
830830
NotImplementedError
@@ -852,7 +852,7 @@ def apply_rules(self, numerator, terms):
852852
853853
EXAMPLES::
854854
855-
sage: from sage.geometry.polyhedron.generating_function import SplitOffSimpleInequalities as prepare
855+
sage: from sage.geometry.polyhedron.generating_function import _SplitOffSimpleInequalities as prepare
856856
sage: from sage.geometry.polyhedron.generating_function import _generating_function_via_Omega_ as gf
857857
sage: B = LaurentPolynomialRing(ZZ, 'y', 3)
858858
sage: ieqs = [(0, -1, 1, 0)]
@@ -865,7 +865,7 @@ def apply_rules(self, numerator, terms):
865865
tuple(t.subs(self.rules) for t in terms))
866866

867867

868-
class SplitOffSimpleInequalities(TransformHrepresentation):
868+
class _SplitOffSimpleInequalities(_TransformHrepresentation):
869869
r"""
870870
Split off (simple) inequalities which can be handled better
871871
without passing them to Omega.
@@ -899,11 +899,11 @@ class SplitOffSimpleInequalities(TransformHrepresentation):
899899
``equations`` is equal to the generating function of the
900900
attributes ``inequalities`` and ``equations`` in which ``rules``
901901
were substitited and ``factor`` was multiplied (via
902-
:meth:`~TransformHrepresentation.apply_rules`).
902+
:meth:`~_TransformHrepresentation.apply_rules`).
903903
904904
EXAMPLES::
905905
906-
sage: from sage.geometry.polyhedron.generating_function import SplitOffSimpleInequalities as prepare
906+
sage: from sage.geometry.polyhedron.generating_function import _SplitOffSimpleInequalities as prepare
907907
sage: from sage.geometry.polyhedron.generating_function import _generating_function_via_Omega_ as gf
908908
909909
sage: def eq(A, B):
@@ -1091,13 +1091,13 @@ def _transform_(self):
10911091
Do the actual transformation.
10921092
10931093
This is called during initialization.
1094-
See :class:`SplitOffSimpleInequalities` for details.
1094+
See :class:`_SplitOffSimpleInequalities` for details.
10951095
10961096
TESTS::
10971097
1098-
sage: from sage.geometry.polyhedron.generating_function import SplitOffSimpleInequalities
1098+
sage: from sage.geometry.polyhedron.generating_function import _SplitOffSimpleInequalities
10991099
sage: B = LaurentPolynomialRing(ZZ, 'y', 2)
1100-
sage: T = SplitOffSimpleInequalities([(1, 1, 1)], [], B) # indirect doctest
1100+
sage: T = _SplitOffSimpleInequalities([(1, 1, 1)], [], B) # indirect doctest
11011101
"""
11021102
inequalities = self.inequalities
11031103
B = self.B
@@ -1175,7 +1175,7 @@ def _transform_(self):
11751175
self.rules = dict(rules_pre)
11761176

11771177

1178-
class EliminateByEquations(TransformHrepresentation):
1178+
class _EliminateByEquations(_TransformHrepresentation):
11791179
r"""
11801180
Prepare the substitutions coming from "eliminated" variables
11811181
in the given equations.
@@ -1215,14 +1215,14 @@ class EliminateByEquations(TransformHrepresentation):
12151215
``equations`` is equal to the generating function of the
12161216
attributes ``inequalities`` and ``equations`` in which ``rules``
12171217
were substitited and ``factor`` was multiplied (via
1218-
:meth:`~TransformHrepresentation.apply_rules`).
1218+
:meth:`~_TransformHrepresentation.apply_rules`).
12191219
12201220
EXAMPLES::
12211221
1222-
sage: from sage.geometry.polyhedron.generating_function import EliminateByEquations
1222+
sage: from sage.geometry.polyhedron.generating_function import _EliminateByEquations
12231223
12241224
sage: def prepare_equations(equations, B):
1225-
....: T = EliminateByEquations([], equations, B)
1225+
....: T = _EliminateByEquations([], equations, B)
12261226
....: return T.factor, T.rules, T.indices
12271227
12281228
sage: B = LaurentPolynomialRing(ZZ, 'y', 4)
@@ -1250,13 +1250,13 @@ def _transform_(self):
12501250
Do the actual transformation.
12511251
12521252
This is called during initialization.
1253-
See :class:`EliminateByEquations` for details.
1253+
See :class:`_EliminateByEquations` for details.
12541254
12551255
TESTS::
12561256
1257-
sage: from sage.geometry.polyhedron.generating_function import EliminateByEquations
1257+
sage: from sage.geometry.polyhedron.generating_function import _EliminateByEquations
12581258
sage: B = LaurentPolynomialRing(ZZ, 'y', 2)
1259-
sage: T = EliminateByEquations([], [], B) # indirect doctest
1259+
sage: T = _EliminateByEquations([], [], B) # indirect doctest
12601260
"""
12611261
from sage.matrix.constructor import matrix
12621262
from sage.misc.misc_c import prod
@@ -1271,7 +1271,7 @@ def _transform_(self):
12711271
self.indices = ()
12721272
return
12731273

1274-
TE, indices, indicesn = EliminateByEquations.prepare_equations_transformation(E)
1274+
TE, indices, indicesn = _EliminateByEquations.prepare_equations_transformation(E)
12751275

12761276
gens = (1,) + B.gens()
12771277
z = tuple(gens[i] for i in indices)
@@ -1314,11 +1314,11 @@ def prepare_equations_transformation(E):
13141314
13151315
TESTS::
13161316
1317-
sage: from sage.geometry.polyhedron.generating_function import EliminateByEquations
1317+
sage: from sage.geometry.polyhedron.generating_function import _EliminateByEquations
13181318
1319-
sage: EliminateByEquations.prepare_equations_transformation(matrix([(0, 1, 0, -2)]))
1319+
sage: _EliminateByEquations.prepare_equations_transformation(matrix([(0, 1, 0, -2)]))
13201320
([ 0 -1/2 0 1], (3,), (0, 1))
1321-
sage: EliminateByEquations.prepare_equations_transformation(matrix([(0, 1, -2, 0), (0, 2, 0, -3)]))
1321+
sage: _EliminateByEquations.prepare_equations_transformation(matrix([(0, 1, -2, 0), (0, 2, 0, -3)]))
13221322
(
13231323
[ 0 -1/2 1 0]
13241324
[ 0 -2/3 0 1], (2, 3), (0, 1)
@@ -1344,7 +1344,7 @@ def prepare_equations_transformation(E):
13441344
return TE, indices, indicesn
13451345

13461346

1347-
class TransformMod(TransformHrepresentation):
1347+
class _TransformMod(_TransformHrepresentation):
13481348
r"""
13491349
Prepare the substitutions coming from the moduli.
13501350
@@ -1381,15 +1381,15 @@ class TransformMod(TransformHrepresentation):
13811381
``equations`` is equal to the generating function of the
13821382
attributes ``inequalities`` and ``equations`` in which ``rules``
13831383
were substitited and ``factor`` was multiplied (via
1384-
:meth:`~TransformHrepresentation.apply_rules`).
1384+
:meth:`~_TransformHrepresentation.apply_rules`).
13851385
13861386
EXAMPLES::
13871387
1388-
sage: from sage.geometry.polyhedron.generating_function import TransformMod
1388+
sage: from sage.geometry.polyhedron.generating_function import _TransformMod
13891389
13901390
sage: def prepare_mod(mod, B, *vecs):
13911391
....: inequalities, equations = vecs
1392-
....: T = TransformMod(inequalities, equations, B, mod)
1392+
....: T = _TransformMod(inequalities, equations, B, mod)
13931393
....: return T.factor, T.rules, T.inequalities, T.equations
13941394
13951395
sage: B = LaurentPolynomialRing(ZZ, 'y', 3)
@@ -1403,30 +1403,30 @@ class TransformMod(TransformHrepresentation):
14031403

14041404
def __init__(self, inequalities, equations, B, mod):
14051405
r"""
1406-
See :class:`TransformMod` for details.
1406+
See :class:`_TransformMod` for details.
14071407
14081408
TESTS::
14091409
1410-
sage: from sage.geometry.polyhedron.generating_function import TransformMod
1410+
sage: from sage.geometry.polyhedron.generating_function import _TransformMod
14111411
sage: B = LaurentPolynomialRing(ZZ, 'y', 2)
1412-
sage: TransformMod([], [], B, {})
1413-
<...TransformMod object at 0x...>
1412+
sage: _TransformMod([], [], B, {})
1413+
<..._TransformMod object at 0x...>
14141414
"""
14151415
self.mod = mod
1416-
super(TransformMod, self).__init__(inequalities, equations, B)
1416+
super(_TransformMod, self).__init__(inequalities, equations, B)
14171417

14181418
def _transform_(self):
14191419
r"""
14201420
Do the actual transformation.
14211421
14221422
This is called during initialization.
1423-
See :class:`TransformMod` for details.
1423+
See :class:`_TransformMod` for details.
14241424
14251425
TESTS::
14261426
1427-
sage: from sage.geometry.polyhedron.generating_function import TransformMod
1427+
sage: from sage.geometry.polyhedron.generating_function import _TransformMod
14281428
sage: B = LaurentPolynomialRing(ZZ, 'y', 2)
1429-
sage: T = TransformMod([], [], B, {}) # indirect doctest
1429+
sage: T = _TransformMod([], [], B, {}) # indirect doctest
14301430
"""
14311431
from sage.matrix.constructor import matrix
14321432
from sage.modules.free_module_element import vector
@@ -1474,16 +1474,16 @@ def generate_mods(equations):
14741474
14751475
TESTS::
14761476
1477-
sage: from sage.geometry.polyhedron.generating_function import TransformMod
1478-
sage: TransformMod.generate_mods([(0, 1, 1, -2)])
1477+
sage: from sage.geometry.polyhedron.generating_function import _TransformMod
1478+
sage: _TransformMod.generate_mods([(0, 1, 1, -2)])
14791479
({0: (2, 0), 1: (2, 0)}, {0: (2, 1), 1: (2, 1)})
14801480
"""
14811481
from sage.arith.all import lcm
14821482
from sage.matrix.constructor import matrix
14831483
from sage.rings.integer_ring import ZZ
14841484
from sage.rings.rational_field import QQ
14851485

1486-
TE, TEi, TEin = EliminateByEquations.prepare_equations_transformation(matrix(equations))
1486+
TE, TEi, TEin = _EliminateByEquations.prepare_equations_transformation(matrix(equations))
14871487
TEin = TEin[1:]
14881488
if TE.base_ring() == ZZ:
14891489
mods = [{}]

0 commit comments

Comments
 (0)