Skip to content

Commit 32c9748

Browse files
authored
Merge pull request #185 from mohabsafey/option-g-1-charac-0
Fixes behaviour of option -g 1 in characteristic 0
2 parents 8a19435 + 97dc082 commit 32c9748

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

doc/msolve-tutorial.tex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,11 @@ \section{Computing Gr\"obner bases}\label{sec:grobner}
582582
\end{tcolorbox}
583583
Note that from this list of monomials, one can deduce the Hilbert series of the
584584
ideal generated by the input equations and then its dimension and its degree
585-
(see~\cite{CLO}).
585+
(see~\cite{CLO}).
586+
587+
Note that when the \verb+-g 1+ flag is used in characteristic $0$, the result is
588+
always probabilistic: the leading monomials are deduced from two computations
589+
over a prime field, the first prime being chosen randomly.
586590

587591
For instance, in the above example, one can deduce that the ideal has dimension
588592
$0$ (finitely many solutions with coordinates in an algebraic closure of

src/msolve/lifting-gb.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,8 @@ gb_modpoly_t *core_groebner_qq(
11471147
mstrace_t msd,
11481148
md_t *st,
11491149
int32_t *errp,
1150-
const len_t fc
1150+
const len_t fc,
1151+
const int print_gb
11511152
)
11521153
{
11531154
double st0 = realtime();
@@ -1158,7 +1159,6 @@ gb_modpoly_t *core_groebner_qq(
11581159
msd->bht = msd->bs_qq->ht;
11591160

11601161
int32_t info_level = st->info_level;
1161-
int32_t print_gb = st->print_gb;
11621162
int64_t dquot = 0;
11631163
int64_t *dquot_ptr = &dquot;
11641164
int32_t truncate_lifting = st->truncate_lifting;
@@ -1295,7 +1295,7 @@ gb_modpoly_t *core_groebner_qq(
12951295
free_rrec_data(recdata2);
12961296

12971297
fprintf(stderr, "Something went wrong in the learning phase, msolve restarts.");
1298-
return core_groebner_qq(modgbsp, bs, msd, st, errp, fc);
1298+
return core_groebner_qq(modgbsp, bs, msd, st, errp, fc, print_gb);
12991299
}
13001300
/* duplicate data for multi-threaded multi-mod computation */
13011301
duplicate_data_mthread_gbtrace(st->nthrds, msd->bs_qq, st, msd->num_gb,
@@ -1421,7 +1421,7 @@ gb_modpoly_t *core_groebner_qq(
14211421
free_rrec_data(recdata1);
14221422
free_rrec_data(recdata2);
14231423

1424-
return core_groebner_qq(modgbsp, bs, msd, st, errp, fc);
1424+
return core_groebner_qq(modgbsp, bs, msd, st, errp, fc, print_gb);
14251425

14261426
}
14271427

@@ -1453,6 +1453,9 @@ gb_modpoly_t *core_groebner_qq(
14531453
break;
14541454
}
14551455
}
1456+
if(!bad && print_gb == 1){
1457+
apply = 0;
1458+
}
14561459
if(dlift->lstart != lstart){
14571460
if(info_level){
14581461
fprintf(stdout, "<%.2f%%>", 100* (float)MIN((dlift->lstart + 1), (*modgbsp)->ld)/(*modgbsp)->ld);
@@ -1646,7 +1649,7 @@ gb_modpoly_t *groebner_qq(
16461649
int err = 0;
16471650

16481651
gb_modpoly_t *modgbsp = malloc(sizeof(gb_modpoly_t));
1649-
modgbsp = core_groebner_qq(modgbsp, bs, msd, md, &err, field_char);
1652+
modgbsp = core_groebner_qq(modgbsp, bs, msd, md, &err, field_char, print_gb);
16501653
if (err) {
16511654
printf("Problem with groebner_qq, stopped computation (%d).\n", err);
16521655
exit(1);
@@ -1821,7 +1824,8 @@ int64_t export_groebner_qq(
18211824
int err = 0;
18221825

18231826
gb_modpoly_t *modgbsp = malloc(sizeof(gb_modpoly_t));
1824-
modgbsp = core_groebner_qq(modgbsp, bs, msd, md, &err, field_char);
1827+
modgbsp = core_groebner_qq(modgbsp, bs, msd, md, &err, field_char,
1828+
2/* if set to 1, only the LM of the Gbs are correct */);
18251829
if (err) {
18261830
printf("Problem with groebner_qq, stopped computation.\n");
18271831
exit(1);

0 commit comments

Comments
 (0)