Skip to content

Commit 1785813

Browse files
committed
Merge pull request #62
#62 (moved from #55)
2 parents a96756f + db046cb commit 1785813

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

polytope/polytope.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def intersect(self, other, abs_tol=ABS_TOL):
265265
@rtype: L{Polytope} or L{Region}
266266
"""
267267
if isinstance(other, Region):
268-
return other.intersect(self)
268+
return other.intersect(self, abs_tol=abs_tol)
269269
if not isinstance(other, Polytope):
270270
msg = 'Polytope intersection defined only'
271271
msg += ' with other Polytope. Got instead: '
@@ -1447,7 +1447,7 @@ def envelope(reg, abs_tol=ABS_TOL):
14471447
else:
14481448
Ae = np.vstack([Ae, poly1.A[ind_i, :]])
14491449
be = np.hstack([be, poly1.b[ind_i]])
1450-
ret = reduce(Polytope(Ae, be))
1450+
ret = reduce(Polytope(Ae, be), abs_tol=abs_tol)
14511451
if is_fulldim(ret):
14521452
return ret
14531453
else:
@@ -1506,9 +1506,9 @@ def intersect(poly1, poly2, abs_tol=ABS_TOL):
15061506
# raise NotImplementedError('Being removed,
15071507
# use {Polytope, Region}.intersect instead')
15081508
if isinstance(poly1, Region):
1509-
return poly1.intersect(poly2)
1509+
return poly1.intersect(poly2, abs_tol=abs_tol)
15101510
if isinstance(poly2, Region):
1511-
return poly2.intersect(poly1)
1511+
return poly2.intersect(poly1, abs_tol=abs_tol)
15121512
if not isinstance(poly1, Polytope):
15131513
msg = 'poly1 not Region nor Polytope.'
15141514
msg += 'Got instead: ' + str(type(poly1))
@@ -1984,7 +1984,7 @@ def projection_iterhull(poly1, new_dim, max_iter=1000,
19841984
).format(
19851985
v=sol))
19861986
vert = np.vstack([vert1, vert2])
1987-
return qhull(vert)
1987+
return qhull(vert, abs_tol=abs_tol)
19881988
else:
19891989
OK = False
19901990
cnt = 0
@@ -2022,7 +2022,7 @@ def projection_iterhull(poly1, new_dim, max_iter=1000,
20222022
logger.debug("Found starting simplex after " +
20232023
str(cnt) + " iterations")
20242024
cnt = 0
2025-
P1 = qhull(Vert[:, new_dim])
2025+
P1 = qhull(Vert[:, new_dim], abs_tol=abs_tol)
20262026
HP = None
20272027
while True:
20282028
# Iteration:
@@ -2072,12 +2072,12 @@ def projection_iterhull(poly1, new_dim, max_iter=1000,
20722072
HP = np.vstack([HP, add])
20732073
Vert = np.vstack([Vert, xopt])
20742074
logger.debug("Taking convex hull of new points")
2075-
P2 = qhull(Vert[:, new_dim])
2075+
P2 = qhull(Vert[:, new_dim], abs_tol=abs_tol)
20762076
logger.debug("Checking if new points are inside convex hull")
20772077
OK = 1
20782078
for i in xrange(np.shape(Vert)[0]):
20792079
if not P1.contains(np.transpose([Vert[i, new_dim]]),
2080-
abs_tol=1e-5):
2080+
abs_tol=abs_tol):
20812081
# If all new points are inside
20822082
# old polytope -> Finished
20832083
OK = 0

0 commit comments

Comments
 (0)