@@ -901,11 +901,11 @@ def hadamard_ratio(self, use_reduced_basis=True):
901
901
r"""
902
902
Computes the normalized Hadamard ratio of the given basis.
903
903
904
- The normalized Hadamard ratio of the basis `B = { v_1, v_2, \dots, v_n}` is defined as
904
+ The normalized Hadamard ratio of the basis `B = \left{ v_1, v_2, \dots, v_n \right }` is defined as
905
905
906
906
.. MATH::
907
907
908
- \mathcal{H}(B) = \dfrac{det L}{\|v_1\| \|v_2\| \cdots \|v_n\|}^{\dfrac {1}{n}}
908
+ \mathcal{H}(B) = \left( \ dfrac{\ det L}{\|v_1\| \|v_2\| \cdots \|v_n\|} \right) ^{\frac {1}{n}}
909
909
910
910
The closer this ratio is to 1, the more orthogonal the basis is.
911
911
@@ -932,23 +932,24 @@ def hadamard_ratio(self, use_reduced_basis=True):
932
932
basis = self .reduced_basis
933
933
else :
934
934
basis = self .basis_matrix ()
935
-
935
+
936
936
n = basis .nrows ()
937
937
r = self .rank ()
938
938
assert r == n
939
-
939
+
940
940
ratio = (self .discriminant ().sqrt () / prod ([v .norm () for v in basis ]))** (1 / r )
941
941
assert 0 < ratio <= 1
942
942
return ratio
943
-
943
+
944
944
def gaussian_heuristic (self , exact_form = False ):
945
945
r"""
946
- Computes the Gaussian expected shortest length, also known as the Gaussian
946
+ Computes the Gaussian expected shortest length, also known as the Gaussian
947
947
heuristic. This estimates the expected norm of the shortest non-zero vector
948
948
in the lattice. The heuristic is independent of the chosen basis.
949
949
950
950
INPUT:
951
- - ``exact_form`` -- boolean (default: ``False``); uses exact formulation based on gamma function, instead of estimation of the gamma function
951
+ - ``exact_form`` -- boolean (default: ``False``); uses exact formulation
952
+ based on gamma function, instead of using stirling's approximation
952
953
953
954
OUTPUT: The Gaussian heuristic described above.
954
955
@@ -965,13 +966,13 @@ def gaussian_heuristic(self, exact_form=False):
965
966
21.375859827168494
966
967
"""
967
968
basis = self .basis_matrix ()
968
-
969
+
969
970
n = basis .nrows ()
970
971
r = self .rank ()
971
972
assert r == n
972
973
973
974
D = self .discriminant ().sqrt ()
974
-
975
+
975
976
if exact_form :
976
977
return (D * gamma (1 + (r / 2 )))** (1 / r ) / pi .sqrt ()
977
978
else :
0 commit comments