File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -136,7 +136,8 @@ def compute_weights(self, start: int = 0) -> None:
136136 def weight_reduce (self ) -> bool :
137137 "Pairwise reducte all weights of the basis vectors."
138138 reduced = False
139- for j in range (1 , self .len ):
139+ j = 1
140+ while j < self .len :
140141 for i in range (j - 1 , - 1 , - 1 ):
141142 r = round (self .Mu [j ][i ])
142143 if not r :
@@ -150,13 +151,15 @@ def weight_reduce(self) -> bool:
150151 Nuj = self .norm2 (self .U [j ])
151152 if not Nuj :
152153 self .delete_vector (j )
153- continue
154+ break
154155 if self .fraction :
155156 Nuj = Fraction (Nuj )
156157 for k in range (self .len ):
157158 if j != k :
158159 self .Mu [k ][j ] = (self .Nu [j ] * self .Mu [k ][j ] - r * self .Nu [i ] * self .Mu [k ][i ]) / Nuj
159160 self .Nu [j ] = Nuj
161+ else :
162+ j += 1
160163 return reduced
161164
162165 def hermite (self ) -> None :
Original file line number Diff line number Diff line change 44
55from math import prod , floor , inf
66from itertools import product
7- from random import choice , sample
8- from .la import Matrix , eye , zeros
7+ from .la import Matrix , eye
98from .lat import Lattice
109
1110
@@ -78,7 +77,7 @@ def babai_plane_bnd(U: Matrix, p=2) -> float:
7877def lll (V : Matrix , delta : float = 0.75 , sort : bool = True ) -> Matrix :
7978 "LLL algorithm for lattice reduction."
8079 lat = Lattice (V )
81- lat .lll ()
80+ lat .lll (delta = delta )
8281 if sort :
8382 lat .sort ()
8483 return lat .basis ()
You can’t perform that action at this time.
0 commit comments