Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package fplll for openSUSE:Factory checked in at 2022-12-21 16:06:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/fplll (Old) and /work/SRC/openSUSE:Factory/.fplll.new.1835 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "fplll" Wed Dec 21 16:06:42 2022 rev:12 rq:1043990 version:5.4.3 Changes: -------- --- /work/SRC/openSUSE:Factory/fplll/fplll.changes 2022-12-10 21:18:42.357864383 +0100 +++ /work/SRC/openSUSE:Factory/.fplll.new.1835/fplll.changes 2022-12-21 16:06:44.198585571 +0100 @@ -1,0 +2,6 @@ +Tue Dec 20 21:30:52 UTC 2022 - Jan Engelhardt <[email protected]> + +- Update to release 5.4.3 + * Add FP_NR::ceil function + +------------------------------------------------------------------- Old: ---- fplll-5.4.2.tar.gz New: ---- fplll-5.4.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ fplll.spec ++++++ --- /var/tmp/diff_new_pack.9PCSQ0/_old 2022-12-21 16:06:44.746588526 +0100 +++ /var/tmp/diff_new_pack.9PCSQ0/_new 2022-12-21 16:06:44.750588549 +0100 @@ -18,7 +18,7 @@ Name: fplll %define lname libfplll7 -Version: 5.4.2 +Version: 5.4.3 Release: 0 Summary: Lenstra-Lovász Lattice Basis Reduction Algorithm Library License: LGPL-2.1-or-later ++++++ fplll-5.4.2.tar.gz -> fplll-5.4.3.tar.gz ++++++ ++++ 20508 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.4.2/README.md new/fplll-5.4.3/README.md --- old/fplll-5.4.2/README.md 2022-05-24 19:36:03.000000000 +0200 +++ new/fplll-5.4.3/README.md 2022-12-20 22:23:09.000000000 +0100 @@ -17,7 +17,7 @@ @unpublished{fplll, author = {The {FPLLL} development team}, - title = {{fplll}, a lattice reduction library, {Version}: 5.4.2}, + title = {{fplll}, a lattice reduction library, {Version}: 5.4.3}, year = 2022, note = {Available at \url{https://github.com/fplll/fplll}}, url = {https://github.com/fplll/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.4.2/compile new/fplll-5.4.3/compile --- old/fplll-5.4.2/compile 2022-05-24 19:36:24.000000000 +0200 +++ new/fplll-5.4.3/compile 2022-12-20 22:23:25.000000000 +0100 @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey <[email protected]>. # # This program is free software; you can redistribute it and/or modify @@ -53,7 +53,7 @@ MINGW*) file_conv=mingw ;; - CYGWIN*) + CYGWIN* | MSYS*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/*) + cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) 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.4.2/config.h.in new/fplll-5.4.3/config.h.in --- old/fplll-5.4.2/config.h.in 2022-05-24 19:36:23.000000000 +0200 +++ new/fplll-5.4.3/config.h.in 2022-12-20 22:23:25.000000000 +0100 @@ -63,9 +63,6 @@ /* Define to 1 if you have the <limits.h> header file. */ #undef HAVE_LIMITS_H -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - /* Define to 1 if you have the `pow' function. */ #undef HAVE_POW @@ -87,6 +84,9 @@ /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H +/* Define to 1 if you have the <stdio.h> header file. */ +#undef HAVE_STDIO_H + /* Define to 1 if you have the <stdlib.h> header file. */ #undef HAVE_STDLIB_H @@ -145,7 +145,9 @@ your system. */ #undef PTHREAD_CREATE_JOINABLE -/* Define to 1 if you have the ANSI C header files. */ +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* Version number of package */ 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.4.2/configure.ac new/fplll-5.4.3/configure.ac --- old/fplll-5.4.2/configure.ac 2022-05-24 19:36:03.000000000 +0200 +++ new/fplll-5.4.3/configure.ac 2022-12-20 22:23:09.000000000 +0100 @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT([fplll],[5.4.2]) +AC_INIT([fplll],[5.4.3]) AC_CONFIG_SRCDIR([fplll/fplll.cpp]) AM_MAINTAINER_MODE([enable]) AC_CANONICAL_TARGET @@ -40,9 +40,9 @@ # 3. If interfaces were removed (breaks backward compatibility): increment # current, and set both revision and age to zero. -FPLLL_LT_CURRENT=7 -FPLLL_LT_REVISION=1 -FPLLL_LT_AGE=0 +FPLLL_LT_CURRENT=8 +FPLLL_LT_REVISION=0 +FPLLL_LT_AGE=1 AC_SUBST(FPLLL_LT_CURRENT) AC_SUBST(FPLLL_LT_REVISION) @@ -104,7 +104,7 @@ # and libraries if that didn't work for some reason. # # We only show a warning if we cannot find libqd, it is optional but recommended -AS_IF([test "x$with_qd" == "xyes"], [ +AS_IF([test "x$with_qd" = "xyes"], [ PKG_CHECK_MODULES([LIBQD], [qd], [have_libqd="yes"], [ # fall back to manual search. AC_SEARCH_LIBS(c_dd_add, 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.4.2/fplll/enum-parallel/enumeration.h new/fplll-5.4.3/fplll/enum-parallel/enumeration.h --- old/fplll-5.4.2/fplll/enum-parallel/enumeration.h 2022-05-24 19:36:03.000000000 +0200 +++ new/fplll-5.4.3/fplll/enum-parallel/enumeration.h 2022-12-20 22:23:09.000000000 +0100 @@ -414,9 +414,8 @@ swirlys[0].clear(); enumerate_recur(i_tag<N - 1, svp, N - SWIRLY, 0>()); - const auto swirl_less = [](const swirl_item_t &l, const swirl_item_t &r) { - return l.second.second < r.second.second; - }; + const auto swirl_less = [](const swirl_item_t &l, const swirl_item_t &r) + { return l.second.second < r.second.second; }; if (activeswirly) { sort(swirlys[0].begin(), swirlys[0].end(), swirl_less); @@ -460,7 +459,8 @@ auto &swirly_ref = swirlys[1]; std::atomic<std::size_t> swirly_i(0); unsigned threadid = 0; - auto f = [this, &swirly_ref, &swirly_i, swirly1end, &threadid]() { + auto f = [this, &swirly_ref, &swirly_i, swirly1end, &threadid]() + { auto mylat = *this; { lock_type lock(globals.mutex); 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.4.2/fplll/gso.cpp new/fplll-5.4.3/fplll/gso.cpp --- old/fplll-5.4.2/fplll/gso.cpp 2022-05-24 19:36:03.000000000 +0200 +++ new/fplll-5.4.3/fplll/gso.cpp 2022-12-20 22:23:09.000000000 +0100 @@ -402,6 +402,112 @@ } } +template <class ZT, class FT> +void MatGSO<ZT, FT>::to_canonical(vector<FT> &w, const vector<FT> &v, long start) +{ + vector<FT> x = vector<FT>(v); + long dim = (((long)x.size()) < d - start) ? x.size() : d - start; + long expo = 0; + FT tmp = 0.0; + // 1. triangular system solving + for (long i = dim - 1; i >= 0; i--) + { + for (long j = i + 1; j < dim; j++) + { + get_mu(tmp, start + j, start + i); + x[i] -= tmp * x[j]; + } + } + // 2. multiply by B + w.resize(b.get_cols()); + for (long j = 0; j < b.get_cols(); j++) + { + w[j] = 0.0; + for (long i = 0; i < dim; i++) + { + b[start + i][j].get_f_exp(tmp, expo); + tmp.mul(tmp, x[i]); + tmp.mul_2si(tmp, expo); + w[j] += tmp; + } + } +} + +template <class ZT, class FT> +void MatGSO<ZT, FT>::from_canonical(vector<FT> &v, const vector<FT> &w, long start, long dimension) +{ + long dim = (dimension == -1) ? d - start : dimension; + long expo = 0; + FT tmp = 0.0; + vector<FT> x(start + dim); + + // 1.multiply by B + for (long i = 0; i < start + dim; i++) + { + x[i] = 0.0; + for (long j = 0; j < b.get_cols(); j++) + { + b[i][j].get_f_exp(tmp, expo); + tmp.mul(tmp, w[j]); + tmp.mul_2si(tmp, expo); + x[i] += tmp; + } + } + // 2. triangular system solving + for (long i = 0; i < start + dim; i++) + { + for (long j = 0; j < i; j++) + { + get_mu(tmp, i, j); + tmp.mul(tmp, x[j]); + x[i] -= tmp; + } + } + // 3. scale + for (long i = 0; i < dim; i++) + { + get_r(tmp, start + i, start + i); + x[i + start] /= tmp; + } + + // copy out + v.resize(dim); + for (long i = 0; i < dim; i++) + { + v[i] = x[start + i]; + } +} + +template <class ZT, class FT> +void MatGSO<ZT, FT>::babai(vector<ZT> &v, int start, int dimension, bool gso) +{ + vector<FT> w; + FT tmp = 0.0; + for (size_t i = 0; i < v.size(); i++) + { + tmp.set_z(v[i]); + w.push_back(tmp); + v[i] = 0; + } + babai(v, w, start, dimension, gso); +} + +template <class ZT, class FT> +void MatGSO<ZT, FT>::babai(vector<ZT> &w, const vector<FT> &v, int start, int dimension, bool gso) +{ + dimension = (dimension == -1) ? this->d - start : dimension; + vector<FT> x; + if (!gso) + { + from_canonical(x, v, start, dimension); + MatGSOInterface<ZT, FT>::babai(w, x, start, dimension); + } + else + { + MatGSOInterface<ZT, FT>::babai(w, v, start, dimension); + } +} + template class MatGSO<Z_NR<long>, FP_NR<double>>; template class MatGSO<Z_NR<double>, FP_NR<double>>; template class MatGSO<Z_NR<mpz_t>, FP_NR<double>>; 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.4.2/fplll/gso.h new/fplll-5.4.3/fplll/gso.h --- old/fplll-5.4.2/fplll/gso.h 2022-05-24 19:36:03.000000000 +0200 +++ new/fplll-5.4.3/fplll/gso.h 2022-12-20 22:23:09.000000000 +0100 @@ -142,8 +142,8 @@ virtual inline long get_max_exp_of_b(); virtual inline bool b_row_is_zero(int i); - virtual inline int get_cols_of_b(); - virtual inline int get_rows_of_b(); + virtual inline int get_cols_of_b() const; + virtual inline int get_rows_of_b() const; virtual inline void negate_row_of_b(int i); virtual inline void create_rows(int n_new_rows); @@ -186,6 +186,53 @@ // b[i] <-> b[j] (i < j) virtual void row_swap(int i, int j); + /** + Given a vector `v` wrt the Gram-Schmidt basis `B^*` return a vector `w` wrt the + canonical basis `ZZ^n`, i.e. solve `w = vâ B^*`. + + @param v a tuple-like object of dimension ``M.d`` + @param start only consider subbasis starting at ``start`` + + */ + + void to_canonical(vector<FT> &w, const vector<FT> &v, long start = 0); + + /** + Given a vector `w` wrt the canonical basis `ZZ^n` return a vector `v` wrt the Gram-Schmidt + basis `B^*`. + + @param v a tuple-like object of dimension ``M.B.ncols`` + @param start only consider subbasis starting at ``start`` + @param dimension: only consider ``dimension`` vectors or all if ``-1`` + + */ + + void from_canonical(vector<FT> &v, const vector<FT> &w, long start = 0, long dimension = -1); + + /** + * Update`v` to `w` s.t. `âwâ B - vâ` is small using Babai's nearest plane algorithm. + * + * @param v a vector + * @param start only consider subbasis starting at start + * @param dimension only consider dimension vectors or all if -1 + * @param gso if true then input `v` is considered to be expressed to `B*` + */ + + void virtual babai(vector<ZT> &v, int start = 0, int dimension = -1, bool gso = false); + + /** + * Return vector `w` s.t. `âwâ B - vâ` is small using Babai's nearest plane algorithm. + * + * @param w a vector + * @param v a vector + * @param start only consider subbasis starting at start + * @param dimension only consider dimension vectors or all if -1 + * @param gso if true then input `v` is considered to be expressed wrt `B*` + */ + + void virtual babai(vector<ZT> &w, const vector<FT> &v, int start = 0, int dimension = 1, + bool gso = false); + private: /* Allocates matrices and arrays whose size depends on d (all but tmp_col_expo). When enable_int_gram=false, initializes bf. */ @@ -230,9 +277,15 @@ { return b[i].is_zero(); } -template <class ZT, class FT> inline int MatGSO<ZT, FT>::get_cols_of_b() { return b.get_cols(); } +template <class ZT, class FT> inline int MatGSO<ZT, FT>::get_cols_of_b() const +{ + return b.get_cols(); +} -template <class ZT, class FT> inline int MatGSO<ZT, FT>::get_rows_of_b() { return b.get_rows(); } +template <class ZT, class FT> inline int MatGSO<ZT, FT>::get_rows_of_b() const +{ + return b.get_rows(); +} template <class ZT, class FT> inline void MatGSO<ZT, FT>::negate_row_of_b(int 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.4.2/fplll/gso_gram.h new/fplll-5.4.3/fplll/gso_gram.h --- old/fplll-5.4.2/fplll/gso_gram.h 2022-05-24 19:36:03.000000000 +0200 +++ new/fplll-5.4.3/fplll/gso_gram.h 2022-12-20 22:23:09.000000000 +0100 @@ -94,8 +94,8 @@ public: virtual inline long get_max_exp_of_b(); virtual inline bool b_row_is_zero(int i); - virtual inline int get_cols_of_b(); - virtual inline int get_rows_of_b(); + virtual inline int get_cols_of_b() const; + virtual inline int get_rows_of_b() const; virtual inline void negate_row_of_b(int i); // inline void set_g(Matrix<ZT> arg_g) @@ -192,7 +192,7 @@ // now, we just check whether g[i][i] is zero. return g[i][i].is_zero(); } -template <class ZT, class FT> inline int MatGSOGram<ZT, FT>::get_cols_of_b() +template <class ZT, class FT> inline int MatGSOGram<ZT, FT>::get_cols_of_b() const { if (gptr == nullptr) { @@ -204,7 +204,7 @@ return gptr->get_cols(); } -template <class ZT, class FT> inline int MatGSOGram<ZT, FT>::get_rows_of_b() +template <class ZT, class FT> inline int MatGSOGram<ZT, FT>::get_rows_of_b() const { if (gptr == nullptr) { 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.4.2/fplll/gso_interface.cpp new/fplll-5.4.3/fplll/gso_interface.cpp --- old/fplll-5.4.2/fplll/gso_interface.cpp 2022-05-24 19:36:03.000000000 +0200 +++ new/fplll-5.4.3/fplll/gso_interface.cpp 2022-12-20 22:23:09.000000000 +0100 @@ -280,6 +280,41 @@ max_dist = f; } } +template <class ZT, class FT> +void MatGSOInterface<ZT, FT>::babai(vector<ZT> &v, int start, int dimension) +{ + vector<FT> w; + FT tmp = 0.0; + for (size_t i = 0; i < v.size(); i++) + { + tmp.set_z(v[i]); + w.push_back(tmp); + v[i] = 0; + } + babai(v, w, start, dimension); +} + +template <class ZT, class FT> +void MatGSOInterface<ZT, FT>::babai(vector<ZT> &w, const vector<FT> &v, int start, int dimension) +{ + FT mu_; + dimension = (dimension == -1) ? this->d - start : dimension; + + vector<FT> x = vector<FT>(v); + for (long i = dimension - 1; i >= 0; i--) + { + x[i].rnd(x[i]); + for (long j = 0; j < i; j++) + { + x[j] -= get_mu(mu_, start + i, start + j) * x[i]; + } + } + w.resize(dimension); + for (long i = 0; i < dimension; i++) + { + w[i].set_f(x[i]); + } +} template class MatGSOInterface<Z_NR<long>, FP_NR<double>>; template class MatGSOInterface<Z_NR<double>, FP_NR<double>>; 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.4.2/fplll/gso_interface.h new/fplll-5.4.3/fplll/gso_interface.h --- old/fplll-5.4.2/fplll/gso_interface.h 2022-05-24 19:36:03.000000000 +0200 +++ new/fplll-5.4.3/fplll/gso_interface.h 2022-12-20 22:23:09.000000000 +0100 @@ -146,14 +146,14 @@ * the gram version it returns the number * of columns of g. */ - virtual int get_cols_of_b() = 0; + virtual int get_cols_of_b() const = 0; /** Returns number of rows of b. In * the gram version it returns the number * of of rows of g. This function is made * to reduce code repetition (dump_mu/dump_r) */ - virtual int get_rows_of_b() = 0; + virtual int get_rows_of_b() const = 0; /** Negates the ith row of b. Needed * by dbkz_postprocessing. @@ -455,6 +455,27 @@ */ inline void print_mu_r_g(ostream &os); + /** + * Update`v` to `w` s.t. `âwâ B - vâ B^*â` is small using Babai's nearest plane algorithm. + * + * @param v a vector, both input and output + * @param start only consider subbasis starting at start + * @param dimension only consider dimension vectors or all if -1 + */ + + void virtual babai(vector<ZT> &v, int start = 0, int dimension = -1); + + /** + * Return vector `w` s.t. `âwâ B - vâ B^*â` is small using Babai's nearest plane algorithm. + * + * @param w a vector + * @param v a vector + * @param start only consider subbasis starting at start + * @param dimension only consider dimension vectors or all if -1 + */ + + void virtual babai(vector<ZT> &w, const vector<FT> &v, int start = 0, int dimension = 1); + /** Exact computation of dot products (i.e. with type ZT instead of FT) */ const bool enable_int_gram; 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.4.2/fplll/nr/nr_FP.inl new/fplll-5.4.3/fplll/nr/nr_FP.inl --- old/fplll-5.4.2/fplll/nr/nr_FP.inl 2022-05-24 19:36:03.000000000 +0200 +++ new/fplll-5.4.3/fplll/nr/nr_FP.inl 2022-12-20 22:23:09.000000000 +0100 @@ -350,6 +350,11 @@ inline void floor(const FP_NR<F> &b); /** + * value := smallest integer greater than (or equal to) b. + **/ + inline void ceil(const FP_NR<F> &b); + + /** * value := NaN. */ inline void set_nan(); 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.4.2/fplll/nr/nr_FP_d.inl new/fplll-5.4.3/fplll/nr/nr_FP_d.inl --- old/fplll-5.4.2/fplll/nr/nr_FP_d.inl 2022-05-24 19:36:03.000000000 +0200 +++ new/fplll-5.4.3/fplll/nr/nr_FP_d.inl 2022-12-20 22:23:09.000000000 +0100 @@ -234,6 +234,8 @@ template <> inline void FP_NR<double>::floor(const FP_NR<double> &b) { data = ::floor(b.data); } +template <> inline void FP_NR<double>::ceil(const FP_NR<double> &b) { data = ::ceil(b.data); } + template <> inline void FP_NR<double>::set_nan() { data = NAN; } template <> inline void FP_NR<double>::swap(FP_NR<double> &a) { std::swap(data, a.data); } 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.4.2/fplll/nr/nr_FP_dd.inl new/fplll-5.4.3/fplll/nr/nr_FP_dd.inl --- old/fplll-5.4.2/fplll/nr/nr_FP_dd.inl 2022-05-24 19:36:03.000000000 +0200 +++ new/fplll-5.4.3/fplll/nr/nr_FP_dd.inl 2022-12-20 22:23:09.000000000 +0100 @@ -242,6 +242,8 @@ template <> inline void FP_NR<dd_real>::floor(const FP_NR<dd_real> &b) { data = ::floor(b.data); } +template <> inline void FP_NR<dd_real>::ceil(const FP_NR<dd_real> &b) { data = ::ceil(b.data); } + template <> inline void FP_NR<dd_real>::set_nan() { data = NAN; } template <> inline void FP_NR<dd_real>::swap(FP_NR<dd_real> &a) 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.4.2/fplll/nr/nr_FP_dpe.inl new/fplll-5.4.3/fplll/nr/nr_FP_dpe.inl --- old/fplll-5.4.2/fplll/nr/nr_FP_dpe.inl 2022-05-24 19:36:03.000000000 +0200 +++ new/fplll-5.4.3/fplll/nr/nr_FP_dpe.inl 2022-12-20 22:23:09.000000000 +0100 @@ -219,6 +219,8 @@ template <> inline void FP_NR<dpe_t>::floor(const FP_NR<dpe_t> &a) { dpe_floor(data, a.data); } +template <> inline void FP_NR<dpe_t>::ceil(const FP_NR<dpe_t> &a) { dpe_ceil(data, a.data); } + template <> inline void FP_NR<dpe_t>::set_nan() { // dpe_set_d(data, NAN); // DPE_UNLIKELY branch in dpe_normalize 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.4.2/fplll/nr/nr_FP_ld.inl new/fplll-5.4.3/fplll/nr/nr_FP_ld.inl --- old/fplll-5.4.2/fplll/nr/nr_FP_ld.inl 2022-05-24 19:36:03.000000000 +0200 +++ new/fplll-5.4.3/fplll/nr/nr_FP_ld.inl 2022-12-20 22:23:09.000000000 +0100 @@ -258,6 +258,11 @@ data = floorl(b.data); } +template <> inline void FP_NR<long double>::ceil(const FP_NR<long double> &b) +{ + data = ceill(b.data); +} + template <> inline void FP_NR<long double>::set_nan() { data = NAN; } template <> inline void FP_NR<long double>::swap(FP_NR<long double> &a) { std::swap(data, a.data); } 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.4.2/fplll/nr/nr_FP_mpfr.inl new/fplll-5.4.3/fplll/nr/nr_FP_mpfr.inl --- old/fplll-5.4.2/fplll/nr/nr_FP_mpfr.inl 2022-05-24 19:36:03.000000000 +0200 +++ new/fplll-5.4.3/fplll/nr/nr_FP_mpfr.inl 2022-12-20 22:23:09.000000000 +0100 @@ -243,6 +243,8 @@ } template <> inline void FP_NR<mpfr_t>::floor(const FP_NR<mpfr_t> &a) { mpfr_floor(data, a.data); } +template <> inline void FP_NR<mpfr_t>::ceil(const FP_NR<mpfr_t> &a) { mpfr_ceil(data, a.data); } + template <> inline void FP_NR<mpfr_t>::set_nan() { mpfr_set_nan(data); } template <> inline void FP_NR<mpfr_t>::swap(FP_NR<mpfr_t> &a) { mpfr_swap(data, a.data); } 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.4.2/fplll/nr/nr_FP_qd.inl new/fplll-5.4.3/fplll/nr/nr_FP_qd.inl --- old/fplll-5.4.2/fplll/nr/nr_FP_qd.inl 2022-05-24 19:36:03.000000000 +0200 +++ new/fplll-5.4.3/fplll/nr/nr_FP_qd.inl 2022-12-20 22:23:09.000000000 +0100 @@ -238,6 +238,8 @@ template <> inline void FP_NR<qd_real>::floor(const FP_NR<qd_real> &b) { data = ::floor(b.data); } +template <> inline void FP_NR<qd_real>::ceil(const FP_NR<qd_real> &b) { data = ::ceil(b.data); } + template <> inline void FP_NR<qd_real>::set_nan() { data = NAN; } template <> inline void FP_NR<qd_real>::swap(FP_NR<qd_real> &a) 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.4.2/fplll/nr/numvect.h new/fplll-5.4.3/fplll/nr/numvect.h --- old/fplll-5.4.2/fplll/nr/numvect.h 2022-05-24 19:36:03.000000000 +0200 +++ new/fplll-5.4.3/fplll/nr/numvect.h 2022-12-20 22:23:09.000000000 +0100 @@ -258,7 +258,7 @@ /** Returns last non-zero index of NumVector. */ int size_nz() const; - friend ostream &operator<<<T>(ostream &os, const NumVect<T> &v); + friend ostream &operator<< <T>(ostream &os, const NumVect<T> &v); friend istream &operator>><T>(istream &is, NumVect<T> &v); private: 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.4.2/m4/libtool.m4 new/fplll-5.4.3/m4/libtool.m4 --- old/fplll-5.4.2/m4/libtool.m4 2022-05-24 19:36:21.000000000 +0200 +++ new/fplll-5.4.3/m4/libtool.m4 2022-12-20 22:23:23.000000000 +0100 @@ -1071,11 +1071,11 @@ # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + 10.0,*86*-darwin8*|10.0,*-darwin[[912]]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[[012]][[,.]]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - 10.*) + 10.*|11.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; 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.4.2/missing new/fplll-5.4.3/missing --- old/fplll-5.4.2/missing 2022-05-24 19:36:24.000000000 +0200 +++ new/fplll-5.4.3/missing 2022-12-20 22:23:25.000000000 +0100 @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard <[email protected]>, 1996. # This program is free software; you can redistribute it and/or modify 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.4.2/test-driver new/fplll-5.4.3/test-driver --- old/fplll-5.4.2/test-driver 2022-05-24 19:36:24.000000000 +0200 +++ new/fplll-5.4.3/test-driver 2022-12-20 22:23:26.000000000 +0100 @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 2011-2018 Free Software Foundation, Inc. +# Copyright (C) 2011-2021 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -42,11 +42,13 @@ { cat <<END Usage: - test-driver --test-name=NAME --log-file=PATH --trs-file=PATH - [--expect-failure={yes|no}] [--color-tests={yes|no}] - [--enable-hard-errors={yes|no}] [--] + test-driver --test-name NAME --log-file PATH --trs-file PATH + [--expect-failure {yes|no}] [--color-tests {yes|no}] + [--enable-hard-errors {yes|no}] [--] TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS] + The '--test-name', '--log-file' and '--trs-file' options are mandatory. +See the GNU Automake documentation for information. END } @@ -103,8 +105,11 @@ trap "st=141; $do_exit" 13 trap "st=143; $do_exit" 15 -# Test script is run here. -"$@" >$log_file 2>&1 +# Test script is run here. We create the file first, then append to it, +# to ameliorate tests themselves also writing to the log file. Our tests +# don't, but others can (automake bug#35762). +: >"$log_file" +"$@" >>"$log_file" 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then @@ -126,7 +131,7 @@ # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). -echo "$res $test_name (exit status: $estatus)" >>$log_file +echo "$res $test_name (exit status: $estatus)" >>"$log_file" # Report outcome to console. echo "${col}${res}${std}: $test_name" 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.4.2/tests/Makefile.am new/fplll-5.4.3/tests/Makefile.am --- old/fplll-5.4.2/tests/Makefile.am 2022-05-24 19:36:03.000000000 +0200 +++ new/fplll-5.4.3/tests/Makefile.am 2022-12-20 22:23:09.000000000 +0100 @@ -43,7 +43,7 @@ STAGEDIR := $(realpath -s $(TOPBUILDDIR)/.libs) AM_LDFLAGS = -L$(STAGEDIR) -Wl,-rpath,$(STAGEDIR) -lfplll -no-install $(LIBQD_LIBS) -TESTS = test_nr test_lll test_enum test_cvp test_svp test_bkz test_pruner test_gso test_lll_gram test_hlll test_svp_gram test_bkz_gram test_counter +TESTS = test_nr test_lll test_enum test_cvp test_svp test_bkz test_pruner test_gso test_lll_gram test_hlll test_svp_gram test_bkz_gram test_counter test_babai test_ceil test_pruner_LDADD=$(LIBQD_LIBS) @@ -60,4 +60,6 @@ test_svp_gram_SOURCES = test_svp_gram.cpp test_bkz_gram_SOURCES = test_bkz_gram.cpp test_counter_SOURCES = test_counter.cpp +test_babai_SOURCES = test_babai.cpp +test_ceil_SOURCES = test_ceil.cpp check_PROGRAMS = $(TESTS) 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.4.2/tests/test_babai.cpp new/fplll-5.4.3/tests/test_babai.cpp --- old/fplll-5.4.2/tests/test_babai.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/fplll-5.4.3/tests/test_babai.cpp 2022-12-20 22:23:09.000000000 +0100 @@ -0,0 +1,110 @@ +/* Copyright (C) 2022 Martin R. Albrecht + + This file is part of fplll. fplll is free software: you + can redistribute it and/or modify it under the terms of the GNU Lesser + General Public License as published by the Free Software Foundation, + either version 2.1 of the License, or (at your option) any later version. + + fplll is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + 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 "fplll/fplll.h" +#include <vector> + +using namespace fplll; + +template <class ZT, class FT> +int test_intrel(long n, long bits, bool shouldfail = false, int seed = 0) +{ + gmp_randseed_ui(RandGen::get_gmp_state(), seed); + mpz_t status; + mpz_init(status); + + ZZ_mat<ZT> B, U, UT; + B.resize(n, n + 1); + B.gen_intrel(bits); + + vector<Z_NR<ZT>> t = vector<Z_NR<ZT>>(n + 1); + + for (long i = 0; i < n; i++) + { + mpz_urandomb(status, RandGen::get_gmp_state(), 1); + if (mpz_cmp_si(status, 1)) + { + t[0].add(t[0], B[i][0]); + } + } + mpz_clear(status); + + vector<Z_NR<ZT>> v = vector<Z_NR<ZT>>(t); + + lll_reduction(B); + + MatGSO<Z_NR<ZT>, FP_NR<FT>> M(B, U, UT, GSO_DEFAULT); + M.update_gso(); + M.babai(v, 0, n, false); + + vector<Z_NR<ZT>> w = vector<Z_NR<ZT>>(n + 1); + + Z_NR<ZT> tmp; + + for (long i = 0; i < B.get_rows(); i++) + { + for (long j = 0; j < B.get_cols(); j++) + { + tmp.mul(v[i], B[i][j]); + w[j].add(w[j], tmp); + } + } + + if ((w[0] == t[0]) - shouldfail) + { + return 0; + } + else + { + std::cerr << "n:" << n << ", bits: " << bits << std::endl; + std::cerr << w << std::endl; + return 1; + } +} + +int main(int argc, char *argv[]) +{ + int status = 0; + RandGen::init_with_seed(0); + status += test_intrel<mpz_t, double>(10, 20); + status += test_intrel<mpz_t, double>(10, 30); + status += test_intrel<mpz_t, double>(10, 40); + status += test_intrel<mpz_t, double>(10, 50); + status += test_intrel<mpz_t, double>(10, 60, true); + status += test_intrel<mpz_t, long double>(10, 60); +#ifdef FPLLL_WITH_LONG_DOUBLE + status += test_intrel<mpz_t, long double>(10, 70, true); +#endif +#ifdef FPLLL_WITH_QD + status += test_intrel<mpz_t, dd_real>(10, 110); + status += test_intrel<mpz_t, dd_real>(10, 120, true); + // status += test_intrel<mpz_t, qd_real>(10, 100); + // status += test_intrel<mpz_t, qd_real>(10, 230, true); +#endif + FP_NR<mpfr_t>::set_prec(100); + status += test_intrel<mpz_t, mpfr_t>(10, 100); + FP_NR<mpfr_t>::set_prec(200); + status += test_intrel<mpz_t, mpfr_t>(10, 200); + + if (status == 0) + { + std::cerr << "All tests passed." << std::endl; + return 0; + } + else + { + return -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.4.2/tests/test_ceil.cpp new/fplll-5.4.3/tests/test_ceil.cpp --- old/fplll-5.4.2/tests/test_ceil.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/fplll-5.4.3/tests/test_ceil.cpp 2022-12-20 22:23:09.000000000 +0100 @@ -0,0 +1,52 @@ +#include "fplll/fplll.h" + +using namespace fplll; + +template <class T> bool test_ceil() +{ + + bool status = false; + + // Case 1: works with fixed values. + FP_NR<T> value(3.5); + FP_NR<T> ceiled{}; + ceiled.ceil(value); + + status |= (ceiled != 4); + + // Case 2: calling ceil either gives us a number >= value. + value = rand(); + ceiled.ceil(value); + status |= (ceiled < value); + return status; +} + +int main(int, char **) +{ + int status = 0; + status += test_ceil<mpfr_t>(); + status += test_ceil<double>(); +#ifdef FPLLL_WITH_LONG_DOUBLE + status += test_ceil<long double>(); +#endif + +#ifdef FPLLL_WITH_QD + status += test_ceil<dd_real>(); + status += test_ceil<qd_real>(); +#endif + +#ifdef FPLLL_WITH_DPE + status += test_ceil<dpe_t>(); +#endif + + if (status == 0) + { + std::cerr << "All tests passed" << std::endl; + return 0; + } + else + { + return -1; + } + return 0; +}
