3-manifolds / SnapPy

SnapPy is a package for studying the topology and geometry of 3-manifolds, with a focus on hyperbolic structures. It is based on the SnapPea kernel written by Jeff Weeks.
https://snappy.computop.org/
84 stars 39 forks source link

some micro-enhancements about usage of all() #39

Closed fchapoton closed 2 years ago

fchapoton commented 2 years ago

using iterators inside for better efficiency

slel commented 2 years ago

In python/snap/polished_reps.py, another possible micro-enhancement:

 def is_essentially_Id2(M, error=10**-3):
     diff = M - identity(M)
-    R = diff.base_ring()
-    return all(abs(d) < R(error) for d in diff.list())
+    error = diff.base_ring()(error)
+    return all(abs(d) < error for d in diff.list())
fchapoton commented 2 years ago

ok, voilà

fchapoton commented 2 years ago

ping ? 🎁