tulip-control / polytope

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

BUG: deprecation warning inside region_diff #35

Closed carterbox closed 7 years ago

carterbox commented 7 years ago

Bug

The following deprecation warning shows when running the test script with python==3.5.2 and numpy==1.11.1.

VisibleDeprecationWarning: converting an array with ndim > 0 to an index will result in an error in the future range(beg_mi[j],beg_mi[j]+mi[j])

This warning is occurring because mi[j] is being used to define a range, but it is a list of size 1 instead of an integer. i.e. [10] instead of 10. The cause is that mi is defined as a 2D column array: mi = np.zeros([N,1], dtype=int) such that 1D indexing of mi returns a row instead of an element.

Fix

Define mi as an (N,0) array instead. Since mi is not involved in matrix muliplications, it shouldn't matter if it is a column or row vector.

slivingston commented 7 years ago

@johnyf you assigned this to yourself, but it appears that @carterbox already provided a candidate fix in PR #36. I am reviewing it now.

johnyf commented 7 years ago

Thanks for the notification. Yes, I have noticed that a PR is under review, so I only reviewed this issue and confirmed that it is an error.

slivingston commented 7 years ago

Fixed in commit 47f0dc0fd988f51bd99e32f873e8a1204e9d85f0, introduced via PR #36