Coverage for src\pqlattice\_backends\_native.py: 73%

26 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2026-01-10 12:32 +0100

1from typing import override 

2 

3from ..lattice._bkz import bkz 

4from ..lattice._hkz import hkz 

5from ..lattice._lll import lll 

6from ..lattice._svp import shortest_vector 

7from ..linalg._linalg import hnf 

8from ..typing import Matrix, SquareMatrix, Vector 

9from ._protocol import BackendInterface 

10 

11 

12class NativeBackend(BackendInterface): 

13 @override 

14 def lll(self, lattice_basis: SquareMatrix, delta: float) -> SquareMatrix: 

15 return lll(lattice_basis, delta) 

16 

17 @override 

18 def bkz(self, lattice_basis: SquareMatrix, block_size: int, delta: float) -> SquareMatrix: 

19 _ = delta 

20 return bkz(lattice_basis, block_size) 

21 

22 @override 

23 def hkz(self, lattice_basis: SquareMatrix, delta: float) -> SquareMatrix: 

24 _ = delta 

25 return hkz(lattice_basis) 

26 

27 @override 

28 def shortest_vector(self, lattice_basis: SquareMatrix) -> Vector: 

29 return shortest_vector(lattice_basis) 

30 

31 @override 

32 def hnf(self, matrix: Matrix) -> tuple[Matrix, SquareMatrix]: 

33 return hnf(matrix)