Skip to content

Commit

Permalink
Update polytope.py
Browse files Browse the repository at this point in the history
  • Loading branch information
natemacfadden committed Oct 1, 2024
1 parent 45095f3 commit f0525ef
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/cytools/polytope.py
Original file line number Diff line number Diff line change
Expand Up @@ -3950,3 +3950,30 @@ def saturating_lattice_pts(

# return
return pts_all, facet_ind

def is_reflexive_barebones(points: "ArrayLike", backend: str) -> bool:
"""
**Description:**
Minimal code to check if conv(points) is reflexive.
**Arguments:**
- `points`: The points defining the hull.
- `backend`: The backend to use. See poly_v_to_h.
**Returns:**
Whether conv(points) is reflexive
"""
# check if the convex hull is solid
ambient_dim = len(points[0])
dim = np.linalg.matrix_rank([list(pt) + [1] for pt in points]) - 1
if dim != ambient_dim:
return False

# check the distance for each inequality
ineqs, _ = poly_v_to_h(points, backend=backend)
for ineq in ineqs:
if ineq[-1] != 1:
return False

# all checks passed
return True

0 comments on commit f0525ef

Please sign in to comment.