Skip to content
Merged
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
6 changes: 6 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions input_files/choice-linear-form-qq-real-roots.ms
Original file line number Diff line number Diff line change
@@ -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]
11 changes: 11 additions & 0 deletions input_files/choice-linear-form-qq.ms
Original file line number Diff line number Diff line change
@@ -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]
3 changes: 3 additions & 0 deletions output_files/choice-linear-form-qq-real-roots.res
Original file line number Diff line number Diff line change
@@ -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]]]
]]:
26 changes: 26 additions & 0 deletions output_files/choice-linear-form-qq.res
Original file line number Diff line number Diff line change
@@ -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]
]]]]]:
5 changes: 4 additions & 1 deletion src/fglm/fglm_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand All @@ -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) {
Expand Down Expand Up @@ -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++){
Expand Down
25 changes: 25 additions & 0 deletions src/msolve/msolve.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
50 changes: 50 additions & 0 deletions test/diff/diff_choice-linear-form-qq-real-roots.sh
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions test/diff/diff_choice-linear-form-qq.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

file=choice-linear-form-qq

source test/diff/diff_source.sh
Loading