Ticket #1346 (closed defect: fixed)
[with patch, positive review] fpLLL doctests don't test fpLLL
| Reported by: | cwitty | Owned by: | was |
|---|---|---|---|
| Priority: | major | Milestone: | sage-3.1.3 |
| Component: | algebraic geometry | Keywords: | |
| Cc: | Work issues: | ||
| Report Upstream: | Reviewers: | ||
| Authors: | Merged in: | ||
| Dependencies: | Stopgaps: |
Description
If the next version of fpLLL started returning bogus answers, the doctests in sage/libs/fplll/fplll.pyx would still pass, because they use random input and output.
There should be at least some doctests where fplll is run on constant input with a known result.
Attachments
Change History
comment:2 Changed 5 years ago by was
13:48 < wstein-2813> re: #1346 -- do we have an is_LLL_reduced function anywhere yet? 13:49 < wstein-2813> If so, we could just use that on the output of LLL functions. 13:49 < wstein-2813> That would be the way to solve the problem (but keep the random output).
comment:3 Changed 5 years ago by cwitty
William's suggestion above is not sufficient to actually test fpLLL; at least we should also test that the input and output matrices generate the same lattice.
comment:4 Changed 5 years ago by malb
- Summary changed from fpLLL doctests don't test fpLLL to [with patch, needs review] fpLLL doctests don't test fpLLL
comment:5 Changed 5 years ago by malb
Damien Stehlé suggested three ways to check for LLL reduction off-list:
In order to checking the LLL-reducedness of a basis, I have three ideas. 1) One could think that LLL on a LLL-reduced basis should not do anything. So one idea would be to run another (reliable) LLL routine on the output, and see if it actually does nothing. That should be easy in SAGE, since you have an easy access to several LLLs. You have to pay attention to the LLL parameters (delta and eta), which could be annoying since eta is not specified in NTL (though it is >1/2). You also have to pay attention to the precision if you use fp-arithmetic (it should be high enough). In any case, it is going to be dirty and provide bugs or inconsistences between the different codes. And on top of it, a LLL may actually do something on an already-reduced basis, as long as it provides another reduced basis. Due to fp-errors, this may actually occur. Furthermore, there are portability issues. fplll is not portable between 32 bit and 64 bit machine (for efficiency reasons). I know inputs for which it answers something different on 32 and 64 bit machines. 2) Compute the Gram-Schmidt Orthogonalisation with rational arithmetic and check if the LLL conditions are satisfied. Easy, but slow on large examples. 3) Use Gilles Villard's paper that tries to do the same as 2), but with fp-arithmetic. Certification of the QR factor R and of lattice basis reducedness. ISSAC 2007: 361-368
I do 2) in the above patch.
comment:6 Changed 5 years ago by wjp
Second patch attached. It marks the output of LLL in the doctests from malb's patch as random, and checks the LLL condition of those that weren't yet. Also fixes a typo in the LLL docstring, and fixes the LLL reducedness tests in is_LLL_reduced(), I think.
comment:7 Changed 5 years ago by malb
I see one issue with the second patch: It recomputes the norms twice as much as needed, this is why I introduced the norms list.
comment:8 Changed 5 years ago by wjp
Oh, yes, you're right. I forgot for a moment that b_i* and b_{i+1}* are orthogonal so you can indeed rewrite the condition like you did. Sorry.
comment:10 Changed 5 years ago by malb
- Summary changed from [with patch, needs review] fpLLL doctests don't test fpLLL to [with patch, positive review] fpLLL doctests don't test fpLLL
comment:11 Changed 5 years ago by mabshoff
- Status changed from new to closed
- Resolution set to fixed
- Milestone changed from sage-3.2 to sage-3.1.3
Merged in Sage 3.1.3.rc0


Bill Hart wrote in http://groups.google.com/group/sage-devel/t/e54f8dd59f799354
Cheers,
Michael