Coverage for src/pqlattice/lattice/__init__.py: 75%

1 from .. import settings

2 from ..typing import SquareMatrix, Vector

3 from . import embeddings

4 from ._cvp import babai_closest_vector, babai_nearest_plane, closest_vector

5 from ._gso import gso

6 from ._lattice import discriminant, gaussian_heuristic, glr_2dim, hadamard_ratio, rank, volume

7 from ._lll import is_lll_reduced, is_size_reduced

8

9

10 def lll(lattice_basis: SquareMatrix, delta: float = 0.99) -> SquareMatrix:

11 return settings.get_backend().lll(lattice_basis, delta)

12

13

14 def bkz(lattice_basis: SquareMatrix, block_size: int = 10, delta: float = 0.99) -> SquareMatrix:

15 return settings.get_backend().bkz(lattice_basis, block_size, delta)

16

17

18 def hkz(lattice_basis: SquareMatrix, delta: float = 0.99) -> SquareMatrix:

19 return settings.get_backend().hkz(lattice_basis, delta)

20

21

22 def shortest_vector(lattice_basis: SquareMatrix) -> Vector:

23 return settings.get_backend().shortest_vector(lattice_basis)

24

25

26 __all__ = [

27 "volume",

28 "rank",

29 "hadamard_ratio",

30 "discriminant",

31 "gaussian_heuristic",

32 "glr_2dim",

33 "gso",

34 "lll",

35 "is_lll_reduced",

36 "is_size_reduced",

37 "bkz",

38 "hkz",

39 "shortest_vector",

40 "closest_vector",

41 "babai_closest_vector",

42 "babai_nearest_plane",

43 "embeddings",

44]