[arch-commits] Commit in e-antic/trunk (3 files)

Antonio Rojas arojas at archlinux.org
Sat Dec 19 22:51:19 UTC 2020


    Date: Saturday, December 19, 2020 @ 22:51:19
  Author: arojas
Revision: 780044

flint 2.7 rebuild

Added:
  e-antic/trunk/e-antic-flint-2.7.patch
Modified:
  e-antic/trunk/PKGBUILD
Deleted:
  e-antic/trunk/e-antic-flint-2.6.patch

-------------------------+
 PKGBUILD                |   17 ++-
 e-antic-flint-2.6.patch |  182 --------------------------------
 e-antic-flint-2.7.patch |  254 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 268 insertions(+), 185 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2020-12-19 22:47:36 UTC (rev 780043)
+++ PKGBUILD	2020-12-19 22:51:19 UTC (rev 780044)
@@ -2,7 +2,7 @@
 
 pkgname=e-antic
 pkgver=0.1.8
-pkgrel=1
+pkgrel=2
 pkgdesc="Embedded algebraic number fields (on top of antic)"
 arch=(x86_64)
 url="https://github.com/videlec/e-antic"
@@ -9,9 +9,15 @@
 license=(LGPL)
 depends=(arb)
 makedepends=()
-source=(https://www.labri.fr/perso/vdelecro/e-antic/$pkgname-$pkgver.tar.gz)
-sha256sums=('d8b6c18107756db86c7c4ca1593364e0ba9b4ad125910b45afd7ad5823d7100c')
+source=(https://www.labri.fr/perso/vdelecro/e-antic/$pkgname-$pkgver.tar.gz
+        e-antic-flint-2.7.patch)
+sha256sums=('d8b6c18107756db86c7c4ca1593364e0ba9b4ad125910b45afd7ad5823d7100c'
+            'bae50e5ff9d64257573d2e1771251d1b6ff779ee567caae7ee88d93a91c9d30d')
 
+prepare() {
+  patch -d $pkgname-$pkgver -p1 -i ../e-antic-flint-2.7.patch # Fix build with flint 2.7
+}
+
 build() {
   cd $pkgname-$pkgver
   ./configure --prefix=/usr
@@ -21,6 +27,11 @@
   make
 }
 
+check() {
+  cd $pkgname-$pkgver
+  make check
+}
+
 package() {
   cd $pkgname-$pkgver
   make DESTDIR="$pkgdir" install

Deleted: e-antic-flint-2.6.patch
===================================================================
--- e-antic-flint-2.6.patch	2020-12-19 22:47:36 UTC (rev 780043)
+++ e-antic-flint-2.6.patch	2020-12-19 22:51:19 UTC (rev 780044)
@@ -1,182 +0,0 @@
-diff --git a/e-antic/e-antic.h b/e-antic/e-antic.h
-index d941baf..5317bd0 100644
---- a/e-antic/e-antic.h
-+++ b/e-antic/e-antic.h
-@@ -18,12 +18,6 @@ extern "C" {
-                            __E_ANTIC_VERSION_MINOR * 100 + \
-                            __E_ANTIC_VERSION_PATCHLEVEL)
- 
--/* check flint version */
--
--#if __FLINT_RELEASE != 20502 && __FLINT_RELEASE != 20503
--#error FLINT 2.5.2 or 2.5.3 required
--#endif
--
- #ifdef __cplusplus
- }
- #endif
-diff --git a/e-antic/poly_extra.h b/e-antic/poly_extra.h
-index 9338f29..ee3b98b 100644
---- a/e-antic/poly_extra.h
-+++ b/e-antic/poly_extra.h
-@@ -100,102 +100,6 @@ void arb_mul_fmpq(arb_t a, const arb_t b, const fmpq_t c, slong prec);
- void arb_div_fmpq(arb_t a, const arb_t b, const fmpq_t c, slong prec);
- void arb_fmpq_div(arb_t a, const fmpq_t c, const arb_t b, slong prec);
- 
--static __inline__
--int fmpq_equal_fmpz(const fmpq_t a, const fmpz_t b)
--{
--    return fmpz_is_one(fmpq_denref(a)) && fmpz_equal(fmpq_numref(a), b);
--}
--
--static __inline__
--int fmpq_equal_si(const fmpq_t a, const slong b)
--{
--    return fmpz_is_one(fmpq_denref(a)) && fmpz_equal_si(fmpq_numref(a), b);
--}
--
--static __inline__
--int fmpq_equal_ui(const fmpq_t a, const ulong b)
--{
--    return fmpz_is_one(fmpq_denref(a)) && fmpz_equal_ui(fmpq_numref(a), b);
--}
--
--static __inline__
--int fmpq_cmp_fmpz(const fmpq_t a, const fmpz_t b)
--{
--    int s;
--    fmpz_t den;
--    fmpz_init(den);
--    fmpz_one(den);
--    s = _fmpq_cmp(fmpq_numref(a), fmpq_denref(a), b, den);
--    fmpz_clear(den);
--    return s;
--}
--
--static __inline__
--int fmpq_cmp_si(const fmpq_t a, slong b)
--{
--    int s;
--    fmpq_t bb;
--    fmpq_init(bb);
--    fmpz_set_si(fmpq_numref(bb), b);
--    fmpz_one(fmpq_denref(bb));
--    s = fmpq_cmp(a, bb);
--    fmpq_clear(bb);
--    return s;
--}
--
--static __inline__
--int fmpq_cmp_ui(const fmpq_t a, ulong b)
--{
--    int s;
--    fmpq_t bb;
--    fmpq_init(bb);
--    fmpz_set_ui(fmpq_numref(bb), b);
--    fmpz_one(fmpq_denref(bb));
--    s = fmpq_cmp(a, bb);
--    fmpq_clear(bb);
--    return s;
--}
--
--static __inline__
--void fmpq_add_ui(fmpq_t a, const fmpq_t b, ulong c)
--{
--    fmpz_t tmp;
--    fmpz_init(tmp);
--    fmpz_set_ui(tmp, c);
--    fmpq_add_fmpz(a, b, tmp);
--    fmpz_clear(tmp);
--}
--
--static __inline__
--void fmpq_sub_ui(fmpq_t a, const fmpq_t b, ulong c)
--{
--    fmpz_t tmp;
--    fmpz_init(tmp);
--    fmpz_set_ui(tmp, c);
--    fmpq_sub_fmpz(a, b, tmp);
--    fmpz_clear(tmp);
--}
--
--static __inline__
--void fmpq_mul_si(fmpq_t a, const fmpq_t b, slong c)
--{
--    fmpz_t tmp;
--    fmpz_init(tmp);
--    fmpz_set_si(tmp, c);
--    fmpq_mul_fmpz(a, b, tmp);
--    fmpz_clear(tmp);
--}
--
--static __inline__
--void fmpq_mul_ui(fmpq_t a, const fmpq_t b, ulong c)
--{
--    fmpz_t tmp;
--    fmpz_init(tmp);
--    fmpz_set_ui(tmp, c);
--    fmpq_mul_fmpz(a, b, tmp);
--    fmpz_clear(tmp);
--}
--
- static __inline__
- void fmpq_div_si(fmpq_t a, const fmpq_t b, slong c)
- {
-@@ -256,22 +160,6 @@ void fmpz_poly_evaluate_at_one(fmpz_t res, fmpz * p, slong len)
-     return _fmpz_vec_sum(res, p, len);
- }
- 
--static __inline__
--double fmpq_get_d(fmpq_t q)
--{
--    arb_t z;
--    double d;
--
--    arb_init(z);
--    arb_set_fmpq(z, q, 64);
--
--    d = arf_get_d(arb_midref(z), ARF_RND_NEAR);
--
--    arb_clear(z);
--
--    return d;
--}
--
- static __inline__
- ulong EANTIC_FIXED_fmpz_vec_max_bits(const fmpz * vec, slong len)
- {
-@@ -338,7 +226,7 @@ void _fmpz_poly_num_real_roots_sturm(slong * n_neg, slong * n_pos, const fmpz *
- 
- void fmpz_poly_product_roots_fmpq_vec(fmpz_poly_t poly, const fmpq * xs, slong n);
- 
--#elif __FLINT_RELEASE == 20503
-+#elif __FLINT_RELEASE >= 20503
- 
- #define _EANTIC_FIXED_fmpq_poly_get_str_pretty _fmpq_poly_get_str_pretty
- #define EANTIC_FIXED_fmpq_poly_get_str_pretty fmpq_poly_get_str_pretty
-diff --git a/nf_elem/mul.c b/nf_elem/mul.c
-index 17fb3ed..a965147 100644
---- a/nf_elem/mul.c
-+++ b/nf_elem/mul.c
-@@ -128,7 +128,7 @@ void _nf_elem_mul_red(nf_elem_t a, const nf_elem_t b,
-                _fmpz_vec_set(r, NF_ELEM_NUMREF(a), plen);
- 
-                _fmpz_poly_divrem(q, NF_ELEM_NUMREF(a), r, plen, 
--                  fmpq_poly_numref(nf->pol), len);
-+                  fmpq_poly_numref(nf->pol), len, 0);
- 
-                _fmpz_vec_clear(r, plen);
-                _fmpz_vec_clear(q, plen - len + 1);
-diff --git a/nf_elem/reduce.c b/nf_elem/reduce.c
-index dd84519..007c6d4 100644
---- a/nf_elem/reduce.c
-+++ b/nf_elem/reduce.c
-@@ -81,7 +81,7 @@ void _nf_elem_reduce(nf_elem_t a, const nf_t nf)
-                _fmpz_vec_set(r, NF_ELEM_NUMREF(a), plen);
- 
-                _fmpz_poly_divrem(q, NF_ELEM_NUMREF(a), r, plen, 
--                  fmpq_poly_numref(nf->pol), len);
-+                  fmpq_poly_numref(nf->pol), len, 0);
- 
-                _fmpz_vec_clear(r, plen);
-                _fmpz_vec_clear(q, plen - len + 1);

Added: e-antic-flint-2.7.patch
===================================================================
--- e-antic-flint-2.7.patch	                        (rev 0)
+++ e-antic-flint-2.7.patch	2020-12-19 22:51:19 UTC (rev 780044)
@@ -0,0 +1,254 @@
+diff --git a/e-antic/nf_elem.h b/e-antic/nf_elem.h
+index 1a49dc2..570b537 100644
+--- a/e-antic/nf_elem.h
++++ b/e-antic/nf_elem.h
+@@ -580,13 +580,13 @@ FLINT_DLL
+ void nf_elem_get_nmod_poly(nmod_poly_t pol, const nf_elem_t a, const nf_t nf);
+ 
+ FLINT_DLL
+-void _nf_elem_get_fmpz_mod_poly(fmpz_mod_poly_t pol, const nf_elem_t a, const nf_t nf);
++void _nf_elem_get_fmpz_mod_poly(fmpz_mod_poly_t pol, const nf_elem_t a, const nf_t nf, const fmpz_mod_ctx_t ctx);
+ 
+ FLINT_DLL
+-void nf_elem_get_fmpz_mod_poly_den(fmpz_mod_poly_t pol, const nf_elem_t a, const nf_t nf, int den);
++void nf_elem_get_fmpz_mod_poly_den(fmpz_mod_poly_t pol, const nf_elem_t a, const nf_t nf, int den, const fmpz_mod_ctx_t ctx);
+ 
+ FLINT_DLL
+-void nf_elem_get_fmpz_mod_poly(fmpz_mod_poly_t pol, const nf_elem_t a, const nf_t nf);
++void nf_elem_get_fmpz_mod_poly(fmpz_mod_poly_t pol, const nf_elem_t a, const nf_t nf, const fmpz_mod_ctx_t ctx);
+ 
+ /******************************************************************************
+  
+diff --git a/nf_elem/get_fmpz_mod_poly.c b/nf_elem/get_fmpz_mod_poly.c
+index 7c31021..eba9c64 100644
+--- a/nf_elem/get_fmpz_mod_poly.c
++++ b/nf_elem/get_fmpz_mod_poly.c
+@@ -25,57 +25,68 @@
+ 
+ #include "e-antic/nf_elem.h"
+ 
+-void _nf_elem_get_fmpz_mod_poly(fmpz_mod_poly_t pol, const nf_elem_t a, const nf_t nf)
++void _nf_elem_get_fmpz_mod_poly(fmpz_mod_poly_t pol, const nf_elem_t a,
++                                       const nf_t nf, const fmpz_mod_ctx_t ctx)
+ {
+     if (nf_elem_is_zero(a, nf))
+     {
+-        fmpz_mod_poly_zero(pol);
++        fmpz_mod_poly_zero(pol, ctx);
++        
+         return;
+     }
+     if (nf->flag & NF_LINEAR)
+     {
+         {
+-            fmpz_mod_poly_fit_length(pol, 1);
+-            fmpz_mod(pol->coeffs + 0, LNF_ELEM_NUMREF(a), &(pol->p));
++            fmpz_mod_poly_fit_length(pol, 1, ctx);
++        
++            fmpz_mod(pol->coeffs + 0, LNF_ELEM_NUMREF(a), ctx->n);
++        
+             _fmpz_mod_poly_set_length(pol, 1);
+             _fmpz_mod_poly_normalise(pol);
+ 
+         }
+     } else if (nf->flag & NF_QUADRATIC)
+     {
+-        fmpz_mod_poly_fit_length(pol, 3);
+-        fmpz_mod(pol->coeffs + 0, QNF_ELEM_NUMREF(a), &(pol->p));
+-        fmpz_mod(pol->coeffs + 1, QNF_ELEM_NUMREF(a) + 1, &(pol->p));
+-        fmpz_mod(pol->coeffs + 2, QNF_ELEM_NUMREF(a) + 2, &(pol->p));
++        fmpz_mod_poly_fit_length(pol, 3, ctx);
++        
++        fmpz_mod(pol->coeffs + 0, QNF_ELEM_NUMREF(a), ctx->n);
++        fmpz_mod(pol->coeffs + 1, QNF_ELEM_NUMREF(a) + 1, ctx->n);
++        fmpz_mod(pol->coeffs + 2, QNF_ELEM_NUMREF(a) + 2, ctx->n);
++        
+         _fmpz_mod_poly_set_length(pol, 3);
+         _fmpz_mod_poly_normalise(pol);
+     } else
+     {
+         slong len = NF_ELEM(a)->length;
+         slong i;
+-        fmpz_mod_poly_fit_length(pol, len);
++
++        fmpz_mod_poly_fit_length(pol, len, ctx);
++        
+         for (i = 0; i < len; i++)
+-            fmpz_mod(pol->coeffs + i, NF_ELEM_NUMREF(a) + i, &(pol->p));
++            fmpz_mod(pol->coeffs + i, NF_ELEM_NUMREF(a) + i, ctx->n);
++        
+         _fmpz_mod_poly_set_length(pol, len);
+         _fmpz_mod_poly_normalise(pol);
+     }
+ }
+ 
+-void nf_elem_get_fmpz_mod_poly_den(fmpz_mod_poly_t pol, const nf_elem_t a, const nf_t nf, int den)
++void nf_elem_get_fmpz_mod_poly_den(fmpz_mod_poly_t pol, const nf_elem_t a,
++                              const nf_t nf, int den, const fmpz_mod_ctx_t ctx)
+ {
+-    _nf_elem_get_fmpz_mod_poly(pol, a, nf);
++    _nf_elem_get_fmpz_mod_poly(pol, a, nf, ctx);
+     if (den)
+     {
+         if (nf->flag & NF_LINEAR)
+-            fmpz_mod_poly_scalar_div_fmpz(pol, pol, LNF_ELEM_DENREF(a));
++            fmpz_mod_poly_scalar_div_fmpz(pol, pol, LNF_ELEM_DENREF(a), ctx);
+         else if (nf->flag & NF_QUADRATIC)
+-            fmpz_mod_poly_scalar_div_fmpz(pol, pol, QNF_ELEM_DENREF(a));
++            fmpz_mod_poly_scalar_div_fmpz(pol, pol, QNF_ELEM_DENREF(a), ctx);
+         else
+-            fmpz_mod_poly_scalar_div_fmpz(pol, pol, NF_ELEM_DENREF(a));
++            fmpz_mod_poly_scalar_div_fmpz(pol, pol, NF_ELEM_DENREF(a), ctx);
+     }
+ }
+ 
+-void nf_elem_get_fmpz_mod_poly(fmpz_mod_poly_t pol, const nf_elem_t a, const nf_t nf)
++void nf_elem_get_fmpz_mod_poly(fmpz_mod_poly_t pol, const nf_elem_t a,
++                                       const nf_t nf, const fmpz_mod_ctx_t ctx)
+ {
+-    nf_elem_get_fmpz_mod_poly_den(pol, a, nf, 1);
++    nf_elem_get_fmpz_mod_poly_den(pol, a, nf, 1, ctx);
+ }
+diff --git a/nf_elem/test/t-get_fmpz_mod_poly.c b/nf_elem/test/t-get_fmpz_mod_poly.c
+index 814ebbd..1fd8e5e 100644
+--- a/nf_elem/test/t-get_fmpz_mod_poly.c
++++ b/nf_elem/test/t-get_fmpz_mod_poly.c
+@@ -45,6 +45,7 @@ main(void)
+         nf_elem_t a;
+         fmpz_mod_poly_t reduced_elem;
+         fmpz_t coeff, mod, reduced_coeff;
++        fmpz_mod_ctx_t ctx;
+ 
+         fmpz_init(mod);
+         fmpz_randtest_unsigned(mod, state, 2 * FLINT_BITS);
+@@ -52,7 +53,8 @@ main(void)
+ 
+         fmpz_init(coeff);
+         fmpz_init(reduced_coeff);
+-        fmpz_mod_poly_init(reduced_elem, mod);
++        fmpz_mod_ctx_init(ctx, mod);
++        fmpz_mod_poly_init(reduced_elem, ctx);
+ 
+         nf_init_randtest(nf, state, 2 + n_randint(state, 20), 200);
+ 
+@@ -60,13 +62,13 @@ main(void)
+ 
+         nf_elem_randtest(a, state, 200, nf);
+ 
+-        nf_elem_get_fmpz_mod_poly_den(reduced_elem, a, nf, 0);
++        nf_elem_get_fmpz_mod_poly_den(reduced_elem, a, nf, 0, ctx);
+ 
+         for (j = 0; j < nf_degree(nf); j++)
+         {
+             nf_elem_get_coeff_fmpz(coeff, a, j, nf);
+             fmpz_mod(coeff, coeff, mod);
+-            fmpz_mod_poly_get_coeff_fmpz(reduced_coeff, reduced_elem, j);
++            fmpz_mod_poly_get_coeff_fmpz(reduced_coeff, reduced_elem, j, ctx);
+             result = fmpz_equal(reduced_coeff, coeff);
+             if (!result)
+             {
+@@ -74,13 +76,14 @@ main(void)
+                 printf("f = "); fmpq_poly_print_pretty(nf->pol, "x"); printf("\n");
+                 printf("a = "); nf_elem_print_pretty(a, nf, "x"); printf("\n");
+                 printf("n = "); fmpz_print(mod); printf("\n");
+-                printf("a mod n = "); fmpz_mod_poly_print_pretty(reduced_elem, "x"); printf("\n");
++                printf("a mod n = "); fmpz_mod_poly_print_pretty(reduced_elem, "x", ctx); printf("\n");
+                 abort();
+             }
+         }
+ 
+         nf_elem_clear(a, nf);
+-        fmpz_mod_poly_clear(reduced_elem);
++        fmpz_mod_poly_clear(reduced_elem, ctx);
++        fmpz_mod_ctx_clear(ctx);
+         fmpz_clear(coeff);
+         fmpz_clear(reduced_coeff);
+         fmpz_clear(mod);
+@@ -94,6 +97,7 @@ main(void)
+         nf_elem_t a;
+         fmpz_mod_poly_t reduced_elem;
+         fmpz_t coeff, reduced_coeff, den, mod, d_mod, d_modinv;
++        fmpz_mod_ctx_t ctx;
+ 
+         fmpz_init(coeff);
+         fmpz_init(den);
+@@ -106,7 +110,9 @@ main(void)
+         fmpz_randtest_unsigned(mod, state, 2 * FLINT_BITS);
+         fmpz_add_ui(mod, mod, 2);
+ 
+-        fmpz_mod_poly_init(reduced_elem, mod);
++        fmpz_mod_ctx_init(ctx, mod);
++
++        fmpz_mod_poly_init(reduced_elem, ctx);
+ 
+         nf_init_randtest(nf, state, 40, 200);
+ 
+@@ -119,7 +125,7 @@ main(void)
+             fmpz_gcd(d_mod, d_mod, mod);
+         } while (!fmpz_is_one(d_mod));
+ 
+-        nf_elem_get_fmpz_mod_poly(reduced_elem, a, nf);
++        nf_elem_get_fmpz_mod_poly(reduced_elem, a, nf, ctx);
+ 
+         for (j = 0; j < nf_degree(nf); j++)
+         {
+@@ -128,14 +134,14 @@ main(void)
+             fmpz_invmod(d_modinv, den, mod);
+             fmpz_mul(coeff, coeff, d_modinv);
+             fmpz_mod(coeff, coeff, mod);
+-            fmpz_mod_poly_get_coeff_fmpz(reduced_coeff, reduced_elem, j);
++            fmpz_mod_poly_get_coeff_fmpz(reduced_coeff, reduced_elem, j, ctx);
+             result = (fmpz_equal(coeff, reduced_coeff));
+             if (!result)
+             {
+                 printf("FAIL: Reducing element with denominator\n");
+                 printf("a = "); nf_elem_print_pretty(a, nf, "x"); printf("\n");
+                 printf("n = "); fmpz_print(mod); flint_printf("\n");
+-                printf("a mod n = "); fmpz_mod_poly_print_pretty(reduced_elem, "x"); printf("\n");
++                printf("a mod n = "); fmpz_mod_poly_print_pretty(reduced_elem, "x", ctx); printf("\n");
+                 abort();
+             }
+         }
+@@ -147,7 +153,8 @@ main(void)
+         fmpz_clear(d_mod);
+         fmpz_clear(d_modinv);
+         nf_elem_clear(a, nf);
+-        fmpz_mod_poly_clear(reduced_elem);
++        fmpz_mod_poly_clear(reduced_elem, ctx);
++        fmpz_mod_ctx_clear(ctx);
+         nf_clear(nf);
+     }
+ 
+diff --git a/poly_extra/fmpz_poly_randtest_irreducible.c b/poly_extra/fmpz_poly_randtest_irreducible.c
+index 5bbbfa1..5b0e9d8 100644
+--- a/poly_extra/fmpz_poly_randtest_irreducible.c
++++ b/poly_extra/fmpz_poly_randtest_irreducible.c
+@@ -17,14 +17,16 @@ void fmpz_poly_randtest_irreducible(fmpz_poly_t p, flint_rand_t state, slong len
+     slong i;
+     fmpz_t c;
+     fmpz_mod_poly_t q;
++    fmpz_mod_ctx_t ctx;
+ 
+     fmpz_init(c);
+ 
+     fmpz_randprime(c, state, bits, 0);
+-    fmpz_mod_poly_init(q, c);
+-    fmpz_mod_poly_randtest_irreducible(q, state, len);
++    fmpz_mod_ctx_init(ctx, c);
++    fmpz_mod_poly_init(q, ctx);
++    fmpz_mod_poly_randtest_irreducible(q, state, len, ctx);
+ 
+-    fmpz_mod_poly_get_fmpz_poly(p, q);
++    fmpz_mod_poly_get_fmpz_poly(p, q, ctx);
+ 
+     /* After lifting, the coefficients belong to {0, ..., c-1}. We now  */
+     /* randomly subtract c so that some of them become negative.        */
+@@ -37,6 +39,7 @@ void fmpz_poly_randtest_irreducible(fmpz_poly_t p, flint_rand_t state, slong len
+                 c);
+     }
+ 
+-    fmpz_mod_poly_clear(q);
++    fmpz_mod_poly_clear(q, ctx);
++    fmpz_mod_ctx_clear(ctx);
+     fmpz_clear(c);
+ }



More information about the arch-commits mailing list