tulip-control / polytope

Geometric operations on polytopes of any dimension
https://pypi.org/project/polytope
Other
74 stars 19 forks source link

numpy version if statement breaks for numpy 1.10 #20

Closed pettni closed 8 years ago

pettni commented 8 years ago

In numpy v. 1.6, unique1d was renamed to unique, which is taken care of in quickhull.py using an if statement. However, for numpy v. 1.10, the code on lines 49-50 give numpy_ver = 1.1, so it looks like numpy v. 1.1 is used.

Suggested fix:

  1. Replace lines 49-50 with numpy_ver = [int(s) for s in np.version.version.split('.')], and change if statements on lines 217 and 384 to lexicographic comparison: if numpy_ver > [1,5,9]:
  2. Remove if statements and require numpy v. 1.6 or above
johnyf commented 8 years ago

The if statement in polytope.quickhull mentioned in the OP is here.

In Python, version comparison should conform to PEP440. This is more readily accomplished using setuptools, as discussed here.

Removing the selection constructs and requiring numpy >= 1.6 seems a reasonable solution, because the latest numpy == 1.10.1. Please feel free to open a pull request.