Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/sage/geometry/hyperbolic_space/hyperbolic_coercion.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ def SL2R_to_SO21(A):
sage: from sage.geometry.hyperbolic_space.hyperbolic_coercion import SL2R_to_SO21
sage: A = SL2R_to_SO21(identity_matrix(2))
sage: J = matrix([[1,0,0],[0,1,0],[0,0,-1]]) #Lorentzian Gram matrix
sage: norm(A.transpose()*J*A - J) < 10**-4
sage: norm(A.transpose()*J*A - J) < 10**-4 # needs scipy
True
"""
a, b, c, d = (A/A.det().sqrt()).list()
Expand Down Expand Up @@ -689,7 +689,7 @@ def SO21_to_SL2R(M):
EXAMPLES::

sage: from sage.geometry.hyperbolic_space.hyperbolic_coercion import SO21_to_SL2R
sage: (SO21_to_SL2R(identity_matrix(3)) - identity_matrix(2)).norm() < 10**-4
sage: (SO21_to_SL2R(identity_matrix(3)) - identity_matrix(2)).norm() < 10**-4 # needs scipy
True
"""
####################################################################
Expand Down
6 changes: 3 additions & 3 deletions src/sage/geometry/hyperbolic_space/hyperbolic_geodesic.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ def reflection_involution(self):
sage: g = HM.get_geodesic((0,0,1), (1,0, n(sqrt(2))))
sage: A = g.reflection_involution()
sage: B = diagonal_matrix([1, -1, 1])
sage: bool((B - A.matrix()).norm() < 10**-9)
sage: bool((B - A.matrix()).norm() < 10**-9) # needs scipy
True

The above tests go through the Upper Half Plane. It remains to
Expand Down Expand Up @@ -1602,7 +1602,7 @@ def perpendicular_bisector(self): # UHP
....: return bool(x.dist(m) < 1e-9)
sage: c, d, e = CC(1, 1), CC(2, 1), CC(2, 0.5)
sage: pairs = [(c, d), (d, c), (c, e), (e, c), (d, e), (e, d)]
sage: all(bisector_gets_midpoint(a, b) for a, b in pairs)
sage: all(bisector_gets_midpoint(a, b) for a, b in pairs) # needs scipy
True
"""
if self.length() == infinity:
Expand Down Expand Up @@ -2379,7 +2379,7 @@ def _plot_vertices(self, points=75):
sage: p1 = HM.get_point((4, -4, sqrt(33)))
sage: p2 = HM.get_point((-3,-3,sqrt(19)))
sage: g = HM.get_geodesic(p1, p2)
sage: g._plot_vertices(5)
sage: g._plot_vertices(5) # needs sage.plot
[(4.0, -4.0, 5.744562...),
(1.363213..., -1.637073..., 2.353372...),
(0.138568..., -0.969980..., 1.400022...),
Expand Down
1 change: 1 addition & 0 deletions src/sage/geometry/hyperbolic_space/hyperbolic_isometry.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# sage.doctest: needs scipy
r"""
Hyperbolic Isometries

Expand Down
23 changes: 12 additions & 11 deletions src/sage/geometry/hyperbolic_space/hyperbolic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,13 +488,13 @@ def get_isometry(self, A):
[1 0]
[0 1]

sage: HyperbolicPlane().KM().get_isometry(identity_matrix(3))
sage: HyperbolicPlane().KM().get_isometry(identity_matrix(3)) # needs scipy
Isometry in KM
[1 0 0]
[0 1 0]
[0 0 1]

sage: HyperbolicPlane().HM().get_isometry(identity_matrix(3))
sage: HyperbolicPlane().HM().get_isometry(identity_matrix(3)) # needs scipy
Isometry in HM
[1 0 0]
[0 1 0]
Expand Down Expand Up @@ -586,6 +586,7 @@ def random_isometry(self, preserve_orientation=True, **kwargs):

EXAMPLES::

sage: # needs scipy
sage: A = HyperbolicPlane().PD().random_isometry()
sage: A.preserves_orientation()
True
Expand Down Expand Up @@ -934,7 +935,7 @@ def get_background_graphic(self, **bdry_options):

EXAMPLES::

sage: hp = HyperbolicPlane().UHP().get_background_graphic()
sage: hp = HyperbolicPlane().UHP().get_background_graphic() # needs sage.plot
"""
from sage.plot.line import line
bd_min = bdry_options.get('bd_min', -5)
Expand Down Expand Up @@ -1104,9 +1105,9 @@ def random_isometry(self, preserve_orientation=True, **kwargs):

EXAMPLES::

sage: A = HyperbolicPlane().UHP().random_isometry()
sage: B = HyperbolicPlane().UHP().random_isometry(preserve_orientation=False)
sage: B.preserves_orientation()
sage: A = HyperbolicPlane().UHP().random_isometry() # needs scipy
sage: B = HyperbolicPlane().UHP().random_isometry(preserve_orientation=False) # needs scipy
sage: B.preserves_orientation() # needs scipy
False
"""
[a, b, c, d] = [RR.random_element() for k in range(4)]
Expand Down Expand Up @@ -1272,7 +1273,7 @@ def get_background_graphic(self, **bdry_options):

EXAMPLES::

sage: circ = HyperbolicPlane().PD().get_background_graphic()
sage: circ = HyperbolicPlane().PD().get_background_graphic() # needs sage.plot
"""
from sage.plot.circle import circle
return circle((0, 0), 1, axes=False, color='black')
Expand Down Expand Up @@ -1380,7 +1381,7 @@ def isometry_in_model(self, A):
EXAMPLES::

sage: A = matrix(3, [[1, 0, 0], [0, 17/8, 15/8], [0, 15/8, 17/8]])
sage: HyperbolicPlane().KM().isometry_in_model(A)
sage: HyperbolicPlane().KM().isometry_in_model(A) # needs scipy
True
"""
if isinstance(A, HyperbolicIsometry):
Expand All @@ -1396,7 +1397,7 @@ def get_background_graphic(self, **bdry_options):

EXAMPLES::

sage: circ = HyperbolicPlane().KM().get_background_graphic()
sage: circ = HyperbolicPlane().KM().get_background_graphic() # needs sage.plot
"""
from sage.plot.circle import circle
return circle((0, 0), 1, axes=False, color='black')
Expand Down Expand Up @@ -1490,7 +1491,7 @@ def isometry_in_model(self, A):
EXAMPLES::

sage: A = diagonal_matrix([1,1,-1])
sage: HyperbolicPlane().HM().isometry_in_model(A)
sage: HyperbolicPlane().HM().isometry_in_model(A) # needs scipy
True
"""
if isinstance(A, HyperbolicIsometry):
Expand All @@ -1505,7 +1506,7 @@ def get_background_graphic(self, **bdry_options):

EXAMPLES::

sage: H = HyperbolicPlane().HM().get_background_graphic()
sage: H = HyperbolicPlane().HM().get_background_graphic() # needs sage.plot
"""
from sage.plot.plot3d.all import plot3d
from sage.symbolic.ring import SR
Expand Down
12 changes: 6 additions & 6 deletions src/sage/geometry/hyperbolic_space/hyperbolic_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def __rmul__(self, other):
We also lift matrices into isometries::

sage: B = diagonal_matrix([-1, -1, 1])
sage: B = HyperbolicPlane().HM().get_isometry(B)
sage: B = HyperbolicPlane().HM().get_isometry(B) # needs scipy
sage: B * HyperbolicPlane().HM().get_point((0, 1, sqrt(2)))
Point in HM (0, -1, sqrt(2))
"""
Expand Down Expand Up @@ -491,7 +491,7 @@ def symmetry_involution(self):
sage: A.preserves_orientation()
True

sage: A*A == HyperbolicPlane().UHP().get_isometry(identity_matrix(2))
sage: A*A == HyperbolicPlane().UHP().get_isometry(identity_matrix(2)) # needs scipy
True
"""
R = self.parent().realization_of().a_realization()
Expand All @@ -508,11 +508,11 @@ def show(self, boundary=True, **options):

EXAMPLES::

sage: HyperbolicPlane().PD().get_point(0).show()
sage: HyperbolicPlane().PD().get_point(0).show() # needs sage.plot
Graphics object consisting of 2 graphics primitives
sage: HyperbolicPlane().KM().get_point((0,0)).show()
sage: HyperbolicPlane().KM().get_point((0,0)).show() # needs sage.plot
Graphics object consisting of 2 graphics primitives
sage: HyperbolicPlane().HM().get_point((0,0,1)).show()
sage: HyperbolicPlane().HM().get_point((0,0,1)).show() # needs sage.plot
Graphics3d Object
"""
p = self.coordinates()
Expand Down Expand Up @@ -587,7 +587,7 @@ def show(self, boundary=True, **options):

sage: HyperbolicPlane().UHP().get_point(I).show()
Graphics object consisting of 2 graphics primitives
sage: HyperbolicPlane().UHP().get_point(0).show()
sage: HyperbolicPlane().UHP().get_point(0).show() # needs sage.plot
Graphics object consisting of 2 graphics primitives
sage: HyperbolicPlane().UHP().get_point(infinity).show()
Traceback (most recent call last):
Expand Down
5 changes: 4 additions & 1 deletion src/sage/modules/free_module_integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,10 @@ def LLL(self, *args, **kwds):
basis = matrix(ZZ, len(basis), len(basis[0]), basis)
basis.set_immutable()

if self.reduced_basis[0].norm() > basis[0].norm():
b0 = basis[0]
rb0 = self.reduced_basis[0]

if rb0.dot_product(rb0) > b0.dot_product(b0):
self._reduced_basis = basis
return basis

Expand Down