My Project
|
This file implements functions to lift factors via Hensel lifting. More...
#include "config.h"
#include "cf_assert.h"
#include "debug.h"
#include "timing.h"
#include "cfGcdAlgExt.h"
#include "facHensel.h"
#include "facMul.h"
#include "fac_util.h"
#include "cf_algorithm.h"
#include "cf_primes.h"
#include "facBivar.h"
#include "cfNTLzzpEXGCD.h"
#include "cfUnivarGcd.h"
#include <NTL/lzz_pEX.h>
#include "NTLconvert.h"
#include "FLINTconvert.h"
Go to the source code of this file.
Functions | |
void | out_cf (const char *s1, const CanonicalForm &f, const char *s2) |
cf_algorithm.cc - simple mathematical algorithms. More... | |
TIMING_DEFINE_PRINT (diotime) TIMING_DEFINE_PRINT(product1) TIMING_DEFINE_PRINT(product2) TIMING_DEFINE_PRINT(hensel23) TIMING_DEFINE_PRINT(hensel) static CFList productsFLINT(const CFList &factors | |
nmod_poly_init (FLINTmipo, getCharacteristic()) | |
convertFacCF2nmod_poly_t (FLINTmipo, M) | |
fq_nmod_ctx_init_modulus (fq_con, FLINTmipo, "Z") | |
for (CFListIterator i=factors;i.hasItem();i++, j++) | |
fq_nmod_poly_init (prod, fq_con) | |
for (j=0;j< factors.length();j++) | |
nmod_poly_clear (FLINTmipo) | |
fq_nmod_poly_clear (prod, fq_con) | |
fq_nmod_ctx_clear (fq_con) | |
static void | tryDiophantine (CFList &result, const CanonicalForm &F, const CFList &factors, const CanonicalForm &M, bool &fail) |
static CFList | mapinto (const CFList &L) |
static int | mod (const CFList &L, const CanonicalForm &p) |
static void | chineseRemainder (const CFList &x1, const CanonicalForm &q1, const CFList &x2, const CanonicalForm &q2, CFList &xnew, CanonicalForm &qnew) |
static CFList | Farey (const CFList &L, const CanonicalForm &q) |
static CFList | replacevar (const CFList &L, const Variable &a, const Variable &b) |
CFList | modularDiophant (const CanonicalForm &f, const CFList &factors, const CanonicalForm &M) |
void | sortList (CFList &list, const Variable &x) |
sort a list of polynomials by their degree in x. More... | |
CFList | diophantine (const CanonicalForm &F, const CFList &factors) |
CFList | diophantineHensel (const CanonicalForm &F, const CFList &factors, const modpk &b) |
CFList | diophantineHenselQa (const CanonicalForm &F, const CanonicalForm &G, const CFList &factors, modpk &b, const Variable &alpha) |
solve mod over by p-adic lifting More... | |
CFList | diophantineQa (const CanonicalForm &F, const CanonicalForm &G, const CFList &factors, modpk &b, const Variable &alpha) |
solve mod over by first computing mod and if no zero divisor occurred compute it mod More... | |
CFList | diophantine (const CanonicalForm &F, const CanonicalForm &G, const CFList &factors, modpk &b) |
void | henselStep12 (const CanonicalForm &F, const CFList &factors, CFArray &bufFactors, const CFList &diophant, CFMatrix &M, CFArray &Pi, int j, const modpk &b) |
void | henselLift12 (const CanonicalForm &F, CFList &factors, int l, CFArray &Pi, CFList &diophant, CFMatrix &M, modpk &b, bool sort) |
Hensel lift from univariate to bivariate. More... | |
void | henselLift12 (const CanonicalForm &F, CFList &factors, int l, CFArray &Pi, CFList &diophant, CFMatrix &M, bool sort) |
Hensel lift from univariate to bivariate. More... | |
void | henselLiftResume12 (const CanonicalForm &F, CFList &factors, int start, int end, CFArray &Pi, const CFList &diophant, CFMatrix &M, const modpk &b) |
resume Hensel lift from univariate to bivariate. Assumes factors are lifted to precision Variable (2)^start and lifts them to precision Variable (2)^end More... | |
CFList | biDiophantine (const CanonicalForm &F, const CFList &factors, int d) |
CFList | multiRecDiophantine (const CanonicalForm &F, const CFList &factors, const CFList &recResult, const CFList &M, int d) |
static void | henselStep (const CanonicalForm &F, const CFList &factors, CFArray &bufFactors, const CFList &diophant, CFMatrix &M, CFArray &Pi, int j, const CFList &MOD) |
CFList | henselLift23 (const CFList &eval, const CFList &factors, int *l, CFList &diophant, CFArray &Pi, CFMatrix &M) |
Hensel lifting from bivariate to trivariate. More... | |
void | henselLiftResume (const CanonicalForm &F, CFList &factors, int start, int end, CFArray &Pi, const CFList &diophant, CFMatrix &M, const CFList &MOD) |
resume Hensel lifting. More... | |
CFList | henselLift (const CFList &F, const CFList &factors, const CFList &MOD, CFList &diophant, CFArray &Pi, CFMatrix &M, int lOld, int lNew) |
Hensel lifting. More... | |
CFList | henselLift (const CFList &eval, const CFList &factors, int *l, int lLength, bool sort) |
Hensel lifting from bivariate to multivariate. More... | |
void | nonMonicHenselStep12 (const CanonicalForm &F, const CFList &factors, CFArray &bufFactors, const CFList &diophant, CFMatrix &M, CFArray &Pi, int j, const CFArray &) |
void | nonMonicHenselLift12 (const CanonicalForm &F, CFList &factors, int l, CFArray &Pi, CFList &diophant, CFMatrix &M, const CFArray &LCs, bool sort) |
Hensel lifting from univariate to bivariate, factors need not to be monic. More... | |
CFList | diophantine (const CFList &recResult, const CFList &factors, const CFList &products, const CFList &M, const CanonicalForm &E, bool &bad) |
solve mod M, products contains More... | |
void | nonMonicHenselStep (const CanonicalForm &F, const CFList &factors, CFArray &bufFactors, const CFList &diophant, CFMatrix &M, CFArray &Pi, const CFList &products, int j, const CFList &MOD, bool &noOneToOne) |
CanonicalForm | replaceLC (const CanonicalForm &F, const CanonicalForm &c) |
CFList | nonMonicHenselLift232 (const CFList &eval, const CFList &factors, int *l, CFList &diophant, CFArray &Pi, CFMatrix &M, const CFList &LCs1, const CFList &LCs2, bool &bad) |
CFList | nonMonicHenselLift2 (const CFList &F, const CFList &factors, const CFList &MOD, CFList &diophant, CFArray &Pi, CFMatrix &M, int lOld, int &lNew, const CFList &LCs1, const CFList &LCs2, bool &bad) |
CFList | nonMonicHenselLift2 (const CFList &eval, const CFList &factors, int *l, int lLength, bool sort, const CFList &LCs1, const CFList &LCs2, const CFArray &Pi, const CFList &diophant, bool &bad) |
two factor Hensel lifting from bivariate to multivariate, factors need not to be monic More... | |
CFList | nonMonicHenselLift23 (const CanonicalForm &F, const CFList &factors, const CFList &LCs, CFList &diophant, CFArray &Pi, int liftBound, int bivarLiftBound, bool &bad) |
CFList | nonMonicHenselLift (const CFList &F, const CFList &factors, const CFList &LCs, CFList &diophant, CFArray &Pi, CFMatrix &M, int lOld, int &lNew, const CFList &MOD, bool &noOneToOne) |
CFList | nonMonicHenselLift (const CFList &eval, const CFList &factors, CFList *const &LCs, CFList &diophant, CFArray &Pi, int *liftBound, int length, bool &noOneToOne) |
Hensel lifting of non monic factors, needs correct leading coefficients of factors and a one to one corresponds between bivariate and multivariate factors to succeed. More... | |
Variables | |
const CanonicalForm & | M |
fq_nmod_ctx_t | fq_con |
fq_nmod_poly_t | prod |
fq_nmod_t | buf |
fq_nmod_poly_t * | vec =new fq_nmod_poly_t [factors.length()] |
int | j = 0 |
CFList | result |
Variable | x = Variable (1) |
This file implements functions to lift factors via Hensel lifting.
ABSTRACT: Hensel lifting is described in "Efficient Multivariate Factorization over Finite Fields" by L. Bernardin & M. Monagon and "Algorithms for Computer Algebra" by Geddes, Czapor, Labahn
Definition in file facHensel.cc.
CFList biDiophantine | ( | const CanonicalForm & | F, |
const CFList & | factors, | ||
int | d | ||
) |
Definition at line 1369 of file facHensel.cc.
|
static |
Definition at line 264 of file facHensel.cc.
convertFacCF2nmod_poly_t | ( | FLINTmipo | , |
M | |||
) |
CFList diophantine | ( | const CanonicalForm & | F, |
const CanonicalForm & | G, | ||
const CFList & | factors, | ||
modpk & | b | ||
) |
Definition at line 1009 of file facHensel.cc.
CFList diophantine | ( | const CanonicalForm & | F, |
const CFList & | factors | ||
) |
Definition at line 1062 of file facHensel.cc.
CFList diophantine | ( | const CFList & | recResult, |
const CFList & | factors, | ||
const CFList & | products, | ||
const CFList & | M, | ||
const CanonicalForm & | E, | ||
bool & | bad | ||
) |
solve mod M, products contains
Definition at line 2234 of file facHensel.cc.
Definition at line 481 of file facHensel.cc.
CFList diophantineHenselQa | ( | const CanonicalForm & | F, |
const CanonicalForm & | G, | ||
const CFList & | factors, | ||
modpk & | b, | ||
const Variable & | alpha | ||
) |
solve mod over by p-adic lifting
Definition at line 574 of file facHensel.cc.
CFList diophantineQa | ( | const CanonicalForm & | F, |
const CanonicalForm & | G, | ||
const CFList & | factors, | ||
modpk & | b, | ||
const Variable & | alpha | ||
) |
solve mod over by first computing mod and if no zero divisor occurred compute it mod
Definition at line 788 of file facHensel.cc.
|
static |
Definition at line 280 of file facHensel.cc.
for | ( | CFListIterator | i = factors; i.hasItem(); i++ , |
j++ | |||
) |
Definition at line 112 of file facHensel.cc.
for | ( | ) |
Definition at line 129 of file facHensel.cc.
fq_nmod_ctx_clear | ( | fq_con | ) |
fq_nmod_ctx_init_modulus | ( | fq_con | , |
FLINTmipo | , | ||
"Z" | |||
) |
CFList henselLift | ( | const CFList & | eval, |
const CFList & | factors, | ||
int * | l, | ||
int | lLength, | ||
bool | sort = true |
||
) |
Hensel lifting from bivariate to multivariate.
[in] | eval | a list of polynomials the last element is a compressed multivariate poly, last but one element equals the last elements modulo its main variable and so on. The first element is a compressed bivariate poly. |
[in] | factors | bivariate factors, including leading coefficient |
[in] | l | lifting bounds |
[in] | lLength | length of l |
[in] | sort | sort factors by degree in Variable(1) |
Definition at line 1894 of file facHensel.cc.
CFList henselLift | ( | const CFList & | F, |
const CFList & | factors, | ||
const CFList & | MOD, | ||
CFList & | diophant, | ||
CFArray & | Pi, | ||
CFMatrix & | M, | ||
int | lOld, | ||
int | lNew | ||
) |
Hensel lifting.
[in] | F | two compressed, multivariate polys F and G |
[in] | factors | monic multivariate factors including leading coefficient as first element. |
[in] | MOD | a list of powers of Variables of level higher than 1 |
[in,out] | diophant | result of multiRecDiophantine() |
[in,out] | Pi | stores intermediate results |
[in,out] | M | stores intermediate results |
[in] | lOld | lifting precision of F.mvar() |
[in] | lNew | lifting precision of G.mvar() |
Definition at line 1852 of file facHensel.cc.
void henselLift12 | ( | const CanonicalForm & | F, |
CFList & | factors, | ||
int | l, | ||
CFArray & | Pi, | ||
CFList & | diophant, | ||
CFMatrix & | M, | ||
bool | sort = true |
||
) |
Hensel lift from univariate to bivariate.
[in] | F | compressed, bivariate poly |
[in,out] | factors | monic univariate factors of F, including leading coefficient as first element. Returns monic lifted factors without the leading coefficient |
[in] | l | lifting precision |
[in,out] | Pi | stores intermediate results |
[in,out] | diophant | result of diophantine() |
[in,out] | M | stores intermediate results |
[in] | sort | sort factors by degree in Variable(1) |
Definition at line 1334 of file facHensel.cc.
void henselLift12 | ( | const CanonicalForm & | F, |
CFList & | factors, | ||
int | l, | ||
CFArray & | Pi, | ||
CFList & | diophant, | ||
CFMatrix & | M, | ||
modpk & | b, | ||
bool | sort = true |
||
) |
Hensel lift from univariate to bivariate.
[in] | F | compressed, bivariate poly |
[in,out] | factors | monic univariate factors of F, including leading coefficient as first element. Returns monic lifted factors without the leading coefficient |
[in] | l | lifting precision |
[in,out] | Pi | stores intermediate results |
[in,out] | diophant | result of diophantine() |
[in,out] | M | stores intermediate results |
[in] | b | coeff bound |
[in] | sort | sort factors by degree in Variable(1) |
Definition at line 1274 of file facHensel.cc.
CFList henselLift23 | ( | const CFList & | eval, |
const CFList & | factors, | ||
int * | l, | ||
CFList & | diophant, | ||
CFArray & | Pi, | ||
CFMatrix & | M | ||
) |
Hensel lifting from bivariate to trivariate.
[in] | eval | contains compressed, bivariate as first element and trivariate one as second element |
[in] | factors | monic bivariate factors, including leading coefficient as first element. |
[in] | l | l[0]: precision of bivariate lifting, l[1] as above |
[in,out] | diophant | returns the result of biDiophantine() |
[in,out] | Pi | stores intermediate results |
[in,out] | M | stores intermediate results |
Definition at line 1785 of file facHensel.cc.
void henselLiftResume | ( | const CanonicalForm & | F, |
CFList & | factors, | ||
int | start, | ||
int | end, | ||
CFArray & | Pi, | ||
const CFList & | diophant, | ||
CFMatrix & | M, | ||
const CFList & | MOD | ||
) |
resume Hensel lifting.
[in] | F | compressed, multivariate poly |
[in,out] | factors | monic multivariate factors lifted to precision F.mvar()^start, including leading coefficient as first element. Returns factors lifted to precision F.mvar()^end |
[in] | start | starting precision |
[in] | end | end precision |
[in,out] | Pi | stores intermediate results |
[in] | diophant | result of multiRecDiophantine() |
[in,out] | M | stores intermediate results |
[in] | MOD | a list of powers of Variables of level higher than 1 |
Definition at line 1827 of file facHensel.cc.
void henselLiftResume12 | ( | const CanonicalForm & | F, |
CFList & | factors, | ||
int | start, | ||
int | end, | ||
CFArray & | Pi, | ||
const CFList & | diophant, | ||
CFMatrix & | M, | ||
const modpk & | b = modpk() |
||
) |
resume Hensel lift from univariate to bivariate. Assumes factors are lifted to precision Variable (2)^start and lifts them to precision Variable (2)^end
[in] | F | compressed, bivariate poly |
[in,out] | factors | monic factors of F, lifted to precision start, including leading coefficient as first element. Returns monic lifted factors without the leading coefficient |
[in] | start | starting precision |
[in] | end | end precision |
[in,out] | Pi | stores intermediate results |
[in] | diophant | result of diophantine |
[in,out] | M | stores intermediate results |
[in] | b | coeff bound |
Definition at line 1343 of file facHensel.cc.
|
static |
Definition at line 1559 of file facHensel.cc.
void henselStep12 | ( | const CanonicalForm & | F, |
const CFList & | factors, | ||
CFArray & | bufFactors, | ||
const CFList & | diophant, | ||
CFMatrix & | M, | ||
CFArray & | Pi, | ||
int | j, | ||
const modpk & | b | ||
) |
Definition at line 1070 of file facHensel.cc.
|
static |
Definition at line 252 of file facHensel.cc.
CFList modularDiophant | ( | const CanonicalForm & | f, |
const CFList & | factors, | ||
const CanonicalForm & | M | ||
) |
Definition at line 298 of file facHensel.cc.
CFList multiRecDiophantine | ( | const CanonicalForm & | F, |
const CFList & | factors, | ||
const CFList & | recResult, | ||
const CFList & | M, | ||
int | d | ||
) |
Definition at line 1470 of file facHensel.cc.
nmod_poly_clear | ( | FLINTmipo | ) |
nmod_poly_init | ( | FLINTmipo | , |
getCharacteristic() | |||
) |
CFList nonMonicHenselLift | ( | const CFList & | eval, |
const CFList & | factors, | ||
CFList *const & | LCs, | ||
CFList & | diophant, | ||
CFArray & | Pi, | ||
int * | liftBound, | ||
int | length, | ||
bool & | noOneToOne | ||
) |
Hensel lifting of non monic factors, needs correct leading coefficients of factors and a one to one corresponds between bivariate and multivariate factors to succeed.
[in] | eval | a list of polys the last element is a compressed multivariate poly, last but one element equals the last elements modulo its main variable and so on. The first element is a compressed poly in 3 variables |
[in] | factors | a list of bivariate factors |
[in] | LCs | leading coefficients, evaluated in the same way as eval |
[in,out] | diophant | solution of univariate diophantine equation |
[in,out] | Pi | buffer intermediate results |
[in] | liftBound | lifting bounds |
[in] | length | length of lifting bounds |
[in,out] | noOneToOne | check for one to one correspondence |
Definition at line 2940 of file facHensel.cc.
CFList nonMonicHenselLift | ( | const CFList & | F, |
const CFList & | factors, | ||
const CFList & | LCs, | ||
CFList & | diophant, | ||
CFArray & | Pi, | ||
CFMatrix & | M, | ||
int | lOld, | ||
int & | lNew, | ||
const CFList & | MOD, | ||
bool & | noOneToOne | ||
) |
Definition at line 2855 of file facHensel.cc.
void nonMonicHenselLift12 | ( | const CanonicalForm & | F, |
CFList & | factors, | ||
int | l, | ||
CFArray & | Pi, | ||
CFList & | diophant, | ||
CFMatrix & | M, | ||
const CFArray & | LCs, | ||
bool | sort | ||
) |
Hensel lifting from univariate to bivariate, factors need not to be monic.
[in] | F | a bivariate poly |
[in,out] | factors | a list of univariate polys lifted factors |
[in] | l | lift bound |
[in,out] | Pi | stores intermediate results |
[in,out] | diophant | result of diophantine |
[in,out] | M | stores intermediate results |
[in] | LCs | leading coefficients |
[in] | sort | if true factors are sorted by their degree |
Definition at line 2154 of file facHensel.cc.
CFList nonMonicHenselLift2 | ( | const CFList & | eval, |
const CFList & | factors, | ||
int * | l, | ||
int | lLength, | ||
bool | sort, | ||
const CFList & | LCs1, | ||
const CFList & | LCs2, | ||
const CFArray & | Pi, | ||
const CFList & | diophant, | ||
bool & | noOneToOne | ||
) |
two factor Hensel lifting from bivariate to multivariate, factors need not to be monic
[in] | eval | a list of polynomials the last element is a compressed multivariate poly, last but one element equals the last elements modulo its main variable and so on. The first element is a compressed bivariate poly. |
[in] | factors | bivariate factors |
[in] | l | lift bounds |
[in] | lLength | length of l |
[in] | sort | if true factors are sorted by their degree in Variable(1) |
[in] | LCs1 | a list of evaluated LC of first factor |
[in] | LCs2 | a list of evaluated LC of second factor |
[in] | Pi | intermediate result |
[in] | diophant | result of diophantine |
[in,out] | bad | check for one to one correspondence |
Definition at line 2697 of file facHensel.cc.
CFList nonMonicHenselLift2 | ( | const CFList & | F, |
const CFList & | factors, | ||
const CFList & | MOD, | ||
CFList & | diophant, | ||
CFArray & | Pi, | ||
CFMatrix & | M, | ||
int | lOld, | ||
int & | lNew, | ||
const CFList & | LCs1, | ||
const CFList & | LCs2, | ||
bool & | bad | ||
) |
Definition at line 2632 of file facHensel.cc.
CFList nonMonicHenselLift23 | ( | const CanonicalForm & | F, |
const CFList & | factors, | ||
const CFList & | LCs, | ||
CFList & | diophant, | ||
CFArray & | Pi, | ||
int | liftBound, | ||
int | bivarLiftBound, | ||
bool & | bad | ||
) |
Definition at line 2751 of file facHensel.cc.
CFList nonMonicHenselLift232 | ( | const CFList & | eval, |
const CFList & | factors, | ||
int * | l, | ||
CFList & | diophant, | ||
CFArray & | Pi, | ||
CFMatrix & | M, | ||
const CFList & | LCs1, | ||
const CFList & | LCs2, | ||
bool & | bad | ||
) |
Definition at line 2568 of file facHensel.cc.
void nonMonicHenselStep | ( | const CanonicalForm & | F, |
const CFList & | factors, | ||
CFArray & | bufFactors, | ||
const CFList & | diophant, | ||
CFMatrix & | M, | ||
CFArray & | Pi, | ||
const CFList & | products, | ||
int | j, | ||
const CFList & | MOD, | ||
bool & | noOneToOne | ||
) |
Definition at line 2313 of file facHensel.cc.
void nonMonicHenselStep12 | ( | const CanonicalForm & | F, |
const CFList & | factors, | ||
CFArray & | bufFactors, | ||
const CFList & | diophant, | ||
CFMatrix & | M, | ||
CFArray & | Pi, | ||
int | j, | ||
const CFArray & | |||
) |
Definition at line 1932 of file facHensel.cc.
void out_cf | ( | const char * | s1, |
const CanonicalForm & | f, | ||
const char * | s2 | ||
) |
cf_algorithm.cc - simple mathematical algorithms.
Hierarchy: mathematical algorithms on canonical forms
A "mathematical" algorithm is an algorithm which calculates some mathematical function in contrast to a "structural" algorithm which gives structural information on polynomials.
Compare these functions to the functions in ‘cf_ops.cc’, which are structural algorithms.
Definition at line 99 of file cf_factor.cc.
CanonicalForm replaceLC | ( | const CanonicalForm & | F, |
const CanonicalForm & | c | ||
) |
Definition at line 2553 of file facHensel.cc.
Definition at line 289 of file facHensel.cc.
TIMING_DEFINE_PRINT | ( | diotime | ) | const & |
|
static |
Definition at line 153 of file facHensel.cc.
fq_nmod_t buf |
Definition at line 101 of file facHensel.cc.
fq_con |
Definition at line 99 of file facHensel.cc.
int j = 0 |
Definition at line 110 of file facHensel.cc.
Definition at line 96 of file facHensel.cc.
fq_nmod_poly_t prod |
Definition at line 100 of file facHensel.cc.
return result |
Definition at line 126 of file facHensel.cc.
delete [] vec =new fq_nmod_poly_t [factors.length()] |
Definition at line 108 of file facHensel.cc.
Definition at line 127 of file facHensel.cc.