Bug#993269: e-antic FTBFS with flint 2.8.0

peter green plugwash at p10link.net
Sun Sep 5 23:34:26 BST 2021


Tags 993269 +patch
thanks

I decided to have a poke around to see if anyone else had fixed this. I followed the homepage link
to  e-antic FTBFS with flint 2.8.0 and noted that the "master" branch was a much newer release series,
but there was also a "master0" branch. Selecting that branch told me it was forked from and behind
flatsurf/e-antic, I'm not sure what the relationship between flatsurf and videlec is but I followed
the link through and had a look at the history. In said history I found there was a commit that
claimed to fix the build with flint 2.7, with a followup commit to make it conditional and allow
building with both newer and older flint.

Debian skipped from flatsurf 2.6 to 2.8 so I figured a fix for flatsurf 2.7 may also work for
flatsurf 2.8 or at least reduce the number of errors. I applied the commits to the Debian package
and they did indeed fix the build.

Debdiff is attatched. I am about to go upload this to raspbian, I don't have any current plans to
NMU this in Debian.
-------------- next part --------------
diff -Nru e-antic-0.1.8+ds/debian/changelog e-antic-0.1.8+ds/debian/changelog
--- e-antic-0.1.8+ds/debian/changelog	2021-02-21 14:17:56.000000000 +0000
+++ e-antic-0.1.8+ds/debian/changelog	2021-09-05 22:14:10.000000000 +0000
@@ -1,3 +1,11 @@
+e-antic (0.1.8+ds-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Apply patches from https://github.com/flatsurf/e-antic/commits/master0
+    for flint 2.7 and above.
+
+ -- Peter Michael Green <plugwash at debian.org>  Sun, 05 Sep 2021 22:14:10 +0000
+
 e-antic (0.1.8+ds-1) unstable; urgency=medium
 
   * Debianization:
diff -Nru e-antic-0.1.8+ds/debian/patches/flint-2.7-conditional.patch e-antic-0.1.8+ds/debian/patches/flint-2.7-conditional.patch
--- e-antic-0.1.8+ds/debian/patches/flint-2.7-conditional.patch	1970-01-01 00:00:00.000000000 +0000
+++ e-antic-0.1.8+ds/debian/patches/flint-2.7-conditional.patch	2021-09-05 22:13:03.000000000 +0000
@@ -0,0 +1,356 @@
+commit 5337ecb9715f26a78fbef53fe0aef5e6d2cb3a88
+Author: Matthias Koeppe <mkoeppe at math.ucdavis.edu>
+Date:   Tue Feb 23 08:31:35 2021 -0800
+
+    Conditionalize changes on __FLINT_RELEASE >= 20700
+
+diff --git a/e-antic/nf_elem.h b/e-antic/nf_elem.h
+index 570b537..e15c544 100644
+--- a/e-antic/nf_elem.h
++++ b/e-antic/nf_elem.h
+@@ -580,13 +580,25 @@ FLINT_DLL
+ void nf_elem_get_nmod_poly(nmod_poly_t pol, const nf_elem_t a, const nf_t nf);
+ 
+ FLINT_DLL
++#if (__FLINT_RELEASE >= 20700)
+ 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);
++#else
++void _nf_elem_get_fmpz_mod_poly(fmpz_mod_poly_t pol, const nf_elem_t a, const nf_t nf);
++#endif
+ 
+ FLINT_DLL
++#if (__FLINT_RELEASE >= 20700)
+ 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);
++#else
++void nf_elem_get_fmpz_mod_poly_den(fmpz_mod_poly_t pol, const nf_elem_t a, const nf_t nf, int den);
++#endif
+ 
+ FLINT_DLL
++#if (__FLINT_RELEASE >= 20700)
+ 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);
++#else
++void nf_elem_get_fmpz_mod_poly(fmpz_mod_poly_t pol, const nf_elem_t a, const nf_t nf);
++#endif
+ 
+ /******************************************************************************
+  
+diff --git a/nf_elem/get_fmpz_mod_poly.c b/nf_elem/get_fmpz_mod_poly.c
+index eba9c64..b55c5bb 100644
+--- a/nf_elem/get_fmpz_mod_poly.c
++++ b/nf_elem/get_fmpz_mod_poly.c
+@@ -25,68 +25,124 @@
+ 
+ #include "e-antic/nf_elem.h"
+ 
++#if (__FLINT_RELEASE >= 20700)
+ 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)
++#else
++void _nf_elem_get_fmpz_mod_poly(fmpz_mod_poly_t pol, const nf_elem_t a, const nf_t nf)
++#endif
+ {
+     if (nf_elem_is_zero(a, nf))
+     {
++#if (__FLINT_RELEASE >= 20700)
+         fmpz_mod_poly_zero(pol, ctx);
+         
++#else
++        fmpz_mod_poly_zero(pol);
++#endif
+         return;
+     }
+     if (nf->flag & NF_LINEAR)
+     {
+         {
++#if (__FLINT_RELEASE >= 20700)
+             fmpz_mod_poly_fit_length(pol, 1, ctx);
+         
+             fmpz_mod(pol->coeffs + 0, LNF_ELEM_NUMREF(a), ctx->n);
+         
++#else
++            fmpz_mod_poly_fit_length(pol, 1);
++            fmpz_mod(pol->coeffs + 0, LNF_ELEM_NUMREF(a), &(pol->p));
++#endif
+             _fmpz_mod_poly_set_length(pol, 1);
+             _fmpz_mod_poly_normalise(pol);
+ 
+         }
+     } else if (nf->flag & NF_QUADRATIC)
+     {
++#if (__FLINT_RELEASE >= 20700)
+         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);
+         
++#else
++        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));
++#endif
+         _fmpz_mod_poly_set_length(pol, 3);
+         _fmpz_mod_poly_normalise(pol);
+     } else
+     {
+         slong len = NF_ELEM(a)->length;
+         slong i;
++#if (__FLINT_RELEASE >= 20700)
+ 
+         fmpz_mod_poly_fit_length(pol, len, ctx);
+         
++#else
++        fmpz_mod_poly_fit_length(pol, len);
++#endif
+         for (i = 0; i < len; i++)
++#if (__FLINT_RELEASE >= 20700)
+             fmpz_mod(pol->coeffs + i, NF_ELEM_NUMREF(a) + i, ctx->n);
+         
++#else
++            fmpz_mod(pol->coeffs + i, NF_ELEM_NUMREF(a) + i, &(pol->p));
++#endif
+         _fmpz_mod_poly_set_length(pol, len);
+         _fmpz_mod_poly_normalise(pol);
+     }
+ }
+ 
++#if (__FLINT_RELEASE >= 20700)
+ 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)
++#else
++void nf_elem_get_fmpz_mod_poly_den(fmpz_mod_poly_t pol, const nf_elem_t a, const nf_t nf, int den)
++#endif
+ {
++#if (__FLINT_RELEASE >= 20700)
+     _nf_elem_get_fmpz_mod_poly(pol, a, nf, ctx);
++#else
++    _nf_elem_get_fmpz_mod_poly(pol, a, nf);
++#endif
+     if (den)
+     {
+         if (nf->flag & NF_LINEAR)
++#if (__FLINT_RELEASE >= 20700)
+             fmpz_mod_poly_scalar_div_fmpz(pol, pol, LNF_ELEM_DENREF(a), ctx);
++#else
++            fmpz_mod_poly_scalar_div_fmpz(pol, pol, LNF_ELEM_DENREF(a));
++#endif
+         else if (nf->flag & NF_QUADRATIC)
++#if (__FLINT_RELEASE >= 20700)
+             fmpz_mod_poly_scalar_div_fmpz(pol, pol, QNF_ELEM_DENREF(a), ctx);
++#else
++            fmpz_mod_poly_scalar_div_fmpz(pol, pol, QNF_ELEM_DENREF(a));
++#endif
+         else
++#if (__FLINT_RELEASE >= 20700)
+             fmpz_mod_poly_scalar_div_fmpz(pol, pol, NF_ELEM_DENREF(a), ctx);
++#else
++            fmpz_mod_poly_scalar_div_fmpz(pol, pol, NF_ELEM_DENREF(a));
++#endif
+     }
+ }
+ 
++#if (__FLINT_RELEASE >= 20700)
+ 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)
++#else
++void nf_elem_get_fmpz_mod_poly(fmpz_mod_poly_t pol, const nf_elem_t a, const nf_t nf)
++#endif
+ {
++#if (__FLINT_RELEASE >= 20700)
+     nf_elem_get_fmpz_mod_poly_den(pol, a, nf, 1, ctx);
++#else
++    nf_elem_get_fmpz_mod_poly_den(pol, a, nf, 1);
++#endif
+ }
+diff --git a/nf_elem/test/t-get_fmpz_mod_poly.c b/nf_elem/test/t-get_fmpz_mod_poly.c
+index 1fd8e5e..ce84545 100644
+--- a/nf_elem/test/t-get_fmpz_mod_poly.c
++++ b/nf_elem/test/t-get_fmpz_mod_poly.c
+@@ -45,7 +45,10 @@ main(void)
+         nf_elem_t a;
+         fmpz_mod_poly_t reduced_elem;
+         fmpz_t coeff, mod, reduced_coeff;
++#if (__FLINT_RELEASE >= 20700)
+         fmpz_mod_ctx_t ctx;
++#else
++#endif
+ 
+         fmpz_init(mod);
+         fmpz_randtest_unsigned(mod, state, 2 * FLINT_BITS);
+@@ -53,8 +56,12 @@ main(void)
+ 
+         fmpz_init(coeff);
+         fmpz_init(reduced_coeff);
++#if (__FLINT_RELEASE >= 20700)
+         fmpz_mod_ctx_init(ctx, mod);
+         fmpz_mod_poly_init(reduced_elem, ctx);
++#else
++        fmpz_mod_poly_init(reduced_elem, mod);
++#endif
+ 
+         nf_init_randtest(nf, state, 2 + n_randint(state, 20), 200);
+ 
+@@ -62,13 +69,21 @@ main(void)
+ 
+         nf_elem_randtest(a, state, 200, nf);
+ 
++#if (__FLINT_RELEASE >= 20700)
+         nf_elem_get_fmpz_mod_poly_den(reduced_elem, a, nf, 0, ctx);
++#else
++        nf_elem_get_fmpz_mod_poly_den(reduced_elem, a, nf, 0);
++#endif
+ 
+         for (j = 0; j < nf_degree(nf); j++)
+         {
+             nf_elem_get_coeff_fmpz(coeff, a, j, nf);
+             fmpz_mod(coeff, coeff, mod);
++#if (__FLINT_RELEASE >= 20700)
+             fmpz_mod_poly_get_coeff_fmpz(reduced_coeff, reduced_elem, j, ctx);
++#else
++            fmpz_mod_poly_get_coeff_fmpz(reduced_coeff, reduced_elem, j);
++#endif
+             result = fmpz_equal(reduced_coeff, coeff);
+             if (!result)
+             {
+@@ -76,14 +91,22 @@ 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");
++#if (__FLINT_RELEASE >= 20700)
+                 printf("a mod n = "); fmpz_mod_poly_print_pretty(reduced_elem, "x", ctx); printf("\n");
++#else
++                printf("a mod n = "); fmpz_mod_poly_print_pretty(reduced_elem, "x"); printf("\n");
++#endif
+                 abort();
+             }
+         }
+ 
+         nf_elem_clear(a, nf);
++#if (__FLINT_RELEASE >= 20700)
+         fmpz_mod_poly_clear(reduced_elem, ctx);
+         fmpz_mod_ctx_clear(ctx);
++#else
++        fmpz_mod_poly_clear(reduced_elem);
++#endif
+         fmpz_clear(coeff);
+         fmpz_clear(reduced_coeff);
+         fmpz_clear(mod);
+@@ -97,7 +120,10 @@ main(void)
+         nf_elem_t a;
+         fmpz_mod_poly_t reduced_elem;
+         fmpz_t coeff, reduced_coeff, den, mod, d_mod, d_modinv;
++#if (__FLINT_RELEASE >= 20700)
+         fmpz_mod_ctx_t ctx;
++#else
++#endif
+ 
+         fmpz_init(coeff);
+         fmpz_init(den);
+@@ -110,9 +136,13 @@ main(void)
+         fmpz_randtest_unsigned(mod, state, 2 * FLINT_BITS);
+         fmpz_add_ui(mod, mod, 2);
+ 
++#if (__FLINT_RELEASE >= 20700)
+         fmpz_mod_ctx_init(ctx, mod);
+ 
+         fmpz_mod_poly_init(reduced_elem, ctx);
++#else
++        fmpz_mod_poly_init(reduced_elem, mod);
++#endif
+ 
+         nf_init_randtest(nf, state, 40, 200);
+ 
+@@ -125,7 +155,11 @@ main(void)
+             fmpz_gcd(d_mod, d_mod, mod);
+         } while (!fmpz_is_one(d_mod));
+ 
++#if (__FLINT_RELEASE >= 20700)
+         nf_elem_get_fmpz_mod_poly(reduced_elem, a, nf, ctx);
++#else
++        nf_elem_get_fmpz_mod_poly(reduced_elem, a, nf);
++#endif
+ 
+         for (j = 0; j < nf_degree(nf); j++)
+         {
+@@ -134,14 +168,22 @@ main(void)
+             fmpz_invmod(d_modinv, den, mod);
+             fmpz_mul(coeff, coeff, d_modinv);
+             fmpz_mod(coeff, coeff, mod);
++#if (__FLINT_RELEASE >= 20700)
+             fmpz_mod_poly_get_coeff_fmpz(reduced_coeff, reduced_elem, j, ctx);
++#else
++            fmpz_mod_poly_get_coeff_fmpz(reduced_coeff, reduced_elem, j);
++#endif
+             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");
++#if (__FLINT_RELEASE >= 20700)
+                 printf("a mod n = "); fmpz_mod_poly_print_pretty(reduced_elem, "x", ctx); printf("\n");
++#else
++                printf("a mod n = "); fmpz_mod_poly_print_pretty(reduced_elem, "x"); printf("\n");
++#endif
+                 abort();
+             }
+         }
+@@ -153,8 +195,12 @@ main(void)
+         fmpz_clear(d_mod);
+         fmpz_clear(d_modinv);
+         nf_elem_clear(a, nf);
++#if (__FLINT_RELEASE >= 20700)
+         fmpz_mod_poly_clear(reduced_elem, ctx);
+         fmpz_mod_ctx_clear(ctx);
++#else
++        fmpz_mod_poly_clear(reduced_elem);
++#endif
+         nf_clear(nf);
+     }
+ 
+diff --git a/poly_extra/fmpz_poly_randtest_irreducible.c b/poly_extra/fmpz_poly_randtest_irreducible.c
+index 5b0e9d8..c1132dc 100644
+--- a/poly_extra/fmpz_poly_randtest_irreducible.c
++++ b/poly_extra/fmpz_poly_randtest_irreducible.c
+@@ -17,16 +17,28 @@ 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;
++#if (__FLINT_RELEASE >= 20700)
+     fmpz_mod_ctx_t ctx;
++#else
++#endif
+ 
+     fmpz_init(c);
+ 
+     fmpz_randprime(c, state, bits, 0);
++#if (__FLINT_RELEASE >= 20700)
+     fmpz_mod_ctx_init(ctx, c);
+     fmpz_mod_poly_init(q, ctx);
+     fmpz_mod_poly_randtest_irreducible(q, state, len, ctx);
++#else
++    fmpz_mod_poly_init(q, c);
++    fmpz_mod_poly_randtest_irreducible(q, state, len);
++#endif
+ 
++#if (__FLINT_RELEASE >= 20700)
+     fmpz_mod_poly_get_fmpz_poly(p, q, ctx);
++#else
++    fmpz_mod_poly_get_fmpz_poly(p, q);
++#endif
+ 
+     /* After lifting, the coefficients belong to {0, ..., c-1}. We now  */
+     /* randomly subtract c so that some of them become negative.        */
+@@ -39,7 +51,11 @@ void fmpz_poly_randtest_irreducible(fmpz_poly_t p, flint_rand_t state, slong len
+                 c);
+     }
+ 
++#if (__FLINT_RELEASE >= 20700)
+     fmpz_mod_poly_clear(q, ctx);
+     fmpz_mod_ctx_clear(ctx);
++#else
++    fmpz_mod_poly_clear(q);
++#endif
+     fmpz_clear(c);
+ }
diff -Nru e-antic-0.1.8+ds/debian/patches/flint-2.7.patch e-antic-0.1.8+ds/debian/patches/flint-2.7.patch
--- e-antic-0.1.8+ds/debian/patches/flint-2.7.patch	1970-01-01 00:00:00.000000000 +0000
+++ e-antic-0.1.8+ds/debian/patches/flint-2.7.patch	2021-09-05 22:12:27.000000000 +0000
@@ -0,0 +1,260 @@
+commit 0246435b421bf6353970041463e051706b533806
+Author: Matthias Koeppe <mkoeppe at math.ucdavis.edu>
+Date:   Tue Feb 23 08:15:08 2021 -0800
+
+    Apply https://github.com/archlinux/svntogit-community/blob/packages/e-antic/trunk/e-antic-flint-2.7.patch
+
+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);
+ }
diff -Nru e-antic-0.1.8+ds/debian/patches/series e-antic-0.1.8+ds/debian/patches/series
--- e-antic-0.1.8+ds/debian/patches/series	2021-02-21 13:50:01.000000000 +0000
+++ e-antic-0.1.8+ds/debian/patches/series	2021-09-05 22:13:33.000000000 +0000
@@ -1,3 +1,5 @@
 upstream-libtool-versioning.patch
 upstream-libtool-version_script.patch
 debianization.patch
+flint-2.7.patch
+flint-2.7-conditional.patch


More information about the debian-science-maintainers mailing list