Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
49f3345
Use FLINT rational reconstruction when lifting parametrizations
mohabsafey Oct 25, 2026
bed9b06
Make the reconstruction period of parametrizations depend on primes only
mohabsafey Oct 25, 2026
3d3d0bd
Apply CRT to parametrizations only when reconstructing them
mohabsafey Oct 25, 2026
b3bc417
Keep a 16-bit margin in the reconstruction bounds of parametrizations
mohabsafey Oct 25, 2026
0cda8a0
Fall back to bounds from the guessed denominator for parametrizations
mohabsafey Oct 25, 2026
41ac422
Fix a leak in mulmat_reconstruct and remove dead code from lifting.c
mohabsafey Oct 25, 2026
6986d4a
Reconstruct witnesses of eliminating polynomials with a common denomi…
mohabsafey Oct 25, 2026
9d7596a
Try a more skewed reconstruction bound for eliminating polynomials
mohabsafey Oct 26, 2026
29eb86b
Fix small memory leaks in the setup of msolve_trace_qq
mohabsafey Oct 28, 2026
9ff5768
record time spent in LLL
vneiger Nov 5, 2026
b33f3d7
augment (and fix inaccuracy) in a comment on reconstruction
vneiger Nov 5, 2026
14c7d00
add todo about refactoring
vneiger Nov 5, 2026
f2fd314
Remove parameters left unused by the new parametrization lifting
vneiger Nov 5, 2026
5d039a5
remove more unused types / fields unused in the new paramtrization
vneiger Nov 5, 2026
219e301
fix memory leak (existed before this PR)
vneiger Nov 5, 2026
1086b99
adds Vincent Neiger as a co-author of this file
mohabsafey Nov 6, 2026
48bff7e
adds Vincent Neiger as a co-author of msolve-data.h
mohabsafey Nov 6, 2026
f38feb9
adds Vincent Neiger as a co-author of msolve.c
mohabsafey Nov 6, 2026
7c7add5
Merge pull request #2 from vneiger/lifting-param-review
mohabsafey Nov 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/fglm/fglm_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,7 @@ param_t *nmod_fglm_compute_trace_data(sp_matfglm_t *matrix, mod_t prime,
nvars) == 0){

fprintf(ERRSTREAM, "Matrix is not invertible (there should be a bug)\n");
free_fglm_param(param);
return NULL;

}
Expand Down Expand Up @@ -1526,6 +1527,7 @@ param_t *nmod_fglm_compute_trace_data(sp_matfglm_t *matrix, mod_t prime,
fprintf(ERRSTREAM, "Matrix is not invertible (there should be a bug)\n");
}
*success = 0;
free_fglm_param(param);
return NULL;
}
if (right_param == 1) {
Expand Down
53 changes: 0 additions & 53 deletions src/msolve/lifting-gb.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,61 +19,8 @@
* Mohab Safey El Din */

#include<flint/fmpz.h>
#include<flint/fmpq.h>
#include "streams.h"

/* rational reconstruction of u mod m with bounds N, D through FLINT
(half-gcd based) instead of the quadratic Euclidean algorithm;
u is assumed to be reduced modulo m */
static int flint_rrec(mpz_t n, mpz_t d, const mpz_t u, const mpz_t m,
const mpz_t N, const mpz_t D){
fmpz_t fu, fm, fN, fD;
fmpq_t q;
fmpz_init(fu); fmpz_init(fm); fmpz_init(fN); fmpz_init(fD);
fmpq_init(q);
fmpz_set_mpz(fu, u);
fmpz_set_mpz(fm, m);
fmpz_set_mpz(fN, N);
fmpz_set_mpz(fD, D);
int b = fmpq_reconstruct_fmpz_2(q, fu, fm, fN, fD);
if(b){
fmpz_get_mpz(n, fmpq_numref(q));
fmpz_get_mpz(d, fmpq_denref(q));
}
fmpq_clear(q);
fmpz_clear(fu); fmpz_clear(fm); fmpz_clear(fN); fmpz_clear(fD);
return b;
}

/* FLINT requires 2ND < m */
static int flint_rrec_bounds_ok(const mpz_t m, rrec_data_t rd){
mpz_mul(rd->tmp, rd->N, rd->D);
mpz_mul_2exp(rd->tmp, rd->tmp, 1);
return mpz_cmp(rd->tmp, m) < 0;
}

/* same as ratrecon, through FLINT when the bounds allow it */
static int lift_ratrecon(mpz_t n, mpz_t d, mpz_t u, const mpz_t mod,
rrec_data_t rd){
if(!flint_rrec_bounds_ok(mod, rd)){
return ratrecon(n, d, u, mod, rd);
}
mpz_mod(u, u, mod);
return flint_rrec(n, d, u, mod, rd->N, rd->D);
}

/* same as ratreconwden, through FLINT when the bounds allow it */
static int lift_ratreconwden(mpz_t n, mpz_t d, mpz_t u, const mpz_t mod,
const mpz_t gden, rrec_data_t rd){
if(!flint_rrec_bounds_ok(mod, rd)){
return ratreconwden(n, d, u, mod, gden, rd);
}
mpz_mod(u, u, mod);
mpz_mul(rd->r1, u, gden);
mpz_mod(rd->r1, rd->r1, mod);
return flint_rrec(n, d, rd->r1, mod, rd->N, rd->D);
}

#define NBCHECK 2
/* number of bits of slack kept in rational reconstruction bounds */
#define RR_MARGIN 16
Expand Down
Loading
Loading