FPLLL Fpylll A Python Interface For Https Github - Com FPLLL FPLLL
FPLLL Fpylll A Python Interface For Https Github - Com FPLLL FPLLL
com/fplll/fplll
GPL-2.0 License
73 stars 45 forks
Star Watch
master
malb … on 11 Jan
View code
fpylll
A Python wrapper for fplll.
>>> M = GSO.Mat(A)
>>> M.update_gso()
>>> M.get_mu(1,0)
0.815748944429783
>>> L = LLL.Reduction(M)
>>> L()
>>> M.get_mu(1,0)
0.41812865497076024
>>> A[0].norm()
24.06241883103193
https://github.com/fplll/fpylll 1/8
2022/4/22 09:09 fplll/fpylll: A Python interface for https://github.com/fplll/fplll
The basic BKZ algorithm can be implemented in about 60 pretty readable lines of Python
code (cf. simple_bkz.py). For a quick tour of the library, you can check out the tutorial.
How to cite
@unpublished{fpylll,
author = {The {FPLLL} development team},
title = {{fpylll}, a {Python} wraper for the {fplll} lattice reduction library, {
year = 2021,
note = {Available at \url{https://github.com/fplll/fpylll}},
url = {https://github.com/fplll/fpylll}
}
Requirements
fpylll relies on the following C/C++ libraries:
We also suggest
Online
fpylll ships with Sage. Thus, it is available via SageMathCell and CoCalc (select a Jupyter
notebook with a Sage kernel). You can also fire up a dply.co virtual server with the latest
fpylll/fplll preinstalled (it takes perhaps 15 minutes until everything is compiled).
https://github.com/fplll/fpylll 2/8
2022/4/22 09:09 fplll/fpylll: A Python interface for https://github.com/fplll/fplll
Getting Started
Note: fpylll is also available via PyPI and Conda-Forge for Conda. In what follows, we explain
manual installation.
Automatic install
1. Run bootstrap.sh
$ ./bootstrap.sh
$ source ./activate
Manual install
$ virtualenv env
$ ln -s ./env/bin/activate ./
$ source ./activate
2. Install the required libraries - GMP or MPIR and MPFR - if not available already. You
may also want to install QD.
3. Install fplll:
Some OSX users report that they required export CXXFLAGS="-stdlib=libc++ -mmacosx-
version-min=10.7" and export CXX=clang++ (after installing a recent clang with brew)
since the default GCC installed by Apple does not have full C++11 support.
4. Then, execute:
Note that you can also patch activate to set LD_LIBRRY_PATH . For this, add:
### LD_LIBRARY_HACK
_OLD_LD_LIBRARY_PATH="$LD_LIBRARY_PATH"
LD_LIBRARY_PATH="$VIRTUAL_ENV/lib:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH
### END_LD_LIBRARY_HACK
### PKG_CONFIG_HACK
_OLD_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
PKG_CONFIG_PATH="$VIRTUAL_ENV/lib/pkgconfig:$PKG_CONFIG_PATH"
export PKG_CONFIG_PATH
### END_PKG_CONFIG_HACK
### LD_LIBRARY_HACK
if ! [ -z ${_OLD_LD_LIBRARY_PATH+x} ] ; then
LD_LIBRARY_PATH="$_OLD_LD_LIBRARY_PATH"
export LD_LIBRARY_PATH
unset _OLD_LD_LIBRARY_PATH
fi
### END_LD_LIBRARY_HACK
### PKG_CONFIG_HACK
if ! [ -z ${_OLD_PKG_CONFIG_PATH+x} ] ; then
PKG_CONFIG_PATH="$_OLD_PKG_CONFIG_PATH"
export PKG_CONFIG_PATH
unset _OLD_PKG_CONFIG_PATH
fi
### END_PKG_CONFIG_HACK
https://github.com/fplll/fpylll 4/8
2022/4/22 09:09 fplll/fpylll: A Python interface for https://github.com/fplll/fplll
Running fpylll
$ source ./activate
2. Start Python:
$ (fpylll) ipython
$ sage -sh
2. Install the required libraries - GMP or MPIR and MPFR - if not available already. You
may also want to install QD.
3. Install fplll:
Some OSX users report that they required export CXXFLAGS="-stdlib=libc++ -mmacosx-
version-min=10.7" and export CXX=clang++ (after installing a recent clang with brew)
since the default GCC installed by Apple does not have full C++11 support.
4. Then, execute:
https://github.com/fplll/fpylll 5/8
2022/4/22 09:09 fplll/fpylll: A Python interface for https://github.com/fplll/fplll
$ sage
sage: import fpylll
sage: print(fpylll.__version__)
Multicore Support
fpylll supports parallelisation on multiple cores. For all C++ support to drop the GIL is
enabled, allowing the use of threads to parallelise. Fplll is thread safe as long as each thread
works on a separate object such as IntegerMatrix or MatGSO . Also, fpylll does not actually
drop the GIL in all calls to C++ functions yet. In many scenarios using multiprocessing,
which sidesteps the GIL and thread safety issues by using processes instead of threads, will
be the better choice.
The example below calls LLL.reduction on 128 matrices of dimension 30 on four worker
processes.
https://github.com/fplll/fpylll 6/8
2022/4/22 09:09 fplll/fpylll: A Python interface for https://github.com/fplll/fplll
To test threading simply replace the line from multiprocessing import Pool with from
multiprocessing.pool import ThreadPool as Pool . For calling BKZ.reduction this way,
which expects a second parameter with options, using functools.partial is a good choice.
Contributing
fpylll welcomes contributions, cf. the list of open issues. To contribute, clone this repository,
README.rst
commit your code on a separate branch and send a pull request. Please write tests for your
code. You can run them by calling:
from the top-level directory which runs all tests in tests/test_*.py . We run flake8 on every
commit automatically, In particular, we run:
Note that fpylll supports Python 2 and 3. In particular, tests are run using Python 2.7 and
3.5. See .travis.yml for details on automated testing.
Eamonn Postlethwaite
E M Bray
Fernando Virdia
Guillaume Bonnoron
Jeroen Demeyer
Jérôme Benoit
Konstantinos Draziotis
Leo Ducas
Martin Albrecht
Michael Walter
Omer Katz
https://github.com/fplll/fpylll 7/8
2022/4/22 09:09 fplll/fpylll: A Python interface for https://github.com/fplll/fplll
We copied a decent bit of code over from Sage, mostly from it's fpLLL interface.
This project was supported through the European Union PROMETHEUS project (Horizon
2020 Research and Innovation Program, grant 780701), EPSRC grant EP/P009417/1 and
EPSRC grant EP/S020330/1.
Releases 15
0.5.6 Latest
on 15 May 2021
+ 14 releases
Packages
No packages published
Contributors 21
+ 10 contributors
Languages
https://github.com/fplll/fpylll 8/8