diff --git a/python/__init__.py b/python/__init__.py index f66ee5fa7..349cd5846 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -190,6 +190,7 @@ def identify(self, extends_to_link=False): ManifoldHP.verify_hyperbolicity = verify.verify_hyperbolicity from .cusps.maximal_cusp_area_matrix import maximal_cusp_area_matrix +from .cusps.cusp_area_matrix import triangulation_dependent_cusp_area_matrix def canonical_retriangulation( manifold, verified=False, @@ -386,15 +387,15 @@ def cusp_area_matrix(manifold, method='trigDependentTryCanonize', raise NotImplementedError("Maximal cusp area matrix only " "available as verified computation. " "Pass verified = True.") - return verify.verified_maximal_cusp_area_matrix( + return verify.legacy_verified_maximal_cusp_area_matrix( manifold, bits_prec=bits_prec) if method in ['trigDependent', 'trigDependentTryCanonize']: if method == 'trigDependentTryCanonize': manifold = manifold.copy() manifold.canonize() - return verify.triangulation_dependent_cusp_area_matrix( - manifold, verified=verified, bits_prec=bits_prec) + return triangulation_dependent_cusp_area_matrix( + manifold, bits_prec=bits_prec, verified=verified) raise ValueError("method passed to cusp_area_matrix must be " "'trigDependent', 'trigDependentTryCanonize', " diff --git a/python/cusps/cusp_area_matrix.py b/python/cusps/cusp_area_matrix.py new file mode 100644 index 000000000..fd8902c95 --- /dev/null +++ b/python/cusps/cusp_area_matrix.py @@ -0,0 +1,63 @@ +from ..geometric_structure.cusp_neighborhood.cusp_cross_section import ComplexCuspCrossSection +from ..math_basics import correct_min +from ..verify.shapes import compute_hyperbolic_shapes + +__all__ = ['triangulation_dependent_cusp_area_matrix'] + +def triangulation_dependent_cusp_area_matrix( + snappy_manifold, bits_prec, verified): + """ + Interesting case: t12521 + + Maximal cusp area matrix: + + [ 77.5537626509970512653317518641810890989543820290380458409? 11.40953140648583915022197187043644048603871960228564151087?] + [11.40953140648583915022197187043644048603871960228564151087? 91.1461442179608339668518063027198489593908228325190920?] + + This result: + + [ 77.553762651? 11.409531407?] + [ 11.409531407? 5.508968850234?] + + After M.canonize: + + [ 62.42018359? 11.409531407?] + [ 11.409531407? 15.1140644993?] + """ + # Get shapes, as intervals if requested + shapes = compute_hyperbolic_shapes( + snappy_manifold, verified=verified, bits_prec=bits_prec) + + # Compute cusp cross section, the code is agnostic about whether + # the numbers are floating-point or intervals. + # Note that the constructed cusp cross section will always be too "large" + # and we need to scale them down (since during construction the + # cross-section of each cusp will have one edge of length 1, the + # corresponding tetrahedron does not intersect in "standard" form.) + c = ComplexCuspCrossSection.fromManifoldAndShapes(snappy_manifold, shapes) + + # If no areas are given, scale (up or down) all the cusps so that + # they are in standard form. + c.ensure_std_form(allow_scaling_up=True) + + areas = c.cusp_areas() + RIF = areas[0].parent() + + def entry(i, j): + if i > j: + i, j = j, i + result = areas[i] * areas[j] + if (i, j) in c._edge_dict: + result *= correct_min( + [ RIF(1), ComplexCuspCrossSection._exp_distance_of_edges( + c._edge_dict[(i,j)])]) ** 2 + return result + + return _to_matrix([[entry(i, j) for i in range(len(areas))] + for j in range(len(areas))]) + +def _to_matrix(m): + # delayed import to avoid cycles + from snappy.SnapPy import matrix + + return matrix(m) diff --git a/python/cusps/maximal_cusp_area_matrix.py b/python/cusps/maximal_cusp_area_matrix.py index 12ca431ae..29ff4172c 100644 --- a/python/cusps/maximal_cusp_area_matrix.py +++ b/python/cusps/maximal_cusp_area_matrix.py @@ -1,6 +1,5 @@ from ..geometric_structure.cusp_neighborhood.tiles_for_cusp_neighborhood import ( - mcomplex_for_tiling_cusp_neighborhoods, - compute_tiles_for_cusp_neighborhood) + mcomplex_for_tiling_cusp_neighborhoods) from ..tiling.tile import Tile from ..sage_helper import _within_sage diff --git a/python/verify/maximal_cusp_area_matrix/__init__.py b/python/verify/maximal_cusp_area_matrix/__init__.py index 1334c056c..13ffd032b 100644 --- a/python/verify/maximal_cusp_area_matrix/__init__.py +++ b/python/verify/maximal_cusp_area_matrix/__init__.py @@ -1,24 +1,17 @@ -from ...geometric_structure.cusp_neighborhood.cusp_cross_section import ComplexCuspCrossSection from ...sage_helper import _within_sage, sage_method -from ...math_basics import correct_min -from ..shapes import compute_hyperbolic_shapes -from .cusp_tiling_engine import * - -if _within_sage: - from sage.all import matrix -__all__ = ['verified_maximal_cusp_area_matrix', - 'triangulation_dependent_cusp_area_matrix'] +from .cusp_tiling_engine import * +__all__ = ['legacy_verified_maximal_cusp_area_matrix'] @sage_method -def verified_maximal_cusp_area_matrix(snappy_manifold, bits_prec=None): +def legacy_verified_maximal_cusp_area_matrix(snappy_manifold, bits_prec=None): """ TESTS:: sage: from snappy import Manifold sage: M = Manifold("s776") - sage: verified_maximal_cusp_area_matrix(M) # doctest: +NUMERIC6 + sage: legacy_verified_maximal_cusp_area_matrix(M) # doctest: +NUMERIC6 [28.0000000000? 7.00000000000? 7.00000000000?] [7.00000000000? 28.000000000? 7.00000000000?] [7.00000000000? 7.00000000000? 28.000000000?] @@ -43,67 +36,12 @@ def verified_maximal_cusp_area_matrix(snappy_manifold, bits_prec=None): return _to_matrix(rows) - -def triangulation_dependent_cusp_area_matrix( - snappy_manifold, verified, bits_prec=None): - """ - Interesting case: t12521 - - Maximal cusp area matrix: - - [ 77.5537626509970512653317518641810890989543820290380458409? 11.40953140648583915022197187043644048603871960228564151087?] - [11.40953140648583915022197187043644048603871960228564151087? 91.1461442179608339668518063027198489593908228325190920?] - - This result: - - [ 77.553762651? 11.409531407?] - [ 11.409531407? 5.508968850234?] - - After M.canonize: - - [ 62.42018359? 11.409531407?] - [ 11.409531407? 15.1140644993?] - """ - # Get shapes, as intervals if requested - shapes = compute_hyperbolic_shapes( - snappy_manifold, verified=verified, bits_prec=bits_prec) - - # Compute cusp cross section, the code is agnostic about whether - # the numbers are floating-point or intervals. - # Note that the constructed cusp cross section will always be too "large" - # and we need to scale them down (since during construction the - # cross-section of each cusp will have one edge of length 1, the - # corresponding tetrahedron does not intersect in "standard" form.) - c = ComplexCuspCrossSection.fromManifoldAndShapes(snappy_manifold, shapes) - - # If no areas are given, scale (up or down) all the cusps so that - # they are in standard form. - c.ensure_std_form(allow_scaling_up=True) - - areas = c.cusp_areas() - RIF = areas[0].parent() - - def entry(i, j): - if i > j: - i, j = j, i - result = areas[i] * areas[j] - if (i, j) in c._edge_dict: - result *= correct_min( - [ RIF(1), ComplexCuspCrossSection._exp_distance_of_edges( - c._edge_dict[(i,j)])]) ** 2 - return result - - return _to_matrix([[entry(i, j) for i in range(len(areas))] - for j in range(len(areas))]) - - def _to_matrix(m): # delayed import to avoid cycles from snappy.SnapPy import matrix return matrix(m) - def _doctest(): import doctest doctest.testmod()