diff --git a/Makefile.am b/Makefile.am index c92c86cc..f3e27587 100644 --- a/Makefile.am +++ b/Makefile.am @@ -48,6 +48,8 @@ checkdiff = test/diff/diff_cp_d_3_n_4_p_2.sh \ test/diff/diff_reals_dim0-chgvar.sh \ test/diff/diff_reals_dim0-extract.sh \ test/diff/diff_reals_dim0-swapvar.sh \ + test/diff/diff_choice-linear-form-qq.sh \ + test/diff/diff_choice-linear-form-qq-real-roots.sh \ test/diff/diff_bug_empty_tracer.sh \ test/diff/diff_bug_2nd_prime_bad.sh \ test/diff/diff_bug_68.sh \ diff --git a/configure.ac b/configure.ac index 5a4c6020..ec886f73 100644 --- a/configure.ac +++ b/configure.ac @@ -202,6 +202,12 @@ AC_CONFIG_LINKS([ input_files/radical_shape-qq.ms:input_files/radical_shape-qq.ms output_files/radical_shape-qq.res:output_files/radical_shape-qq.res test/diff/diff_radical_shape-qq.sh:test/diff/diff_radical_shape-qq.sh + input_files/choice-linear-form-qq.ms:input_files/choice-linear-form-qq.ms + output_files/choice-linear-form-qq.res:output_files/choice-linear-form-qq.res + test/diff/diff_choice-linear-form-qq.sh:test/diff/diff_choice-linear-form-qq.sh + input_files/choice-linear-form-qq-real-roots.ms:input_files/choice-linear-form-qq-real-roots.ms + output_files/choice-linear-form-qq-real-roots.res:output_files/choice-linear-form-qq-real-roots.res + test/diff/diff_choice-linear-form-qq-real-roots.sh:test/diff/diff_choice-linear-form-qq-real-roots.sh input_files/reals_dim0.ms:input_files/reals_dim0.ms output_files/reals_dim0.res:output_files/reals_dim0.res output_files/reals_dim0.p256.res:output_files/reals_dim0.p256.res diff --git a/input_files/choice-linear-form-qq-real-roots.ms b/input_files/choice-linear-form-qq-real-roots.ms new file mode 100644 index 00000000..21a609ae --- /dev/null +++ b/input_files/choice-linear-form-qq-real-roots.ms @@ -0,0 +1,11 @@ +_xx[1], _xx[2], _xx[3], _xx[4], _xx[5], _xx[6], _xx[7], _xx[8] +0 +-_xx[1]+_xx[2], +-_xx[1]+_xx[4], +-_xx[1]+_xx[5], +_xx[1]+_xx[6], +-_xx[1]+_xx[7], +-_xx[3]*_xx[6]+_xx[2]*_xx[7]+_xx[1], +-_xx[4]*_xx[7]-_xx[1]+_xx[3], +-_xx[5]*_xx[6]+_xx[2]*_xx[8]-_xx[1]+_xx[6]-_xx[8], +-_xx[4]*_xx[6]+_xx[5]*_xx[6]-_xx[2]*_xx[8]+_xx[4]*_xx[8]+_xx[2]-_xx[5] diff --git a/input_files/choice-linear-form-qq.ms b/input_files/choice-linear-form-qq.ms new file mode 100644 index 00000000..21a609ae --- /dev/null +++ b/input_files/choice-linear-form-qq.ms @@ -0,0 +1,11 @@ +_xx[1], _xx[2], _xx[3], _xx[4], _xx[5], _xx[6], _xx[7], _xx[8] +0 +-_xx[1]+_xx[2], +-_xx[1]+_xx[4], +-_xx[1]+_xx[5], +_xx[1]+_xx[6], +-_xx[1]+_xx[7], +-_xx[3]*_xx[6]+_xx[2]*_xx[7]+_xx[1], +-_xx[4]*_xx[7]-_xx[1]+_xx[3], +-_xx[5]*_xx[6]+_xx[2]*_xx[8]-_xx[1]+_xx[6]-_xx[8], +-_xx[4]*_xx[6]+_xx[5]*_xx[6]-_xx[2]*_xx[8]+_xx[4]*_xx[8]+_xx[2]-_xx[5] diff --git a/output_files/choice-linear-form-qq-real-roots.res b/output_files/choice-linear-form-qq-real-roots.res new file mode 100644 index 00000000..bea02a67 --- /dev/null +++ b/output_files/choice-linear-form-qq-real-roots.res @@ -0,0 +1,3 @@ +[0, [1, +[[[-1, -1], [-1, -1], [0, 0], [-1, -1], [-1, -1], [1, 1], [-1, -1], [3 / 2, 3 / 2]], [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]] +]]: diff --git a/output_files/choice-linear-form-qq.res b/output_files/choice-linear-form-qq.res new file mode 100644 index 00000000..ff593ec7 --- /dev/null +++ b/output_files/choice-linear-form-qq.res @@ -0,0 +1,26 @@ +[0, [0, +9, +3, +['_xx[1]', '_xx[2]', '_xx[3]', '_xx[4]', '_xx[5]', '_xx[6]', '_xx[7]', '_xx[8]', 'A'], +[1,4,9,16,25,36,49,64,1], +[1, +[[2, [0, 37, 1]], +[1, [37, 2]], +[ +[[1, [0, 1]], +1], +[[1, [0, 1]], +1], +[[1, [0, 0]], +1], +[[1, [0, 1]], +1], +[[1, [0, 1]], +1], +[[1, [0, -1]], +1], +[[1, [0, 1]], +1], +[[1, [0, -3]], +2] +]]]]]: diff --git a/src/fglm/fglm_core.c b/src/fglm/fglm_core.c index 7bb52c6d..14e8ec5c 100644 --- a/src/fglm/fglm_core.c +++ b/src/fglm/fglm_core.c @@ -1154,7 +1154,6 @@ static inline int invert_table_polynomial (param_t *param, if (lambda == 0) { nmod_poly_set_coeff_ui (data_bms->BMS->R0,i, data->res[(length-i-1)*block_size+ncoord]); - } else { uint64_t coeff= (lambda*data->res[(length-i-1)*block_size]) % prime; @@ -1165,6 +1164,8 @@ static inline int invert_table_polynomial (param_t *param, } + nmod_poly_zero(data_bms->BMS->R1); + nmod_poly_mul (data_bms->Z1,data_bms->BMS->R0,data_bms->BMS->V1); nmod_poly_shift_right (data_bms->Z1,data_bms->Z1,length); nmod_poly_xgcd (data_bms->BMS->R0,data_bms->BMS->R1,data_bms->Z2,param->elim, @@ -1186,6 +1187,7 @@ static inline void divide_table_polynomials (param_t *param, szmat_t length= data_bms->BMS->V1->length-1; nmod_poly_zero (data_bms->BMS->R0); nmod_poly_fit_length(data_bms->BMS->R0, length); + nmod_poly_zero(data_bms->BMS->R1); for (long i = 0; i < length; i++){ if (lambda == 0) { @@ -1268,6 +1270,7 @@ int compute_parametrizations_non_shape_position_case(param_t *param, fprintf(stdout, "invC1="); nmod_poly_fprint_pretty (stdout, data_bms->Z2, "x"); fprintf (stdout,"\n"); #endif + long dec = 0; for(long nc = 0; nc < nvars - 1 ; nc++){ diff --git a/src/msolve/msolve.c b/src/msolve/msolve.c index c4a9b6be..2c6fb374 100644 --- a/src/msolve/msolve.c +++ b/src/msolve/msolve.c @@ -1586,6 +1586,18 @@ static int32_t check_for_single_element_groebner_basis( return empty_solution_set; } +/* + * returns 1 if the parametrizations are the same else it returns 0 + * */ +static int equal_param(param_t *param, param_t *test_param){ + for(int i = 0; i < param->nvars-1; i++){ + if(!nmod_poly_equal(param->coords[i], test_param->coords[i])){ + return 0; + } + } + return 1; +} + static int32_t *initial_modular_step( sp_matfglm_t **bmatrix, int32_t **bdiv_xn, @@ -1695,6 +1707,19 @@ static int32_t *initial_modular_step( *bparam = nmod_fglm_compute_trace_data(*bmatrix, fc, bs->ht->nv, *bsz, *nlins_ptr, linvars, lineqs_ptr[0], squvars, md->info_level, bdata_fglm, bdata_bms, success, md); + if((*bparam)->elim->length - 1 != dquot){ + param_t **test_nmod_param = + (param_t **)malloc(sizeof(param_t *)); + *test_nmod_param = nmod_fglm_compute_trace_data(*bmatrix, fc, bs->ht->nv, + *bsz, *nlins_ptr, linvars, lineqs_ptr[0], squvars, + 0, bdata_fglm, bdata_bms, success, md); + int boo = equal_param(*bparam, *test_nmod_param); + if(boo == 0){ + *success = 0; + } + free_fglm_param(test_nmod_param[0]); + free(test_nmod_param); + } } *dim = 0; *dquot_ori = dquot; diff --git a/test/diff/diff_choice-linear-form-qq-real-roots.sh b/test/diff/diff_choice-linear-form-qq-real-roots.sh new file mode 100755 index 00000000..ce544eee --- /dev/null +++ b/test/diff/diff_choice-linear-form-qq-real-roots.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +file=choice-linear-form-qq-real-roots + + +$(pwd)/msolve -f input_files/$file.ms -o test/diff/$file.res \ + -d 0 -l 2 -t 1 +if [ $? -gt 0 ]; then + exit 1 +fi + +diff test/diff/$file.res output_files/$file.res +if [ $? -gt 0 ]; then + exit 2 +fi + +$(pwd)/msolve -f input_files/$file.ms -o test/diff/$file.res \ + -d 0 -l 2 -t 2 +if [ $? -gt 0 ]; then + exit 21 +fi + +diff test/diff/$file.res output_files/$file.res +if [ $? -gt 0 ]; then + exit 22 +fi + +$(pwd)/msolve -f input_files/$file.ms -o test/diff/$file.res \ + -d 0 -l 44 -t 1 +if [ $? -gt 0 ]; then + exit 41 +fi + +diff test/diff/$file.res output_files/$file.res +if [ $? -gt 0 ]; then + exit 42 +fi + +$(pwd)/msolve -f input_files/$file.ms -o test/diff/$file.res \ + -d 0 -l 44 -t 2 +if [ $? -gt 0 ]; then + exit 61 +fi + +diff test/diff/$file.res output_files/$file.res +if [ $? -gt 0 ]; then + exit 62 +fi + +rm test/diff/$file.res diff --git a/test/diff/diff_choice-linear-form-qq.sh b/test/diff/diff_choice-linear-form-qq.sh new file mode 100755 index 00000000..6850588a --- /dev/null +++ b/test/diff/diff_choice-linear-form-qq.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +file=choice-linear-form-qq + +source test/diff/diff_source.sh