fplll is distributed under the GNU Lesser General Public License (either version 2.1 of the License, or, at your option, any later version) as published by the Free Software Foundation.
fplll contains several algorithms on lattices that rely on floating-point computations. This includes implementations of the floating-point LLL reduction algorithm, offering different speed/guarantees ratios. It contains a 'wrapper' choosing the estimated best sequence of variants in order to provide a guaranteed output as fast as possible. In the case of the wrapper, the succession of variants is oblivious to the user. It also includes a rigorous floating-point implementation of the Kannan-Fincke-Pohst algorithm that finds a shortest non-zero lattice vector, and the BKZ reduction algorithm.
Absolutely needed:
If GMP and/or MPFR include and lib files are not in the default directories /usr/include and /usr/lib, you have to set the environment variables CFLAGS and LDFLAGS for instance through the configure command line
configure CPPFLAGS="-I/mpfrinclude -I/gmpinclude" LDFLAGS="-L/mpfrlib -L/gmplib"or
configure CPPFLAGS="-I/mpfrinclude -I/gmpinclude $CPPFLAGD" LDFLAGS="-L/mpfrlib -L/gmplib $LDFLAGS"if these variables already exist in your environment. This should be modified soon for using standard --with-gmp and --with-mpfr package specifications.
To install files 'cd' to the directory containing the package's source code and just type
./configure make make install # (as root)
You can remove the program binaries and object files from the source code directory by typing 'make clean'. To also remove the files that 'configure' created (so you can compile the package for a different kind of computer), type 'make distclean'. By default, 'make install' installs the package commands under '/usr/local/bin', include files under '/usr/local/include', etc. You can specify an installation directory name other than '/usr/local' by giving 'configure' the option '--prefix=dirname'. Run 'configure --help' for further details.
make checkThis tests the LLL wrapper given dim55_in as input. If the error message 'INVALID RESULT' is not printed, the self-test has succeeded.
Executable files fplll and latticegen are installed in the directory bin. If you type 'make check', it will also generate the file llldiff. (Note that the programs generated by make in the 'src/' directory are only wrappers to the programs in 'src/.libs/)
latticegen is an utility for generating matrices (rows form input lattice bases).
The options are :
The matrix is printed in stdout.
Note that by default, the random bits always use the same seed, to ensure reproducibility. You can change the seed with the option
-randseed <integer>or use the current time (in seconds)
-randseed timeIf you use this option, it must be the first one on the command line.
fplll does LLL, BKZ or SVP on a matrix (considered as a set of row vectors) given in stdin or in a file as parameter.
The options are:
-a lll : LLL-reduction (default). -a bkz : BKZ-reduction. -a svp : print a shortest vector of the lattice. -r <size>, -c <size> : ignored, provided for compatibility with previous versions of fplll.
Options for LLL-reduction:
-d <delta> : delta (default=0.99) -e <eta> : eta (default=0.51) -l <lovasz> : if !=0 Lovasz's condition. Otherwise, Siegel's condition (default: Lovasz) -p <precision> : precision of the floating-point arithmetic, works only with -f mpfr. -f mpfr : sets the floating-point type to MPFR (default if m=proved). -f dpe : sets the floating-point type to DPE (default if m=heuristic/heuristicearly). -f double : sets the floating-point type to double (default if m=fast/fastearly). -f longdouble : sets the floating-point type to long double. -z int : sets the integer type to int. -z mpz : sets the integer type to mpz, the integer type of GMP (default). -z double : sets the integer type to double. -m wrapper : uses the wrapper. (default if z=mpz) -m fast : uses the fast method, works only with -f double. -m fastearly : uses the fast method with early reduction, works only with -f double. -m heuristic : uses the heuristic method. -m heuristicearly : uses the heuristic method with early reduction. -m proved : uses the proved version of the algorithm. With the wrapper or the proved version, it is guaranteed that the basis is LLL-reduced with delta'=2*delta-1 and eta'=2*eta-1/2. For instance, with the default options, it is guaranteed that the basis is (0.98,0.52)-LLL-reduced.
Options for BKZ-reduction:
-b <blocksize> Block size, mandatory, between 2 and the number of rows. -f <float_type> Same as LLL (-p is required if float_type=mpfr) -p <precision> Precision of the floating-point arithmetic with -f mpfr -bkzmaxloops <loops> Maximum number of full loops. -bkzmaxtime <time> Stop after time seconds (up to loop completion). -bkzautoabort Heuristic, stop when the average slope of log(||b_i*||) does not decrease fast enough.
llldiff compares two bases (b1,...,bd) and (c1,...c_d'): they are considered equal iff d=d' and for any i, bi = +- ci.
At the beginning of your code, type:
#include <fplll.h> using namespace fplll;
See the example file test.cpp in the src directory. To compile it, assuming fplll has been installed in /tmp/fplll:
bash-3.00$ g++ -static -I /tmp/fplll/include test.cpp -L /tmp/fplll/lib -lfplll -lmpfr -lgmp bash-3.00$ ./a.out [[4 3 7] [3 0 1] [3 5 3]] [[3 0 1] [2 2 -3] [0 5 2]]All types, functions and constants are wrapped in the
fplll
namespace, with the exception of the dpe
type defined in dpe.h. Preprocessor definitions prefixed by FPLLL_ are reserved for internal use.
int lllReduction(ZZ_mat<mpz_t>& b, double delta =
0.99, double eta = 0.51, LLLMethod method = LM_WRAPPER,
FloatType floatType = FT_DEFAULT, int precision = 0, int flags =
LLL_DEFAULT) LLL-reduces a basis of Z_NR<mpz_t>. It is guaranteed that the output is (delta', eta')-LLL-reduced with delta'=2×delta-1, eta'=2×eta-1/2 provided that method=LM_WRAPPER/LM_PROVED, floatType=FT_DEFAULT and precision=0. For instance, with the default parameters, it is guaranteed that the output basis is (0.98, 0.52)-LLL-reduced. Parameters:
Return value:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
int lllReduction(ZZ_mat<long>& b, double delta =
0.99, double eta = 0.51, LLLMethod method = LM_FAST,
FloatType floatType = FT_DEFAULT, int precision = 0, int flags =
LLL_DEFAULT) LLL-reduces a basis of Z_NR<long>. There is no guarantee and the LM_WRAPPER method is not available. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
int lllReduction(ZZ_mat<double>& b, double delta =
0.99, double eta = 0.51, LLLMethod method = LM_FAST,
FloatType floatType = FT_DEFAULT, int precision = 0, int flags =
LLL_DEFAULT) LLL-reduces a basis of Z_NR<double>. There is no guarantee and the LM_WRAPPER method is not available. BKZ
SVP
Data typesZ_NR<Z>Z_NR stores integers. This template provides a uniform interface for doing integer computations with several underlying types (long, double and mpz_t). Methods:
Non-member functions:
Containers: typedef Z_NR<mpz_t> Integer; FP_NR<F>FP_NR stores floating-point numbers. This template provides a uniform interface for doing floating-point computations with several underlying types (double, dpe_t and mpfr_t). For all functions, the rounding mode rnd is ignored unless F=mpfr_t. Methods:
Static members:
Non-member functions:
Containers: typedef FP_NR<mpfr_t> Float; Matrix<T>Methods:
Non-member functions:
Note: a call to clear, resize, setRows, setCols or swap invalidates all references returned by operator() and MatrixRow objects returned by operator[]. MatrixRow<T>MatrixRow stores a reference to a row of a Matrix. It supports a subset of operations available on vectors. Methods:
Non-member functions:
ZZ_mat<ZT>Base class: Matrix<Z_NR<ZT>> Matrix of integers. Same constructors as Matrix. FP_mat<FT>Base class: Matrix<FP_NR<FT>> Matrix of floating-point nubmers. Same constructors as Matrix. See alsoDocumentation of std::vectorExamples1) ./latticegen r 10 1000 | ./fplll 2) If the file 'matrix' contains [[ 10 11] [11 12]] Then ./fplll matrix produces [[0 1 ] [1 0 ] ] 3) Random generator ./latticegen -randseed 1234 r 10 1000 | ./fplll ./latticegen -randseed time u 10 16 | ./fplll 4) Solving SVP ./latticegen r 30 3000 | ./fplll -a svp DevelopersCurrent developer: Former developers: AcknowledgementsPatrick Pelissier and Paul Zimmermann for dpe. Martin Albrecht, Sylvain Chevillard, Christoph Lauter and Gilles Villard for the "configure/make/make install" packaging. Martin Albrecht for the incorporation into SAGE. Timothy Abbott, Michael Abshoff, Martin Albrecht, Bill Allombert, John Cannon, Sylvain Chevillard, Julien Clement, Andreas Enge, Jean-Pierre Flori, Laurent Fousse, Guillaume Hanrot, Jens Hermans, Jerry James, Christoph Lauter, Andrew Novocin, Willem Jan Palenstijn, Patrick Pelissier, Michael Schneider, Thiemo Seufer, Allan Steel, Gilles Villard and Paul Zimmermann for their support and for many suggestions that helped debugging and improving this code. New releases and bug reportsNew releases will be announced at the URL: http://perso.ens-lyon.fr/damien.stehle/fplll/ Bug reports may be sent at: |