Global context
[linpy.git] / pypol / linear.py
index 348294c..07c6293 100644 (file)
@@ -42,6 +42,9 @@ def _polymorphic_operator(func):
     return wrapper
 
 
+_main_ctx = Context()
+
+
 class Expression:
     """
     This class implements linear expressions.
@@ -498,8 +501,7 @@ class Polyhedron:
         if symbols is None:
             symbols = self.symbols()
         num_coefficients = len(symbols)
-        ctx = Context()
-        space = libisl.isl_space_set_alloc(ctx, 0, num_coefficients)
+        space = libisl.isl_space_set_alloc(_main_ctx, 0, num_coefficients)
         bset = libisl.isl_basic_set_universe(libisl.isl_space_copy(space))
         ls = libisl.isl_local_space_from_space(space)
         ceq = libisl.isl_equality_alloc(libisl.isl_local_space_copy(ls))