Skip to content

Commit

Permalink
is_reflexive bugfix
Browse files Browse the repository at this point in the history
allow translations for is_polytope. This is more-commonly what is wanted
  • Loading branch information
natemacfadden committed Nov 18, 2024
1 parent 98c6b72 commit 0dde9f7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/cytools/polytope.py
Original file line number Diff line number Diff line change
Expand Up @@ -1479,13 +1479,13 @@ def dual_polytope(self) -> "Polytope":
polar_polytope = dual_polytope
polar = dual_polytope

def is_reflexive(self) -> bool:
def is_reflexive(self, allow_translations=True) -> bool:
"""
**Description:**
Returns True if the polytope is reflexive and False otherwise.
**Arguments:**
None.
- `allow_translations`: Whether to allow the polytope to be translated.
**Returns:**
The truth value of the polytope being reflexive.
Expand All @@ -1508,7 +1508,10 @@ def is_reflexive(self) -> bool:
c == 1 for c in self._ineqs_input[:, -1]
)
else:
p = Polytope(lll_reduce(self.points())[:,-self.dim():])
if allow_translations:
p = Polytope(self.points(optimal=True))
else:
p = Polytope(lll_reduce(self.points())[:,-self.dim():])
self._is_reflexive = p.is_reflexive()

# return
Expand Down

0 comments on commit 0dde9f7

Please sign in to comment.