Skip to content

Commit 98c1c91

Browse files
committed
One at a time
1 parent b59fb11 commit 98c1c91

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

src/sage/modules/free_module_integer.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -896,44 +896,6 @@ def babai(self, *args, **kwargs):
896896
Alias for :meth:`approximate_closest_vector`.
897897
"""
898898
return self.approximate_closest_vector(*args, **kwargs)
899-
900-
def hadamard_ratio(self, use_reduced_basis=True):
901-
"""
902-
Computes the normalized Hadamard ratio of the given basis.
903-
904-
The normalized Hadamard ratio of the basis `B = \{v_1, v_2, \dots, v_n\} is defined as
905-
906-
.. MATH::
907-
\mathcal{H}(B) = \left(\dfrac{det L}{\|v_1\| \|v_2\| \cdots \|v_n\|}\right)^{\frac{1}{n}}
908-
909-
The closer this ratio is to 1, the more orthogonal the basis is.
910-
911-
EXAMPLES::
912-
913-
sage: from sage.modules.free_module_integer import IntegerLattice
914-
sage: L = IntegerLattice([[101, 0, 0, 0], [0, 101, 0, 0], [0, 0, 101, 0], [-28, 39, 45, 1]], lll_reduce=False)
915-
sage: float(L.hadamard_ratio())
916-
0.351096481348176
917-
sage: L.LLL()
918-
[ 1 -5 2 18]
919-
[ -5 25 -10 11]
920-
[-17 -16 -34 -3]
921-
[-39 -7 23 5]
922-
sage: float(L.hadamard_ratio())
923-
0.9933322263147489
924-
"""
925-
if use_reduced_basis:
926-
basis = self.reduced_basis
927-
else:
928-
basis = self.basis_matrix()
929-
930-
n = basis.nrows()
931-
r = self.rank()
932-
assert r == n
933-
934-
ratio = (self.discriminant().sqrt() / prod([v.norm() for v in basis]))**(1/r)
935-
assert 0 < ratio <= 1
936-
return ratio
937899

938900
def gaussian_heuristic(self, exact_form=False):
939901
"""

0 commit comments

Comments
 (0)