Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 96946f63 authored by Andreas Enge's avatar Andreas Enge
Browse files

Correct logic in class polynomial factoring.

* lib/pari.c (mpzx_oneroot_split_mod): Make sure that factors of factors
  are also read by only treating one factor per loop round.
parent efef56ad
No related branches found
No related tags found
No related merge requests found
......@@ -524,7 +524,7 @@ void mpzx_oneroot_split_mod (mpz_ptr root, mpzx_srcptr f, mpz_srcptr p,
/* Compute in root a root of the polynomial f over the prime field
of characteristic p, assuming that f splits completely. */
{
mpzx_t F, factor, factorloc;
mpzx_t F, factor;
mpz_t inv;
int i;
cm_timer_t clock;
......@@ -548,22 +548,18 @@ void mpzx_oneroot_split_mod (mpz_ptr root, mpzx_srcptr f, mpz_srcptr p,
while (F->deg != 1) {
/* Try to read a factor of F from a checkpointing file. */
if (tmpdir != NULL) {
mpzx_init (factorloc, -1);
if (cm_file_read_factor (tmpdir, factorloc, F, p)) {
mpzx_set (F, factorloc);
if (debug)
cm_file_printf (" Read factor of degree %i\n", F->deg);
}
mpzx_clear (factorloc);
if (tmpdir != NULL && cm_file_read_factor (tmpdir, factor, F, p)) {
if (debug)
cm_file_printf (" Read factor of degree %i\n", factor->deg);
}
else {
/* Find a factor. */
mpzx_onefactor_split_mod (factor, F, p, debug);
/* Find a smaller factor. */
mpzx_onefactor_split_mod (factor, F, p, debug);
/* Write the factor to a checkpointing file. */
if (tmpdir != NULL)
cm_file_write_factor (tmpdir, factor, F, p);
/* Write the factor to a checkpointing file. */
if (tmpdir != NULL)
cm_file_write_factor (tmpdir, factor, F, p);
}
/* Replace F by the factor. */
mpzx_set (F, factor);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment