From 98c6b7289a7a909bbe0e09c2fe80a4731f55cc78 Mon Sep 17 00:00:00 2001 From: Nate MacFadden Date: Thu, 14 Nov 2024 11:29:47 -0500 Subject: [PATCH] Make Cone.rays return input rays, if possible There are cases for which one wants Cone(rays=R).rays() to always return R. Currently, if the extremal rays of the cone are also found, it'll return the extremal rays --- src/cytools/cone.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cytools/cone.py b/src/cytools/cone.py index 56d70df..d917032 100644 --- a/src/cytools/cone.py +++ b/src/cytools/cone.py @@ -565,8 +565,6 @@ def rays(self, use_extremal_hyperplanes: bool=False, verbosity: int=0): # [-1, 1]]) ``` """ - if self._ext_rays is not None: - return np.array(self._ext_rays) if self._rays is not None: return np.array(self._rays) if self._ambient_dim >= 12 and len(self._hyperplanes) != self._ambient_dim: @@ -877,6 +875,8 @@ def extremal_rays(self, tol=1e-4, verbose=False): try: self._ext_rays = rays[list(ext_rays)] + if self._rays is None: + self._rays = self._ext_rays except IndexError as e: raise Exception( f"Dimension/indexing error rays={rays}; " + f"ext_rays={ext_rays}"