snappy 3.0.3__cp38-cp38-macosx_11_0_arm64.whl → 3.2__cp38-cp38-macosx_11_0_arm64.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (401) hide show
  1. snappy/CyOpenGL.cpython-38-darwin.so +0 -0
  2. snappy/SnapPy.cpython-38-darwin.so +0 -0
  3. snappy/SnapPyHP.cpython-38-darwin.so +0 -0
  4. snappy/__init__.py +373 -426
  5. snappy/app.py +240 -75
  6. snappy/app_menus.py +93 -78
  7. snappy/browser.py +87 -63
  8. snappy/cache.py +5 -8
  9. snappy/canonical.py +249 -0
  10. snappy/{verify/cusp_shapes.py → cusps/__init__.py} +11 -19
  11. snappy/cusps/cusp_area_matrix.py +101 -0
  12. snappy/{verify/cusp_areas.py → cusps/cusp_areas_from_matrix.py} +39 -54
  13. snappy/cusps/maximal_cusp_area_matrix.py +136 -0
  14. snappy/cusps/test.py +21 -0
  15. snappy/cusps/trig_cusp_area_matrix.py +63 -0
  16. snappy/database.py +40 -31
  17. snappy/db_utilities.py +13 -14
  18. snappy/decorated_isosig.py +377 -133
  19. snappy/dev/extended_ptolemy/complexVolumesClosed.py +42 -9
  20. snappy/dev/extended_ptolemy/extended.py +32 -25
  21. snappy/dev/extended_ptolemy/giac_rur.py +23 -8
  22. snappy/dev/extended_ptolemy/phc_wrapper.py +10 -10
  23. snappy/dev/vericlosed/computeApproxHyperbolicStructureOrb.py +2 -1
  24. snappy/dev/vericlosed/gimbalLoopFinder.py +5 -5
  25. snappy/dev/vericlosed/hyperbolicStructure.py +3 -3
  26. snappy/dev/vericlosed/oneVertexTruncatedComplex.py +2 -2
  27. snappy/dev/vericlosed/truncatedComplex.py +3 -2
  28. snappy/dev/vericlosed/verifyHyperbolicStructureEngine.py +4 -3
  29. snappy/doc/_images/geodesics.jpg +0 -0
  30. snappy/doc/_images/m004_paper_plane_on_systole.jpg +0 -0
  31. snappy/doc/_images/m125_paper_plane.jpg +0 -0
  32. snappy/doc/_images/o9_00000_systole_paper_plane.jpg +0 -0
  33. snappy/doc/_images/o9_00000_systole_paper_plane_closer.jpg +0 -0
  34. snappy/doc/_sources/additional_classes.rst.txt +1 -0
  35. snappy/doc/_sources/credits.rst.txt +6 -1
  36. snappy/doc/_sources/development.rst.txt +69 -50
  37. snappy/doc/_sources/index.rst.txt +101 -66
  38. snappy/doc/_sources/installing.rst.txt +148 -165
  39. snappy/doc/_sources/news.rst.txt +136 -32
  40. snappy/doc/_sources/ptolemy.rst.txt +1 -1
  41. snappy/doc/_sources/ptolemy_examples1.rst.txt +9 -8
  42. snappy/doc/_sources/ptolemy_examples2.rst.txt +3 -3
  43. snappy/doc/_sources/ptolemy_examples3.rst.txt +14 -14
  44. snappy/doc/_sources/ptolemy_prelim.rst.txt +1 -1
  45. snappy/doc/_sources/snap.rst.txt +2 -2
  46. snappy/doc/_sources/snappy.rst.txt +1 -1
  47. snappy/doc/_sources/triangulation.rst.txt +3 -2
  48. snappy/doc/_sources/verify.rst.txt +89 -29
  49. snappy/doc/_sources/verify_internals.rst.txt +5 -16
  50. snappy/doc/_static/SnapPy-horizontal-128.png +0 -0
  51. snappy/doc/_static/SnapPy.ico +0 -0
  52. snappy/doc/_static/_sphinx_javascript_frameworks_compat.js +123 -0
  53. snappy/doc/_static/basic.css +47 -27
  54. snappy/doc/_static/css/badge_only.css +1 -0
  55. snappy/doc/_static/css/fonts/Roboto-Slab-Bold.woff +0 -0
  56. snappy/doc/_static/css/fonts/Roboto-Slab-Bold.woff2 +0 -0
  57. snappy/doc/_static/css/fonts/Roboto-Slab-Regular.woff +0 -0
  58. snappy/doc/_static/css/fonts/Roboto-Slab-Regular.woff2 +0 -0
  59. snappy/doc/_static/css/fonts/fontawesome-webfont.eot +0 -0
  60. snappy/doc/_static/css/fonts/fontawesome-webfont.svg +2671 -0
  61. snappy/doc/_static/css/fonts/fontawesome-webfont.ttf +0 -0
  62. snappy/doc/_static/css/fonts/fontawesome-webfont.woff +0 -0
  63. snappy/doc/_static/css/fonts/fontawesome-webfont.woff2 +0 -0
  64. snappy/doc/_static/css/fonts/lato-bold-italic.woff +0 -0
  65. snappy/doc/_static/css/fonts/lato-bold-italic.woff2 +0 -0
  66. snappy/doc/_static/css/fonts/lato-bold.woff +0 -0
  67. snappy/doc/_static/css/fonts/lato-bold.woff2 +0 -0
  68. snappy/doc/_static/css/fonts/lato-normal-italic.woff +0 -0
  69. snappy/doc/_static/css/fonts/lato-normal-italic.woff2 +0 -0
  70. snappy/doc/_static/css/fonts/lato-normal.woff +0 -0
  71. snappy/doc/_static/css/fonts/lato-normal.woff2 +0 -0
  72. snappy/doc/_static/css/theme.css +4 -0
  73. snappy/doc/_static/doctools.js +107 -274
  74. snappy/doc/_static/documentation_options.js +6 -5
  75. snappy/doc/_static/fonts/Lato/lato-bold.eot +0 -0
  76. snappy/doc/_static/fonts/Lato/lato-bold.ttf +0 -0
  77. snappy/doc/_static/fonts/Lato/lato-bold.woff +0 -0
  78. snappy/doc/_static/fonts/Lato/lato-bold.woff2 +0 -0
  79. snappy/doc/_static/fonts/Lato/lato-bolditalic.eot +0 -0
  80. snappy/doc/_static/fonts/Lato/lato-bolditalic.ttf +0 -0
  81. snappy/doc/_static/fonts/Lato/lato-bolditalic.woff +0 -0
  82. snappy/doc/_static/fonts/Lato/lato-bolditalic.woff2 +0 -0
  83. snappy/doc/_static/fonts/Lato/lato-italic.eot +0 -0
  84. snappy/doc/_static/fonts/Lato/lato-italic.ttf +0 -0
  85. snappy/doc/_static/fonts/Lato/lato-italic.woff +0 -0
  86. snappy/doc/_static/fonts/Lato/lato-italic.woff2 +0 -0
  87. snappy/doc/_static/fonts/Lato/lato-regular.eot +0 -0
  88. snappy/doc/_static/fonts/Lato/lato-regular.ttf +0 -0
  89. snappy/doc/_static/fonts/Lato/lato-regular.woff +0 -0
  90. snappy/doc/_static/fonts/Lato/lato-regular.woff2 +0 -0
  91. snappy/doc/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot +0 -0
  92. snappy/doc/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf +0 -0
  93. snappy/doc/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff +0 -0
  94. snappy/doc/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 +0 -0
  95. snappy/doc/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot +0 -0
  96. snappy/doc/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf +0 -0
  97. snappy/doc/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff +0 -0
  98. snappy/doc/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 +0 -0
  99. snappy/doc/_static/jquery.js +2 -2
  100. snappy/doc/_static/js/badge_only.js +1 -0
  101. snappy/doc/_static/js/theme.js +1 -0
  102. snappy/doc/_static/js/versions.js +228 -0
  103. snappy/doc/_static/language_data.js +3 -101
  104. snappy/doc/_static/pygments.css +1 -0
  105. snappy/doc/_static/searchtools.js +489 -398
  106. snappy/doc/_static/snappy_furo.css +33 -0
  107. snappy/doc/_static/snappy_sphinx_rtd_theme.css +42 -0
  108. snappy/doc/_static/sphinx_highlight.js +154 -0
  109. snappy/doc/additional_classes.html +688 -263
  110. snappy/doc/bugs.html +107 -94
  111. snappy/doc/censuses.html +155 -127
  112. snappy/doc/credits.html +115 -104
  113. snappy/doc/development.html +184 -146
  114. snappy/doc/genindex.html +287 -204
  115. snappy/doc/index.html +189 -150
  116. snappy/doc/installing.html +259 -266
  117. snappy/doc/manifold.html +1626 -592
  118. snappy/doc/manifoldhp.html +119 -105
  119. snappy/doc/news.html +198 -104
  120. snappy/doc/objects.inv +0 -0
  121. snappy/doc/other.html +117 -105
  122. snappy/doc/platonic_census.html +161 -114
  123. snappy/doc/plink.html +113 -105
  124. snappy/doc/ptolemy.html +131 -108
  125. snappy/doc/ptolemy_classes.html +242 -223
  126. snappy/doc/ptolemy_examples1.html +144 -130
  127. snappy/doc/ptolemy_examples2.html +141 -129
  128. snappy/doc/ptolemy_examples3.html +148 -132
  129. snappy/doc/ptolemy_examples4.html +131 -111
  130. snappy/doc/ptolemy_prelim.html +162 -138
  131. snappy/doc/py-modindex.html +104 -69
  132. snappy/doc/screenshots.html +117 -108
  133. snappy/doc/search.html +115 -84
  134. snappy/doc/searchindex.js +1 -1
  135. snappy/doc/snap.html +109 -96
  136. snappy/doc/snappy.html +134 -97
  137. snappy/doc/spherogram.html +259 -187
  138. snappy/doc/todo.html +107 -94
  139. snappy/doc/triangulation.html +1380 -111
  140. snappy/doc/tutorial.html +107 -94
  141. snappy/doc/verify.html +194 -125
  142. snappy/doc/verify_internals.html +248 -686
  143. snappy/drilling/__init__.py +456 -0
  144. snappy/drilling/barycentric.py +103 -0
  145. snappy/drilling/constants.py +5 -0
  146. snappy/drilling/crush.py +270 -0
  147. snappy/drilling/cusps.py +125 -0
  148. snappy/drilling/debug.py +242 -0
  149. snappy/drilling/epsilons.py +6 -0
  150. snappy/drilling/exceptions.py +55 -0
  151. snappy/drilling/moves.py +620 -0
  152. snappy/drilling/peripheral_curves.py +210 -0
  153. snappy/drilling/perturb.py +188 -0
  154. snappy/drilling/shorten.py +36 -0
  155. snappy/drilling/subdivide.py +274 -0
  156. snappy/drilling/test.py +23 -0
  157. snappy/drilling/test_cases.py +126 -0
  158. snappy/drilling/tracing.py +351 -0
  159. snappy/exceptions.py +23 -3
  160. snappy/export_stl.py +20 -14
  161. snappy/exterior_to_link/__init__.py +2 -0
  162. snappy/exterior_to_link/barycentric_geometry.py +463 -0
  163. snappy/exterior_to_link/exceptions.py +6 -0
  164. snappy/exterior_to_link/geodesic_map.json +14408 -0
  165. snappy/exterior_to_link/hyp_utils.py +112 -0
  166. snappy/exterior_to_link/link_projection.py +323 -0
  167. snappy/exterior_to_link/main.py +197 -0
  168. snappy/exterior_to_link/mcomplex_with_expansion.py +261 -0
  169. snappy/exterior_to_link/mcomplex_with_link.py +687 -0
  170. snappy/exterior_to_link/mcomplex_with_memory.py +162 -0
  171. snappy/exterior_to_link/pl_utils.py +491 -0
  172. snappy/exterior_to_link/put_in_S3.py +156 -0
  173. snappy/exterior_to_link/rational_linear_algebra.py +123 -0
  174. snappy/exterior_to_link/rational_linear_algebra_wrapped.py +135 -0
  175. snappy/exterior_to_link/simplify_to_base_tri.py +114 -0
  176. snappy/exterior_to_link/stored_moves.py +475 -0
  177. snappy/exterior_to_link/test.py +31 -0
  178. snappy/geometric_structure/__init__.py +212 -0
  179. snappy/geometric_structure/cusp_neighborhood/__init__.py +3 -0
  180. snappy/geometric_structure/cusp_neighborhood/complex_cusp_cross_section.py +697 -0
  181. snappy/geometric_structure/cusp_neighborhood/cusp_cross_section_base.py +484 -0
  182. snappy/geometric_structure/cusp_neighborhood/exceptions.py +42 -0
  183. snappy/geometric_structure/cusp_neighborhood/real_cusp_cross_section.py +298 -0
  184. snappy/geometric_structure/cusp_neighborhood/tiles_for_cusp_neighborhood.py +159 -0
  185. snappy/geometric_structure/cusp_neighborhood/vertices.py +32 -0
  186. snappy/geometric_structure/geodesic/__init__.py +0 -0
  187. snappy/geometric_structure/geodesic/add_core_curves.py +152 -0
  188. snappy/geometric_structure/geodesic/avoid_core_curves.py +369 -0
  189. snappy/geometric_structure/geodesic/canonical_keys.py +52 -0
  190. snappy/geometric_structure/geodesic/check_away_from_core_curve.py +60 -0
  191. snappy/geometric_structure/geodesic/constants.py +6 -0
  192. snappy/geometric_structure/geodesic/exceptions.py +22 -0
  193. snappy/geometric_structure/geodesic/fixed_points.py +93 -0
  194. snappy/geometric_structure/geodesic/geodesic_start_point_info.py +435 -0
  195. snappy/geometric_structure/geodesic/graph_trace_helper.py +67 -0
  196. snappy/geometric_structure/geodesic/line.py +30 -0
  197. snappy/geometric_structure/geodesic/multiplicity.py +127 -0
  198. snappy/geometric_structure/geodesic/tiles_for_geodesic.py +101 -0
  199. snappy/geometric_structure/test.py +22 -0
  200. snappy/gui.py +36 -36
  201. snappy/horoviewer.py +50 -48
  202. snappy/hyperboloid/__init__.py +212 -0
  203. snappy/hyperboloid/distances.py +245 -0
  204. snappy/hyperboloid/horoball.py +19 -0
  205. snappy/hyperboloid/line.py +35 -0
  206. snappy/hyperboloid/point.py +9 -0
  207. snappy/hyperboloid/triangle.py +29 -0
  208. snappy/{infodialog.py → infowindow.py} +32 -33
  209. snappy/isometry_signature.py +382 -0
  210. snappy/len_spec/__init__.py +596 -0
  211. snappy/len_spec/geodesic_info.py +110 -0
  212. snappy/len_spec/geodesic_key_info_dict.py +117 -0
  213. snappy/len_spec/geodesic_piece.py +143 -0
  214. snappy/len_spec/geometric_structure.py +182 -0
  215. snappy/len_spec/geometry.py +80 -0
  216. snappy/len_spec/length_spectrum_geodesic_info.py +170 -0
  217. snappy/len_spec/spine.py +206 -0
  218. snappy/len_spec/test.py +24 -0
  219. snappy/len_spec/test_cases.py +69 -0
  220. snappy/len_spec/tile.py +275 -0
  221. snappy/len_spec/word.py +86 -0
  222. snappy/manifolds/__init__.py +1 -1
  223. snappy/math_basics.py +176 -0
  224. snappy/matrix.py +525 -0
  225. snappy/number.py +97 -21
  226. snappy/numeric_output_checker.py +37 -27
  227. snappy/pari.py +30 -69
  228. snappy/phone_home.py +25 -20
  229. snappy/polyviewer.py +39 -37
  230. snappy/ptolemy/__init__.py +4 -6
  231. snappy/ptolemy/component.py +14 -12
  232. snappy/ptolemy/coordinates.py +312 -295
  233. snappy/ptolemy/fieldExtensions.py +14 -12
  234. snappy/ptolemy/findLoops.py +43 -31
  235. snappy/ptolemy/geometricRep.py +24 -26
  236. snappy/ptolemy/homology.py +12 -7
  237. snappy/ptolemy/manifoldMethods.py +69 -70
  238. snappy/ptolemy/matrix.py +65 -26
  239. snappy/ptolemy/numericalSolutionsToGroebnerBasis.py +18 -14
  240. snappy/ptolemy/polynomial.py +125 -119
  241. snappy/ptolemy/processComponents.py +36 -30
  242. snappy/ptolemy/processFileBase.py +79 -18
  243. snappy/ptolemy/processFileDispatch.py +13 -14
  244. snappy/ptolemy/processMagmaFile.py +44 -39
  245. snappy/ptolemy/processRurFile.py +18 -11
  246. snappy/ptolemy/ptolemyGeneralizedObstructionClass.py +20 -17
  247. snappy/ptolemy/ptolemyObstructionClass.py +13 -17
  248. snappy/ptolemy/ptolemyVariety.py +190 -121
  249. snappy/ptolemy/ptolemyVarietyPrimeIdealGroebnerBasis.py +20 -19
  250. snappy/ptolemy/reginaWrapper.py +25 -29
  251. snappy/ptolemy/rur.py +6 -14
  252. snappy/ptolemy/solutionsToPrimeIdealGroebnerBasis.py +27 -22
  253. snappy/ptolemy/test.py +247 -188
  254. snappy/ptolemy/utilities.py +41 -43
  255. snappy/raytracing/__init__.py +64 -0
  256. snappy/raytracing/additional_horospheres.py +64 -0
  257. snappy/raytracing/additional_len_spec_choices.py +63 -0
  258. snappy/raytracing/cohomology_fractal.py +10 -6
  259. snappy/raytracing/eyeball.py +123 -0
  260. snappy/raytracing/finite_raytracing_data.py +48 -38
  261. snappy/raytracing/finite_viewer.py +218 -210
  262. snappy/raytracing/geodesic_tube_info.py +174 -0
  263. snappy/raytracing/geodesics.py +246 -0
  264. snappy/raytracing/geodesics_window.py +258 -0
  265. snappy/raytracing/gui_utilities.py +152 -40
  266. snappy/raytracing/hyperboloid_navigation.py +102 -52
  267. snappy/raytracing/hyperboloid_utilities.py +114 -261
  268. snappy/raytracing/ideal_raytracing_data.py +256 -179
  269. snappy/raytracing/inside_viewer.py +522 -253
  270. snappy/raytracing/pack.py +22 -0
  271. snappy/raytracing/raytracing_data.py +46 -34
  272. snappy/raytracing/raytracing_view.py +190 -109
  273. snappy/raytracing/shaders/Eye.png +0 -0
  274. snappy/raytracing/shaders/NonGeometric.png +0 -0
  275. snappy/raytracing/shaders/__init__.py +60 -4
  276. snappy/raytracing/shaders/fragment.glsl +575 -148
  277. snappy/raytracing/test.py +29 -0
  278. snappy/raytracing/tooltip.py +146 -0
  279. snappy/raytracing/upper_halfspace_utilities.py +98 -0
  280. snappy/raytracing/view_scale_controller.py +98 -0
  281. snappy/raytracing/zoom_slider/__init__.py +32 -29
  282. snappy/raytracing/zoom_slider/test.py +2 -0
  283. snappy/sage_helper.py +69 -123
  284. snappy/{preferences.py → settings.py} +167 -145
  285. snappy/shell.py +4 -0
  286. snappy/snap/__init__.py +12 -8
  287. snappy/snap/character_varieties.py +24 -18
  288. snappy/snap/find_field.py +35 -34
  289. snappy/snap/fundamental_polyhedron.py +99 -85
  290. snappy/snap/generators.py +6 -8
  291. snappy/snap/interval_reps.py +18 -6
  292. snappy/snap/kernel_structures.py +8 -3
  293. snappy/snap/mcomplex_base.py +1 -2
  294. snappy/snap/nsagetools.py +107 -53
  295. snappy/snap/peripheral/__init__.py +1 -1
  296. snappy/snap/peripheral/dual_cellulation.py +15 -7
  297. snappy/snap/peripheral/link.py +20 -16
  298. snappy/snap/peripheral/peripheral.py +22 -14
  299. snappy/snap/peripheral/surface.py +47 -50
  300. snappy/snap/peripheral/test.py +8 -8
  301. snappy/snap/polished_reps.py +65 -40
  302. snappy/snap/shapes.py +41 -22
  303. snappy/snap/slice_obs_HKL.py +64 -25
  304. snappy/snap/t3mlite/arrow.py +88 -51
  305. snappy/snap/t3mlite/corner.py +5 -6
  306. snappy/snap/t3mlite/edge.py +32 -21
  307. snappy/snap/t3mlite/face.py +7 -9
  308. snappy/snap/t3mlite/files.py +31 -23
  309. snappy/snap/t3mlite/homology.py +14 -10
  310. snappy/snap/t3mlite/linalg.py +158 -56
  311. snappy/snap/t3mlite/mcomplex.py +739 -291
  312. snappy/snap/t3mlite/perm4.py +236 -84
  313. snappy/snap/t3mlite/setup.py +9 -10
  314. snappy/snap/t3mlite/simplex.py +65 -48
  315. snappy/snap/t3mlite/spun.py +42 -30
  316. snappy/snap/t3mlite/surface.py +45 -45
  317. snappy/snap/t3mlite/test.py +3 -0
  318. snappy/snap/t3mlite/test_vs_regina.py +17 -13
  319. snappy/snap/t3mlite/tetrahedron.py +25 -24
  320. snappy/snap/t3mlite/vertex.py +8 -13
  321. snappy/snap/test.py +45 -52
  322. snappy/snap/utilities.py +66 -65
  323. snappy/test.py +155 -158
  324. snappy/test_cases.py +263 -0
  325. snappy/testing.py +131 -0
  326. snappy/tiling/__init__.py +2 -0
  327. snappy/tiling/canonical_key_dict.py +59 -0
  328. snappy/tiling/dict_based_set.py +79 -0
  329. snappy/tiling/floor.py +49 -0
  330. snappy/tiling/hyperboloid_dict.py +54 -0
  331. snappy/tiling/iter_utils.py +78 -0
  332. snappy/tiling/lifted_tetrahedron.py +22 -0
  333. snappy/tiling/lifted_tetrahedron_set.py +54 -0
  334. snappy/tiling/real_hash_dict.py +164 -0
  335. snappy/tiling/test.py +23 -0
  336. snappy/tiling/tile.py +215 -0
  337. snappy/tiling/triangle.py +33 -0
  338. snappy/tkterminal.py +313 -203
  339. snappy/twister/main.py +1 -8
  340. snappy/twister/twister_core.cpython-38-darwin.so +0 -0
  341. snappy/upper_halfspace/__init__.py +146 -0
  342. snappy/upper_halfspace/ideal_point.py +26 -0
  343. snappy/verify/__init__.py +4 -8
  344. snappy/verify/{verifyCanonical.py → canonical.py} +114 -97
  345. snappy/verify/complex_volume/__init__.py +3 -2
  346. snappy/verify/complex_volume/adjust_torsion.py +13 -11
  347. snappy/verify/complex_volume/closed.py +29 -24
  348. snappy/verify/complex_volume/compute_ptolemys.py +8 -6
  349. snappy/verify/complex_volume/cusped.py +10 -9
  350. snappy/verify/complex_volume/extended_bloch.py +14 -12
  351. snappy/verify/{cuspTranslations.py → cusp_translations.py} +15 -14
  352. snappy/verify/edge_equations.py +80 -0
  353. snappy/verify/exceptions.py +23 -56
  354. snappy/verify/{verifyHyperbolicity.py → hyperbolicity.py} +19 -15
  355. snappy/verify/interval_newton_shapes_engine.py +51 -211
  356. snappy/verify/interval_tree.py +27 -25
  357. snappy/verify/krawczyk_shapes_engine.py +47 -50
  358. snappy/verify/maximal_cusp_area_matrix/__init__.py +17 -86
  359. snappy/verify/maximal_cusp_area_matrix/cusp_tiling_engine.py +58 -48
  360. snappy/verify/maximal_cusp_area_matrix/cusp_translate_engine.py +53 -57
  361. snappy/verify/{realAlgebra.py → real_algebra.py} +26 -20
  362. snappy/verify/shapes.py +10 -7
  363. snappy/verify/short_slopes.py +41 -42
  364. snappy/verify/{squareExtensions.py → square_extensions.py} +96 -92
  365. snappy/verify/test.py +59 -57
  366. snappy/verify/upper_halfspace/extended_matrix.py +5 -5
  367. snappy/verify/upper_halfspace/finite_point.py +44 -31
  368. snappy/verify/upper_halfspace/ideal_point.py +69 -57
  369. snappy/verify/volume.py +15 -12
  370. snappy/version.py +2 -3
  371. {snappy-3.0.3.dist-info → snappy-3.2.dist-info}/METADATA +14 -12
  372. snappy-3.2.dist-info/RECORD +503 -0
  373. {snappy-3.0.3.dist-info → snappy-3.2.dist-info}/WHEEL +1 -1
  374. {snappy-3.0.3.dist-info → snappy-3.2.dist-info}/entry_points.txt +0 -1
  375. {snappy-3.0.3.dist-info → snappy-3.2.dist-info}/top_level.txt +10 -1
  376. snappy/doc/_sources/verify_canon.rst.txt +0 -90
  377. snappy/doc/_static/classic.css +0 -266
  378. snappy/doc/_static/jquery-3.5.1.js +0 -10872
  379. snappy/doc/_static/sidebar.js +0 -159
  380. snappy/doc/_static/underscore-1.13.1.js +0 -2042
  381. snappy/doc/_static/underscore.js +0 -6
  382. snappy/doc/verify_canon.html +0 -283
  383. snappy/ppm_to_png.py +0 -243
  384. snappy/togl/__init__.py +0 -3
  385. snappy/togl/darwin-tk8.6/Togl2.1/LICENSE +0 -28
  386. snappy/togl/darwin-tk8.6/Togl2.1/libTogl2.1.dylib +0 -0
  387. snappy/togl/darwin-tk8.6/Togl2.1/pkgIndex.tcl +0 -5
  388. snappy/togl/linux2-x86_64-tk8.6/Togl2.1/LICENSE +0 -28
  389. snappy/togl/linux2-x86_64-tk8.6/Togl2.1/libTogl2.1.so +0 -0
  390. snappy/togl/linux2-x86_64-tk8.6/Togl2.1/pkgIndex.tcl +0 -5
  391. snappy/togl/win32VC-tk8.6/Togl2.1/LICENSE +0 -28
  392. snappy/togl/win32VC-tk8.6/Togl2.1/Togl21.dll +0 -0
  393. snappy/togl/win32VC-tk8.6/Togl2.1/Togl21.lib +0 -0
  394. snappy/togl/win32VC-tk8.6/Togl2.1/pkgIndex.tcl +0 -6
  395. snappy/togl/win32VC-x86_64-tk8.6/Togl2.1/LICENSE +0 -28
  396. snappy/togl/win32VC-x86_64-tk8.6/Togl2.1/Togl21.dll +0 -0
  397. snappy/togl/win32VC-x86_64-tk8.6/Togl2.1/Togl21.lib +0 -0
  398. snappy/togl/win32VC-x86_64-tk8.6/Togl2.1/pkgIndex.tcl +0 -6
  399. snappy/verify/cuspCrossSection.py +0 -1413
  400. snappy/verify/mathHelpers.py +0 -64
  401. snappy-3.0.3.dist-info/RECORD +0 -360
@@ -1,5 +1,3 @@
1
- from __future__ import print_function
2
-
3
1
  from .component import ZeroDimensionalComponent
4
2
  from .rur import RUR
5
3
  from . import matrix
@@ -9,6 +7,7 @@ from ..sage_helper import _within_sage
9
7
  from ..pari import Gen, pari
10
8
  import re
11
9
 
10
+
12
11
  class PtolemyCannotBeCheckedError(Exception):
13
12
  def __init__(self):
14
13
  msg = (
@@ -17,6 +16,7 @@ class PtolemyCannotBeCheckedError(Exception):
17
16
  "class is not supported.")
18
17
  Exception.__init__(self, msg)
19
18
 
19
+
20
20
  class LogToCloseToBranchCutError(Exception):
21
21
  """
22
22
  An exception raised when taking log(-x) for some real number x
@@ -25,6 +25,7 @@ class LogToCloseToBranchCutError(Exception):
25
25
  """
26
26
  pass
27
27
 
28
+
28
29
  class RelationViolationError(Exception):
29
30
  """
30
31
  An exception raised when some supposed relation doesn't hold exactly
@@ -35,7 +36,7 @@ class RelationViolationError(Exception):
35
36
  self.value = value
36
37
  self.epsilon = epsilon
37
38
  self.comment = comment
38
-
39
+
39
40
  def __str__(self):
40
41
  r = self.comment + " is violated, "
41
42
  r += "difference is %s" % self.value
@@ -43,6 +44,7 @@ class RelationViolationError(Exception):
43
44
  return r + " (exact values)"
44
45
  return r + " (epsilon = %s)" % self.epsilon
45
46
 
47
+
46
48
  class NotPU21Representation:
47
49
  """
48
50
  Returned by is_pu_2_1_representation if cross ratios do not fulfill
@@ -53,26 +55,32 @@ class NotPU21Representation:
53
55
 
54
56
  def __init__(self, reason):
55
57
  self.reason = reason
58
+
56
59
  def __repr__(self):
57
60
  return "NotPU21Representation(reason = %r)" % self.reason
58
61
 
59
62
  def __bool__(self):
60
63
  return False
61
-
64
+
62
65
  __nonzero__ = __bool__ # backwards compatibility python 2x
63
66
 
67
+
64
68
  class NumericalMethodError(Exception):
65
69
  def __init__(self, method):
66
70
  self.method = method
71
+
67
72
  def __str__(self):
68
73
  return "Method %s only supported for numerical values" % self.method
69
74
 
75
+
70
76
  class ExactMethodError(Exception):
71
77
  def __init__(self, method):
72
78
  self.method = method
79
+
73
80
  def __str__(self):
74
81
  return "Method %s only supported for exact values" % self.method
75
82
 
83
+
76
84
  def _check_relation(value, epsilon, comment):
77
85
  if epsilon is None:
78
86
  if not value == 0:
@@ -80,7 +88,8 @@ def _check_relation(value, epsilon, comment):
80
88
  else:
81
89
  if not abs(value) < epsilon:
82
90
  raise RelationViolationError(value, epsilon, comment)
83
-
91
+
92
+
84
93
  class PtolemyCoordinates(dict):
85
94
  """
86
95
  Represents a solution of a Ptolemy variety as python dictionary.
@@ -126,7 +135,7 @@ class PtolemyCoordinates(dict):
126
135
 
127
136
  >>> old_precision = pari.set_real_precision(100) # with high precision
128
137
  >>> numerical_solutions = solution.numerical()
129
-
138
+
130
139
  Check that it is a solution, numerically:
131
140
 
132
141
  >>> numerical_solutions[0].check_against_manifold(M, 1e-80)
@@ -152,7 +161,7 @@ class PtolemyCoordinates(dict):
152
161
  True
153
162
 
154
163
  Compute flattenings:
155
-
164
+
156
165
  >>> flattenings = solution.flattenings_numerical()
157
166
 
158
167
  Compute complex volumes:
@@ -168,14 +177,14 @@ class PtolemyCoordinates(dict):
168
177
  >>> normalized = chernSimons * 6 / (pari('Pi')**2)
169
178
 
170
179
  Check that Chern Simons is zero up to 6 torsion:
171
-
180
+
172
181
  >>> normalized - normalized.round() < 1e-9
173
182
  True
174
183
  """
175
-
176
- def __init__(self, d, is_numerical = True, py_eval_section = None,
177
- manifold_thunk = lambda : None,
178
- non_trivial_generalized_obstruction_class = False):
184
+
185
+ def __init__(self, d, is_numerical=True, py_eval_section=None,
186
+ manifold_thunk=lambda : None,
187
+ non_trivial_generalized_obstruction_class=False):
179
188
 
180
189
  self._manifold_thunk = manifold_thunk
181
190
 
@@ -186,7 +195,7 @@ class PtolemyCoordinates(dict):
186
195
  non_trivial_generalized_obstruction_class)
187
196
  processed_dict = d
188
197
 
189
- if not py_eval_section is None:
198
+ if py_eval_section is not None:
190
199
  # process the extra information that is given by
191
200
  # ptolemyVariety's py_eval_section
192
201
 
@@ -198,13 +207,13 @@ class PtolemyCoordinates(dict):
198
207
  # Caches the matrices that label the short and long edges
199
208
  # of the truncated simplices building the manifold
200
209
  self._edge_cache = {}
201
-
210
+
202
211
  # Caches the images of a fundamental group generator
203
212
  self._matrix_cache = []
204
213
  self._inverse_matrix_cache = []
205
214
 
206
- super(PtolemyCoordinates, self).__init__(processed_dict)
207
-
215
+ super().__init__(processed_dict)
216
+
208
217
  def __repr__(self):
209
218
  dict_repr = dict.__repr__(self)
210
219
  return "PtolemyCoordinates(%s, is_numerical = %r, ...)" % (
@@ -246,17 +255,17 @@ class PtolemyCoordinates(dict):
246
255
  def has_obstruction(self):
247
256
  """
248
257
  Whether the Ptolemy variety has legacy obstruction class that
249
- modifies the Ptolemy relation to
258
+ modifies the Ptolemy relation to
250
259
  """
251
260
  N, has_obstruction = _N_and_has_obstruction_for_ptolemys(self)
252
- return has_obstruction
261
+ return has_obstruction
253
262
 
254
263
  def number_field(self):
255
264
  """
256
265
  For an exact solution, return the number_field spanned by the
257
266
  Ptolemy coordinates. If number_field is Q, return None.
258
267
  """
259
-
268
+
260
269
  if self._is_numerical:
261
270
  raise ExactMethodError("number_field")
262
271
 
@@ -273,7 +282,7 @@ class PtolemyCoordinates(dict):
273
282
  >>> solution = solutions[2]
274
283
 
275
284
  Turn into a numerical solution:
276
-
285
+
277
286
  >>> old_precision = pari.set_real_precision(100) # with high precision
278
287
  >>> numerical_solutions = solution.numerical()
279
288
  >>> pari.set_real_precision(old_precision) # reset pari engine
@@ -284,38 +293,36 @@ class PtolemyCoordinates(dict):
284
293
  >>> numerical_solution = numerical_solutions[0]
285
294
  >>> value = numerical_solution['c_1110_0']
286
295
  """
287
-
296
+
288
297
  if self._is_numerical:
289
298
  return self
290
299
  return ZeroDimensionalComponent(
291
300
  [ PtolemyCoordinates(
292
- d, is_numerical = True,
293
- manifold_thunk = self._manifold_thunk,
294
- non_trivial_generalized_obstruction_class = (
301
+ d, is_numerical=True,
302
+ manifold_thunk=self._manifold_thunk,
303
+ non_trivial_generalized_obstruction_class=(
295
304
  self._non_trivial_generalized_obstruction_class))
296
305
  for d in _to_numerical(self) ])
297
306
 
298
307
  def to_PUR(self):
299
-
300
308
  """
301
309
  If any Ptolemy coordinates are given as Rational Univariate
302
310
  Representation, convert them to Polynomial Univariate Representation and
303
311
  return the result.
304
-
312
+
305
313
  See to_PUR of RUR.
306
314
 
307
315
  This conversion might lead to very large coefficients.
308
316
  """
309
-
317
+
310
318
  return PtolemyCoordinates(
311
319
  _apply_to_RURs(self, RUR.to_PUR),
312
- is_numerical = self._is_numerical,
313
- manifold_thunk = self._manifold_thunk,
314
- non_trivial_generalized_obstruction_class = (
320
+ is_numerical=self._is_numerical,
321
+ manifold_thunk=self._manifold_thunk,
322
+ non_trivial_generalized_obstruction_class=(
315
323
  self._non_trivial_generalized_obstruction_class))
316
324
 
317
325
  def multiply_terms_in_RUR(self):
318
-
319
326
  """
320
327
  If a Ptolemy coordinate is given as Rational Univariate Representation
321
328
  with numerator and denominator being a product, multiply the terms and
@@ -329,13 +336,12 @@ class PtolemyCoordinates(dict):
329
336
 
330
337
  return PtolemyCoordinates(
331
338
  _apply_to_RURs(self, RUR.multiply_terms),
332
- is_numerical = self._is_numerical,
333
- manifold_thunk = self._manifold_thunk,
334
- non_trivial_generalized_obstruction_class = (
339
+ is_numerical=self._is_numerical,
340
+ manifold_thunk=self._manifold_thunk,
341
+ non_trivial_generalized_obstruction_class=(
335
342
  self._non_trivial_generalized_obstruction_class))
336
343
 
337
344
  def multiply_and_simplify_terms_in_RUR(self):
338
-
339
345
  """
340
346
  If a Ptolemy coordinate is given as Rational Univariate Representation
341
347
  with numerator and denominator being a product, multiply the terms,
@@ -347,31 +353,31 @@ class PtolemyCoordinates(dict):
347
353
  factorised.
348
354
 
349
355
  """
350
-
356
+
351
357
  return PtolemyCoordinates(
352
358
  _apply_to_RURs(self, RUR.multiply_and_simplify_terms),
353
- is_numerical = self._is_numerical,
354
- manifold_thunk = self._manifold_thunk,
355
- non_trivial_generalized_obstruction_class = (
356
- self._non_trivial_generalized_obstruction_class))
359
+ is_numerical=self._is_numerical,
360
+ manifold_thunk=self._manifold_thunk,
361
+ non_trivial_generalized_obstruction_class=(
362
+ self._non_trivial_generalized_obstruction_class))
357
363
 
358
364
  def cross_ratios(self):
359
365
  """
360
366
  Compute cross ratios from Ptolemy coordinates. The cross ratios are
361
367
  according to the SnapPy convention, so we have::
362
-
368
+
363
369
  z = 1 - 1/zp, zp = 1 - 1/zpp, zpp = 1 - 1/z
364
-
370
+
365
371
  where::
366
-
372
+
367
373
  z is at the edge 01 and equal to s0 * s1 * (c_1010 * c_0101) / (c_1001 * c_0110)
368
374
  zp is at the edge 02 and equal to - s0 * s2 * (c_1001 * c_0110) / (c_1100 * c_0011)
369
375
  zpp is at the edge 03 and equal to s0 * s3 * (c_1100 * c_0011) / (c_0101 * c_1010).
370
376
 
371
- Note that this is different from the convention used in
377
+ Note that this is different from the convention used in
372
378
  Garoufalidis, Goerner, Zickert:
373
- Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
374
- http://arxiv.org/abs/1207.6711
379
+ Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
380
+ https://arxiv.org/abs/1207.6711
375
381
 
376
382
  Take an exact solution:
377
383
 
@@ -382,14 +388,14 @@ class PtolemyCoordinates(dict):
382
388
  Turn into cross Ratios:
383
389
 
384
390
  >>> crossRatios = solution.cross_ratios()
385
-
391
+
386
392
  Get a cross ratio:
387
-
393
+
388
394
  >>> crossRatios['zp_0010_0']
389
395
  Mod(-x, x^2 + x + 1)
390
396
 
391
397
  Check the relationship between cross ratios:
392
-
398
+
393
399
  >>> crossRatios['z_0010_0'] == 1 - 1 / crossRatios['zp_0010_0']
394
400
  True
395
401
 
@@ -402,15 +408,15 @@ class PtolemyCoordinates(dict):
402
408
  Get information about what one can do with cross ratios
403
409
  """
404
410
  return CrossRatios(_ptolemy_to_cross_ratio(self)[0],
405
- is_numerical = self._is_numerical,
406
- manifold_thunk = self._manifold_thunk)
411
+ is_numerical=self._is_numerical,
412
+ manifold_thunk=self._manifold_thunk)
407
413
 
408
414
  def cross_ratios_numerical(self):
409
415
  """
410
416
  Turn exact solutions into numerical and then compute cross ratios.
411
417
  See numerical() and cross_ratios().
412
418
  """
413
-
419
+
414
420
  if self._is_numerical:
415
421
  return self.cross_ratios()
416
422
  else:
@@ -419,7 +425,7 @@ class PtolemyCoordinates(dict):
419
425
 
420
426
  def flattenings_numerical(self):
421
427
  """
422
- Turn into numerical solutions and compute flattenings, see
428
+ Turn into numerical solutions and compute flattenings, see
423
429
  help(snappy.ptolemy.coordinates.Flattenings)
424
430
  Also see numerical()
425
431
 
@@ -429,7 +435,7 @@ class PtolemyCoordinates(dict):
429
435
  >>> solutions = solutions_from_magma(_magma_output_for_4_1__sl3)
430
436
  >>> solution = solutions[2]
431
437
 
432
- Compute a numerical soluton
438
+ Compute a numerical solution
433
439
 
434
440
  >>> flattenings = solution.flattenings_numerical()
435
441
 
@@ -445,17 +451,17 @@ class PtolemyCoordinates(dict):
445
451
  for i in range(1000):
446
452
  try:
447
453
  # get the dictionary containing flattenings
448
- # and the evenN that describes in what
454
+ # and the evenN that describes in what
449
455
  # flavor of the Extended Bloch group the result lives in
450
456
  d, evenN = _ptolemy_to_cross_ratio(
451
457
  self,
452
458
  branch_factor,
453
459
  self._non_trivial_generalized_obstruction_class,
454
- as_flattenings = True)
460
+ as_flattenings=True)
455
461
 
456
462
  return Flattenings(d,
457
- manifold_thunk = self._manifold_thunk,
458
- evenN = evenN)
463
+ manifold_thunk=self._manifold_thunk,
464
+ evenN=evenN)
459
465
  except LogToCloseToBranchCutError:
460
466
  # Values to close to the branch cut, just multiply
461
467
  # by a small offset
@@ -466,7 +472,7 @@ class PtolemyCoordinates(dict):
466
472
  return ZeroDimensionalComponent(
467
473
  [num.flattenings_numerical() for num in self.numerical()])
468
474
 
469
- def volume_numerical(self, drop_negative_vols = False):
475
+ def volume_numerical(self, drop_negative_vols=False):
470
476
  """
471
477
  Turn into (Galois conjugate) numerical solutions and compute volumes.
472
478
  If already numerical, only return the one volume.
@@ -485,8 +491,8 @@ class PtolemyCoordinates(dict):
485
491
  return vols
486
492
 
487
493
  def complex_volume_numerical(self,
488
- drop_negative_vols = False,
489
- with_modulo = False):
494
+ drop_negative_vols=False,
495
+ with_modulo=False):
490
496
  """
491
497
  Turn into (Galois conjugate) numerical solutions and compute complex
492
498
  volumes. If already numerical, return the volume.
@@ -496,14 +502,14 @@ class PtolemyCoordinates(dict):
496
502
  See numerical(). If drop_negative_vols = True is given as optional
497
503
  argument, only return complex volumes with non-negative real part.
498
504
  """
499
-
505
+
500
506
  if self._is_numerical:
501
507
  return self.flattenings_numerical().complex_volume(
502
- with_modulo = with_modulo)
508
+ with_modulo=with_modulo)
503
509
  else:
504
510
  cvols = ZeroDimensionalComponent(
505
511
  [ num.flattenings_numerical().complex_volume(
506
- with_modulo = with_modulo)
512
+ with_modulo=with_modulo)
507
513
  for num in self.numerical()])
508
514
  if drop_negative_vols:
509
515
  return [cvol for cvol in cvols if cvol.real() > -1e-12]
@@ -556,10 +562,10 @@ class PtolemyCoordinates(dict):
556
562
 
557
563
  See Definition 10.1:
558
564
  Garoufalidis, Goerner, Zickert:
559
- Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
560
- http://arxiv.org/abs/1207.6711
565
+ Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
566
+ https://arxiv.org/abs/1207.6711
561
567
  """
562
-
568
+
563
569
  # Integral points that are indices of Ptolemy coordinates
564
570
  pt_v0_v0 = [ a + 2 * _kronecker_delta(v0, i)
565
571
  for i, a in enumerate(pt) ]
@@ -580,14 +586,14 @@ class PtolemyCoordinates(dict):
580
586
  # See Definition 9.23 of
581
587
  # Garoufalidis, Thurston, Zickert
582
588
  # The Complex Volume of SL(n,C)-Representations of 3-Manifolds
583
- # http://arxiv.org/abs/1111.2828
584
- face = list(set(range(4)) - set([v0, v1, v2]))[0]
589
+ # httpss://arxiv.org/abs/1111.2828
590
+ face = next(iter(set(range(4)) - {v0, v1, v2}))
585
591
  obstruction = self._get_obstruction_variable(face, tet)
586
592
 
587
593
  # The epsilon permutation sign from Definition 10.1 of
588
594
  # Garoufalidis, Goerner, Zickert:
589
- # Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
590
- # http://arxiv.org/abs/1207.6711
595
+ # Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
596
+ # https://arxiv.org/abs/1207.6711
591
597
  s = PtolemyCoordinates._three_perm_sign(v0, v1, v2)
592
598
 
593
599
  # The equation from the same Definition
@@ -595,7 +601,6 @@ class PtolemyCoordinates(dict):
595
601
  (c_pt_v0_v0 * c_pt_v1_v2) /
596
602
  (c_pt_v0_v1 * c_pt_v0_v2))
597
603
 
598
-
599
604
  def ratio_coordinate(self, tet, v0, v1, pt):
600
605
  """
601
606
  Returns the ratio coordinate for tetrahedron with index tet
@@ -604,8 +609,8 @@ class PtolemyCoordinates(dict):
604
609
 
605
610
  See Definition 10.2:
606
611
  Garoufalidis, Goerner, Zickert:
607
- Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
608
- http://arxiv.org/abs/1207.6711
612
+ Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
613
+ https://arxiv.org/abs/1207.6711
609
614
 
610
615
  Note that this definition turned out to have the wrong sign. Multiply
611
616
  the result by -1 if v1 < v0 and N is even.
@@ -632,7 +637,7 @@ class PtolemyCoordinates(dict):
632
637
 
633
638
  # Get N
634
639
  N = self.N()
635
-
640
+
636
641
  return [[_kronecker_delta(i, j) for i in range(N)] for j in range(N)]
637
642
 
638
643
  def long_edge(self, tet, v0, v1, v2):
@@ -644,8 +649,8 @@ class PtolemyCoordinates(dict):
644
649
  This matrix was labeled alpha^{v0v1v2} (v2 does not matter for non
645
650
  double-truncated simplex) in Figure 18 of
646
651
  Garoufalidis, Goerner, Zickert:
647
- Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
648
- http://arxiv.org/abs/1207.6711
652
+ Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
653
+ https://arxiv.org/abs/1207.6711
649
654
 
650
655
  It is computed using equation 10.4. Note that the ratio coordinate
651
656
  is different from the definition in the paper (see ratio_coordinate).
@@ -657,7 +662,7 @@ class PtolemyCoordinates(dict):
657
662
  key = 'long_%d_%d%d' % (tet, v0, v1)
658
663
 
659
664
  # Fill cache if necessary
660
- if not key in self._edge_cache:
665
+ if key not in self._edge_cache:
661
666
 
662
667
  # Get N
663
668
  N = self.N()
@@ -688,8 +693,8 @@ class PtolemyCoordinates(dict):
688
693
 
689
694
  This matrix was labeled beta^{v0v1v2} in Figure 18 of
690
695
  Garoufalidis, Goerner, Zickert:
691
- Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
692
- http://arxiv.org/abs/1207.6711
696
+ Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
697
+ https://arxiv.org/abs/1207.6711
693
698
 
694
699
  It is computed using equation 10.4.
695
700
 
@@ -700,21 +705,21 @@ class PtolemyCoordinates(dict):
700
705
  key = 'middle_%d_%d%d%d' % (tet, v0, v1, v2)
701
706
 
702
707
  # Fill cache if necessary
703
- if not key in self._edge_cache:
708
+ if key not in self._edge_cache:
704
709
 
705
710
  # Get N
706
711
  N = self.N()
707
712
 
708
713
  # Start with identity
709
714
  m = self._get_identity_matrix()
710
-
715
+
711
716
  # Compute the product in equation 10.4
712
717
  for a0, a1, a2 in utilities.triples_with_fixed_sum_iterator(N - 2):
713
-
718
+
714
719
  # Get integral point for diamond coordinate
715
720
  pt = [ a1 * _kronecker_delta(v0, i) +
716
721
  a2 * _kronecker_delta(v1, i) +
717
- a0 * _kronecker_delta(v2, i) for i in range(4) ]
722
+ a0 * _kronecker_delta(v2, i) for i in range(4) ]
718
723
 
719
724
  # Compute diamond coordinate
720
725
  diamond = self.diamond_coordinate(tet, v0, v1, v2, pt)
@@ -734,18 +739,18 @@ class PtolemyCoordinates(dict):
734
739
  can be though of as doubly truncated simplices where all short edges
735
740
  are collapsed, hence labeled by the identity.
736
741
 
737
- See equation 10.4 in
742
+ See equation 10.4 in
738
743
  Garoufalidis, Goerner, Zickert:
739
- Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
740
- http://arxiv.org/abs/1207.6711
744
+ Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
745
+ https://arxiv.org/abs/1207.6711
741
746
  """
742
747
 
743
748
  # Key for the cache
744
749
  key = 'short'
745
750
 
746
751
  # Fill cache if necessary
747
- if not key in self._edge_cache:
748
-
752
+ if key not in self._edge_cache:
753
+
749
754
  # Get N
750
755
  N = self.N()
751
756
 
@@ -762,7 +767,7 @@ class PtolemyCoordinates(dict):
762
767
  # fundamental group generators and their inverses
763
768
 
764
769
  if self._matrix_cache and self._inverse_matrix_cache:
765
- return
770
+ return
766
771
 
767
772
  # Compute all the matrices for the generators and there inverses
768
773
  # The short edges of the doubly truncated simplices are all identities
@@ -770,9 +775,9 @@ class PtolemyCoordinates(dict):
770
775
  # no penalty.
771
776
  self._matrix_cache, self._inverse_matrix_cache = (
772
777
  findLoops.images_of_original_generators(self,
773
- penalties = (0, 1, 1)))
778
+ penalties=(0, 1, 1)))
774
779
 
775
- def evaluate_word(self, word, G = None):
780
+ def evaluate_word(self, word, G=None):
776
781
  """
777
782
  Given a word in the generators of the fundamental group,
778
783
  compute the corresponding matrix. By default, these are the
@@ -797,7 +802,7 @@ class PtolemyCoordinates(dict):
797
802
  G)
798
803
 
799
804
  def _testing_assert_identity(self, m,
800
- allow_sign_if_obstruction_class = False):
805
+ allow_sign_if_obstruction_class=False):
801
806
 
802
807
  N = self.N()
803
808
 
@@ -836,17 +841,17 @@ class PtolemyCoordinates(dict):
836
841
  m2 = self.long_edge(tet,v[1],v[0],v[2])
837
842
  self._testing_assert_identity(
838
843
  matrix.matrix_mult(m1, m2))
839
-
844
+
840
845
  # Check triangle for each vertex
841
846
  for v in [(0,1,2,3), (1,2,3,0), (2,3,0,1), (3,0,1,2)]:
842
847
  m1 = self.middle_edge(tet, v[0], v[1], v[2])
843
848
  m2 = self.middle_edge(tet, v[0], v[2], v[3])
844
849
  m3 = self.middle_edge(tet, v[0], v[3], v[1])
845
-
850
+
846
851
  self._testing_assert_identity(
847
852
  matrix.matrix_mult(
848
853
  m1, matrix.matrix_mult(m2, m3)))
849
-
854
+
850
855
  # Check hexagon for each face
851
856
  for v in [(0,1,2), (0,1,3), (0,2,3), (1,2,3)]:
852
857
  m1 = self.middle_edge(tet,v[0],v[1],v[2])
@@ -866,8 +871,7 @@ class PtolemyCoordinates(dict):
866
871
  m4,
867
872
  matrix.matrix_mult(m5,m6))))), True)
868
873
 
869
-
870
- def check_against_manifold(self, M = None, epsilon = None):
874
+ def check_against_manifold(self, M=None, epsilon=None):
871
875
  """
872
876
  Checks that the given solution really is a solution to the Ptolemy
873
877
  variety of a manifold. See help(ptolemy.PtolemyCoordinates) for
@@ -930,12 +934,11 @@ class PtolemyCoordinates(dict):
930
934
  key = "c_%d%d%d%d" % tuple(total_index) + "_%d" % tet
931
935
  return self[key]
932
936
 
933
-
934
937
  s0 = self._get_obstruction_variable(0, tet)
935
938
  s1 = self._get_obstruction_variable(1, tet)
936
939
  s2 = self._get_obstruction_variable(2, tet)
937
940
  s3 = self._get_obstruction_variable(3, tet)
938
-
941
+
939
942
  rel = ( s0 * s1 * get_ptolemy_coordinate((1,1,0,0))
940
943
  * get_ptolemy_coordinate((0,0,1,1))
941
944
  - s0 * s2 * get_ptolemy_coordinate((1,0,1,0))
@@ -947,7 +950,7 @@ class PtolemyCoordinates(dict):
947
950
  epsilon,
948
951
  "Ptolemy relation")
949
952
 
950
- def is_geometric(self, epsilon = 1e-6):
953
+ def is_geometric(self, epsilon=1e-6):
951
954
  """
952
955
  Returns true if all shapes corresponding to this solution have positive
953
956
  imaginary part.
@@ -974,19 +977,19 @@ class Flattenings(dict):
974
977
 
975
978
  We assign to each pair of parallel edges of each simplex a triple (w, z, p)
976
979
  such that::
977
-
980
+
978
981
  w = log(z) + p * (2 * pi * i / N) where N is fixed and even.
979
-
982
+
980
983
  For N = 2, the three triples belonging to a simplex form a combinatorial
981
984
  flattening (w0, w1, w2) as defined in Definition 3.1 in
982
985
  Walter D. Neumann, Extended Bloch group and the Cheeger-Chern-Simons class
983
- http://arxiv.org/abs/math.GT/0307092
986
+ https://arxiv.org/abs/math.GT/0307092
984
987
 
985
988
  For N > 2, the three triples form a generalized combinatorial flattening
986
989
  (w0, w1, w2) that gives an element in the generalized Extended Bloch group
987
990
  which is the Extended Bloch group corresponding to the Riemann surface
988
991
  given by::
989
-
992
+
990
993
  u1 * e^w0 + u2 * e^w1 = 1
991
994
 
992
995
  where u1^N = u2^N = 1.
@@ -999,14 +1002,14 @@ class Flattenings(dict):
999
1002
  This work has not been published yet.
1000
1003
 
1001
1004
  If f is a flattening, then in the notation of Neumann, the value of::
1002
-
1005
+
1003
1006
  f['z_xxxx_y'] is (w0, z, p)
1004
1007
  f['zp_xxxx_y'] is (w1, z', q)
1005
1008
  f['zpp_xxxx_y'] is (w2, z'', r).
1006
1009
  """
1007
-
1008
- def __init__(self, d, manifold_thunk = lambda : None, evenN = 2):
1009
- super(Flattenings, self).__init__(d)
1010
+
1011
+ def __init__(self, d, manifold_thunk=lambda : None, evenN=2):
1012
+ super().__init__(d)
1010
1013
  self._is_numerical = True
1011
1014
  self._manifold_thunk = manifold_thunk
1012
1015
  self.dimension = 0
@@ -1050,7 +1053,6 @@ class Flattenings(dict):
1050
1053
 
1051
1054
  @classmethod
1052
1055
  def from_tetrahedra_shapes_of_manifold(cls, M):
1053
-
1054
1056
  """
1055
1057
  Takes as argument a manifold and produces (weak) flattenings using
1056
1058
  the tetrahedra_shapes of the manifold M.
@@ -1067,7 +1069,7 @@ class Flattenings(dict):
1067
1069
  num_tets = M.num_tetrahedra()
1068
1070
 
1069
1071
  z_cross_ratios = M.tetrahedra_shapes(
1070
- part='rect', dec_prec = pari.get_real_precision())
1072
+ part='rect', dec_prec=pari.get_real_precision())
1071
1073
 
1072
1074
  all_cross_ratios = sum(
1073
1075
  [ [z, 1 / (1-z), 1 - 1/z] for z in z_cross_ratios], [])
@@ -1075,9 +1077,9 @@ class Flattenings(dict):
1075
1077
  log_all_cross_ratios = [ z.log() for z in all_cross_ratios ]
1076
1078
 
1077
1079
  def flattening_condition(r):
1078
- return ( 3 * r * [0]
1079
- + 3 * [1]
1080
- + 3 * (num_tets - r - 1) * [0])
1080
+ return (3 * r * [0]
1081
+ + 3 * [1]
1082
+ + 3 * (num_tets - r - 1) * [0])
1081
1083
 
1082
1084
  flattening_conditions = [
1083
1085
  flattening_condition(r) for r in range(num_tets)]
@@ -1095,11 +1097,11 @@ class Flattenings(dict):
1095
1097
  extra_cols = len(all_equations[0]) - len(all_equations)
1096
1098
 
1097
1099
  d = [d_mat[r][r + extra_cols] for r in range(len(d_mat))]
1098
-
1100
+
1099
1101
  # errors to the gluing equations and flattening condition
1100
1102
  # when using the logarithms without adding p * pi * i as complex
1101
1103
  # numbers
1102
- errors = matrix.matrix_mult_vector(all_equations,
1104
+ errors = matrix.matrix_mult_vector(all_equations,
1103
1105
  log_all_cross_ratios)
1104
1106
 
1105
1107
  # divide by pi * i and turn into integers
@@ -1121,7 +1123,7 @@ class Flattenings(dict):
1121
1123
 
1122
1124
  flattenings = matrix.matrix_mult_vector(v, flattenings_in_other_basis)
1123
1125
 
1124
- assert (matrix.matrix_mult_vector(all_equations, flattenings) ==
1126
+ assert (matrix.matrix_mult_vector(all_equations, flattenings) ==
1125
1127
  [-x for x in int_errors])
1126
1128
 
1127
1129
  keys = sum([ ['z_0000_%d' % i,
@@ -1129,12 +1131,12 @@ class Flattenings(dict):
1129
1131
  'zpp_0000_%d' % i] for i in range(num_tets)],[])
1130
1132
 
1131
1133
  Mcopy = M.copy()
1132
-
1134
+
1133
1135
  return Flattenings(
1134
- dict([ (k, (log + PiI * p, z, p))
1136
+ {k: (log + PiI * p, z, p)
1135
1137
  for k, log, z, p in zip(keys, log_all_cross_ratios,
1136
- all_cross_ratios, flattenings)]),
1137
- manifold_thunk = lambda : Mcopy)
1138
+ all_cross_ratios, flattenings)},
1139
+ manifold_thunk=lambda : Mcopy)
1138
1140
 
1139
1141
  def get_order(self):
1140
1142
  """
@@ -1146,24 +1148,23 @@ class Flattenings(dict):
1146
1148
  return self._evenN
1147
1149
 
1148
1150
  def get_zpq_triple(self, key_z):
1149
-
1150
1151
  """
1151
1152
  Gives a flattening as triple [z;p,q] representing an element
1152
1153
  in the generalized Extended Bloch group similar to the way the
1153
- triple [z;p,q] is used in Lemma 3.2 in
1154
+ triple [z;p,q] is used in Lemma 3.2 in
1154
1155
  Walter D. Neumann, Extended Bloch group and the Cheeger-Chern-Simons class
1155
- http://arxiv.org/abs/math.GT/0307092
1156
+ https://arxiv.org/abs/math.GT/0307092
1156
1157
  """
1157
1158
  if not key_z[:2] == 'z_':
1158
1159
  raise Exception("Need to be called with cross ratio variable z_....")
1159
1160
  key_zp = 'zp_' + key_z[2:]
1160
-
1161
- w, z, p = self[key_z]
1161
+
1162
+ w, z, p = self[key_z]
1162
1163
  wp, zp, q_canonical_branch_cut = self[key_zp]
1163
1164
 
1164
1165
  # Note that the q in l(z;p,q) and in Definition 3.1 are different if
1165
1166
  # z is on the real axis and > 1!!!
1166
- # Thus we need to compute the q again here according to the formula
1167
+ # Thus we need to compute the q again here according to the formula
1167
1168
  # for l(z;p,q)
1168
1169
 
1169
1170
  pari_z = _convert_to_pari_float(z)
@@ -1174,7 +1175,7 @@ class Flattenings(dict):
1174
1175
 
1175
1176
  return (z, p, q_dilog_branch_cut)
1176
1177
 
1177
- def complex_volume(self, with_modulo = False):
1178
+ def complex_volume(self, with_modulo=False):
1178
1179
  """
1179
1180
  Compute complex volume. The complex volume is defined only up to
1180
1181
  some multiple of m where m = i * pi**2/6 for PSL(2,C) and SL(N,C)
@@ -1197,8 +1198,8 @@ class Flattenings(dict):
1197
1198
  if key[:2] == 'z_' ])
1198
1199
 
1199
1200
  cvol = sum_L_functions / pari('I')
1200
- vol = cvol.real()
1201
- cs = cvol.imag() % m
1201
+ vol = cvol.real()
1202
+ cs = cvol.imag() % m
1202
1203
 
1203
1204
  if cs > m/2 + pari('1e-12'):
1204
1205
  cs = cs - m
@@ -1206,17 +1207,17 @@ class Flattenings(dict):
1206
1207
  cvol = vol + cs * pari('I')
1207
1208
 
1208
1209
  if with_modulo:
1209
- if not self._evenN in [2, 6]:
1210
+ if self._evenN not in [2, 6]:
1210
1211
  raise Exception("Unknown torsion")
1211
1212
 
1212
1213
  return cvol, m * pari('I')
1213
1214
  return cvol
1214
1215
 
1215
- def check_against_manifold(self, M = None, epsilon = 1e-10):
1216
+ def check_against_manifold(self, M=None, epsilon=1e-10):
1216
1217
  """
1217
1218
  Checks that the flattening really is a solution to the logarithmic
1218
- PGL(N,C) gluing equations of a manifold. Usage similar to
1219
- check_against_manifold of Ptolemy Coordinates, see
1219
+ PGL(N,C) gluing equations of a manifold. Usage similar to
1220
+ check_against_manifold of Ptolemy Coordinates, see
1220
1221
  help(ptolemy.Coordinates) for similar examples.
1221
1222
 
1222
1223
  === Arguments ===
@@ -1237,28 +1238,28 @@ class Flattenings(dict):
1237
1238
  _check_relation(
1238
1239
  w - (z.log() + f * p),
1239
1240
  epsilon,
1240
- "Flattening relation w != log(z) + PiI * p")
1241
+ "Flattening relation w == log(z) + PiI * p")
1241
1242
 
1242
1243
  for k in list(self.keys()):
1243
1244
  if k[:2] == 'z_':
1244
- w, z, p = self[k]
1245
- wp, zp, q = self['zp_'+k[2:]]
1245
+ w, z, p = self[k]
1246
+ wp, zp, q = self['zp_'+k[2:]]
1246
1247
  wpp, zpp, r = self['zpp_'+k[2:]]
1247
1248
  _check_relation(
1248
1249
  w + wp + wpp,
1249
1250
  epsilon,
1250
- "Flattening relation w0 + w1 + w2 != 0")
1251
+ "Flattening relation w0 + w1 + w2 == 0")
1251
1252
 
1252
1253
  some_z = list(self.keys())[0]
1253
1254
  variable_name, index, tet_index = some_z.split('_')
1254
- if not variable_name in ['z', 'zp', 'zpp']:
1255
+ if variable_name not in ['z', 'zp', 'zpp']:
1255
1256
  raise Exception("Variable not z, zp, or, zpp")
1256
- if not len(index) == 4:
1257
+ if len(index) != 4:
1257
1258
  raise Exception("Not 4 indices")
1258
1259
  N = sum([int(x) for x in index]) + 2
1259
1260
 
1260
1261
  matrix_with_explanations = M.gluing_equations_pgl(
1261
- N, equation_type = 'all')
1262
+ N, equation_type='all')
1262
1263
 
1263
1264
  matrix = matrix_with_explanations.matrix
1264
1265
  rows = matrix_with_explanations.explain_rows
@@ -1275,35 +1276,36 @@ class Flattenings(dict):
1275
1276
  epsilon,
1276
1277
  "Gluing equation %s" % rows[row])
1277
1278
 
1278
- class CrossRatios(dict):
1279
+
1280
+ class CrossRatios(dict):
1279
1281
  """
1280
1282
  Represents assigned shape parameters/cross ratios as
1281
1283
  dictionary. The cross ratios are according to SnapPy convention, so we
1282
1284
  have::
1283
-
1285
+
1284
1286
  z = 1 - 1/zp, zp = 1 - 1/zpp, zpp = 1 - 1/z
1285
-
1287
+
1286
1288
  where::
1287
-
1289
+
1288
1290
  z is at the edge 01 and equal to s0 * s1 * (c_1010 * c_0101) / (c_1001 * c_0110)
1289
1291
  zp is at the edge 02 and equal to s0 * s2 * (c_1001 * c_0110) / (c_1100 * c_0011)
1290
1292
  zpp is at the edge 03 and equal to s0 * s3 * (c_1100 * c_0011) / (c_0101 * c_1010).
1291
1293
 
1292
- Note that this is different from the convention used in
1294
+ Note that this is different from the convention used in
1293
1295
  Garoufalidis, Goerner, Zickert:
1294
- Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
1295
- http://arxiv.org/abs/1207.6711
1296
+ Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
1297
+ https://arxiv.org/abs/1207.6711
1296
1298
  """
1297
-
1298
- def __init__(self, d, is_numerical = True, manifold_thunk = None):
1299
- super(CrossRatios, self).__init__(d)
1299
+
1300
+ def __init__(self, d, is_numerical=True, manifold_thunk=None):
1301
+ super().__init__(d)
1300
1302
  self._is_numerical = is_numerical
1301
1303
  self._manifold_thunk = manifold_thunk
1302
1304
 
1303
1305
  # Caches the matrices that label the short and long edges
1304
1306
  # of the truncated simplices building the manifold
1305
1307
  self._edge_cache = {}
1306
-
1308
+
1307
1309
  # Caches the images of a fundamental group generator
1308
1310
  self._matrix_cache = []
1309
1311
  self._inverse_matrix_cache = []
@@ -1311,25 +1313,25 @@ class CrossRatios(dict):
1311
1313
  self.dimension = 0
1312
1314
 
1313
1315
  @staticmethod
1314
- def from_snappy_manifold(M, dec_prec = None, bits_prec = None,
1315
- intervals = False):
1316
+ def from_snappy_manifold(M, dec_prec=None, bits_prec=None,
1317
+ intervals=False):
1316
1318
  """
1317
1319
  Constructs an assignment of shape parameters/cross ratios using
1318
1320
  the tetrahehdra_shapes method of a given SnapPy manifold. The optional
1319
1321
  parameters are the same as that of tetrahedra_shapes.
1320
1322
  """
1321
1323
 
1322
- shapes = M.tetrahedra_shapes('rect', dec_prec = dec_prec,
1323
- bits_prec = bits_prec,
1324
- intervals = intervals)
1324
+ shapes = M.tetrahedra_shapes('rect', dec_prec=dec_prec,
1325
+ bits_prec=bits_prec,
1326
+ intervals=intervals)
1325
1327
  d = {}
1326
1328
  for i, shape in enumerate(shapes):
1327
1329
  d['z_0000_%d' % i] = shape
1328
1330
  d['zp_0000_%d' % i] = 1 / (1 - shape)
1329
1331
  d['zpp_0000_%d' % i] = 1 - 1 / shape
1330
-
1331
- return CrossRatios(d, is_numerical = True,
1332
- manifold_thunk = lambda M = M: M)
1332
+
1333
+ return CrossRatios(d, is_numerical=True,
1334
+ manifold_thunk=lambda M=M: M)
1333
1335
 
1334
1336
  def __repr__(self):
1335
1337
  dict_repr = dict.__repr__(self)
@@ -1374,33 +1376,31 @@ class CrossRatios(dict):
1374
1376
  Turn exact solutions into numerical solutions using pari. Similar to
1375
1377
  numerical() of PtolemyCoordinates. See help(ptolemy.PtolemyCoordinates)
1376
1378
  for example.
1377
- """
1379
+ """
1378
1380
  if self._is_numerical:
1379
1381
  return self
1380
1382
  return ZeroDimensionalComponent([
1381
- CrossRatios(d, is_numerical = True,
1382
- manifold_thunk = self._manifold_thunk)
1383
+ CrossRatios(d, is_numerical=True,
1384
+ manifold_thunk=self._manifold_thunk)
1383
1385
  for d in _to_numerical(self) ])
1384
1386
 
1385
1387
  def to_PUR(self):
1386
-
1387
1388
  """
1388
1389
  If any Ptolemy coordinates are given as Rational Univariate
1389
1390
  Representation, convert them to Polynomial Univariate Representation and
1390
1391
  return the result.
1391
1392
 
1392
1393
  See to_PUR of RUR.
1393
-
1394
+
1394
1395
  This conversion might lead to very large coefficients.
1395
1396
  """
1396
1397
 
1397
1398
  return CrossRatios(
1398
1399
  _apply_to_RURs(self, RUR.to_PUR),
1399
- is_numerical = self._is_numerical,
1400
- manifold_thunk = self._manifold_thunk)
1400
+ is_numerical=self._is_numerical,
1401
+ manifold_thunk=self._manifold_thunk)
1401
1402
 
1402
1403
  def multiply_terms_in_RUR(self):
1403
-
1404
1404
  """
1405
1405
  If a cross ratio is given as Rational Univariate Representation
1406
1406
  with numerator and denominator being a product, multiply the terms and
@@ -1411,14 +1411,13 @@ class CrossRatios(dict):
1411
1411
  This loses information about how the numerator and denominator are
1412
1412
  factorised.
1413
1413
  """
1414
-
1414
+
1415
1415
  return CrossRatios(
1416
1416
  _apply_to_RURs(self, RUR.multiply_terms),
1417
- is_numerical = self._is_numerical,
1418
- manifold_thunk = self._manifold_thunk)
1417
+ is_numerical=self._is_numerical,
1418
+ manifold_thunk=self._manifold_thunk)
1419
1419
 
1420
1420
  def multiply_and_simplify_terms_in_RUR(self):
1421
-
1422
1421
  """
1423
1422
  If a cross ratio is given as Rational Univariate Representation
1424
1423
  with numerator and denominator being a product, multiply the terms,
@@ -1430,13 +1429,13 @@ class CrossRatios(dict):
1430
1429
  factorised.
1431
1430
 
1432
1431
  """
1433
-
1432
+
1434
1433
  return CrossRatios(
1435
1434
  _apply_to_RURs(self, RUR.multiply_and_simplify_terms),
1436
- is_numerical = self._is_numerical,
1437
- manifold_thunk = self._manifold_thunk)
1435
+ is_numerical=self._is_numerical,
1436
+ manifold_thunk=self._manifold_thunk)
1438
1437
 
1439
- def volume_numerical(self, drop_negative_vols = False):
1438
+ def volume_numerical(self, drop_negative_vols=False):
1440
1439
  """
1441
1440
  Turn into (Galois conjugate) numerical solutions and compute volumes.
1442
1441
  If already numerical, only compute the one volume.
@@ -1475,8 +1474,8 @@ class CrossRatios(dict):
1475
1474
  and the conventions in Definition 4.2 of
1476
1475
 
1477
1476
  Garoufalidis, Goerner, Zickert:
1478
- Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
1479
- http://arxiv.org/abs/1207.6711
1477
+ Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
1478
+ https://arxiv.org/abs/1207.6711
1480
1479
  """
1481
1480
 
1482
1481
  postfix = '_%d%d%d%d' % tuple(pt) + '_%d' % tet
@@ -1486,7 +1485,7 @@ class CrossRatios(dict):
1486
1485
 
1487
1486
  if tuple(edge) in [(1,0,1,0), (0,1,0,1)]:
1488
1487
  return self['zp' + postfix]
1489
-
1488
+
1490
1489
  if tuple(edge) in [(1,0,0,1), (0,1,1,0)]:
1491
1490
  return self['zpp' + postfix]
1492
1491
 
@@ -1499,8 +1498,8 @@ class CrossRatios(dict):
1499
1498
 
1500
1499
  See Definition 10.9:
1501
1500
  Garoufalidis, Goerner, Zickert:
1502
- Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
1503
- http://arxiv.org/abs/1207.6711
1501
+ Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
1502
+ https://arxiv.org/abs/1207.6711
1504
1503
  """
1505
1504
 
1506
1505
  result = 1
@@ -1508,7 +1507,7 @@ class CrossRatios(dict):
1508
1507
  for v0 in range(4):
1509
1508
  for v1 in range(v0 + 1, 4):
1510
1509
  e = [ _kronecker_delta(v0, i) +
1511
- _kronecker_delta(v1, i) for i in range(4) ]
1510
+ _kronecker_delta(v1, i) for i in range(4) ]
1512
1511
  p = [ x1 - x2 for x1, x2 in zip(pt, e) ]
1513
1512
  if all(x >= 0 for x in p):
1514
1513
  result *= self._shape_at_tet_point_and_edge(tet, p, e)
@@ -1519,7 +1518,7 @@ class CrossRatios(dict):
1519
1518
 
1520
1519
  # Get N
1521
1520
  N = self.N()
1522
-
1521
+
1523
1522
  return [[_kronecker_delta(i, j) for i in range(N)] for j in range(N)]
1524
1523
 
1525
1524
  def long_edge(self, tet, v0, v1, v2):
@@ -1530,30 +1529,30 @@ class CrossRatios(dict):
1530
1529
 
1531
1530
  This matrix was labeled alpha^{v0v1v2} in Figure 18 of
1532
1531
  Garoufalidis, Goerner, Zickert:
1533
- Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
1534
- http://arxiv.org/abs/1207.6711
1532
+ Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
1533
+ https://arxiv.org/abs/1207.6711
1535
1534
 
1536
1535
  It is computed using equation 10.22.
1537
-
1536
+
1538
1537
  The resulting matrix is given as a python list of lists.
1539
1538
  """
1540
-
1539
+
1541
1540
  # Key for cache
1542
1541
  key = 'long_edge'
1543
1542
 
1544
1543
  # Fill cache if necessary
1545
- if not key in self._edge_cache:
1546
-
1544
+ if key not in self._edge_cache:
1545
+
1547
1546
  # Get N
1548
1547
  N = self.N()
1549
-
1548
+
1550
1549
  # It is just the counter diagonal matrix
1551
1550
  m = [ [ _kronecker_delta(i+j, N-1) for i in range(N) ]
1552
1551
  for j in range(N)]
1553
1552
 
1554
1553
  # Set in cache
1555
1554
  self._edge_cache[key] = m
1556
-
1555
+
1557
1556
  return self._edge_cache[key]
1558
1557
 
1559
1558
  def middle_edge(self, tet, v0, v1, v2):
@@ -1564,11 +1563,11 @@ class CrossRatios(dict):
1564
1563
 
1565
1564
  This matrix was labeled beta^{v0v1v2} in Figure 18 of
1566
1565
  Garoufalidis, Goerner, Zickert:
1567
- Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
1568
- http://arxiv.org/abs/1207.6711
1566
+ Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
1567
+ https://arxiv.org/abs/1207.6711
1569
1568
 
1570
1569
  It is computed using equation 10.22.
1571
-
1570
+
1572
1571
  The resulting matrix is given as a python list of lists.
1573
1572
  """
1574
1573
 
@@ -1576,7 +1575,7 @@ class CrossRatios(dict):
1576
1575
  key = 'middle_%d_%d%d%d' % (tet, v0, v1, v2)
1577
1576
 
1578
1577
  # Fill cache if necessary
1579
- if not key in self._edge_cache:
1578
+ if key not in self._edge_cache:
1580
1579
 
1581
1580
  # Get N
1582
1581
  N = self.N()
@@ -1592,7 +1591,7 @@ class CrossRatios(dict):
1592
1591
  prod1 = self._get_identity_matrix()
1593
1592
  for i in range(1, N - k + 1):
1594
1593
  prod1 = matrix.matrix_mult(prod1, _X(N, i, 1))
1595
-
1594
+
1596
1595
  # Compute second product
1597
1596
  prod2 = self._get_identity_matrix()
1598
1597
  for i in range(1, N - k):
@@ -1618,10 +1617,10 @@ class CrossRatios(dict):
1618
1617
  for j in range(N) ]
1619
1618
 
1620
1619
  m = matrix.matrix_mult(m, dpm)
1621
-
1620
+
1622
1621
  # Set in cache
1623
1622
  self._edge_cache[key] = m
1624
-
1623
+
1625
1624
  return self._edge_cache[key]
1626
1625
 
1627
1626
  def short_edge(self, tet, v0, v1, v2):
@@ -1632,11 +1631,11 @@ class CrossRatios(dict):
1632
1631
 
1633
1632
  This matrix was labeled gamma^{v0v1v2} in Figure 18 of
1634
1633
  Garoufalidis, Goerner, Zickert:
1635
- Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
1636
- http://arxiv.org/abs/1207.6711
1634
+ Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
1635
+ https://arxiv.org/abs/1207.6711
1637
1636
 
1638
1637
  It is computed using equation 10.22.
1639
-
1638
+
1640
1639
  The resulting matrix is given as a python list of lists.
1641
1640
  """
1642
1641
 
@@ -1644,10 +1643,10 @@ class CrossRatios(dict):
1644
1643
  key = 'short_%d_%d%d%d' % (tet, v0, v1, v2)
1645
1644
 
1646
1645
  # Fill cache if necessary
1647
- if not key in self._edge_cache:
1646
+ if key not in self._edge_cache:
1648
1647
 
1649
1648
  edge = [ _kronecker_delta(v0, i) +
1650
- _kronecker_delta(v1, i) for i in range(4) ]
1649
+ _kronecker_delta(v1, i) for i in range(4) ]
1651
1650
 
1652
1651
  # The epsilon permutation sign
1653
1652
  sgn = CrossRatios._cyclic_three_perm_sign(v0, v1, v2)
@@ -1662,12 +1661,12 @@ class CrossRatios(dict):
1662
1661
  for a0 in range(N-1):
1663
1662
  a1 = N - 2 - a0
1664
1663
  pt = [ a0 * _kronecker_delta(v0, i) +
1665
- a1 * _kronecker_delta(v1, i) for i in range(4) ]
1664
+ a1 * _kronecker_delta(v1, i) for i in range(4) ]
1666
1665
 
1667
1666
  cross_ratio = self._shape_at_tet_point_and_edge(tet, pt, edge)
1668
1667
 
1669
1668
  # Multiply result with the H matrix
1670
-
1669
+
1671
1670
  # Note that the sgn is different from the paper
1672
1671
  # because we are using SnapPy conventions for
1673
1672
  # cross ratios here
@@ -1684,7 +1683,7 @@ class CrossRatios(dict):
1684
1683
  # fundamental group generators and their inverses
1685
1684
 
1686
1685
  if self._matrix_cache and self._inverse_matrix_cache:
1687
- return
1686
+ return
1688
1687
 
1689
1688
  # Compute all the matrices for the generators and there inverses
1690
1689
  # The long edges of the doubly truncated simplex are all unit
@@ -1692,9 +1691,9 @@ class CrossRatios(dict):
1692
1691
  # size of any polynomial coefficients. We thus don't give them penalty.
1693
1692
  self._matrix_cache, self._inverse_matrix_cache = (
1694
1693
  findLoops.images_of_original_generators(self,
1695
- penalties = (0, 1, 1)))
1694
+ penalties=(0, 1, 1)))
1696
1695
 
1697
- def evaluate_word(self, word, G = None):
1696
+ def evaluate_word(self, word, G=None):
1698
1697
  """
1699
1698
  Given a word in the generators of the fundamental group,
1700
1699
  compute the corresponding matrix. By default, these are the
@@ -1718,7 +1717,7 @@ class CrossRatios(dict):
1718
1717
  word,
1719
1718
  G)
1720
1719
 
1721
- def check_against_manifold(self, M = None, epsilon = None):
1720
+ def check_against_manifold(self, M=None, epsilon=None):
1722
1721
  """
1723
1722
  Checks that the given solution really is a solution to the PGL(N,C) gluing
1724
1723
  equations of a manifold. Usage similar to check_against_manifold of
@@ -1738,14 +1737,14 @@ class CrossRatios(dict):
1738
1737
 
1739
1738
  some_z = list(self.keys())[0]
1740
1739
  variable_name, index, tet_index = some_z.split('_')
1741
- if not variable_name in ['z', 'zp', 'zpp']:
1740
+ if variable_name not in ['z', 'zp', 'zpp']:
1742
1741
  raise Exception("Variable not z, zp, or, zpp")
1743
- if not len(index) == 4:
1742
+ if len(index) != 4:
1744
1743
  raise Exception("Not 4 indices")
1745
1744
  N = sum([int(x) for x in index]) + 2
1746
-
1745
+
1747
1746
  matrix_with_explanations = M.gluing_equations_pgl(
1748
- N, equation_type = 'all')
1747
+ N, equation_type='all')
1749
1748
 
1750
1749
  matrix = matrix_with_explanations.matrix
1751
1750
  rows = matrix_with_explanations.explain_rows
@@ -1770,7 +1769,7 @@ class CrossRatios(dict):
1770
1769
  SL(N,C) / {+1,-1} if N is even and is described in the Introduction of
1771
1770
  Garoufalidis, Thurston, Zickert
1772
1771
  The Complex Volume of SL(n,C)-Representations of 3-Manifolds
1773
- http://arxiv.org/abs/1111.2828
1772
+ https://arxiv.org/abs/1111.2828
1774
1773
 
1775
1774
  There is a canonical group homomorphism SL(2,C)->SL(N,C) coming from
1776
1775
  the the natural SL(2,C)-action on the vector space Sym^{N-1}(C^2).
@@ -1782,7 +1781,7 @@ class CrossRatios(dict):
1782
1781
 
1783
1782
  num_tetrahedra = self.num_tetrahedra()
1784
1783
 
1785
- if not self.N() == 2:
1784
+ if self.N() != 2:
1786
1785
  raise Exception(
1787
1786
  "Cross ratios need to come from a PSL(2,C) representation")
1788
1787
 
@@ -1796,20 +1795,18 @@ class CrossRatios(dict):
1796
1795
  for v in ['z', 'zp', 'zpp']
1797
1796
  for t in range(num_tetrahedra)
1798
1797
  for index in utilities.quadruples_with_fixed_sum_iterator(N-2)])
1799
-
1798
+
1800
1799
  return CrossRatios(d,
1801
- is_numerical = self._is_numerical,
1802
- manifold_thunk = self._manifold_thunk)
1803
-
1800
+ is_numerical=self._is_numerical,
1801
+ manifold_thunk=self._manifold_thunk)
1804
1802
 
1805
1803
  def is_real(self, epsilon):
1806
-
1807
1804
  """
1808
1805
  Returns True if all cross ratios are real (have absolute imaginary
1809
1806
  part < epsilon where epsilon is given as argument).
1810
1807
  This means that the corresponding representation is in PSL(N,R).
1811
1808
  """
1812
-
1809
+
1813
1810
  if not self._is_numerical:
1814
1811
  raise NumericalMethodError("is_real")
1815
1812
 
@@ -1818,8 +1815,7 @@ class CrossRatios(dict):
1818
1815
  return False
1819
1816
  return True
1820
1817
 
1821
- def is_induced_from_psl2(self, epsilon = None):
1822
-
1818
+ def is_induced_from_psl2(self, epsilon=None):
1823
1819
  """
1824
1820
  For each simplex and each edges, checks that all cross ratios of that
1825
1821
  simplex that are parallel to that each are the same (maximal absolute
@@ -1832,28 +1828,28 @@ class CrossRatios(dict):
1832
1828
  d = { }
1833
1829
 
1834
1830
  for key, value in self.items():
1835
- variable_name, index, tet_index = key.split('_')
1836
- if not variable_name in ['z', 'zp', 'zpp']:
1837
- raise Exception("Variable not z, zp, or, zpp")
1838
- if not len(index) == 4:
1839
- raise Exception("Not 4 indices")
1831
+ variable_name, index, tet_index = key.split('_')
1832
+ if variable_name not in ['z', 'zp', 'zpp']:
1833
+ raise Exception("Variable not z, zp, or, zpp")
1834
+ if len(index) != 4:
1835
+ raise Exception("Not 4 indices")
1840
1836
 
1841
- # The key in the auxiliary dictionary
1842
- short_key = variable_name + '_' + tet_index
1837
+ # The key in the auxiliary dictionary
1838
+ short_key = variable_name + '_' + tet_index
1843
1839
 
1844
- # Get the old value in the auxiliary dictionary
1845
- old_value = d.setdefault(short_key, value)
1840
+ # Get the old value in the auxiliary dictionary
1841
+ old_value = d.setdefault(short_key, value)
1846
1842
 
1847
- if epsilon is None:
1848
- if not value == old_value:
1849
- return False
1850
- else:
1851
- if (value - old_value).abs() > epsilon:
1852
- return False
1843
+ if epsilon is None:
1844
+ if value != old_value:
1845
+ return False
1846
+ else:
1847
+ if (value - old_value).abs() > epsilon:
1848
+ return False
1853
1849
 
1854
1850
  return True
1855
1851
 
1856
- def is_pu_2_1_representation(self, epsilon, epsilon2 = None):
1852
+ def is_pu_2_1_representation(self, epsilon, epsilon2=None):
1857
1853
  r"""
1858
1854
  Returns True if the representation is also a
1859
1855
  PU(2,1)-representation. This uses Proposition 3.5 and the
@@ -1916,49 +1912,56 @@ class CrossRatios(dict):
1916
1912
 
1917
1913
  return True
1918
1914
 
1919
- if not self.N() == 3:
1915
+ if self.N() != 3:
1920
1916
  raise Exception("PU(2,1)-representations only allowed for N = 3")
1921
1917
 
1922
1918
  if not self._is_numerical:
1923
1919
  raise NumericalMethodError("is_pu_2_1_representation")
1924
1920
 
1925
1921
  for t in range(self.num_tetrahedra()):
1926
-
1922
+
1927
1923
  m0 = mainCondition("z_1000_%d" % t, "z_0100_%d" % t,
1928
1924
  "z_0010_%d" % t, "z_0001_%d" % t)
1929
- if not m0: return m0
1925
+ if not m0:
1926
+ return m0
1930
1927
 
1931
1928
  m1 = mainCondition("zp_1000_%d" % t, "zp_0010_%d" % t,
1932
1929
  "zp_0100_%d" % t, "zp_0001_%d" % t)
1933
- if not m1: return m1
1930
+ if not m1:
1931
+ return m1
1934
1932
 
1935
1933
  m2 = mainCondition("zpp_1000_%d" % t, "zpp_0001_%d" % t,
1936
1934
  "zpp_0100_%d" % t, "zpp_0010_%d" % t)
1937
- if not m2: return m2
1935
+ if not m2:
1936
+ return m2
1938
1937
 
1939
1938
  t0 = tripleRatioCondition( "z_0100_%d" % t,
1940
1939
  "zp_0010_%d" % t,
1941
1940
  "zpp_0001_%d" % t)
1942
- if not t0: return t0
1941
+ if not t0:
1942
+ return t0
1943
1943
 
1944
1944
  t1 = tripleRatioCondition( "z_1000_%d" % t,
1945
1945
  "zp_0001_%d" % t,
1946
1946
  "zpp_0010_%d" % t)
1947
- if not t1: return t1
1947
+ if not t1:
1948
+ return t1
1948
1949
 
1949
1950
  t2 = tripleRatioCondition( "z_0001_%d" % t,
1950
1951
  "zp_1000_%d" % t,
1951
1952
  "zpp_0100_%d" % t)
1952
- if not t2: return t2
1953
+ if not t2:
1954
+ return t2
1953
1955
 
1954
1956
  t3 = tripleRatioCondition( "z_0010_%d" % t,
1955
1957
  "zp_0100_%d" % t,
1956
1958
  "zpp_1000_%d" % t)
1957
- if not t3: return t3
1959
+ if not t3:
1960
+ return t3
1958
1961
 
1959
1962
  return True
1960
-
1961
- def is_geometric(self, epsilon = 1e-6):
1963
+
1964
+ def is_geometric(self, epsilon=1e-6):
1962
1965
  """
1963
1966
  Returns true if all shapes corresponding to this solution have positive
1964
1967
  imaginary part.
@@ -1981,10 +1984,11 @@ class CrossRatios(dict):
1981
1984
  return True
1982
1985
  return False
1983
1986
 
1987
+
1984
1988
  def _ptolemy_to_cross_ratio(solution_dict,
1985
- branch_factor = 1,
1986
- non_trivial_generalized_obstruction_class = False,
1987
- as_flattenings = False):
1989
+ branch_factor=1,
1990
+ non_trivial_generalized_obstruction_class=False,
1991
+ as_flattenings=False):
1988
1992
 
1989
1993
  N, has_obstruction = _N_and_has_obstruction_for_ptolemys(solution_dict)
1990
1994
  num_tets = _num_tetrahedra(solution_dict)
@@ -2017,17 +2021,17 @@ def _ptolemy_to_cross_ratio(solution_dict,
2017
2021
  c1100 = get_ptolemy_coordinate((1,1,0,0))
2018
2022
  c0011 = get_ptolemy_coordinate((0,0,1,1))
2019
2023
 
2020
- z = (c1010 * c0101) / (c1001 * c0110)
2021
- zp = - (c1001 * c0110) / (c1100 * c0011)
2022
- zpp = (c1100 * c0011) / (c1010 * c0101)
2024
+ z = (c1010 * c0101) / (c1001 * c0110)
2025
+ zp = - (c1001 * c0110) / (c1100 * c0011)
2026
+ zpp = (c1100 * c0011) / (c1010 * c0101)
2023
2027
 
2024
2028
  if has_obstruction:
2025
2029
  s0 = get_obstruction_variable(0)
2026
2030
  s1 = get_obstruction_variable(1)
2027
2031
  s2 = get_obstruction_variable(2)
2028
2032
  s3 = get_obstruction_variable(3)
2029
- z = s0 * s1 * z
2030
- zp = s0 * s2 * zp
2033
+ z = s0 * s1 * z
2034
+ zp = s0 * s2 * zp
2031
2035
  zpp = s0 * s3 * zpp
2032
2036
 
2033
2037
  variable_end = '_%d%d%d%d' % tuple(index) + '_%d' % tet
@@ -2043,50 +2047,53 @@ def _ptolemy_to_cross_ratio(solution_dict,
2043
2047
  branch_factor, evenN)
2044
2048
  wpp = _compute_flattening(c1100, c0011, c1010, c0101,
2045
2049
  branch_factor, evenN)
2046
-
2050
+
2047
2051
  return [
2048
- ('z' + variable_end, make_triple(w ,z )),
2049
- ('zp' + variable_end, make_triple(wp ,zp )),
2052
+ ('z' + variable_end, make_triple(w ,z )),
2053
+ ('zp' + variable_end, make_triple(wp ,zp )),
2050
2054
  ('zpp' + variable_end, make_triple(wpp,zpp)) ]
2051
2055
 
2052
2056
  else:
2053
2057
  return [
2054
- ('z' + variable_end, z),
2055
- ('zp' + variable_end, zp),
2058
+ ('z' + variable_end, z),
2059
+ ('zp' + variable_end, zp),
2056
2060
  ('zpp' + variable_end, zpp) ]
2057
-
2061
+
2058
2062
  return dict(
2059
- sum([compute_cross_ratios_and_flattenings(tet,index)
2060
- for tet in range(num_tets)
2063
+ sum([compute_cross_ratios_and_flattenings(tet,index)
2064
+ for tet in range(num_tets)
2061
2065
  for index in utilities.quadruples_with_fixed_sum_iterator(N - 2)],
2062
2066
  [])), evenN
2063
2067
 
2068
+
2064
2069
  def _num_tetrahedra(solution_dict):
2065
2070
  return max( [ int(key.split('_')[-1])
2066
2071
  for key in solution_dict.keys() ] ) + 1
2067
2072
 
2073
+
2068
2074
  def _N_for_shapes(solution_dict):
2069
-
2075
+
2070
2076
  def get_N(key):
2071
2077
  m = re.match(r'zp{0,2}_(\d{4})_\d+$', key)
2072
2078
  if not m:
2073
2079
  raise Exception("Not a valid shape key: '%s'" % key)
2074
2080
  return sum([int(char) for char in m.group(1)]) + 2
2075
-
2081
+
2076
2082
  l = [ get_N(key) for key in solution_dict.keys() ]
2077
2083
  if not len(set(l)) == 1:
2078
2084
  raise Exception("Shape keys for different N")
2079
-
2085
+
2080
2086
  return l[0]
2081
2087
 
2088
+
2082
2089
  def _N_and_has_obstruction_for_ptolemys(solution_dict):
2083
-
2090
+
2084
2091
  def get_N(key):
2085
2092
  m = re.match(r'c_(\d{4})_\d+$', key)
2086
2093
  if not m:
2087
2094
  raise Exception("Not a valid Ptolemy key: '%s'" % key)
2088
2095
  return sum([int(char) for char in m.group(1)])
2089
-
2096
+
2090
2097
  has_obstruction = False
2091
2098
 
2092
2099
  l = set()
@@ -2102,9 +2109,10 @@ def _N_and_has_obstruction_for_ptolemys(solution_dict):
2102
2109
  for N in l:
2103
2110
  return N, has_obstruction
2104
2111
 
2112
+
2105
2113
  def _get_number_field(d):
2106
2114
  for value in d.values():
2107
-
2115
+
2108
2116
  if isinstance(value, RUR):
2109
2117
  nf = value.number_field()
2110
2118
  if nf:
@@ -2115,6 +2123,7 @@ def _get_number_field(d):
2115
2123
 
2116
2124
  return None
2117
2125
 
2126
+
2118
2127
  def _evaluate_at_root(p, root):
2119
2128
 
2120
2129
  if type(p) == Gen and p.type() == 't_POLMOD':
@@ -2124,7 +2133,8 @@ def _evaluate_at_root(p, root):
2124
2133
  return p.evaluate_at_root(root)
2125
2134
 
2126
2135
  return p
2127
-
2136
+
2137
+
2128
2138
  def _to_numerical(d):
2129
2139
 
2130
2140
  number_field = _get_number_field(d)
@@ -2139,16 +2149,16 @@ def _to_numerical(d):
2139
2149
  def evaluate_all_for_root(root):
2140
2150
 
2141
2151
  def evaluate_key_for_root(key, value):
2142
-
2152
+
2143
2153
  v = _evaluate_at_root(value, root)
2144
-
2154
+
2145
2155
  if key[:2] == 'z_':
2146
- z = v
2147
- zp = 1 / (1 - z)
2156
+ z = v
2157
+ zp = 1 / (1 - z)
2148
2158
  zpp = 1 - 1 / z
2149
2159
 
2150
- return [(key, z),
2151
- ('zp_' + key[2:], zp),
2160
+ return [(key, z),
2161
+ ('zp_' + key[2:], zp),
2152
2162
  ('zpp_' + key[2:], zpp)]
2153
2163
  elif key[:3] == 'zp_' or key[:4] == 'zpp_':
2154
2164
  return []
@@ -2161,24 +2171,26 @@ def _to_numerical(d):
2161
2171
 
2162
2172
  return [ evaluate_all_for_root(root) for root in roots ]
2163
2173
 
2174
+
2164
2175
  def _apply_to_RURs(d, RUR_method):
2165
-
2176
+
2166
2177
  def _apply_to_RUR(v):
2167
2178
  if isinstance(v, RUR):
2168
2179
  return RUR_method(v)
2169
2180
  return v
2170
-
2171
- return dict( [ (k, _apply_to_RUR(v)) for k, v in d.items() ] )
2181
+
2182
+ return {k: _apply_to_RUR(v) for k, v in d.items()}
2172
2183
 
2173
2184
 
2174
2185
  def _convert_to_pari_float(z):
2175
2186
 
2176
2187
  if type(z) == Gen and z.type() in ['t_INT', 't_FRAC']:
2177
2188
  return z * pari('1.0')
2178
-
2189
+
2179
2190
  return pari(z)
2180
-
2181
- def _compute_flattening(a, b, c, d, branch_factor, N = 2):
2191
+
2192
+
2193
+ def _compute_flattening(a, b, c, d, branch_factor, N=2):
2182
2194
 
2183
2195
  PiMinusEpsilon = pari(3.141592)
2184
2196
 
@@ -2202,10 +2214,12 @@ def _compute_flattening(a, b, c, d, branch_factor, N = 2):
2202
2214
 
2203
2215
  # bug in pari
2204
2216
 
2217
+
2205
2218
  def _dilog(z):
2206
2219
  return pari("dilog(%s)" % z)
2207
2220
 
2208
- def _L_function(zpq_triple, evenN = 2):
2221
+
2222
+ def _L_function(zpq_triple, evenN=2):
2209
2223
 
2210
2224
  z, p, q = zpq_triple
2211
2225
 
@@ -2220,12 +2234,14 @@ def _L_function(zpq_triple, evenN = 2):
2220
2234
  + (z.log() + p * f) * ((1-z).log() + q * f) / 2
2221
2235
  - Pi2 / 6)
2222
2236
 
2237
+
2223
2238
  def _volume(z):
2224
-
2239
+
2225
2240
  z = _convert_to_pari_float(z)
2226
-
2241
+
2227
2242
  return (1-z).arg() * z.abs().log() + _dilog(z).imag()
2228
2243
 
2244
+
2229
2245
  def _kronecker_delta(i, j):
2230
2246
  """
2231
2247
  Kronecker Delta, returns 1 if and only if i and j are equal, other 0.
@@ -2236,35 +2252,36 @@ def _kronecker_delta(i, j):
2236
2252
  else:
2237
2253
  return 0
2238
2254
 
2239
- def _X(N, k, v):
2240
2255
 
2256
+ def _X(N, k, v):
2241
2257
  """
2242
2258
  Returns the NxN matrix with off-diagonal entry v at position k, that
2243
2259
  is the entry at row k and column k+1 is v.
2244
2260
 
2245
2261
  See (10.2) of
2246
2262
  Garoufalidis, Goerner, Zickert:
2247
- Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
2248
- http://arxiv.org/abs/1207.6711
2263
+ Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
2264
+ https://arxiv.org/abs/1207.6711
2249
2265
  """
2250
2266
 
2251
2267
  m = [[_kronecker_delta(i,j) for i in range(N)] for j in range(N)]
2252
2268
  m[k-1][k] = v
2253
2269
  return m
2254
2270
 
2271
+
2255
2272
  def _H(N, k, x):
2256
2273
  """
2257
2274
  Returns the NxN diagonal matrix where the first k diagonal entries are x
2258
2275
  and all other entries are 1.
2259
-
2276
+
2260
2277
  See (10.1) of
2261
2278
  Garoufalidis, Goerner, Zickert:
2262
- Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
2263
- http://arxiv.org/abs/1207.6711
2279
+ Gluing Equations for PGL(n,C)-Representations of 3-Manifolds
2280
+ https://arxiv.org/abs/1207.6711
2264
2281
  """
2265
2282
 
2266
2283
  def _entry(i, j):
2267
- if not i == j:
2284
+ if i != j:
2268
2285
  return 0
2269
2286
  if i < k:
2270
2287
  return x