Skip to content

Commit 2034821

Browse files
committed
put some f4sat messages into verbose mode and put send some error messages to stderr
1 parent 1f2d3a1 commit 2034821

8 files changed

Lines changed: 37 additions & 29 deletions

File tree

src/msolve/hilbert.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,7 +1770,7 @@ build_matrixn_colon(int32_t *lmb, long dquot, int32_t bld,
17701770
int32_t err = 0;
17711771
tbr = core_nf(tbr, st, mul, bs, &err);
17721772
if (err) {
1773-
printf("Problem with normalform, stopped computation.\n");
1773+
fprintf(stderr,"Problem with normalform, stopped computation.\n");
17741774
exit(1);
17751775
}
17761776
/* printf ("reductions\n"); */
@@ -1953,7 +1953,7 @@ build_matrixn_colon(int32_t *lmb, long dquot, int32_t bld,
19531953
/* st, gens->vnames, 0); */
19541954
success = core_nf(&tbr, &bht, &st, mul, bs);
19551955
if (!success) {
1956-
printf("Problem with normalform, stopped computation.\n");
1956+
fprintf(stderr,"Problem with normalform, stopped computation.\n");
19571957
exit(1);
19581958
}
19591959
/* printf ("reduction\n"); */
@@ -2002,7 +2002,7 @@ build_matrixn_colon(int32_t *lmb, long dquot, int32_t bld,
20022002
/* st, gens->vnames, 0); */
20032003
int success = core_nf(&tbr, &bht, &st, mul, bs);
20042004
if (!success) {
2005-
printf("Problem with normalform, stopped computation.\n");
2005+
fprintf(stderr,"Problem with normalform, stopped computation.\n");
20062006
exit(1);
20072007
}
20082008
/* printf ("reductions\n"); */
@@ -2217,7 +2217,7 @@ build_matrixn_colon_no_zero(int32_t *lmb, long dquot, int32_t bld,
22172217
int32_t err = 0;
22182218
tbr = core_nf(tbr, st, mul, bs, &err);
22192219
if (err) {
2220-
printf("Problem with normalform, stopped computation.\n");
2220+
fprintf(stderr,"Problem with normalform, stopped computation.\n");
22212221
exit(1);
22222222
}
22232223
/* printf ("reductions\n"); */
@@ -3076,7 +3076,7 @@ static inline void build_matrixn_unstable_from_bs_trace_application(sp_matfglm_t
30763076
int32_t err = 0;
30773077
tbr = core_nf(tbr, md, mul, bs, &err);
30783078
if (err) {
3079-
printf("Problem with normalform, stopped computation.\n");
3079+
fprintf(stderr,"Problem with normalform, stopped computation.\n");
30803080
exit(1);
30813081
}
30823082
free(mul);

src/msolve/iofiles.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ static void get_variables(FILE *fh, char * line, int max_line_size,
523523
if (fgets(line, max_line_size, fh) != NULL) {
524524
tmp = line;
525525
} else {
526-
printf("Bad file format (variable names).\n");
526+
fprintf(stderr,"Bad file format (variable names).\n");
527527
/* free(vnames);
528528
* free(line); */
529529
fclose(fh);
@@ -978,11 +978,11 @@ static inline void get_data_from_file(char *fn, int32_t *nr_vars,
978978
int32_t *nr_gens, data_gens_ff_t *gens){
979979
*nr_vars = get_nvars(fn);
980980
if (*nr_vars == -1)
981-
printf("Bad file format (first line).\n");
981+
fprintf(stderr,"Bad file format (first line).\n");
982982

983983
*nr_gens = get_ngenerators(fn);
984984
if (*nr_gens == -1)
985-
printf("Bad file format (generators).\n");
985+
fprintf(stderr,"Bad file format (generators).\n");
986986

987987
const int max_line_size = 1073741824;
988988
char *line = (char *)malloc((nelts_t)max_line_size * sizeof(char));

src/msolve/lifting-gb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ static int32_t gb_modular_trace_learning(gb_modpoly_t modgbs,
722722
st->f4_qq_round = 1;
723723
bs = core_gba(bs_qq, st, &err, fc);
724724
if (err) {
725-
printf("Problem with F4, stopped computation.\n");
725+
fprintf(stderr,"Problem with F4, stopped computation.\n");
726726
exit(1);
727727
}
728728

@@ -1773,7 +1773,7 @@ gb_modpoly_t *groebner_qq(
17731773
return NULL;
17741774
}
17751775
if (success == 0) {
1776-
printf("Bad input data, stopped computation.\n");
1776+
fprintf(stderr,"Bad input data, stopped computation.\n");
17771777
exit(1);
17781778
}
17791779

@@ -1783,7 +1783,7 @@ gb_modpoly_t *groebner_qq(
17831783
gb_modpoly_t *modgbsp = malloc(sizeof(gb_modpoly_t));
17841784
modgbsp = core_groebner_qq(modgbsp, bs, msd, md, &err, field_char, print_gb);
17851785
if (err) {
1786-
printf("Problem with groebner_qq, stopped computation (%d).\n", err);
1786+
fprintf(stderr,"Problem with groebner_qq, stopped computation (%d).\n", err);
17871787
exit(1);
17881788
}
17891789

src/msolve/msolve.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3998,14 +3998,14 @@ int core_msolve(
39983998
st->gfc);
39993999
}
40004000
if (!success) {
4001-
printf("Bad input data, stopped computation.\n");
4001+
fprintf(stderr,"Bad input data, stopped computation.\n");
40024002
exit(1);
40034003
}
40044004
/* compute a gb for initial generators */
40054005
success = core_sba_schreyer(&bs, &bht, &st);
40064006

40074007
if (!success) {
4008-
printf("Problem with sba, stopped computation.\n");
4008+
fprintf(stderr,"Problem with sba, stopped computation.\n");
40094009
exit(1);
40104010
}
40114011
int64_t nb = export_results_from_gba(bld, blen, bexp,
@@ -4068,7 +4068,7 @@ int core_msolve(
40684068
0 /*truncate_lifting */, info_level);
40694069

40704070
if (!success) {
4071-
printf("Bad input data, stopped computation.\n");
4071+
fprintf(stderr,"Bad input data, stopped computation.\n");
40724072
exit(1);
40734073
}
40744074

@@ -4094,7 +4094,7 @@ int core_msolve(
40944094
success = core_f4sat(bs, sat, st, &error);
40954095

40964096
if (!success) {
4097-
printf("Problem with f4sat, stopped computation.\n");
4097+
fprintf(stderr,"Problem with f4sat, stopped computation.\n");
40984098
exit(1);
40994099
}
41004100
int64_t nb = export_results_from_gba(bld, blen, bexp,
@@ -4166,7 +4166,7 @@ int core_msolve(
41664166
st->gfc);
41674167
}
41684168
if (!success) {
4169-
printf("Bad input data, stopped computation.\n");
4169+
fprintf(stderr,"Bad input data, stopped computation.\n");
41704170
exit(1);
41714171
}
41724172

@@ -4192,7 +4192,7 @@ int core_msolve(
41924192
bs = core_gba(bs, st, &err, gens->field_char);
41934193

41944194
if (err) {
4195-
printf("Problem with F4, stopped computation.\n");
4195+
fprintf(stderr,"Problem with F4, stopped computation.\n");
41964196
exit(1);
41974197
}
41984198
}
@@ -4226,7 +4226,7 @@ int core_msolve(
42264226
tbr = core_nf(tbr, st, mul, bs, &err);
42274227

42284228
if (err) {
4229-
printf("Problem with normalform, stopped computation.\n");
4229+
fprintf(stderr,"Problem with normalform, stopped computation.\n");
42304230
exit(1);
42314231
}
42324232
/* print reduced element in tbr, last one is the input element */
@@ -4546,7 +4546,7 @@ int core_msolve(
45464546

45474547
st->gfc = gens->field_char;
45484548
if (!success) {
4549-
printf("Bad input data, stopped computation.\n");
4549+
fprintf(stderr,"Bad input data, stopped computation.\n");
45504550
exit(1);
45514551
}
45524552

@@ -4585,7 +4585,7 @@ int core_msolve(
45854585
tbr = core_nf(tbr, st, mul, bs, &err);
45864586

45874587
if (err) {
4588-
printf("Problem with normalform, stopped computation.\n");
4588+
fprintf(stderr,"Problem with normalform, stopped computation.\n");
45894589
exit(1);
45904590
}
45914591
/* print all reduced elements in tbr, first normal_form ones
@@ -4959,7 +4959,9 @@ int core_msolve(
49594959
sat_qq->lmps[k] = k; /* fix input element in tbr */
49604960
}
49614961

4962-
printf("LEARNING PHASE -- PART 1\n");
4962+
if (info_level){
4963+
fprintf(stdout,"LEARNING PHASE -- PART 1\n");
4964+
}
49634965
f4sat_trace_learning_phase_1(
49644966
trace,
49654967
tht,
@@ -4988,7 +4990,9 @@ int core_msolve(
49884990

49894991
lp->p[0] = prime;
49904992

4991-
printf("LEARNING PHASE -- PART 2\n");
4993+
if (info_level){
4994+
fprintf(stdout,"LEARNING PHASE -- PART 2\n");
4995+
}
49924996
f4sat_trace_learning_phase_2(
49934997
trace,
49944998
tht,

src/neogb/f4.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,15 +815,15 @@ int64_t export_f4(
815815
return 1;
816816
}
817817
if (success == 0) {
818-
printf("Bad input data, stopped computation.\n");
818+
fprintf(stderr,"Bad input data, stopped computation.\n");
819819
exit(1);
820820
}
821821

822822
int err = 0;
823823
bs = core_f4(bs, md, &err, field_char);
824824

825825
if (err) {
826-
printf("Problem with F4, stopped computation.\n");
826+
fprintf(stderr,"Problem with F4, stopped computation.\n");
827827
exit(1);
828828
}
829829

src/neogb/f4sat.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ static int is_already_saturated(
9494
md_t *st
9595
)
9696
{
97-
printf("testing if system is already saturated: ");
97+
if(st->info_level){
98+
printf("testing if system is already saturated: ");
99+
}
98100
double rrt0, rrt1;
99101
rrt0 = realtime();
100102

@@ -201,10 +203,12 @@ static int is_already_saturated(
201203
*bhtp = bht;
202204
*shtp = sht;
203205

204-
if (is_constant == 1) {
206+
if (st->info_level){
207+
if (is_constant == 1) {
205208
printf("yes.");
206-
} else {
209+
} else {
207210
printf("no.");
211+
}
208212
}
209213

210214
rrt1 = realtime();

src/neogb/io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ int32_t check_and_set_meta_data(
831831
/* elimination block order? If so, store the blocks length */
832832
st->nev = elim_block_len >= 0 ? elim_block_len : 0;
833833
if (st->nev >= st->nvars) {
834-
printf("error: Too large elimination block.\n");
834+
fprintf(stderr,"error: Too large elimination block.\n");
835835
exit(1);
836836
}
837837
/* set hash table size */

src/neogb/nf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ int64_t export_nf(
162162
return 1;
163163
}
164164
if (success == 0) {
165-
printf("Bad input data, stopped computation.\n");
165+
printf(stderr,"Bad input data, stopped computation.\n");
166166
exit(1);
167167
}
168168
if (bs_is_gb == 1) {

0 commit comments

Comments
 (0)