Skip to content

Commit

Permalink
Rename parameter for brevity.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmtroffaes committed Sep 18, 2024
1 parent 1e1b2be commit 93a2a06
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions cython/pycddlib.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -549,25 +549,25 @@ cdef polyhedron_from_ptr(dd_PolyhedraPtr dd_poly):


def polyhedron_from_matrix(
mat: Matrix, row_order_type: Optional[RowOrderType] = None
mat: Matrix, row_order: Optional[RowOrderType] = None
) -> Polyhedron:
"""Run the double description method to convert *mat* into a polyhedron,
using *row_order_type* if specified.
using *row_order* if specified.

.. versionadded:: 3.0.0

The *row_order_type* parameter.
The *row_order* parameter.
"""
if (
mat.dd_mat.representation != dd_Inequality
and mat.dd_mat.representation != dd_Generator
):
raise ValueError("rep_type must be INEQUALITY or GENERATOR")
cdef dd_ErrorType error = dd_NoError
if row_order_type is None:
if row_order is None:
dd_poly = dd_DDMatrix2Poly(mat.dd_mat, &error)
else:
dd_poly = dd_DDMatrix2Poly2(mat.dd_mat, row_order_type, &error)
dd_poly = dd_DDMatrix2Poly2(mat.dd_mat, row_order, &error)
if error != dd_NoError:
dd_FreePolyhedra(dd_poly)
_raise_error(error, "failed to run double description method")
Expand Down
2 changes: 1 addition & 1 deletion src/cdd/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,5 @@ def matrix_from_array(
obj_func: Optional[Sequence[SupportsNumberType]] = None,
) -> Matrix: ...
def polyhedron_from_matrix(
mat: Matrix, row_order_type: Optional[RowOrderType] = None
mat: Matrix, row_order: Optional[RowOrderType] = None
) -> Polyhedron: ...
2 changes: 1 addition & 1 deletion src/cdd/gmp.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ def matrix_from_array(
obj_func: Optional[Sequence[SupportsNumberType]] = None,
) -> Matrix: ...
def polyhedron_from_matrix(
mat: Matrix, row_order_type: Optional[RowOrderType] = None
mat: Matrix, row_order: Optional[RowOrderType] = None
) -> Polyhedron: ...
8 changes: 4 additions & 4 deletions test/test_polyhedron.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_polyhedron_cube_2() -> None:


@pytest.mark.parametrize(
"row_order_type,order",
"row_order,order",
[
(cdd.RowOrderType.MAX_INDEX, [2, 3, 0, 1]),
(cdd.RowOrderType.MIN_INDEX, [2, 1, 0, 3]),
Expand All @@ -95,13 +95,13 @@ def test_polyhedron_cube_2() -> None:
(cdd.RowOrderType.LEX_MAX, [2, 3, 0, 1]),
],
)
def test_polyhedron_row_order_type(
row_order_type: Optional[cdd.RowOrderType], order: Sequence[int]
def test_polyhedron_row_order(
row_order: Optional[cdd.RowOrderType], order: Sequence[int]
) -> None:
generators = [[1, 1, 0], [1, 0, 0], [1, 0, 1], [1, 1, 1]]
inequalities = [[0, 0, 1], [0, 1, 0], [1, 0, -1], [1, -1, 0]]
mat = cdd.matrix_from_array(inequalities, rep_type=cdd.RepType.INEQUALITY)
poly = cdd.polyhedron_from_matrix(mat, row_order_type=row_order_type)
poly = cdd.polyhedron_from_matrix(mat, row_order=row_order)
print(cdd.copy_generators(poly).array)
assert_matrix_almost_equal(
cdd.copy_generators(poly).array, [generators[i] for i in order]
Expand Down

0 comments on commit 93a2a06

Please sign in to comment.