Skip to content
58 changes: 32 additions & 26 deletions src/fglm/fglm_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ static inline void generate_sequence(sp_matfglm_t *matrix, fglm_data_t * data,
}
#endif

#ifdef BLOCKWIED
#ifdef BLOCKWIED
static void generate_matrix_sequence(sp_matfglm_t *matxn, fglm_data_t *data,
szmat_t block_size, long dimquot,
nvars_t* squvars,
Expand Down Expand Up @@ -1701,16 +1701,16 @@ param_t *nmod_fglm_compute_trace_data(sp_matfglm_t *matrix, mod_t prime,
else {
if (right_param == 1) {
if(info_level){
fprintf(stderr,
fprintf(stdout,
"Ideal not in generic position, parametrizations are not correct\n");
}
*success = 0;
}
else {
if (right_param < nvars) {
if(info_level){
fprintf(stderr, "Only the first %d parametrizations of ",right_param-1);
fprintf(stderr, "the radical ideal are correct\n");
fprintf(stdout, "Only the first %d parametrizations of ",right_param-1);
fprintf(stdout, "the radical ideal are correct\n");
}
*success = 0;
}
Expand Down Expand Up @@ -1772,10 +1772,10 @@ int nmod_fglm_compute_apply_trace_data(sp_matfglm_t *matrix,
const long nb = initialize_fglm_data(matrix, data_fglm, prime, sz, block_size);

if(info_level){
fprintf(stderr, "[%u, %u], Dense / Total = %.2f%%\n",
fprintf(stdout, "[%u, %u], Dense / Total = %.2f%%\n",
matrix->ncols, matrix->nrows,
100*((double)matrix->nrows / (double)matrix->ncols));
fprintf(stderr, "Density of non-trivial part %.2f%%\n",
fprintf(stdout, "Density of non-trivial part %.2f%%\n",
100-100*(float)nb/(float)sz);
}

Expand All @@ -1799,7 +1799,7 @@ int nmod_fglm_compute_apply_trace_data(sp_matfglm_t *matrix,
if(info_level){
double nops = 2 * (matrix->nrows/ 1000.0) * (matrix->ncols / 1000.0) * (matrix->ncols / 1000.0);
double rt_fglm = realtime()-st_fglm;
fprintf(stderr, "Time spent to generate sequence (elapsed): %.2f sec (%.2f Gops/sec)\n", rt_fglm, nops / rt_fglm);
fprintf(stdout, "Time spent to generate sequence (elapsed): %.2f sec (%.2f Gops/sec)\n", rt_fglm, nops / rt_fglm);
}

st_fglm = realtime();
Expand All @@ -1811,11 +1811,13 @@ int nmod_fglm_compute_apply_trace_data(sp_matfglm_t *matrix,
info_level);

if(info_level){
fprintf(stderr, "Time spent to compute eliminating polynomial (elapsed): %.2f sec\n",
fprintf(stdout, "Time spent to compute eliminating polynomial (elapsed): %.2f sec\n",
realtime()-st_fglm);
}
if(param->elim->length-1 != deg_init){
fprintf(stderr, "Warning: Degree of elim poly = %ld\n", param->elim->length-1);
if(info_level){
fprintf(stdout, "Warning: Degree of elim poly = %ld\n", param->elim->length-1);
}
return 1;
}

Expand Down Expand Up @@ -2124,10 +2126,10 @@ param_t *nmod_fglm_guess_colon(sp_matfglmcol_t *matrix,
long nb = initialize_fglm_colon_data(matrix, data, prime, sz, block_size);

if(info_level){
fprintf(stderr, "[%u, %u], Dense / Total = %.2f%%\n",
fprintf(stdout, "[%u, %u], Dense / Total = %.2f%%\n",
matrix->ncols, matrix->nrows,
100*((double)matrix->nrows / (double)matrix->ncols));
fprintf(stderr, "Density of non-trivial part %.2f%%\n",
fprintf(stdout, "Density of non-trivial part %.2f%%\n",
100-100*(float)nb/(float)sz);
}
ulong dimquot = (matrix->ncols);
Expand All @@ -2154,10 +2156,10 @@ param_t *nmod_fglm_guess_colon(sp_matfglmcol_t *matrix,
//////////////////////////////////////////////////////////////////

if(info_level){
fprintf(stderr,"Time spent to generate sequence\n");
fprintf(stderr,"and compute eliminating polynomial (elapsed): %.2f sec\n",
fprintf(stdout,"Time spent to generate sequence\n");
fprintf(stdout,"and compute eliminating polynomial (elapsed): %.2f sec\n",
omp_get_wtime()-st0);
fprintf(stderr, "Elimination done.\n");
fprintf(stdout, "Elimination done.\n");
}

/* nmod_poly_fprint_pretty(stderr, param->elim, "x"); fprintf (stdout,"\n"); */
Expand All @@ -2179,22 +2181,26 @@ param_t *nmod_fglm_guess_colon(sp_matfglmcol_t *matrix,
free_fglm_bms_data(data_bms);
free_fglm_data(data);
return NULL;
} else if (right_param == 1) {
fprintf(stderr, "Ideal might have no correct parametrization\n");
} else if (right_param == 2) {
fprintf(stderr, "Only the first parametrization of ");
fprintf (stderr,"the ideal seems correct\n");
} else if (right_param < nvars) {
fprintf(stderr, "Only the first %d parametrizations of ",right_param-1);
fprintf(stderr, "the ideal seem correct\n");
} else {
fprintf(stderr, "All the parametrizations of ");
fprintf(stderr, "the ideal seem correct\n");
if (right_param == 1) {
if(info_level){
fprintf(stdout,
"Colon ideal not in generic position, parametrizations are not correct\n");
}
}
else {
if (right_param < nvars) {
if (info_level){
fprintf(stdout, "Only the first %d parametrizations of ",right_param-1);
fprintf(stdout, "the colon ideal are correct\n");
}
}
}
}
if(info_level){
fprintf(stderr, "Time spent to compute parametrizations (elapsed): %.2f sec\n",
fprintf(stdout, "Time spent to compute parametrizations (elapsed): %.2f sec\n",
omp_get_wtime()-st0);
fprintf(stderr, "Parametrizations done.\n");
fprintf(stdout, "Parametrizations done.\n");
}
free_fglm_bms_data(data_bms);
free_fglm_data(data);
Expand Down
32 changes: 15 additions & 17 deletions src/msolve/hilbert.c
Original file line number Diff line number Diff line change
Expand Up @@ -2804,12 +2804,10 @@ static inline sp_matfglm_t * build_matrixn_from_bs(int32_t *lmb, long dquot,
}
}
else{
fprintf(stderr, "Staircase is not generic\n");
fprintf(stderr, "Multiplication by ");
#if DEBUGBUILDMATRIX > 0
display_monomial_full(stderr, nv, NULL, 0, exp);
#endif
fprintf(stderr, " gets outside the staircase\n");
fprintf(stdout, "Staircase is not generic\n");
fprintf(stdout, "Multiplication by ");
display_monomial_full(stdout, nv, NULL, 0, exp);
fprintf(stdout, " gets outside the staircase\n");
free(matrix->dense_mat);
free(matrix->dense_idx);
free(matrix->triv_idx);
Expand Down Expand Up @@ -3405,17 +3403,17 @@ static inline sp_matfglm_t * build_matrixn_from_bs_trace(int32_t **bdiv_xn,

if(len_xn < count && i < dquot){
if(info_level){
fprintf(stderr, "Staircase is not generic (1 => explain better)\n");
fprintf(stdout, "Staircase is not generic (1 => explain better)\n");
}
return NULL;
}
}
else{
if(info_level){
fprintf(stderr, "Staircase is not generic\n");
fprintf(stderr, "Multiplication by ");
display_monomial_full(stderr, nv, NULL, 0, exp);
fprintf(stderr, " gets outside the staircase\n");
fprintf(stdout, "Staircase is not generic\n");
fprintf(stdout, "Multiplication by ");
display_monomial_full(stdout, nv, NULL, 0, exp);
fprintf(stdout, " gets outside the staircase\n");
}
return NULL;
}
Expand Down Expand Up @@ -3451,7 +3449,7 @@ static inline sp_matfglm_t * build_matrixn_unstable_from_bs_trace(int32_t **bdiv
const int nv,
const long fc,
const int32_t unstable_staircase,
const int info_level,
const int info_level,
files_gb* files){
double st_fglm = realtime();
double cst_fglm = cputime();
Expand Down Expand Up @@ -3574,8 +3572,8 @@ static inline sp_matfglm_t * build_matrixn_unstable_from_bs_trace(int32_t **bdiv

if (count_not_lm > threshold) {
if(info_level){
fprintf(stderr, "Staircase is not generic\n");
fprintf(stderr, "and too many normal forms need to be computed\n");
fprintf(stdout, "Staircase is not generic\n");
fprintf(stdout, "and too many normal forms need to be computed\n");
}
return NULL;
}
Expand Down Expand Up @@ -3630,7 +3628,7 @@ static inline sp_matfglm_t * build_matrixn_unstable_from_bs_trace(int32_t **bdiv
}
tbr = core_nf(tbr, md, mul, bs, &err);
if (err) {
printf("Problem with normalform, stopped computation.\n");
fprintf(stderr, "Problem with normalform, stopped computation.\n");
exit(1);
}
free(mul);
Expand Down Expand Up @@ -3739,7 +3737,7 @@ static inline sp_matfglm_t * build_matrixn_unstable_from_bs_trace(int32_t **bdiv
count++;
if(len_xn < count && i < dquot){
if (info_level){
fprintf(stderr, "Staircase is not generic (1 => explain better)\n");
fprintf(stdout, "Staircase is not generic (1 => explain better)\n");
}
free(evi);
return NULL;
Expand All @@ -3760,7 +3758,7 @@ static inline sp_matfglm_t * build_matrixn_unstable_from_bs_trace(int32_t **bdiv
count_nf++;
if(count_not_lm < count_nf && i < dquot){
if (info_level){
fprintf(stderr, "Staircase is not generic (1 => explain better)\n");
fprintf(stdout, "Staircase is not generic (1 => explain better)\n");
}
free(evi);
return NULL;
Expand Down
42 changes: 27 additions & 15 deletions src/msolve/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
static inline void display_option_help(char short_opt, char *long_opt,
char *arg_opt, char* str) {
int long_opt_non_empty= strcmp (long_opt, "");
if (short_opt == '\0') {

if (short_opt == 0) {
fprintf (stdout, " ");
} else {
fprintf (stdout, "-%c", short_opt);
Expand All @@ -55,7 +55,7 @@ static inline void display_option_help(char short_opt, char *long_opt,
}

static inline void display_option_help_noopt(char* str) {
display_option_help ('\0', "", "", str);
display_option_help (0, "", "", str);
}

static inline void display_help(char *str){
Expand Down Expand Up @@ -166,7 +166,7 @@ static inline void display_help(char *str){
display_option_help('q', "", "Q", "Uses signature-based algorithms.\n");
display_option_help_noopt("0 - no (default).\n");
display_option_help_noopt("1 - yes.\n");
display_option_help('\0', "random_seed", "SEED", "Random seed to initialize the pseudo\n");
display_option_help(0, "random-seed", "SEED", "Random seed to initialize the pseudo\n");
display_option_help_noopt("random generator\n");
display_option_help_noopt("-1 - time(0) will be used (default)\n");
display_option_help_noopt("SEED ≥ 0 - use at your own risks;\n");
Expand Down Expand Up @@ -228,10 +228,17 @@ static void getoptions(
char *out_fname = NULL;
char *bin_out_fname = NULL;
opterr = 1;
/* char short_options[] = "hf:N:F:v:l:t:e:o:O:u:iI:p:P:L:q:g:c:s:SCr:R:m:M:n:d:Vf:"; */
char short_options[] = "c:Cd:e:f:F:g:hiI:l:L:m:M:n:N:o:O:p:P:q:r:R:s:St:u:v:V";

int random_seed_flag = 0;
/* For long options that have no equivalent short option, use a
non-character as a pseudo short option, starting with CHAR_MAX + 1.
see https://cgit.git.savannah.gnu.org/cgit/coreutils.git/tree/src/ls.c */
enum {
RANDOM_SEED_OPTION = CHAR_MAX + 1,
/* Below is the template for the next long option with
* no equivalent short option */
/* NEXT_OPTION */
};
struct option long_options[] = {
{"elimination", required_argument, NULL, 'e'},
{"file", required_argument, NULL, 'f'},
Expand All @@ -244,29 +251,27 @@ static void getoptions(
{"output-file", required_argument, NULL, 'o'},
{"precision", required_argument, NULL, 'p'},
{"parametrization", required_argument, NULL, 'P'},
{"random-seed", required_argument, &random_seed_flag, 1},
{"random-seed", required_argument, NULL, RANDOM_SEED_OPTION},
{"reduce-gb", required_argument, NULL, 'r'},
{"threads", required_argument, NULL, 't'},
{"verbose", required_argument, NULL, 'v'},
{"version", no_argument, NULL, 'V'},
/* Below is the template for the next long option with
* no equivalent short option,
* adapt the 2nd field accordingly */
/* {"next-option", required_argument, NULL, NEXT_OPION}, */
{NULL,0,NULL,0}
};

while(1) {
int this_option_optind = optind ? optind : 1;
int option_index = 0;
opt = getopt_long(argc, argv, short_options, long_options, &option_index);
if (opt == -1) {
/* processed all command-line options */
break;
}

switch(opt) {
case 0: /* no short option equivalent */
if (random_seed_flag == 1) {
*seed = strtoll(optarg, NULL, 10);
}
break;
case 'N':
*truncate_lifting = strtol(optarg, NULL, 10);
break;
Expand Down Expand Up @@ -401,6 +406,13 @@ static void getoptions(
*normal_form_matrix = 0;
}
break;
case RANDOM_SEED_OPTION:
*seed = strtoll(optarg, NULL, 10);
break;
/* Below is the template for the next long option with
* no equivalent short option */
/* case NEXT_OPTION: */
/* break; */
default:
errflag++;
break;
Expand Down
6 changes: 3 additions & 3 deletions src/msolve/msolve.c
Original file line number Diff line number Diff line change
Expand Up @@ -4727,7 +4727,7 @@ int core_msolve(
import_input_data(bs_qq, st, 0, st->ngens_input, gens->lens, gens->exps,
(void *)gens->mpz_cfs, invalid_gens);

print_initial_statistics(stderr, st);
print_initial_statistics(stdout, st);

/* for faster divisibility checks, needs to be done after we have
* read some input data for applying heuristics */
Expand Down Expand Up @@ -4790,10 +4790,10 @@ int core_msolve(
st->f4_rtime = rt1 - rt0;

if (st->info_level > 1) {
print_final_statistics(stderr, st);
print_final_statistics(stdout, st);
}
if(info_level){
fprintf(stderr, "\nStarts trace based multi-modular computations\n");
fprintf(stdout, "\nStarts trace based multi-modular computations\n");
}

int i;
Expand Down
Loading