Hi Huck,
Thanks!
# Issue 1
This is now:
https://github.com/fplll/fpylll/pull/225
# Issue 2
I think this is because I was lazy. Babai in FPyLLL is just:
cdef Py_ssize_t i, j
cdef list vv = list(v)
for i in range(dimension)[::-1]:
vv[i] = int(round(vv[i]))
for j in range(i):
vv[j] -= self.get_mu(start+i, start+j) * vv[i]
return tuple(vv)
which dumbs everything down to a machine float. Can you open a ticket with a minimal failing example?
Cheers,
Martin
On Mon, May 02 2022, Huck Bennett wrote:
> Dear fp(y)lll developers,
>
> First, thanks a lot for all of your work on this very nice tool!
>
> This email documents two potential issues with documentation and
> implementation of Babai's algorithm in fpylll. I will describe them here
> fairly briefly, but have also attached two corresponding Python files
> reproducing the issues with more extensive comments.
>
> *Issue #1:*
> Babai's algorithm in fpylll is outputting a *coefficient vector*, not a
> lattice vector. This does not match the fpylll specification
> <
https://buildmedia.readthedocs.org/media/pdf/fpylll/latest/fpylll.pdf>,
> which says that "[Babai returns a] lattice vector close to [the input
> target vector]."
>
> In particular, fpylll outputs a coefficient vector (and not a lattice
> vector) in the main fpylll Babai usage example
> <
https://github.com/fplll/fpylll/blob/master/docs/tutorial.rst#svp-and-cvp-tools>.
> In fact, as noted in the attached file fpylll-cvp-ex1.py, the vector output
> in the example is the coefficient vector of the lattice vector output
> by CVP.closest_vector called on the same lattice and target.
>
> I did not trace how the fplll implementation of Babai, the core of which
> seems to be here
> <
https://github.com/fplll/fplll/blob/37bcab0caf510dd7ad49d8a3b277366d7b8b763a/fplll/svpcvp.cpp#L517>,
> is pulled through to fpylll.
>
> *Issue #2:*
> I ran into what seems likely to be an overflow/precision issue when running
> LLL and then Babai on a "knapsack type" integer lattice with some large
> (presumably greater than 64-bit long) but not ridiculously large (<=
> 100-bit long) entries. It is not clear where the issue is coming from, but
> maybe from representing Gram-Schmidt vectors using floating point numbers.
>
> I tried to use mpfr and FPLLL.set_precision to go to higher precision, but
> am likely not using them correctly. That said, when calling
> fpylll.LLL.reduction with "float_type=mpfr" and "precision=1000" I get the
> error message "ValueError: LLL wrapper function requires float_type==None."
> Whatever else I'm not doing correctly, the documentation makes it seem like
> this should be allowed, and this error message seems like a potential issue.
> Interestingly, CVP.closest_vector works correctly when called on the same
> lattice and target as Babai and does not seem to have the same issues.
>
> Best wishes,
> Huck
--
_pgp:
https://keybase.io/martinralbrecht
_www:
https://malb.io
_prn: he/him or they/them