Skip to content

Commit 51321c3

Browse files
committed
fix spelling and some more error fixes, increment version
1 parent f60efff commit 51321c3

5 files changed

Lines changed: 70 additions & 38 deletions

File tree

pplite/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- Acadia Larsen (2024): initial version.
1111
"""
1212

13-
__version__ = "0.0.51"
13+
__version__ = "0.0.52"
1414

1515
from .linear_algebra import (
1616
Variable, Linear_Expression, Affine_Expression

pplite/generators.pyx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,12 @@ cdef class PPliteGenerator(object):
329329
n = self.thisptr.coeff(vv[0])
330330
return FLINT_Integer_to_Python(n)
331331

332+
# def coefficients(self):
333+
# """
334+
# Returns a list of coefficients for a given generator.
335+
# """
336+
# return [self.coefficient(v) for v in range(self.space_dimension())]
337+
332338
def divisor(self):
333339
"""
334340
TESTS:
@@ -344,15 +350,15 @@ cdef class PPliteGenerator(object):
344350
n = self.thisptr.divisor()
345351
return FLINT_Integer_to_Python(n)
346352

347-
def space_dimision(self):
353+
def space_dimension(self):
348354
"""
349355
TESTS:
350356
>>> from pplite import Variable, Linear_Expression, Affine_Expression, PPliteGenerator
351357
>>> x = Variable(0)
352358
>>> y = Variable(1)
353359
>>> e = 2*x + 3*y
354360
>>> g = PPliteGenerator('point', e, 7)
355-
>>> g.space_dimision()
361+
>>> g.space_dimension()
356362
2
357363
"""
358364
return self.thisptr.space_dim()

pplite/linear_algebra.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ cdef class Affine_Expression(object):
10341034
r"""
10351035
Wrapper for PPLite's ``Affine_Expr`` class.
10361036
1037-
Note, this behaves analgolously to ppl's ``Linear_Expression`` class.
1037+
Note, this behaves analogously to ppl's ``Linear_Expression`` class.
10381038
10391039
Examples:
10401040

pplite/polyhedron.pyx

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ cdef class NNC_Polyhedron(object):
156156
d = d_cons
157157
dd = d
158158
ss = string_to_Spec_Elem("universe")
159-
160159
tt = string_to_Topol("nnc")
161160
self.thisptr = new Poly(dd, ss, tt)
162161
for c in cons:
@@ -289,7 +288,7 @@ cdef class NNC_Polyhedron(object):
289288
def topology(self):
290289
pass
291290

292-
def space_dim(self):
291+
def space_dimension(self):
293292
return self.thisptr.space_dim()
294293

295294
def affine_dim(self):
@@ -325,8 +324,6 @@ cdef class NNC_Polyhedron(object):
325324
except TypeError:
326325
return self._relation_with_g(gen_or_constraint) # failure here will raise the right type error for the general method.
327326

328-
329-
330327
def min(self, affine_expr, value, included_pointer, gen_object):
331328
cdef Affine_Expr ae
332329
cdef FLINT_Rational val
@@ -484,7 +481,7 @@ cdef class NNC_Polyhedron(object):
484481
>>> P_2.add_constraint(A >= 0)
485482
>>> P_2.is_necessarily_closed()
486483
False
487-
>>> P_2.space_dim()
484+
>>> P_2.space_dimension()
488485
1
489486
>>> P_2.equals(P)
490487
True
@@ -657,6 +654,19 @@ cdef class NNC_Polyhedron(object):
657654
def minimize(self):
658655
self.thisptr[0].minimize()
659656

657+
def add_space_dimensions(self, dim_to_add, projection):
658+
cdef cppbool project
659+
if projection:
660+
project = True
661+
else:
662+
project = False
663+
cdef dim_type m
664+
if isinstance(dim_to_add, int):
665+
m = dim_to_add
666+
self.thisptr[0].add_space_dims(m, project)
667+
else:
668+
raise TypeError("dim_to_add needs to be an ``int``.")
669+
660670
#####################################
661671
### Poly_Con_Rel and Poly_Gen_Rel ###
662672
#####################################
@@ -668,7 +678,21 @@ cdef class Polyhedron_Constraint_Rel(object):
668678
self.thisptr = NULL
669679
def __dealloc__(self):
670680
del self.thisptr
671-
681+
def __init__(self):
682+
pass
683+
def nothing(self):
684+
pass
685+
def is_disjoint(self):
686+
pass
687+
def strictly_intersects(self):
688+
pass
689+
def is_included(self):
690+
pass
691+
def saturates(self):
692+
pass
693+
def implies(self, other):
694+
pass
695+
672696
cdef class Polyhedron_Generator_Rel(object):
673697
def __cinit__(self):
674698
self.thisptr = NULL

setup.py

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import os
44
import sys
55

6-
from setuptools import setup, Command
7-
from setuptools.extension import Extension
6+
from setuptools import setup, Command, Extension
7+
# from setuptools.extension import Extension
88

99
# NOTE: setuptools build_ext does not work properly with Cython code
1010
from distutils.command.build_ext import build_ext as _build_ext
@@ -44,37 +44,37 @@ def run(self):
4444

4545
_build_ext.run(self)
4646

47-
class TestCommand(Command):
48-
user_options = []
47+
# class TestCommand(Command):
48+
# user_options = []
4949

50-
def initialize_options(self):
51-
pass
50+
# def initialize_options(self):
51+
# pass
5252

53-
def finalize_options(self):
54-
pass
53+
# def finalize_options(self):
54+
# pass
5555

56-
def run(self):
57-
import subprocess, os, tempfile, shutil
56+
# def run(self):
57+
# import subprocess, os, tempfile, shutil
5858

59-
old_path = os.getcwd()
60-
tempdir_path = tempfile.mkdtemp()
61-
try:
62-
shutil.copytree('./tests', tempdir_path, dirs_exist_ok=True)
63-
os.chdir(tempdir_path)
59+
# old_path = os.getcwd()
60+
# tempdir_path = tempfile.mkdtemp()
61+
# try:
62+
# shutil.copytree('./tests', tempdir_path, dirs_exist_ok=True)
63+
# os.chdir(tempdir_path)
6464

65-
if subprocess.call([sys.executable, 'runtests.py']):
66-
raise SystemExit("Doctest failures")
65+
# if subprocess.call([sys.executable, 'runtests.py']):
66+
# raise SystemExit("Doctest failures")
6767

68-
if subprocess.call([sys.executable, 'setup.py', 'build_ext', '--inplace']) or \
69-
subprocess.call([sys.executable, '-c', "import testpplitepy; testpplitepy.test(); testpplitepy.example()"]):
70-
raise SystemExit("Cython test 1 failure")
68+
# if subprocess.call([sys.executable, 'setup.py', 'build_ext', '--inplace']) or \
69+
# subprocess.call([sys.executable, '-c', "import testpplitepy; testpplitepy.test(); testpplitepy.example()"]):
70+
# raise SystemExit("Cython test 1 failure")
7171

72-
if subprocess.call([sys.executable, 'setup2.py', 'build_ext', '--inplace']) or \
73-
subprocess.call([sys.executable, '-c', "import testpplitepy2; testpplitepy2.test(); testpplitepy2.example()"]):
74-
raise SystemExit("Cython test 2 failure")
75-
finally:
76-
os.chdir(old_path)
77-
shutil.rmtree(tempdir_path)
72+
# if subprocess.call([sys.executable, 'setup2.py', 'build_ext', '--inplace']) or \
73+
# subprocess.call([sys.executable, '-c', "import testpplitepy2; testpplitepy2.test(); testpplitepy2.example()"]):
74+
# raise SystemExit("Cython test 2 failure")
75+
# finally:
76+
# os.chdir(old_path)
77+
# shutil.rmtree(tempdir_path)
7878

7979
extensions = [
8080
Extension('pplite.integer_conversions', sources=['pplite/integer_conversions.pyx']),
@@ -85,8 +85,10 @@ def run(self):
8585
Extension('pplite.bounding_box', sources=['pplite/bounding_box.pyx']),
8686
Extension('pplite.polyhedron', sources=['pplite/polyhedron.pyx'])
8787
]
88-
#finish writing setup at some point
88+
8989
setup(
9090
ext_modules = extensions,
91-
cmdclass = {'build_ext': build_ext, 'test': TestCommand},
91+
cmdclass = {'build_ext': build_ext},
92+
# long_description=open('README.rst').read(),
93+
# long_description_content_type='text/markdown',
9294
)

0 commit comments

Comments
 (0)