Skip to content

Commit d72eb6d

Browse files
Fix hang in nmod_mpoly_gcd
1 parent 474f55e commit d72eb6d

8 files changed

Lines changed: 245 additions & 4 deletions

File tree

src/fq_nmod_mpoly/mpolyu_gcdp_zippel.c

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ nmod_gcds_ret_t fq_nmod_mpolyu_gcds_zippel(
384384
{
385385
slong d = fq_nmod_ctx_degree(ctx->fqctx);
386386
int eval_points_tried;
387+
slong l_growths = 0;
387388
nmod_gcds_ret_t success;
388389
fq_nmod_mpolyu_t Aevalsk1, Bevalsk1, fevalsk1, Aevalski, Bevalski, fevalski;
389390
fq_nmod_poly_t Aeval, Beval, Geval;
@@ -504,10 +505,13 @@ nmod_gcds_ret_t fq_nmod_mpolyu_gcds_zippel(
504505
for (i = 0; i < (f->coeffs + tlen[f->length - 1])->length; i++)
505506
fq_nmod_init(b + i, ctx->fqctx);
506507

507-
fq_nmod_mat_init(MF, 0, l, ctx->fqctx);
508-
509508
M = (fq_nmod_mat_struct *) TMP_ALLOC(f->length*sizeof(fq_nmod_mat_struct));
510509
ML_is_initialized = (int *) TMP_ALLOC(f->length*sizeof(int));
510+
511+
alloc_images:
512+
513+
fq_nmod_mat_init(MF, 0, l, ctx->fqctx);
514+
511515
for (i = 0; i < f->length; i++)
512516
{
513517
fq_nmod_mat_init(M + i, l, (f->coeffs + i)->length, ctx->fqctx);
@@ -740,6 +744,25 @@ nmod_gcds_ret_t fq_nmod_mpolyu_gcds_zippel(
740744
if (underdeterminedcount < 2)
741745
goto pick_evaluation_point;
742746

747+
/* see nmod version: structural underdetermination, use more images */
748+
if (++l_growths <= 4)
749+
{
750+
for (i = 0; i < l*f->length; i++)
751+
fq_nmod_clear(W + i, ctx->fqctx);
752+
flint_free(W);
753+
fq_nmod_mat_clear(MF, ctx->fqctx);
754+
fq_nmod_mat_clear(Msol, ctx->fqctx);
755+
for (i = 0; i < f->length; i++)
756+
{
757+
fq_nmod_mat_clear(M + i, ctx->fqctx);
758+
if (ML_is_initialized[i])
759+
fq_nmod_mat_clear(ML + i, ctx->fqctx);
760+
}
761+
l += 1 + l/2;
762+
underdeterminedcount = 0;
763+
goto alloc_images;
764+
}
765+
743766
success = nmod_gcds_scales_not_found;
744767
goto finished;
745768
}

src/fq_nmod_mpoly/test/t-gcd_zippel.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,35 @@ TEST_FUNCTION_START(fq_nmod_mpoly_gcd_zippel, state)
107107
{
108108
slong i, j;
109109

110+
/* issue #2581: the LINZIP scale system in gcds_zippel was generically
111+
underdetermined for these inputs and the evaluation-point retry loop
112+
effectively never terminated */
113+
{
114+
fq_nmod_mpoly_ctx_t ctx;
115+
fq_nmod_mpoly_t g, a, b, t;
116+
117+
fq_nmod_mpoly_ctx_init_deg(ctx, 12, ORD_LEX, UWORD(2147483647), 1);
118+
fq_nmod_mpoly_init(g, ctx);
119+
fq_nmod_mpoly_init(a, ctx);
120+
fq_nmod_mpoly_init(b, ctx);
121+
fq_nmod_mpoly_init(t, ctx);
122+
123+
fq_nmod_mpoly_set_str_pretty(t, "x4*x7^2*x11^3*x12 + x4*x7^2*x11*x12^3 + 2*x4*x7*x8*x10*x11^2*x12 + 2*x4*x7*x8*x10*x12^3 + 2*x4*x7*x9*x10*x11^3 + 2*x4*x7*x9*x10*x11*x12^2 + x4*x8^2*x10^2*x11*x12 + x4*x8^2*x11*x12^3 + x4*x8*x9*x10^2*x11^2 + x4*x8*x9*x10^2*x12^2 + 2*x4*x8*x9*x11^2*x12^2 + x4*x9^2*x10^2*x11*x12 + x4*x9^2*x11^3*x12 - x5*x7^2*x11*x12^3 - 2*x5*x7*x8*x10*x12^3 - 2*x5*x7*x9*x10*x11*x12^2 - x5*x8^2*x11*x12^3 + x5*x8*x9*x10^2*x11^2 - 2*x5*x8*x9*x10^2*x12^2 - x5*x8*x9*x11^2*x12^2 - x5*x9^2*x10^2*x11*x12 - x6*x7^2*x11^3*x12 - 2*x6*x7*x8*x10*x11^2*x12 - 2*x6*x7*x9*x10*x11^3 - x6*x8^2*x10^2*x11*x12 - 2*x6*x8*x9*x10^2*x11^2 + x6*x8*x9*x10^2*x12^2 - x6*x8*x9*x11^2*x12^2 - x6*x9^2*x11^3*x12", NULL, ctx);
124+
fq_nmod_mpoly_set_str_pretty(a, "x3*(x5-x4)", NULL, ctx);
125+
fq_nmod_mpoly_set_str_pretty(b, "x2*(x4-x6)", NULL, ctx);
126+
fq_nmod_mpoly_mul(a, a, t, ctx);
127+
fq_nmod_mpoly_mul(b, b, t, ctx);
128+
129+
gcd_check(g, a, b, t, ctx, 0, 0, "issue 2581");
130+
131+
fq_nmod_mpoly_clear(g, ctx);
132+
fq_nmod_mpoly_clear(a, ctx);
133+
fq_nmod_mpoly_clear(b, ctx);
134+
fq_nmod_mpoly_clear(t, ctx);
135+
fq_nmod_mpoly_ctx_clear(ctx);
136+
}
137+
138+
110139
for (i = 0; i < 20*flint_test_multiplier(); i++)
111140
{
112141
fq_nmod_mpoly_ctx_t ctx;

src/nmod_mpoly/mpolyu_gcdp_zippel.c

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ nmod_gcds_ret_t nmod_mpolyu_gcds_zippel(nmod_mpolyu_t G,
194194
const nmod_mpoly_ctx_t ctx, flint_rand_t randstate, slong * degbound)
195195
{
196196
int eval_points_tried;
197+
slong l_growths = 0;
197198
nmod_gcds_ret_t success;
198199
nmod_mpolyu_t Aevalsk1, Bevalsk1, fevalsk1, Aevalski, Bevalski, fevalski;
199200
nmod_poly_t Aeval, Beval, Geval;
@@ -303,10 +304,13 @@ nmod_gcds_ret_t nmod_mpolyu_gcds_zippel(nmod_mpolyu_t G,
303304
b = (ulong *) TMP_ALLOC((f->coeffs + d[f->length - 1])->length
304305
*sizeof(ulong));
305306

306-
nmod_mat_init(MF, 0, l, ctx->mod.n);
307-
308307
M = (nmod_mat_struct *) TMP_ALLOC(f->length*sizeof(nmod_mat_struct));
309308
ML_is_initialized = (int *) TMP_ALLOC(f->length*sizeof(int));
309+
310+
alloc_images:
311+
312+
nmod_mat_init(MF, 0, l, ctx->mod.n);
313+
310314
for (i = 0; i < f->length; i++)
311315
{
312316
nmod_mat_init(M + i, l, (f->coeffs + i)->length, ctx->mod.n);
@@ -527,6 +531,29 @@ nmod_gcds_ret_t nmod_mpolyu_gcds_zippel(nmod_mpolyu_t G,
527531
if (underdeterminedcount < 2)
528532
goto pick_evaluation_point;
529533

534+
/*
535+
The failure is likely structural: with this form the scale
536+
system is generically underdetermined for this number of
537+
images. Retry with more images instead of giving up, which
538+
would otherwise send the caller into a near-infinite loop
539+
of new evaluation points that can never succeed.
540+
*/
541+
if (++l_growths <= 4)
542+
{
543+
flint_free(W);
544+
nmod_mat_clear(MF);
545+
nmod_mat_clear(Msol);
546+
for (i = 0; i < f->length; i++)
547+
{
548+
nmod_mat_clear(M + i);
549+
if (ML_is_initialized[i])
550+
nmod_mat_clear(ML + i);
551+
}
552+
l += 1 + l/2;
553+
underdeterminedcount = 0;
554+
goto alloc_images;
555+
}
556+
530557
success = nmod_gcds_scales_not_found;
531558
goto finished;
532559
}

src/nmod_mpoly/test/t-gcd.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,38 @@ TEST_FUNCTION_START(nmod_mpoly_gcd, state)
138138
const slong max_threads = 5;
139139
slong i, j, k, tmul = 5;
140140

141+
/* issue #2581: the LINZIP scale system in gcds_zippel was generically
142+
underdetermined for these inputs and the evaluation-point retry loop
143+
effectively never terminated */
144+
{
145+
nmod_mpoly_ctx_t ctx;
146+
nmod_mpoly_t g, a, b, t;
147+
const char * vars[] = {"l1", "l2", "l3", "a1", "a2", "a3",
148+
"b1", "b2", "b3", "g1", "g2", "g3"};
149+
150+
nmod_mpoly_ctx_init(ctx, 12, ORD_LEX, UWORD(2147483647));
151+
nmod_mpoly_init(g, ctx);
152+
nmod_mpoly_init(a, ctx);
153+
nmod_mpoly_init(b, ctx);
154+
nmod_mpoly_init(t, ctx);
155+
156+
nmod_mpoly_set_str_pretty(t, "l1*a2-l1*a3-l2*a1+l2*a3+l3*a1-l3*a2", vars, ctx);
157+
nmod_mpoly_set_str_pretty(a, "(b1*g2*g3+b2*g1*g3+b3*g1*g2)^2", vars, ctx);
158+
nmod_mpoly_set_str_pretty(b, "a1*b1^2*g2^3*g3 + a1*b1^2*g2*g3^3 + 2*a1*b1*b2*g1*g2^2*g3 + 2*a1*b1*b2*g1*g3^3 + 2*a1*b1*b3*g1*g2^3 + 2*a1*b1*b3*g1*g2*g3^2 + a1*b2^2*g1^2*g2*g3 + a1*b2^2*g2*g3^3 + a1*b2*b3*g1^2*g2^2 + a1*b2*b3*g1^2*g3^2 + 2*a1*b2*b3*g2^2*g3^2 + a1*b3^2*g1^2*g2*g3 + a1*b3^2*g2^3*g3 - a2*b1^2*g2*g3^3 - 2*a2*b1*b2*g1*g3^3 - 2*a2*b1*b3*g1*g2*g3^2 - a2*b2^2*g2*g3^3 + a2*b2*b3*g1^2*g2^2 - 2*a2*b2*b3*g1^2*g3^2 - a2*b2*b3*g2^2*g3^2 - a2*b3^2*g1^2*g2*g3 - a3*b1^2*g2^3*g3 - 2*a3*b1*b2*g1*g2^2*g3 - 2*a3*b1*b3*g1*g2^3 - a3*b2^2*g1^2*g2*g3 - 2*a3*b2*b3*g1^2*g2^2 + a3*b2*b3*g1^2*g3^2 - a3*b2*b3*g2^2*g3^2 - a3*b3^2*g2^3*g3", vars, ctx);
159+
nmod_mpoly_mul(a, a, t, ctx);
160+
nmod_mpoly_mul(a, a, t, ctx);
161+
nmod_mpoly_mul(b, b, t, ctx);
162+
163+
gcd_check(g, a, b, ctx, 0, 0, "issue 2581");
164+
165+
nmod_mpoly_clear(g, ctx);
166+
nmod_mpoly_clear(a, ctx);
167+
nmod_mpoly_clear(b, ctx);
168+
nmod_mpoly_clear(t, ctx);
169+
nmod_mpoly_ctx_clear(ctx);
170+
}
171+
172+
141173
{
142174
nmod_mpoly_ctx_t ctx;
143175
nmod_mpoly_t g, a, b;

src/nmod_mpoly/test/t-gcd_cofactors.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,43 @@ TEST_FUNCTION_START(nmod_mpoly_gcd_cofactors, state)
268268
const slong max_threads = 5;
269269
slong i, j, k, tmul = 3;
270270

271+
/* issue #2581: the LINZIP scale system in gcds_zippel was generically
272+
underdetermined for these inputs and the evaluation-point retry loop
273+
effectively never terminated */
274+
{
275+
nmod_mpoly_ctx_t ctx;
276+
nmod_mpoly_t g, a, b, t;
277+
nmod_mpoly_t abar, bbar;
278+
const char * vars[] = {"l1", "l2", "l3", "a1", "a2", "a3",
279+
"b1", "b2", "b3", "g1", "g2", "g3"};
280+
281+
nmod_mpoly_ctx_init(ctx, 12, ORD_LEX, UWORD(2147483647));
282+
nmod_mpoly_init(g, ctx);
283+
nmod_mpoly_init(a, ctx);
284+
nmod_mpoly_init(b, ctx);
285+
nmod_mpoly_init(t, ctx);
286+
nmod_mpoly_init(abar, ctx);
287+
nmod_mpoly_init(bbar, ctx);
288+
289+
nmod_mpoly_set_str_pretty(t, "l1*a2-l1*a3-l2*a1+l2*a3+l3*a1-l3*a2", vars, ctx);
290+
nmod_mpoly_set_str_pretty(a, "(b1*g2*g3+b2*g1*g3+b3*g1*g2)^2", vars, ctx);
291+
nmod_mpoly_set_str_pretty(b, "a1*b1^2*g2^3*g3 + a1*b1^2*g2*g3^3 + 2*a1*b1*b2*g1*g2^2*g3 + 2*a1*b1*b2*g1*g3^3 + 2*a1*b1*b3*g1*g2^3 + 2*a1*b1*b3*g1*g2*g3^2 + a1*b2^2*g1^2*g2*g3 + a1*b2^2*g2*g3^3 + a1*b2*b3*g1^2*g2^2 + a1*b2*b3*g1^2*g3^2 + 2*a1*b2*b3*g2^2*g3^2 + a1*b3^2*g1^2*g2*g3 + a1*b3^2*g2^3*g3 - a2*b1^2*g2*g3^3 - 2*a2*b1*b2*g1*g3^3 - 2*a2*b1*b3*g1*g2*g3^2 - a2*b2^2*g2*g3^3 + a2*b2*b3*g1^2*g2^2 - 2*a2*b2*b3*g1^2*g3^2 - a2*b2*b3*g2^2*g3^2 - a2*b3^2*g1^2*g2*g3 - a3*b1^2*g2^3*g3 - 2*a3*b1*b2*g1*g2^2*g3 - 2*a3*b1*b3*g1*g2^3 - a3*b2^2*g1^2*g2*g3 - 2*a3*b2*b3*g1^2*g2^2 + a3*b2*b3*g1^2*g3^2 - a3*b2*b3*g2^2*g3^2 - a3*b3^2*g2^3*g3", vars, ctx);
292+
nmod_mpoly_mul(a, a, t, ctx);
293+
nmod_mpoly_mul(a, a, t, ctx);
294+
nmod_mpoly_mul(b, b, t, ctx);
295+
296+
gcd_check(g, abar, bbar, a, b, t, ctx, 0, 0, "issue 2581");
297+
298+
nmod_mpoly_clear(g, ctx);
299+
nmod_mpoly_clear(a, ctx);
300+
nmod_mpoly_clear(b, ctx);
301+
nmod_mpoly_clear(t, ctx);
302+
nmod_mpoly_clear(abar, ctx);
303+
nmod_mpoly_clear(bbar, ctx);
304+
nmod_mpoly_ctx_clear(ctx);
305+
}
306+
307+
271308
{
272309
nmod_mpoly_ctx_t ctx;
273310
nmod_mpoly_t g, abar, bbar, a, b, t;

src/nmod_mpoly/test/t-gcd_hensel.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,38 @@ TEST_FUNCTION_START(nmod_mpoly_gcd_hensel, state)
107107
{
108108
slong i, j;
109109

110+
/* issue #2581: the LINZIP scale system in gcds_zippel was generically
111+
underdetermined for these inputs and the evaluation-point retry loop
112+
effectively never terminated */
113+
{
114+
nmod_mpoly_ctx_t ctx;
115+
nmod_mpoly_t g, a, b, t;
116+
const char * vars[] = {"l1", "l2", "l3", "a1", "a2", "a3",
117+
"b1", "b2", "b3", "g1", "g2", "g3"};
118+
119+
nmod_mpoly_ctx_init(ctx, 12, ORD_LEX, UWORD(2147483647));
120+
nmod_mpoly_init(g, ctx);
121+
nmod_mpoly_init(a, ctx);
122+
nmod_mpoly_init(b, ctx);
123+
nmod_mpoly_init(t, ctx);
124+
125+
nmod_mpoly_set_str_pretty(t, "l1*a2-l1*a3-l2*a1+l2*a3+l3*a1-l3*a2", vars, ctx);
126+
nmod_mpoly_set_str_pretty(a, "(b1*g2*g3+b2*g1*g3+b3*g1*g2)^2", vars, ctx);
127+
nmod_mpoly_set_str_pretty(b, "a1*b1^2*g2^3*g3 + a1*b1^2*g2*g3^3 + 2*a1*b1*b2*g1*g2^2*g3 + 2*a1*b1*b2*g1*g3^3 + 2*a1*b1*b3*g1*g2^3 + 2*a1*b1*b3*g1*g2*g3^2 + a1*b2^2*g1^2*g2*g3 + a1*b2^2*g2*g3^3 + a1*b2*b3*g1^2*g2^2 + a1*b2*b3*g1^2*g3^2 + 2*a1*b2*b3*g2^2*g3^2 + a1*b3^2*g1^2*g2*g3 + a1*b3^2*g2^3*g3 - a2*b1^2*g2*g3^3 - 2*a2*b1*b2*g1*g3^3 - 2*a2*b1*b3*g1*g2*g3^2 - a2*b2^2*g2*g3^3 + a2*b2*b3*g1^2*g2^2 - 2*a2*b2*b3*g1^2*g3^2 - a2*b2*b3*g2^2*g3^2 - a2*b3^2*g1^2*g2*g3 - a3*b1^2*g2^3*g3 - 2*a3*b1*b2*g1*g2^2*g3 - 2*a3*b1*b3*g1*g2^3 - a3*b2^2*g1^2*g2*g3 - 2*a3*b2*b3*g1^2*g2^2 + a3*b2*b3*g1^2*g3^2 - a3*b2*b3*g2^2*g3^2 - a3*b3^2*g2^3*g3", vars, ctx);
128+
nmod_mpoly_mul(a, a, t, ctx);
129+
nmod_mpoly_mul(a, a, t, ctx);
130+
nmod_mpoly_mul(b, b, t, ctx);
131+
132+
gcd_check(g, a, b, t, ctx, 0, 0, "issue 2581");
133+
134+
nmod_mpoly_clear(g, ctx);
135+
nmod_mpoly_clear(a, ctx);
136+
nmod_mpoly_clear(b, ctx);
137+
nmod_mpoly_clear(t, ctx);
138+
nmod_mpoly_ctx_clear(ctx);
139+
}
140+
141+
110142
for (i = 0; i < 10 * flint_test_multiplier(); i++)
111143
{
112144
nmod_mpoly_ctx_t ctx;

src/nmod_mpoly/test/t-gcd_zippel.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,35 @@ TEST_FUNCTION_START(nmod_mpoly_gcd_zippel, state)
107107
{
108108
slong i, j;
109109

110+
/* issue #2581: the LINZIP scale system in gcds_zippel was generically
111+
underdetermined for these inputs and the evaluation-point retry loop
112+
effectively never terminated */
113+
{
114+
nmod_mpoly_ctx_t ctx;
115+
nmod_mpoly_t g, a, b, t;
116+
117+
nmod_mpoly_ctx_init(ctx, 12, ORD_LEX, UWORD(2147483647));
118+
nmod_mpoly_init(g, ctx);
119+
nmod_mpoly_init(a, ctx);
120+
nmod_mpoly_init(b, ctx);
121+
nmod_mpoly_init(t, ctx);
122+
123+
nmod_mpoly_set_str_pretty(t, "x4*x7^2*x11^3*x12 + x4*x7^2*x11*x12^3 + 2*x4*x7*x8*x10*x11^2*x12 + 2*x4*x7*x8*x10*x12^3 + 2*x4*x7*x9*x10*x11^3 + 2*x4*x7*x9*x10*x11*x12^2 + x4*x8^2*x10^2*x11*x12 + x4*x8^2*x11*x12^3 + x4*x8*x9*x10^2*x11^2 + x4*x8*x9*x10^2*x12^2 + 2*x4*x8*x9*x11^2*x12^2 + x4*x9^2*x10^2*x11*x12 + x4*x9^2*x11^3*x12 - x5*x7^2*x11*x12^3 - 2*x5*x7*x8*x10*x12^3 - 2*x5*x7*x9*x10*x11*x12^2 - x5*x8^2*x11*x12^3 + x5*x8*x9*x10^2*x11^2 - 2*x5*x8*x9*x10^2*x12^2 - x5*x8*x9*x11^2*x12^2 - x5*x9^2*x10^2*x11*x12 - x6*x7^2*x11^3*x12 - 2*x6*x7*x8*x10*x11^2*x12 - 2*x6*x7*x9*x10*x11^3 - x6*x8^2*x10^2*x11*x12 - 2*x6*x8*x9*x10^2*x11^2 + x6*x8*x9*x10^2*x12^2 - x6*x8*x9*x11^2*x12^2 - x6*x9^2*x11^3*x12", NULL, ctx);
124+
nmod_mpoly_set_str_pretty(a, "x3*(x5-x4)", NULL, ctx);
125+
nmod_mpoly_set_str_pretty(b, "x2*(x4-x6)", NULL, ctx);
126+
nmod_mpoly_mul(a, a, t, ctx);
127+
nmod_mpoly_mul(b, b, t, ctx);
128+
129+
gcd_check(g, a, b, t, ctx, 0, 0, "issue 2581");
130+
131+
nmod_mpoly_clear(g, ctx);
132+
nmod_mpoly_clear(a, ctx);
133+
nmod_mpoly_clear(b, ctx);
134+
nmod_mpoly_clear(t, ctx);
135+
nmod_mpoly_ctx_clear(ctx);
136+
}
137+
138+
110139
for (i = 0; i < 30 * flint_test_multiplier(); i++)
111140
{
112141
nmod_mpoly_ctx_t ctx;

src/nmod_mpoly/test/t-gcd_zippel2.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,38 @@ TEST_FUNCTION_START(nmod_mpoly_gcd_zippel2, state)
107107
{
108108
slong i, j;
109109

110+
/* issue #2581: the LINZIP scale system in gcds_zippel was generically
111+
underdetermined for these inputs and the evaluation-point retry loop
112+
effectively never terminated */
113+
{
114+
nmod_mpoly_ctx_t ctx;
115+
nmod_mpoly_t g, a, b, t;
116+
const char * vars[] = {"l1", "l2", "l3", "a1", "a2", "a3",
117+
"b1", "b2", "b3", "g1", "g2", "g3"};
118+
119+
nmod_mpoly_ctx_init(ctx, 12, ORD_LEX, UWORD(2147483647));
120+
nmod_mpoly_init(g, ctx);
121+
nmod_mpoly_init(a, ctx);
122+
nmod_mpoly_init(b, ctx);
123+
nmod_mpoly_init(t, ctx);
124+
125+
nmod_mpoly_set_str_pretty(t, "l1*a2-l1*a3-l2*a1+l2*a3+l3*a1-l3*a2", vars, ctx);
126+
nmod_mpoly_set_str_pretty(a, "(b1*g2*g3+b2*g1*g3+b3*g1*g2)^2", vars, ctx);
127+
nmod_mpoly_set_str_pretty(b, "a1*b1^2*g2^3*g3 + a1*b1^2*g2*g3^3 + 2*a1*b1*b2*g1*g2^2*g3 + 2*a1*b1*b2*g1*g3^3 + 2*a1*b1*b3*g1*g2^3 + 2*a1*b1*b3*g1*g2*g3^2 + a1*b2^2*g1^2*g2*g3 + a1*b2^2*g2*g3^3 + a1*b2*b3*g1^2*g2^2 + a1*b2*b3*g1^2*g3^2 + 2*a1*b2*b3*g2^2*g3^2 + a1*b3^2*g1^2*g2*g3 + a1*b3^2*g2^3*g3 - a2*b1^2*g2*g3^3 - 2*a2*b1*b2*g1*g3^3 - 2*a2*b1*b3*g1*g2*g3^2 - a2*b2^2*g2*g3^3 + a2*b2*b3*g1^2*g2^2 - 2*a2*b2*b3*g1^2*g3^2 - a2*b2*b3*g2^2*g3^2 - a2*b3^2*g1^2*g2*g3 - a3*b1^2*g2^3*g3 - 2*a3*b1*b2*g1*g2^2*g3 - 2*a3*b1*b3*g1*g2^3 - a3*b2^2*g1^2*g2*g3 - 2*a3*b2*b3*g1^2*g2^2 + a3*b2*b3*g1^2*g3^2 - a3*b2*b3*g2^2*g3^2 - a3*b3^2*g2^3*g3", vars, ctx);
128+
nmod_mpoly_mul(a, a, t, ctx);
129+
nmod_mpoly_mul(a, a, t, ctx);
130+
nmod_mpoly_mul(b, b, t, ctx);
131+
132+
gcd_check(g, a, b, t, ctx, 0, 0, "issue 2581");
133+
134+
nmod_mpoly_clear(g, ctx);
135+
nmod_mpoly_clear(a, ctx);
136+
nmod_mpoly_clear(b, ctx);
137+
nmod_mpoly_clear(t, ctx);
138+
nmod_mpoly_ctx_clear(ctx);
139+
}
140+
141+
110142
for (i = 0; i < 20 * flint_test_multiplier(); i++)
111143
{
112144
nmod_mpoly_ctx_t ctx;

0 commit comments

Comments
 (0)