Hello community, here is the log from the commit of package fplll for openSUSE:Factory checked in at 2018-10-22 11:25:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/fplll (Old) and /work/SRC/openSUSE:Factory/.fplll.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "fplll" Mon Oct 22 11:25:43 2018 rev:3 rq:643480 version:5.2.1 Changes: -------- --- /work/SRC/openSUSE:Factory/fplll/fplll.changes 2018-01-23 13:47:06.654091157 +0100 +++ /work/SRC/openSUSE:Factory/.fplll.new/fplll.changes 2018-10-22 11:25:46.575010816 +0200 @@ -1,0 +2,6 @@ +Sat Oct 20 11:46:28 UTC 2018 - Jan Engelhardt <[email protected]> + +- Update to new upstream release 5.2.1 + * Unify randomness on 32-bit and 64-bit systems + +------------------------------------------------------------------- Old: ---- fplll-5.2.0.tar.gz New: ---- fplll-5.2.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ fplll.spec ++++++ --- /var/tmp/diff_new_pack.AGYzSo/_old 2018-10-22 11:25:47.271010132 +0200 +++ /var/tmp/diff_new_pack.AGYzSo/_new 2018-10-22 11:25:47.271010132 +0200 @@ -1,7 +1,7 @@ # # spec file for package fplll # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,16 +12,16 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: fplll -%define lname libfplll4 -Version: 5.2.0 +%define lname libfplll5 +Version: 5.2.1 Release: 0 Summary: Lenstra-Lovász Lattice Basis Reduction Algorithm Library -License: LGPL-2.1+ +License: LGPL-2.1-or-later Group: Productivity/Scientific/Math Url: https://github.com/dstehle/fplll ++++++ fplll-5.2.0.tar.gz -> fplll-5.2.1.tar.gz ++++++ ++++ 1850 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/README.md new/fplll-5.2.1/README.md --- old/fplll-5.2.0/README.md 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/README.md 2018-05-18 15:14:06.000000000 +0200 @@ -33,6 +33,8 @@ * [Dependencies](#dependencies) * [Required](#required), [Optional](#optional). * [Installation](#installation) + * [Linux](#linux) + * [Windows 10](#windows-10) * [Optimization](#optimization) * [Check](#check) * [How to use](#how-to-use) @@ -54,24 +56,11 @@ ### Required ### -- GNU MP 4.2.0 or higher [http://gmplib.org/](http://gmplib.org/) +- GNU MP 4.2.0 or higher [http://gmplib.org/](http://gmplib.org/) or MPIR 1.0.0 or higher [http://mpir.org](http://mpir.org) - MPFR 2.3.0 or higher, COMPLETE INSTALLATION [http://www.mpfr.org/](http://www.mpfr.org/) - autotools 2.61 or higher - g++ 4.9.3 or higher -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. The same philosophy applies to the -(optional) QD library. ### Optional ### - QD 2.3.15 or higher (a C++/Fortran-90 double-double and quad-double package), compile and install @@ -80,6 +69,8 @@ ## Installation ## +### Linux ### + You should downloaded the source code from github and then run ./autogen.sh @@ -93,6 +84,17 @@ make make install # (as root) +If GMP, MPFR and/or MPIR are not in the `$LD_LIBRARY_PATH`, you have to point to the directories where the libraries are, with + + ./configure --with-gmp=path/to/gmp + +or + + ./configure --with-mpfr=path/to/mpfr + +The same philosophy applies to the (optional) QD library. If you want to use +mpir instead of gmp, use `--enable-mpir` and `--with-mpir=path/to/mpir`. + 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 @@ -100,6 +102,24 @@ installation directory name other than `/usr/local` by giving `./configure` the option `--prefix=dirname`. Run `./configure --help` for further details. +### Windows 10 ### + +Windows 10 has a "Windows Subsystem for Linux", which essentially allows you to use Linux features in Windows without the need for a dual-boot system or a virtual machine. To activate this, first go to **Settings** -> **Update and security** -> **For developers** and enable developer mode. (This may take a while.) Afterwards, open command prompt and run + + lxrun /install + +This will install the WSL, and afterwards this system can be accessed e.g. by opening command prompt and typing `bash`. With this Linux-like subsystem, installing fplll is then similar to above, except that most likely the package repository is not up to date, and various additional packages need to be installed first. To make sure you only install the most recent software, run: + + sudo apt-get update + +Then run `sudo apt-get install <packages>` for the (indirectly) required packages, such as `make`, `autoconf`, `libtool`, `gcc`, `g++`, `libgmp-dev`, and `libmpfr-dev`. Finally, download the fplll source code, extract the contents, navigate to this folder in Bash (commonly found under `/mnt/c/<local path>` when stored somewhere on the `C:\` drive), and run: + + ./autogen.sh + ./configure + make + +The same comments as before apply for using e.g. `make install` or `make distclean` instead of `make`. + ## Check ## Type @@ -157,7 +177,6 @@ * `-a cvp` : prints the vector in the lattice closest to the input vector. * `-v` : verbose mode. * `-nolll` : does not apply to LLL-reduction. In the case of bkz, hkz and svp, by default, the input basis is LLL-reduced before anything else. This option allows to remove that initial LLL-reduction (note that other calls to LLL-reduction may occur during the execution). -* `-r` `size`, `-c` `size` : ignored, provided for compatibility with previous versions of fplll. Options for LLL-reduction: @@ -171,8 +190,8 @@ * `-p precision` : precision of the floating-point arithmetic, works only with `-f mpfr`. * `-f dd` : sets the floating-point type to double-double. * `-f qd` : sets the floating-point type to quad-double. -* `-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 dpe` : sets the floating-point type to DPE (default if `m=heuristic`). +* `-f double` : sets the floating-point type to double (default if `m=fast`). * `-f longdouble` : sets the floating-point type to long double. * `-z mpz` : sets the integer type to mpz, the integer type of GMP (default). @@ -182,9 +201,7 @@ * `-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. * `-y` : early reduction. @@ -217,13 +234,16 @@ * `-of ` : prints new line (if `-a [lll|bkz]`) * `-of b` : prints the basis (if `-a [lll|bkz]`, this value by default) +* `-of bk` : prints the basis (if `-a [lll|bkz]`, format compatible with sage) * `-of c` : prints the closest vector (if `-a cvp`, this value by default) * `-of s` : prints the closest vector (if `-a svp`, this value by default) * `-of t` : prints status (if `-a [lll|bkz|cvp|svp]`) * `-of u` : prints unimodular matrix (if `-a [lll|bkz]`) +* `-of uk` : prints unimodular matrix (if `-a [lll|bkz]`, format compatible with sage) * `-of v` : prints inverse of u (if `-a lll`) +* `-of vk` : prints inverse of u (if `-a lll`, format compatible with sage) -A combination of these option is allowed (e.g., `-of but`). +A combination of these option is allowed (e.g., `-of bkut`). ## llldiff ## diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/config.h.in new/fplll-5.2.1/config.h.in --- old/fplll-5.2.0/config.h.in 2017-09-11 17:00:56.000000000 +0200 +++ new/fplll-5.2.1/config.h.in 2018-05-18 15:14:26.000000000 +0200 @@ -48,6 +48,9 @@ /* Define to 1 if you have the `mpfr' library (-lmpfr). */ #undef HAVE_LIBMPFR +/* Define to 1 if you have the `mpir' library (-lmpir). */ +#undef HAVE_LIBMPIR + /* Define to 1 if you have the <limits> header file. */ #undef HAVE_LIMITS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/configure.ac new/fplll-5.2.1/configure.ac --- old/fplll-5.2.0/configure.ac 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/configure.ac 2018-05-18 15:14:06.000000000 +0200 @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT(fplll, 5.2.0) +AC_INIT(fplll, 5.2.1) AC_CONFIG_SRCDIR([fplll/fplll.cpp]) # cf http://comments.gmane.org/gmane.comp.sysutils.autoconf.general/15737 @@ -38,7 +38,7 @@ # 3. If interfaces were removed (breaks backward compatibility): increment # current, and set both revision and age to zero. -FPLLL_LT_CURRENT=4 +FPLLL_LT_CURRENT=5 FPLLL_LT_REVISION=0 FPLLL_LT_AGE=0 @@ -56,18 +56,37 @@ AX_CXX_COMPILE_STDCXX([11],[noext],[mandatory]) # Checks for libraries. -AC_ARG_WITH(gmp, - AS_HELP_STRING([--with-gmp=@<:@=DIR@:>@], [GMP install directory]), [ - CPPFLAGS="$CPPFLAGS -I$withval/include" - LDFLAGS="$LDFLAGS -L$withval/lib" - gmp_lib_path="$withval/lib" - ]) - -AC_CHECK_LIB(gmp, __gmpz_init, , [AC_MSG_ERROR( -[GNU MP not found, see http://gmplib.org])]) - -AC_CHECK_LIB(gmp, __gmp_get_memory_functions, , [AC_MSG_ERROR( -[GMP version too old, need >= 4.2.0, see http://gmplib.org])]) +AC_ARG_ENABLE(mpir, + AS_HELP_STRING([--enable-mpir], + [Enable MPIR instead of GMP])) + +AS_IF([test "x$enable_mpir" = "xyes"], [ + AC_ARG_WITH(mpir, + AS_HELP_STRING([--with-mpir=@<:@=DIR@:>@], [MPIR install directory]), [ + CPPFLAGS="$CPPFLAGS -I$withval/include" + LDFLAGS="$LDFLAGS -L$withval/lib" + mpir_lib_path="$withval/lib" + ]) + AC_CHECK_LIB(mpir, __gmpz_init, , [AC_MSG_ERROR( + [MPIR not found, see http://mpir.org])]) + AC_CHECK_LIB(mpir, __gmp_get_memory_functions, , [AC_MSG_ERROR( + [MPIR version too old, need >= 1.0.0, see http://mpir.org])]) + LIBGMP="-lmpir" +]) + +AS_IF([test "x$enable_mpir" != "xyes"], [ + AC_ARG_WITH(gmp, + AS_HELP_STRING([--with-gmp=@<:@=DIR@:>@], [GMP install directory]), [ + CPPFLAGS="$CPPFLAGS -I$withval/include" + LDFLAGS="$LDFLAGS -L$withval/lib" + mpir_lib_path="$withval/lib" + ]) + AC_CHECK_LIB(gmp, __gmpz_init, , [AC_MSG_ERROR( + [GNU MP not found, see http://mpir.org])]) + AC_CHECK_LIB(gmp, __gmp_get_memory_functions, , [AC_MSG_ERROR( + [GMP version too old, need >= 4.2.0, see http://gmplib.org])]) + LIBGMP="-lgmp" +]) AC_ARG_WITH(mpfr, AS_HELP_STRING([--with-mpfr=@<:@=DIR@:>@], [MPFR install directory]), [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/Makefile.am new/fplll-5.2.1/fplll/Makefile.am --- old/fplll-5.2.0/fplll/Makefile.am 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/Makefile.am 2018-05-18 15:14:06.000000000 +0200 @@ -93,7 +93,7 @@ sieve/sampler_basic.cpp EXTRA_libfplll_la_SOURCES= svpcvp.cpp -libfplll_la_LIBADD=-lgmp -lmpfr $(LIBQD_LIBADD) +libfplll_la_LIBADD=$(LIBGMP) -lmpfr $(LIBQD_LIBADD) libfplll_la_LDFLAGS=-no-undefined -version-info @FPLLL_LT_CURRENT@:@FPLLL_LT_REVISION@:@FPLLL_LT_AGE@ libfplllv_la_SOURCES=$(libfplll_la_SOURCES) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/bkz.cpp new/fplll-5.2.1/fplll/bkz.cpp --- old/fplll-5.2.0/fplll/bkz.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/bkz.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -80,7 +80,7 @@ } template <class ZT, class FT> -const PruningParams &BKZReduction<ZT, FT>::get_pruning(int kappa, int block_size, +const PruningParams &BKZReduction<ZT, FT>::get_pruning(int kappa, unsigned int block_size, const BKZParam &par) const { @@ -98,7 +98,8 @@ } template <class ZT, class FT> -bool BKZReduction<ZT, FT>::svp_preprocessing(int kappa, int block_size, const BKZParam ¶m) +bool BKZReduction<ZT, FT>::svp_preprocessing(int kappa, unsigned int block_size, + const BKZParam ¶m) { bool clean = true; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/bkz.h new/fplll-5.2.1/fplll/bkz.h --- old/fplll-5.2.0/fplll/bkz.h 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/bkz.h 2018-05-18 15:14:06.000000000 +0200 @@ -115,7 +115,7 @@ *@returns * false if it modified the basis, true otherwise */ - bool svp_preprocessing(int kappa, int block_size, const BKZParam ¶m); + bool svp_preprocessing(int kappa, unsigned int block_size, const BKZParam ¶m); /** * @brief Inserts given (dual) vector into the basis @@ -303,7 +303,7 @@ bool set_status(int new_status); - const PruningParams &get_pruning(int kappa, int block_size, const BKZParam &par) const; + const PruningParams &get_pruning(int kappa, unsigned int block_size, const BKZParam &par) const; // handles the general case of inserting a vector into the (dual) basis, i.e. // when none of the coefficients are \pm 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/defs.h new/fplll-5.2.1/fplll/defs.h --- old/fplll-5.2.0/fplll/defs.h 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/defs.h 2018-05-18 15:14:06.000000000 +0200 @@ -50,7 +50,12 @@ #endif #include "fplll_config.h" +#ifdef HAVE_LIBMPIR +#include <mpir.h> +#endif +#ifdef HAVE_LIBGMP #include <gmp.h> +#endif #include <mpfr.h> #ifdef FPLLL_WITH_DPE #include "nr/dpe.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/enum/evaluator.cpp new/fplll-5.2.1/fplll/enum/evaluator.cpp --- old/fplll-5.2.0/fplll/enum/evaluator.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/enum/evaluator.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -268,15 +268,14 @@ return true; } -bool ExactErrorBoundedEvaluator::get_max_error(FP_NR<mpfr_t> &max_error, - const FP_NR<mpfr_t> &last_partial_dist) +bool ExactErrorBoundedEvaluator::get_max_error(FP_NR<mpfr_t> &max_error, const FP_NR<mpfr_t> &) { max_error = 0.0; return true; } -void ExactErrorBoundedEvaluator::eval_sol(const vector<FP_NR<mpfr_t>> &new_sol_coord, - const enumf &new_partial_dist, enumf &max_dist) +void ExactErrorBoundedEvaluator::eval_sol(const vector<FP_NR<mpfr_t>> &new_sol_coord, const enumf &, + enumf &max_dist) { int n = matrix.get_cols(); Z_NR<mpz_t> new_sol_dist, coord; @@ -315,7 +314,7 @@ void ExactErrorBoundedEvaluator::eval_sub_sol(int offset, const vector<FP_NR<mpfr_t>> &new_sub_sol_coord, - const enumf &sub_dist) + const enumf &) { Z_NR<mpz_t> minusone; minusone = -1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/fplll_config.h.in new/fplll-5.2.1/fplll/fplll_config.h.in --- old/fplll-5.2.0/fplll/fplll_config.h.in 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/fplll_config.h.in 2018-05-18 15:14:06.000000000 +0200 @@ -28,4 +28,8 @@ /* Recursive enumeration enabled */ #undef FPLLL_WITH_RECURSIVE_ENUM +/* Switch between GMP and MPIR */ +#undef HAVE_LIBGMP +#undef HAVE_LIBMPIR + #endif //FPLLL_CONFIG__H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/gso.cpp new/fplll-5.2.1/fplll/gso.cpp --- old/fplll-5.2.0/fplll/gso.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/gso.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -71,7 +71,7 @@ { for (int j = 0; j <= i; j++) { - dot_product(g(i, j), b[i], b[j], n_known_cols); + b[i].dot_product(g(i, j), b[j], n_known_cols); } } else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/gso.h new/fplll-5.2.1/fplll/gso.h --- old/fplll-5.2.0/fplll/gso.h 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/gso.h 2018-05-18 15:14:06.000000000 +0200 @@ -249,7 +249,7 @@ { if (gf(i, j).is_nan()) { - dot_product(gf(i, j), bf[i], bf[j], n_known_cols); + bf[i].dot_product(gf(i, j), bf[j], n_known_cols); } f = gf(i, j); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/gso_gram.cpp new/fplll-5.2.1/fplll/gso_gram.cpp --- old/fplll-5.2.0/fplll/gso_gram.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/gso_gram.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -37,12 +37,12 @@ gso_valid_cols[i] = 0; } -template <class ZT, class FT> void MatGSOGram<ZT, FT>::update_bf(int i) +template <class ZT, class FT> void MatGSOGram<ZT, FT>::update_bf(int) { // EMPTY } -template <class ZT, class FT> void MatGSOGram<ZT, FT>::invalidate_gram_row(int i) +template <class ZT, class FT> void MatGSOGram<ZT, FT>::invalidate_gram_row(int) { // EMPTY } @@ -68,7 +68,7 @@ ztmp1.add(ztmp1, g(j, j)); g(i, i).add(g(i, i), ztmp1); - for (int k = 0; k < n_known_rows; k++) + for (int k = 0; k < d; k++) { if (k != i) sym_g(i, k).add(sym_g(i, k), sym_g(j, k)); @@ -98,7 +98,7 @@ ztmp1.sub(g(j, j), ztmp1); g(i, i).add(g(i, i), ztmp1); - for (int k = 0; k < n_known_rows; k++) + for (int k = 0; k < d; k++) if (k != i) sym_g(i, k).sub(sym_g(i, k), sym_g(j, k)); } @@ -132,7 +132,7 @@ g(i, i).add(g(i, i), ztmp1); // g(i, k) += g(j, k) * (2^e * x) for k != i - for (int k = 0; k < n_known_rows; k++) + for (int k = 0; k < d; k++) { if (k == i) continue; @@ -170,7 +170,7 @@ g(i, i).add(g(i, i), ztmp1); // g(i, k) += g(j, k) * (2^e * x) for k != i - for (int k = 0; k < n_known_rows; k++) + for (int k = 0; k < d; k++) { if (k == i) continue; @@ -214,7 +214,7 @@ // g(i, k) += g(j, k) * (2^e * x) for k != i - for (int k = 0; k < n_known_rows; k++) + for (int k = 0; k < d; k++) { if (k == i) continue; @@ -275,7 +275,7 @@ g(i, k).swap(g(j, k)); for (int k = i + 1; k < j; k++) g(k, i).swap(g(j, k)); - for (int k = j + 1; k < n_known_rows; k++) + for (int k = j + 1; k < d; k++) g(k, i).swap(g(k, j)); g(i, i).swap(g(j, j)); } @@ -307,7 +307,7 @@ { throw std::runtime_error("Error: gptr is equal to the nullpointer."); } - gptr->rotate_gram_right(new_r, old_r, n_known_rows); + gptr->rotate_gram_right(new_r, old_r, d); } else { @@ -341,7 +341,7 @@ throw std::runtime_error("Error: gptr is equal to the nullpointer."); } // gptr->rotate_gram_left(old_r, new_r, n_known_rows); - gptr->rotate_gram_left(old_r, min(new_r, n_known_rows - 1), n_known_rows); + gptr->rotate_gram_left(old_r, min(new_r, n_known_rows - 1), d); } } else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/gso_gram.h new/fplll-5.2.1/fplll/gso_gram.h --- old/fplll-5.2.0/fplll/gso_gram.h 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/gso_gram.h 2018-05-18 15:14:06.000000000 +0200 @@ -69,9 +69,13 @@ using MatGSOInterface<ZT, FT>::in_row_op_range; #endif - MatGSOGram(Matrix<ZT> &arg_g, Matrix<ZT> &arg_u, Matrix<ZT> &arg_uinv_t, int flags) - : MatGSOInterface<ZT, FT>(arg_u, arg_uinv_t, GSO_INT_GRAM) + MatGSOGram(Matrix<ZT> &arg_g, Matrix<ZT> &arg_u, Matrix<ZT> &arg_uinv_t, int flags = GSO_INT_GRAM) + : MatGSOInterface<ZT, FT>(arg_u, arg_uinv_t, flags) { + if (flags != GSO_INT_GRAM) + { + throw std::invalid_argument("flags must be equal to GSO_INT_GRAM"); + } gptr = &arg_g; if (gptr == nullptr) { @@ -115,6 +119,9 @@ virtual inline FT &get_gram(FT &f, int i, int j); + // b[i] <-> b[j] (i < j) + virtual void row_swap(int i, int j); + private: /* Allocates matrices and arrays whose size depends on d (all but tmp_col_expo). When enable_int_gram=false, initializes bf. */ @@ -134,8 +141,6 @@ virtual void row_addmul_si_2exp(int i, int j, long x, long expo); virtual void row_addmul_2exp(int i, int j, const ZT &x, long expo); - // b[i] <-> b[j] (i < j) - virtual void row_swap(int i, int j); // virtual void apply_transform(const Matrix<FT> &transform, int src_base, int target_base); }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/lll.h new/fplll-5.2.1/fplll/lll.h --- old/fplll-5.2.0/fplll/lll.h 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/lll.h 2018-05-18 15:14:06.000000000 +0200 @@ -111,6 +111,10 @@ { if (kappa_end == -1) kappa_end = m.d; + + extend_vect(babai_mu, kappa_end); + extend_vect(babai_expo, kappa_end); + for (int k = kappa_min; k < kappa_end; k++) { if ((k > 0 && !babai(k, k, size_reduction_start)) || !m.update_gso_row(k)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/main.cpp new/fplll-5.2.1/fplll/main.cpp --- old/fplll-5.2.0/fplll/main.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/main.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -20,7 +20,7 @@ template <class ZT> int lll(Options &o, ZZ_mat<ZT> &b) { - // Stupid intialization of u and u_inv to be not empty. + // Stupid initialization of u and u_inv to be not empty. ZZ_mat<ZT> u(1, 1), u_inv(1, 1); const char *format = o.output_format ? o.output_format : "b"; int status, flags = 0; @@ -51,13 +51,31 @@ switch (format[i]) { case 'b': - cout << b << endl; + if (format[i + 1] == 'k') + { + b.print_comma(cout); + i++; + } + else + cout << b << endl; break; case 'u': - cout << u << endl; + if (format[i + 1] == 'k') + { + u.print_comma(cout); + i++; + } + else + cout << u << endl; break; case 'v': - cout << u_inv << endl; + if (format[i + 1] == 'k') + { + u_inv.print_comma(cout); + i++; + } + else + cout << u_inv << endl; break; case 't': cout << status << endl; @@ -102,7 +120,7 @@ "File '" << file_name << "' should contain exactly " << n << " numbers"); } -template <class ZT> int bkz(Options &o, ZZ_mat<ZT> &b) { ABORT_MSG("mpz required for BKZ"); } +template <class ZT> int bkz(Options &, ZZ_mat<ZT> &) { ABORT_MSG("mpz required for BKZ"); } template <> int bkz(Options &o, ZZ_mat<mpz_t> &b) { @@ -114,7 +132,7 @@ } BKZParam param(o.block_size, strategies); - // Stupid intialization of u to be not empty. + // Stupid initialization of u to be not empty. ZZ_mat<mpz_t> u(1, 1); const char *format = o.output_format ? o.output_format : "b"; int status; @@ -140,10 +158,22 @@ switch (format[i]) { case 'b': - cout << b << endl; + if (format[i + 1] == 'k') + { + b.print_comma(cout); + i++; + } + else + cout << b << endl; break; case 'u': - cout << u << endl; + if (format[i + 1] == 'k') + { + u.print_comma(cout); + i++; + } + else + cout << u << endl; break; case 't': cout << status << endl; @@ -164,15 +194,28 @@ Note: since we only force |mu_i,j| <= eta with eta > 0.5, the solution is not unique even for a generic matrix */ -template <class ZT> int hkz(Options &o, ZZ_mat<ZT> &b) { ABORT_MSG("mpz required for HKZ"); } +template <class ZT> int hkz(Options &, ZZ_mat<ZT> &) { ABORT_MSG("mpz required for HKZ"); } template <> int hkz(Options &o, ZZ_mat<mpz_t> &b) { - int flags = 0; + const char *format = o.output_format ? o.output_format : "b"; + int flags = 0; if (o.verbose) flags |= HKZ_VERBOSE; int status = hkz_reduction(b, flags, o.float_type, o.precision); - cout << b << endl; + for (int i = 0; format[i]; i++) + { + if (format[i] == 'b') + { + if (format[i + 1] == 'k') + { + b.print_comma(cout); + i++; + } + else + cout << b << endl; + } + } if (status != RED_SUCCESS) { cerr << "Failure: " << get_red_status_str(status) << endl; @@ -182,7 +225,7 @@ /* Shortest vector problem and closest vector problem */ -template <class ZT> int svpcvp(Options &o, ZZ_mat<ZT> &b, const vector<Z_NR<ZT>> &target) +template <class ZT> int svpcvp(Options &, ZZ_mat<ZT> &, const vector<Z_NR<ZT>> &target) { if (target.empty()) { @@ -381,11 +424,9 @@ o.bkz_dump_gso_filename = argv[ac]; o.bkz_flags |= BKZ_DUMP_GSO; } - else if (strcmp(argv[ac], "-c") == 0) + else if (strcmp(argv[ac], "-c") == 0 || strcmp(argv[ac], "-r") == 0) { - ++ac; - CHECK(ac < argc, "missing value after -c switch"); - // o.c=atoi(argv[ac]); // ignored (was the number of columns) + ABORT_MSG("option " << argv[ac] << " no more supported"); } else if (strcmp(argv[ac], "-bkzghbound") == 0) { @@ -449,15 +490,11 @@ o.method = LM_HEURISTIC; else if (strcmp("fast", argv[ac]) == 0) o.method = LM_FAST; - else if (strcmp("fastearly", argv[ac]) == 0) - { - o.method = LM_FAST; - o.early_red = true; - } - else if (strcmp("heuristicearly", argv[ac]) == 0) + else if (strcmp("fastearly", argv[ac]) == 0 || strcmp("heuristicearly", argv[ac]) == 0) { - o.method = LM_HEURISTIC; - o.early_red = true; + string m = string(argv[ac]); + // m.substr(0, m.size() - 4) remove early from the string + ABORT_MSG("use '-m " << m.substr(0, m.size() - 5) << " -y' instead of " << argv[ac]); } else ABORT_MSG("parse error in -m switch : proved, heuristic, fast, " @@ -479,12 +516,6 @@ CHECK(ac < argc, "missing value after -p switch"); o.precision = atoi(argv[ac]); } - else if (strcmp(argv[ac], "-r") == 0) - { - ++ac; - CHECK(ac < argc, "missing value after -r switch"); - // o.r = atoi(argv[ac]); // ignored (was the number of rows) - } else if (strcmp(argv[ac], "-v") == 0) { o.verbose = true; @@ -522,12 +553,7 @@ << " -v\n" << " Enable verbose mode\n" << " -nolll\n" - << " Does not apply intial LLL-reduction (for bkz, hkz and svp)\n" - << " -c <size>\n" - << " Was the number of columns (ignored)\n" - << " -r <size>\n" - << " Was the number of rows (ignored)\n" - + << " Does not apply initial LLL-reduction (for bkz, hkz and svp)\n" << " -d <delta> (default=0.99; alias to -delta <delta>)\n" << " -e <eta> (default=0.51; alias to -eta <eta>)\n" << " -l <lovasz>\n" @@ -538,7 +564,7 @@ << " Floating-point precision (only with -f mpfr)\n" << " -z [mpz|int|long|double]\n" << " Integer type in LLL (default: mpz; long is an alias to int)\n" - << " -m [wrapper|fast|fastearly|heuristic|heuristicearly|proved]\n" + << " -m [wrapper|fast|heuristic|proved]\n" << " LLL version (default: wrapper)\n" << " -y\n" << " Enable early reduction\n" @@ -559,11 +585,10 @@ << " Restricts the LLL call\n" << " -bkzdumpgso <file_name>\n" << " Dumps the log of the Gram-Schmidt vectors in specified file\n" - - << " -of [bcstuv]\n" + << " -of [b|c|s|t|u|v|bk|uk|vk]\n" << " Output formats.\n" - << "Please refer to https://github.com/fplll/fplll/README.md for more informations.\n"; + << "Please refer to https://github.com/fplll/fplll/README.md for more information.\n"; exit(0); } else if (strcmp(argv[ac], "--version") == 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/nr/dpe.h new/fplll-5.2.1/fplll/nr/dpe.h --- old/fplll-5.2.0/fplll/nr/dpe.h 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/nr/dpe.h 2018-05-18 15:14:06.000000000 +0200 @@ -708,14 +708,14 @@ DPE_INLINE void dpe_ugly_exp(dpe_t x, const dpe_t y) { // printf ("## exp is %ld\n", DPE_EXP(y)); - dpe_set_d(x, exp(((double)DPE_MANT(y)) * pow(2, ((double)DPE_EXP(y))))); + dpe_set_d(x, exp(((double)DPE_MANT(y)) * pow(2.0, ((double)DPE_EXP(y))))); } /* More hacks */ /* x = y^k */ DPE_INLINE void dpe_pow_si(dpe_t x, const dpe_t y, const unsigned int k) { - DPE_MANT(x) = pow(DPE_MANT(y), k); + DPE_MANT(x) = pow(DPE_MANT(y), (double)k); DPE_EXP(x) = DPE_EXP(y) * k; dpe_normalize(x); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/nr/matrix.cpp new/fplll-5.2.1/fplll/nr/matrix.cpp --- old/fplll-5.2.0/fplll/nr/matrix.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/nr/matrix.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -202,6 +202,28 @@ } } +template <class T> ostream &Matrix<T>::print_comma(ostream &os) const +{ + os << '['; + for (int i = 0; i < r - 1; i++) + { + os << '['; + for (int j = 0; j < c - 1; j++) + { + os << matrix[i][j] << ", "; + } + os << matrix[i][c - 1] << "],\n"; + } + os << '['; + for (int j = 0; j < c - 1; j++) + { + os << matrix[r - 1][j] << ", "; + } + os << matrix[r - 1][c - 1] << "]]\n"; + + return os; +} + /* ZZ_mat */ template <class ZT> inline void ZZ_mat<ZT>::gen_intrel(int bits) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/nr/matrix.h new/fplll-5.2.1/fplll/nr/matrix.h --- old/fplll-5.2.0/fplll/nr/matrix.h 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/nr/matrix.h 2018-05-18 15:14:06.000000000 +0200 @@ -73,31 +73,24 @@ row.addmul_si_2exp(v.row, x, expo, n, tmp); } + /** Computes the dot product between two rows of a Matrix */ + inline void dot_product(T &result, const MatrixRow<T> &v0, int n) const + { + fplll::dot_product(result, this->row, v0.row, n); + } + + /** Computes (inline) the dot product between two rows of a Matrix */ + inline void dot_product(T &result, const MatrixRow<T> &v0) const + { + this->dot_product(result, v0, this->size()); + } + friend class Matrix<T>; private: MatrixRow(const NumVect<T> &row) : row(const_cast<NumVect<T> &>(row)) {} NumVect<T> &row; }; -/** Computes the dot product between two rows of a Matrix */ -template <class T> -void dot_product(T &result, const MatrixRow<T> &v1, const MatrixRow<T> &v2, int n) -{ - FPLLL_DEBUG_CHECK(n > 0 && n <= v1.size() && v1.size() == v2.size() && - (v1.is_zero(n) || v2.is_zero(n))); - result.mul(v1[0], v2[0]); - for (int i = 1; i < n; i++) - { - result.addmul(v1[i], v2[i]); - } -} - -/** Computes (inline) the dot product between two rows of a Matrix */ -template <class T> -inline void dot_product(T &result, const MatrixRow<T> &v1, const MatrixRow<T> &v2) -{ - dot_product(result, v1, v2, v1.size()); -} /** Prints a MatrixRow on stream os. */ template <class T> ostream &operator<<(ostream &os, const MatrixRow<T> &row) @@ -204,6 +197,8 @@ void print(ostream &os, int nrows = -1, int ncols = -1) const; /** Reads this matrix from a stream. */ void read(istream &is); + /** Print the matrix, sage format style */ + ostream &print_comma(ostream &os) const; /** Change the output format style of Matrix */ static int set_print_mode(int new_print_mode) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/nr/nr_FP.inl new/fplll-5.2.1/fplll/nr/nr_FP.inl --- old/fplll-5.2.0/fplll/nr/nr_FP.inl 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/nr/nr_FP.inl 2018-05-18 15:14:06.000000000 +0200 @@ -153,7 +153,7 @@ inline FP_NR<F>& operator=(const char *s); inline FP_NR<F>& operator=(double a); // inline FP_NR<F>& operator=(mpfr_t& a); - inline FP_NR<F>& operator=(mpfr_t &a) { set_mpfr(a, MPFR_RNDN); }; + inline FP_NR<F>& operator=(mpfr_t &a) { set_mpfr(a, GMP_RNDN); }; inline bool operator==(const FP_NR<F> &a) const { return cmp(a) == 0; } inline bool operator==(double a) const { return cmp(a) == 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/nr/nr_FP_dd.inl new/fplll-5.2.1/fplll/nr/nr_FP_dd.inl --- old/fplll-5.2.0/fplll/nr/nr_FP_dd.inl 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/nr/nr_FP_dd.inl 2018-05-18 15:14:06.000000000 +0200 @@ -43,9 +43,19 @@ mpfr_add_d (r, r, data._hi(), rnd); } -template<> + +template<> inline void FP_NR<dd_real>::set_mpfr(mpfr_t r, mp_rnd_t rnd) { - data = mpfr_get_ld (r, rnd); + + double hi; + hi = mpfr_get_d (r, rnd); + + mpfr_t tf; + mpfr_init(tf); + mpfr_sub_d(tf,r,hi,rnd); + + data = dd_real(hi,mpfr_get_d (tf, rnd)); + mpfr_clear(tf); } template<> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/nr/nr_FP_misc.inl new/fplll-5.2.1/fplll/nr/nr_FP_misc.inl --- old/fplll-5.2.0/fplll/nr/nr_FP_misc.inl 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/nr/nr_FP_misc.inl 2018-05-18 15:14:06.000000000 +0200 @@ -113,10 +113,19 @@ } #endif -/** set_z (from default mpz_t to dd_real) */ + +/** set_z (from default mpz_t to dd_real) */ template<> template<> inline void FP_NR<dd_real>::set_z(const Z_NR<mpz_t>& a, mp_rnd_t /*rnd*/) { - data = mpz_get_d(a.get_data()); + + double hi = mpz_get_d(a.get_data()); + + mpz_t tz; + mpz_init(tz); + mpz_set_d(tz,hi); + mpz_sub(tz,a.get_data(),tz); + + data = dd_real(hi,mpz_get_d(tz)); } #endif @@ -329,13 +338,13 @@ #ifdef FPLLL_WITH_ZDOUBLE /** get_z_exp_we (from dd_real to Z_NR<double>) */ template<> template<> -inline void FP_NR<dd_real>::get_z_exp_we(Z_NR<double>& a, long& expo, long expo_add) const { +inline void FP_NR<dd_real>::get_z_exp_we(Z_NR<double>& a, long& expo, long) const { expo = 0; a = get_si(); } /** get_z_exp_we (from qd_real to Z_NR<double>) */ template<> template<> -inline void FP_NR<qd_real>::get_z_exp_we(Z_NR<double>& a, long& expo, long expo_add) const { +inline void FP_NR<qd_real>::get_z_exp_we(Z_NR<double>& a, long& expo, long) const { expo = 0; a = get_si(); } @@ -395,4 +404,4 @@ FPLLL_END_NAMESPACE -#endif \ No newline at end of file +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/nr/nr_FP_mpfr.inl new/fplll-5.2.1/fplll/nr/nr_FP_mpfr.inl --- old/fplll-5.2.0/fplll/nr/nr_FP_mpfr.inl 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/nr/nr_FP_mpfr.inl 2018-05-18 15:14:06.000000000 +0200 @@ -249,7 +249,11 @@ template<> inline void FP_NR<mpfr_t>::root(const FP_NR<mpfr_t>& a, unsigned int k, mp_rnd_t rnd) { +#if MPFR_VERSION_MAJOR >= 4 + mpfr_rootn_ui(data, a.data, k, rnd); +#else // MPFR_VERSION_MAJOR >= 4 mpfr_root(data, a.data, k, rnd); +#endif // MPFR_VERSION_MAJOR >= 4 } template<> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/nr/nr_Z_mpz.inl new/fplll-5.2.1/fplll/nr/nr_Z_mpz.inl --- old/fplll-5.2.0/fplll/nr/nr_Z_mpz.inl 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/nr/nr_Z_mpz.inl 2018-05-18 15:14:06.000000000 +0200 @@ -250,7 +250,7 @@ inline void Z_NR<mpz_t>::randb(int bits) { mpz_urandomb(data, RandGen::get_gmp_state(), bits); if (bits > 32){ - unsigned long int tmp = mpz_get_ui(data); + unsigned long long tmp = static_cast<unsigned long long>(mpz_get_ui(data) & ~((1ULL)<<31)); gmp_randseed_ui(RandGen::gmp_state, tmp*tmp); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/nr/numvect.h new/fplll-5.2.1/fplll/nr/numvect.h --- old/fplll-5.2.0/fplll/nr/numvect.h 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/nr/numvect.h 2018-05-18 15:14:06.000000000 +0200 @@ -344,7 +344,8 @@ return i; } -template <class T> void dot_product(T &result, const NumVect<T> &v1, const NumVect<T> &v2, int n) +template <class T> +inline void dot_product(T &result, const NumVect<T> &v1, const NumVect<T> &v2, int n) { FPLLL_DEBUG_CHECK(n > 0 && n <= v1.size() && v1.size() == v2.size() && (v1.is_zero(n) || v2.is_zero(n))); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/sieve/sieve_gauss.cpp new/fplll-5.2.1/fplll/sieve/sieve_gauss.cpp --- old/fplll-5.2.0/fplll/sieve/sieve_gauss.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/sieve/sieve_gauss.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -107,7 +107,7 @@ template <class ZT, class F> void GaussSieve<ZT, F>::add_mat_list(ZZ_mat<ZT> &B) { Z_NR<ZT> t, current_norm; - dot_product(best_sqr_norm, B[0], B[0]); + B[0].dot_product(best_sqr_norm, B[0]); ListPoint<ZT> *p; for (int i = 0; i < nr; ++i) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/sieve/sieve_gauss_2sieve.cpp new/fplll-5.2.1/fplll/sieve/sieve_gauss_2sieve.cpp --- old/fplll-5.2.0/fplll/sieve/sieve_gauss_2sieve.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/sieve/sieve_gauss_2sieve.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -33,7 +33,7 @@ for (lp_it = List.begin(); lp_it != List.end(); ++lp_it) { v = *lp_it; - if (p->norm < v->norm) + if ((p->norm) < v->norm) break; /* if there is one reduction the vector should re-pass the list */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/sieve/sieve_gauss_3sieve.cpp new/fplll-5.2.1/fplll/sieve/sieve_gauss_3sieve.cpp --- old/fplll-5.2.0/fplll/sieve/sieve_gauss_3sieve.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/sieve/sieve_gauss_3sieve.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -27,7 +27,7 @@ for (lp_it = List.begin(); lp_it != List.end(); ++lp_it) { v = *lp_it; - if (p->norm < v->norm) + if ((p->norm) < v->norm) break; if (half_2reduce(p, v)) { @@ -166,7 +166,7 @@ continue; } ++lp_it2; - if (v1->norm < p->norm) + if ((v1->norm) < p->norm) { vnew2 = new_listpoint<ZT>(nc); if (check_3reduce(v1, p, v2, vnew2) != 1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/sieve/sieve_gauss_4sieve.cpp new/fplll-5.2.1/fplll/sieve/sieve_gauss_4sieve.cpp --- old/fplll-5.2.0/fplll/sieve/sieve_gauss_4sieve.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/sieve/sieve_gauss_4sieve.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -15,7 +15,7 @@ for (lp_it = List.begin(); lp_it != List.end(); ++lp_it) { v = *lp_it; - if (p->norm < v->norm) + if ((p->norm) < v->norm) break; } lp_it_k = lp_it; @@ -119,7 +119,7 @@ continue; } ++lp_it2; - if (v1->norm < p->norm) + if ((v1->norm) < p->norm) { /*cout << "# --- here 1 " << endl; cout << v1->norm << endl; @@ -274,7 +274,7 @@ } ++lp_it3; /* (v1, p, v2, v3) or (v1, v2, p, v3) */ - if (v1->norm < p->norm) + if ((v1->norm) < p->norm) { /* (v1, p, v2, v3) */ if (v2->norm > p->norm) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/sieve/sieve_main.cpp new/fplll-5.2.1/fplll/sieve/sieve_main.cpp --- old/fplll-5.2.0/fplll/sieve/sieve_main.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/sieve/sieve_main.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -72,6 +72,7 @@ alg = atoi(optarg); if (alg != 2 && alg != 3 && alg != 4) throw std::invalid_argument("only support 2-, 3- and 4-sieve"); + break; case 'f': input_file_name = optarg; flag_file = true; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/svpcvp.cpp new/fplll-5.2.1/fplll/svpcvp.cpp --- old/fplll-5.2.0/fplll/svpcvp.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/svpcvp.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -47,11 +47,11 @@ { Z_NR<mpz_t> sq_norm; int n = b.get_cols(); - sqr_norm(basis_min, b[first], n); + b[first].dot_product(basis_min, b[first], n); for (int i = first + 1; i < last; i++) { - sqr_norm(sq_norm, b[i], n); + b[i].dot_product(sq_norm, b[i], n); if (sq_norm < basis_min) basis_min = sq_norm; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/util.h new/fplll-5.2.1/fplll/util.h --- old/fplll-5.2.0/fplll/util.h 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/util.h 2018-05-18 15:14:06.000000000 +0200 @@ -59,24 +59,6 @@ result[j].addmul(x[i], m(i, j)); } -template <class T> -void scalar_product(T &result, const MatrixRow<T> &v1, const MatrixRow<T> &v2, int n) -{ - FPLLL_DEBUG_CHECK(n <= static_cast<int>(v1.size()) && n <= static_cast<int>(v2.size())); - T tmp; - result.mul(v1[0], v2[0]); - for (int i = 1; i < n; i++) - { - tmp.mul(v1[i], v2[i]); - result.add(result, tmp); - } -} - -template <class T> inline void sqr_norm(T &result, const MatrixRow<T> &v, int n) -{ - scalar_product(result, v, v, n); -} - const double DEF_GSO_PREC_EPSILON = 0.03; /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll/wrapper.cpp new/fplll-5.2.1/fplll/wrapper.cpp --- old/fplll-5.2.0/fplll/wrapper.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll/wrapper.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -390,8 +390,8 @@ } template <class ZT> -int lll_reduction_wrapper(ZZ_mat<ZT> &b, ZZ_mat<ZT> &u, ZZ_mat<ZT> &u_inv, double delta, double eta, - FloatType float_type, int precision, int flags) +int lll_reduction_wrapper(ZZ_mat<ZT> &, ZZ_mat<ZT> &, ZZ_mat<ZT> &, double, double, FloatType, int, + int) { FPLLL_ABORT("The wrapper method works only with integer type mpz"); return RED_LLL_FAILURE; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/fplll.pc.in new/fplll-5.2.1/fplll.pc.in --- old/fplll-5.2.0/fplll.pc.in 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/fplll.pc.in 2018-05-18 15:14:06.000000000 +0200 @@ -6,4 +6,4 @@ Name: @PACKAGE_NAME@ Description: lattice algorithms with floating-point computations Version: @PACKAGE_VERSION@ -Libs: -L${libdir} @LIBQD_LIBADD@ -lgmp -lmpfr -lfplll +Libs: -L${libdir} @LIBQD_LIBADD@ @LIBGMP@ -lmpfr -lfplll diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/tests/Makefile.am new/fplll-5.2.1/tests/Makefile.am --- old/fplll-5.2.0/tests/Makefile.am 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/tests/Makefile.am 2018-05-18 15:14:06.000000000 +0200 @@ -39,8 +39,8 @@ TESTS = test_nr test_lll test_cvp test_svp test_bkz test_pruner test_sieve test_gso test_lll_gram -test_pruner_LDADD=-lgmp -lmpfr $(LIBQD_LIBADD) -test_sieve_LDADD=-lgmp -lmpfr $(LIBQD_LIBADD) +test_pruner_LDADD=$(LIBGMP) -lmpfr $(LIBQD_LIBADD) +test_sieve_LDADD=$(LIBGMP) -lmpfr $(LIBQD_LIBADD) test_nr_SOURCES = test_nr.cpp test_lll_SOURCES = test_lll.cpp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/tests/test_bkz.cpp new/fplll-5.2.1/tests/test_bkz.cpp --- old/fplll-5.2.0/tests/test_bkz.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/tests/test_bkz.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -14,9 +14,9 @@ along with fplll. If not, see <http://www.gnu.org/licenses/>. */ #include "io/json.hpp" -#include <../tests/test_utils.h> #include <cstring> #include <fplll.h> +#include <test_utils.h> using json = nlohmann::json; @@ -183,7 +183,7 @@ @return zero on success. */ template <class ZT> -int test_int_rel_bkz_dump_gso(int d, int b, const int block_size, FloatType float_type = FT_DEFAULT, +int test_int_rel_bkz_dump_gso(int d, int b, const int block_size, int flags = BKZ_DEFAULT | BKZ_DUMP_GSO) { ZZ_mat<ZT> A, B; @@ -375,7 +375,7 @@ test_filename<mpz_t>(TESTDATADIR "/tests/lattices/example_in", 10, FT_DOUBLE, BKZ_SLD_RED); // Test BKZ_DUMP_GSO - status |= test_int_rel_bkz_dump_gso<mpz_t>(50, 1000, 15, FT_MPFR, BKZ_DEFAULT | BKZ_DUMP_GSO); + status |= test_int_rel_bkz_dump_gso<mpz_t>(50, 1000, 15, BKZ_DEFAULT | BKZ_DUMP_GSO); if (status == 0) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/tests/test_cvp.cpp new/fplll-5.2.1/tests/test_cvp.cpp --- old/fplll-5.2.0/tests/test_cvp.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/tests/test_cvp.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -13,9 +13,9 @@ You should have received a copy of the GNU Lesser General Public License along with fplll. If not, see <http://www.gnu.org/licenses/>. */ -#include <../tests/test_utils.h> #include <cstring> #include <fplll.h> +#include <test_utils.h> #ifndef TESTDATADIR #define TESTDATADIR ".." diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/tests/test_gso.cpp new/fplll-5.2.1/tests/test_gso.cpp --- old/fplll-5.2.0/tests/test_gso.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/tests/test_gso.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -19,7 +19,7 @@ #include <gso_interface.h> #include <nr/matrix.h> //#include <random> -#include <../tests/test_utils.h> +#include <test_utils.h> using namespace std; using namespace fplll; @@ -197,8 +197,7 @@ @return zero on success */ -template <class ZT, class FT> -int test_int_rel(int d, int b, FloatType float_type = FT_DEFAULT, int prec = 0) +template <class ZT, class FT> int test_int_rel(int d, int b) { ZZ_mat<ZT> A; A.resize(d, d + 1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/tests/test_lll.cpp new/fplll-5.2.1/tests/test_lll.cpp --- old/fplll-5.2.0/tests/test_lll.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/tests/test_lll.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -13,9 +13,9 @@ You should have received a copy of the GNU Lesser General Public License along with fplll. If not, see <http://www.gnu.org/licenses/>. */ -#include <../tests/test_utils.h> #include <cstring> #include <fplll.h> +#include <test_utils.h> using namespace std; using namespace fplll; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/tests/test_lll_gram.cpp new/fplll-5.2.1/tests/test_lll_gram.cpp --- old/fplll-5.2.0/tests/test_lll_gram.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/tests/test_lll_gram.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -13,13 +13,13 @@ You should have received a copy of the GNU Lesser General Public License along with fplll. If not, see <http://www.gnu.org/licenses/>. */ -#include <../tests/test_utils.h> #include <cstring> #include <fplll.h> #include <gso.h> #include <gso_gram.h> #include <gso_interface.h> #include <lll.h> +#include <test_utils.h> using namespace std; using namespace fplll; @@ -28,32 +28,11 @@ #define TESTDATADIR ".." #endif -template <class ZT, class FT> -bool have_equal_grammatrix(MatGSO<Z_NR<ZT>, FP_NR<FT>> M1, MatGSOGram<Z_NR<ZT>, FP_NR<FT>> M2) -{ - Matrix<Z_NR<ZT>> g1 = M1.get_g_matrix(); - Matrix<Z_NR<ZT>> g2 = M2.get_g_matrix(); - - for (int i = 0; i < g1.get_rows(); i++) - { - for (int j = 0; j < g1.get_cols(); j++) - { - if (g1[i][j] != g2[i][j]) - { - return false; - } - } - } - return true; -} - template <class ZT, class FT> int is_already_reduced(ZZ_mat<ZT> &A, Matrix<Z_NR<ZT>> &G) { ZZ_mat<ZT> U; ZZ_mat<ZT> UT; - // MatGSO<Z_NR<ZT>, FP_NR<FT>> M(A, U, UT, 0); - // changed this to flag = 1 MatGSO<Z_NR<ZT>, FP_NR<FT>> M(A, U, UT, 1); MatGSOGram<Z_NR<ZT>, FP_NR<FT>> M2(G, U, UT, 1); @@ -67,11 +46,10 @@ } /** - @brief Test LLL reduction. - - @param A test matrix + @brief Tests whether LLL applied on A is equivalent to LLLGram applied on G = A*A^T - @return zero on success. + @param A basis matrix of a lattice + @return zero on success */ template <class ZT, class FT> int test_lll(ZZ_mat<ZT> &A) @@ -80,43 +58,61 @@ ZZ_mat<ZT> U; ZZ_mat<ZT> UT; + // _______________________________________________ // ----------------------------------------------- - // Create the gram matrix G of the basis matrix A. - MatGSO<Z_NR<ZT>, FP_NR<FT>> Mbuf(A, U, UT, 1); - Mbuf.update_gso(); - Matrix<Z_NR<ZT>> G = Mbuf.get_g_matrix(); - // ------------------------------------------------ + // Create the Gram matrix G of the basis A + ZZ_mat<ZT> G; + int r = A.r; + int c = A.c; + G.resize(r, r); + for (int i = 0; i < r; i++) + { + for (int j = 0; j < r; j++) + { + A[i].dot_product(G(i, j), A[j], c); + } + } // ------------------------------------------------ - // Create a MatGSO-object (basis gso) for A - // and a MatGSOGram-object (gram gso) for G. - // changed flag to 1 here + // ************************************************ + + // _______________________________________________ + // ----------------------------------------------- + // Create a MatGSO-object M (basis gso) for A + // and a MatGSOGram-object Mgram (gram gso) for G. + MatGSO<Z_NR<ZT>, FP_NR<FT>> M(A, U, UT, 1); M.update_gso(); MatGSOGram<Z_NR<ZT>, FP_NR<FT>> Mgram(G, U, UT, 1); Mgram.update_gso(); - // ------------------------------------------------- + // ------------------------------------------------ + // ************************************************ - // -------------------------------------------------- + // _________________________________________________ + // ------------------------------------------------- // Test whether A and G are not already LLL-reduced. if (is_already_reduced<ZT, FT>(A, G)) { cerr << "The matrices are already LLL-reduced"; return 1; } - // --------------------------------------------------- + // ------------------------------------------------ + // ************************************************ - // ----------------------------------------------------- + // _________________________________________________ + // ------------------------------------------------- // Make two LLLObjects. One of the basis MatGSO-object M // one of the gram MatGSOGram-object Mgram. LLLReduction<Z_NR<ZT>, FP_NR<FT>> LLLObj(M, LLL_DEF_DELTA, LLL_DEF_ETA, 0); LLLReduction<Z_NR<ZT>, FP_NR<FT>> LLLObjgram(Mgram, LLL_DEF_DELTA, LLL_DEF_ETA, 0); - // LLL reduce both objects. + // and LLL reduce both objects LLLObj.lll(); LLLObjgram.lll(); - // --------------------------------------------------------- + // ------------------------------------------------ + // ************************************************ + // _________________________________________________ // ------------------------------------------------- // Check whether M and Mgram are really reduced after LLL reduction int is_reduced = is_lll_reduced<Z_NR<ZT>, FP_NR<FT>>(M, LLL_DEF_DELTA, LLL_DEF_ETA); @@ -134,29 +130,49 @@ } return 1; } - // ---------------------------------------------------------- + // ------------------------------------------------ + // ************************************************ + + // + // After this reduction, A (the input matrix) and G (gram matrix) + // are LLL-reduced accordingly. Therefore we should check whether + // A *A^T = G + // - // ---------------------------------------------------------- - // Create the MatGSO object M2, which creates the Gram matrix - // of the LLL-reduced basis M.b of M. - MatGSO<Z_NR<ZT>, FP_NR<FT>> M2(M.b, U, UT, 1); - M2.update_gso(); - // ---------------------------------------------------------- - - // ---------------------------------------------------------- - // Test whether M2.g and Mgram.g are equal. - bool retvalue1 = have_equal_grammatrix(M2, Mgram); - // ---------------------------------------------------------- + // _______________________________________________ + // ----------------------------------------------- + // Create the Gram matrix G_reduced of the basis A_reduced - if (retvalue1) + ZZ_mat<ZT> G_reduced; + G_reduced.resize(r, r); + for (int i = 0; i < r; i++) { - return 0; + for (int j = 0; j < r; j++) + { + (M.b)[i].dot_product(G_reduced(i, j), (M.b)[j], c); + } } - else + // ------------------------------------------------ + // ************************************************ + + // _______________________________________________ + // ----------------------------------------------- + // Test whether G_reduced = G + for (int i = 0; i < r; i++) { - cerr << "Unequal gram matrix\n"; - return 1; + for (int j = 0; j < i; j++) + { + if (G(i, j) != G_reduced(i, j)) + { + cerr << "The gram-representation and the basis-representation of the same lattice have an " + "unequal gram matrix.\n"; + return 1; + } + } } + + // Return 0 on success. + return 0; } template <class ZT, class FT> int test_filename(const char *input_filename) @@ -198,6 +214,9 @@ status |= test_filename<mpz_t, double>(TESTDATADIR "/tests/lattices/example_cvp_in_lattice5"); status |= test_int_rel<mpz_t, double>(50, 20); status |= test_int_rel<mpz_t, double>(40, 10); + + status |= test_int_rel<mpz_t, double>(100, 200); + status |= test_int_rel<mpz_t, double>(200, 100); status |= test_filename<mpz_t, mpfr_t>(TESTDATADIR "/tests/lattices/example2_in"); @@ -208,7 +227,6 @@ status |= test_filename<mpz_t, mpfr_t>(TESTDATADIR "/tests/lattices/example_cvp_in_lattice5"); status |= test_int_rel<mpz_t, mpfr_t>(50, 20); status |= test_int_rel<mpz_t, mpfr_t>(40, 10); - status |= test_int_rel<mpz_t, mpfr_t>(200, 100); #ifdef FPLLL_WITH_LONG_DOUBLE status |= test_filename<mpz_t, long double>(TESTDATADIR "/tests/lattices/example2_in"); @@ -223,8 +241,7 @@ test_filename<mpz_t, long double>(TESTDATADIR "/tests/lattices/example_cvp_in_lattice5"); status |= test_int_rel<mpz_t, long double>(50, 20); status |= test_int_rel<mpz_t, long double>(40, 10); -// status |= test_int_rel<mpz_t, long double>(200, 100); -// * + #endif #ifdef FPLLL_WITH_QD status |= test_filename<mpz_t, dd_real>(TESTDATADIR "/tests/lattices/example2_in"); @@ -235,7 +252,6 @@ status |= test_filename<mpz_t, dd_real>(TESTDATADIR "/tests/lattices/example_cvp_in_lattice5"); status |= test_int_rel<mpz_t, dd_real>(50, 20); status |= test_int_rel<mpz_t, dd_real>(40, 10); - // status |= test_int_rel<mpz_t, dd_real>(200, 100); status |= test_filename<mpz_t, qd_real>(TESTDATADIR "/tests/lattices/example2_in"); status |= test_filename<mpz_t, qd_real>(TESTDATADIR "/tests/lattices/example_cvp_in_lattice"); @@ -245,7 +261,7 @@ status |= test_filename<mpz_t, qd_real>(TESTDATADIR "/tests/lattices/example_cvp_in_lattice5"); status |= test_int_rel<mpz_t, qd_real>(50, 20); status |= test_int_rel<mpz_t, qd_real>(40, 10); -// status |= test_int_rel<mpz_t, qd_real>(200, 100); + #endif #ifdef FPLLL_WITH_DPE status |= test_filename<mpz_t, dpe_t>(TESTDATADIR "/tests/lattices/example2_in"); @@ -256,8 +272,7 @@ status |= test_filename<mpz_t, dpe_t>(TESTDATADIR "/tests/lattices/example_cvp_in_lattice5"); status |= test_int_rel<mpz_t, dpe_t>(50, 20); status |= test_int_rel<mpz_t, dpe_t>(40, 10); -// status |= test_int_rel<mpz_t, dpe_t>(200, 100); -//* + #endif if (status == 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/tests/test_nr.cpp new/fplll-5.2.1/tests/test_nr.cpp --- old/fplll-5.2.0/tests/test_nr.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/tests/test_nr.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -86,7 +86,7 @@ return status; } -int main(int argc, char *argv[]) +int main() { int status = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/tests/test_pruner.cpp new/fplll-5.2.1/tests/test_pruner.cpp --- old/fplll-5.2.0/tests/test_pruner.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/tests/test_pruner.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -509,7 +509,7 @@ return status; } -int main(int argc, char *argv[]) +int main() { int status = 0; #ifdef FPLLL_WITH_QD diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/tests/test_sieve.cpp new/fplll-5.2.1/tests/test_sieve.cpp --- old/fplll-5.2.0/tests/test_sieve.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/tests/test_sieve.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -1,7 +1,7 @@ #include <../fplll/sieve/sieve_main.h> /* standalone bin */ -#include <../tests/test_utils.h> #include <cstring> #include <fplll.h> +#include <test_utils.h> #ifndef TESTDATADIR #define TESTDATADIR ".." diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/fplll-5.2.0/tests/test_svp.cpp new/fplll-5.2.1/tests/test_svp.cpp --- old/fplll-5.2.0/tests/test_svp.cpp 2017-09-11 17:00:36.000000000 +0200 +++ new/fplll-5.2.1/tests/test_svp.cpp 2018-05-18 15:14:06.000000000 +0200 @@ -14,9 +14,9 @@ You should have received a copy of the GNU Lesser General Public License along with fplll. If not, see <http://www.gnu.org/licenses/>. */ -#include <../tests/test_utils.h> #include <cstring> #include <fplll.h> +#include <test_utils.h> #ifndef TESTDATADIR #define TESTDATADIR ".." @@ -291,12 +291,10 @@ /** @brief Run SVP tests. - @param argc ignored - @param argv ignored @return */ -int main(int argc, char *argv[]) +int main() { int status = 0;
