From 4ef82d5bc17eba945222b997ff203a941882b81c Mon Sep 17 00:00:00 2001 From: Andres Rios Tascon Date: Wed, 16 Feb 2022 20:35:33 -0500 Subject: [PATCH] Fixed bug when picking divisor basis and other small bugs. Bumped to version 0.3.2 --- cytools/__init__.py | 2 +- cytools/calabiyau.py | 6 ++---- cytools/polytope.py | 15 +++++++++------ cytools/toricvariety.py | 2 +- cytools/triangulation.py | 6 +++--- scripts/linux/cytools | 2 +- scripts/macos/cytools | 2 +- scripts/windows/launcher.ps1 | 2 +- setup.py | 2 +- 9 files changed, 20 insertions(+), 19 deletions(-) diff --git a/cytools/__init__.py b/cytools/__init__.py index 7623748..e5e325b 100644 --- a/cytools/__init__.py +++ b/cytools/__init__.py @@ -19,7 +19,7 @@ from cytools.utils import read_polytopes, fetch_polytopes # Latest version -version = "0.3.1" +version = "0.3.2" versions_with_serious_bugs = [] # Check for more recent versions of CYTools diff --git a/cytools/calabiyau.py b/cytools/calabiyau.py index 368f8d2..fa58456 100644 --- a/cytools/calabiyau.py +++ b/cytools/calabiyau.py @@ -1258,7 +1258,7 @@ def intersection_numbers(self, in_basis=False, format="dok", # Let's print the output and see how to interpret it print(intnum_nobasis) # {(1, 2, 3): 18, (2, 3, 4): 18, (1, 3, 4): 2, (1, 2, 4): 3, (1, 2, 5): 3, (2, 3, 5): 18, [the output is too long so we truncate it] - # The above output means that the intersection number of divisors 1, 2, 3 is 13, and so on + # The above output means that the intersection number of divisors 1, 2, 3 is 18, and so on # Let us now compute the intersection numbers in a given basis of divisors # First, let's check the current basis of divisors cy.divisor_basis() @@ -1489,9 +1489,7 @@ def is_smooth(self): if self._is_smooth is not None: return self._is_smooth if self._is_hypersurface: - sm = (True if self.dim() <= 3 else - all(c.is_smooth() for c in self.ambient_variety().fan_cones(self.dim(),self.dim()-1))) - self._is_smooth = sm + self._is_smooth = self.ambient_variety().canonical_divisor_is_smooth() else: self.intersection_numbers() # The variable is set while computing intersection numbers return self._is_smooth diff --git a/cytools/polytope.py b/cytools/polytope.py index a5cf096..f5a80c4 100644 --- a/cytools/polytope.py +++ b/cytools/polytope.py @@ -604,8 +604,8 @@ def _points_saturated(self): - Points are sorted so that interior points are first, and then the rest are arranged by decreasing number of saturated inequalities and lexicographically. For reflexive polytopes this is useful since the - origin will be at index 0 and boundary points not interior to facets - will be last. + origin will be at index 0 and boundary points interior to facets will + be last. - Typically this function should not be called by the user. Instead, it is called by various other functions in the Polytope class. ::: @@ -761,10 +761,11 @@ def points(self, as_indices=False): Returns the lattice points of the polytope. :::note - Points are sorted so that interior points are first, and then the rest - are arranged by decreasing number of saturated inequalities. - For reflexive polytopes this is useful since the origin will be at - index 0 and boundary points not interior to facets will be last. + Points are sorted so that interior points are first, and then the + rest are arranged by decreasing number of saturated inequalities and + lexicographically. For reflexive polytopes this is useful since the + origin will be at index 0 and boundary points interior to facets will + be last. ::: **Arguments:** @@ -1811,6 +1812,8 @@ def glsm_charge_matrix(self, include_origin=True, glsm = np.insert(glsm, pp, extra_columns[p], axis=1) origin_column = -np.sum(glsm, axis=1) glsm = np.insert(glsm, 0, origin_column, axis=1) + glsm_rref = fmpz_mat(glsm.tolist()).rref() + glsm = np.array(glsm_rref[0].tolist(),dtype=int) // int(glsm_rref[1]) linear_relations = extra_rows extra_linear_relation_columns = -1*np.diag(row_scalings) for p,pp in enumerate(good_lattice_basis): diff --git a/cytools/toricvariety.py b/cytools/toricvariety.py index 70e6487..dcf542c 100644 --- a/cytools/toricvariety.py +++ b/cytools/toricvariety.py @@ -1565,7 +1565,7 @@ def canonical_divisor_is_smooth(self): pts_mpcp = {tuple(pt) for pt in self.polytope().points_not_interior_to_facets()} ind_triang = list(set.union(*[set(s) for s in self._triang.simplices()])) pts_triang = {tuple(pt) for pt in self._triang.points()[ind_triang]} - sm = (pts_triang.issubset(pts_mpcp) and + sm = (pts_mpcp.issubset(pts_triang) and (True if self.dim() <= 4 else all(c.is_smooth() for c in self.fan_cones(self.dim()-1,self.dim()-2)))) self._canon_div_is_smooth = sm diff --git a/cytools/triangulation.py b/cytools/triangulation.py index 655bc7a..a660610 100644 --- a/cytools/triangulation.py +++ b/cytools/triangulation.py @@ -164,15 +164,15 @@ def __init__(self, triang_pts, poly=None, heights=None, make_star=False, # A fine, regular, star triangulation of a 4-dimensional point configuration with 7 points in ZZ^4 ``` """ - tmp_triang_pts = [tuple(pt) for pt in np.array(triang_pts, dtype=int)] + tmp_triang_pts = {tuple(pt) for pt in np.array(triang_pts, dtype=int)} heights = copy.deepcopy(heights) if poly is None: from cytools.polytope import Polytope - self._poly = Polytope(tmp_triang_pts) + self._poly = Polytope(list(tmp_triang_pts)) else: self._poly = poly if (not self._poly.is_solid() - or np.linalg.matrix_rank([pt+(1,) for pt in tmp_triang_pts]) != len(tmp_triang_pts[0])+1): + or np.linalg.matrix_rank([pt+(1,) for pt in tmp_triang_pts]) != len(next(iter(tmp_triang_pts)))+1): raise Exception("Only triangulations of full-dimensional point " "configurations are supported.") # Now we reorder the points to make sure they match the ordering of diff --git a/scripts/linux/cytools b/scripts/linux/cytools index 4830e18..9c3d8ec 100755 --- a/scripts/linux/cytools +++ b/scripts/linux/cytools @@ -106,7 +106,7 @@ cat << EOF ░░█████████ █████ █████ ░░██████ ░░██████ █████ ██████ ░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░░ ░░░░░░ ░░░░░ ░░░░░░ - Developed by Liam McAllister's Group | Version 0.3.1 + Developed by Liam McAllister's Group | Version 0.3.2 https://cytools.liammcallistergroup.com EOF diff --git a/scripts/macos/cytools b/scripts/macos/cytools index 9a40d78..df729e6 100755 --- a/scripts/macos/cytools +++ b/scripts/macos/cytools @@ -100,7 +100,7 @@ cat << EOF ░░█████████ █████ █████ ░░██████ ░░██████ █████ ██████ ░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░░ ░░░░░░ ░░░░░ ░░░░░░ - Developed by Liam McAllister's Group | Version 0.3.1 + Developed by Liam McAllister's Group | Version 0.3.2 https://cytools.liammcallistergroup.com EOF diff --git a/scripts/windows/launcher.ps1 b/scripts/windows/launcher.ps1 index 5ae11c3..39a860c 100644 --- a/scripts/windows/launcher.ps1 +++ b/scripts/windows/launcher.ps1 @@ -38,7 +38,7 @@ $banner=@" ░░█████████ █████ █████ ░░██████ ░░██████ █████ ██████ ░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░░ ░░░░░░ ░░░░░ ░░░░░░ - Developed by Liam McAllister's Group | Version 0.3.1 + Developed by Liam McAllister's Group | Version 0.3.2 https://cytools.liammcallistergroup.com "@ diff --git a/setup.py b/setup.py index dff4332..800beed 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="cytools", - version="0.3.1", + version="0.3.2", author="Liam McAllister Group", author_email="", description="A software package for analyzing Calabi-Yau hypersurfaces in toric varieties.",