26#include "factory/factoryconf.h"
40# define OSTREAM std::ostream
41# define ISTREAM std::istream
42# elif defined(HAVE_IOSTREAM_H)
44# define OSTREAM ostream
45# define ISTREAM istream
82#define LEVELBASE -1000000
83#define LEVELTRANS -500000
84#define LEVELQUOT 1000000
85#define LEVELEXPR 1000001
143 int level()
const {
return _level; }
218 return ( ((
int)((intptr_t)ptr)) & 3 );
504 return power(
f.mvar(),
f.degree() ) *
f.LC();
811 bool ispoly, hasterms;
1124int igcd (
int a,
int b);
1208 if (
this != &value )
1236 bool removeContents=
true);
1251 bool removeContents=
true);
bool operator!=(const Rational &a, const Rational &b)
bool operator<(const Rational &a, const Rational &b)
bool operator==(const Rational &a, const Rational &b)
bool operator>(const Rational &a, const Rational &b)
bool operator<=(const Rational &a, const Rational &b)
bool operator>=(const Rational &a, const Rational &b)
const CanonicalForm CFMap CFMap & N
static void sort(int **points, int sizePoints)
generate all elements in F_p(alpha) starting from 0
CanonicalForm item() const
CFGenerator * clone() const
AlgExtGenerator(const Variable &a)
AlgExtGenerator(const AlgExtGenerator &)
AlgExtGenerator & operator=(const AlgExtGenerator &)
generate random elements in F_p(alpha)
AlgExtRandomF(const Variable &v, CFRandom *g, int nn)
AlgExtRandomF & operator=(const AlgExtRandomF &)
AlgExtRandomF(const Variable &v1, const Variable &v2)
AlgExtRandomF(const Variable &v)
AlgExtRandomF(const AlgExtRandomF &)
CanonicalForm generate() const
static CFGenerator * generate()
virtual class for generators
virtual CFGenerator * clone() const
virtual CanonicalForm item() const
virtual bool hasItems() const
class to iterate through CanonicalForm's
CFIterator(const CFIterator &)
CF_NO_INLINE int exp() const
get the current exponent
CF_NO_INLINE CanonicalForm coeff() const
get the current coefficient
CFIterator(const CanonicalForm &, const Variable &)
CFIterator(const CanonicalForm &)
CF_NO_INLINE int hasTerms() const
check if iterator has reached the end of CanonicalForm
CanonicalForm operator()(const CanonicalForm &f) const
CanonicalForm CFMap::operator () ( const CanonicalForm & f ) const.
void newpair(const Variable &v, const CanonicalForm &s)
CFMap(const Variable &v, const CanonicalForm &s)
friend OSTREAM & operator<<(OSTREAM &s, const CFMap &m)
OSTREAM & operator << ( OSTREAM & s, const CFMap & m )
CFMap & operator=(const CFMap &m)
CFMap & CFMap::operator = ( const CFMap & m )
CFMap(const CanonicalForm &s)
static CFRandom * generate()
virtual class for random element generation
virtual CFRandom * clone() const
virtual CanonicalForm generate() const
class to evaluate a polynomial at points
void setValue(int i, const CanonicalForm &f)
CanonicalForm operator[](const Variable &v) const
Evaluation(int min0, int max0)
Evaluation & operator=(const Evaluation &e)
CanonicalForm operator()(const CanonicalForm &f) const
CanonicalForm operator[](int i) const
friend OSTREAM & operator<<(OSTREAM &s, const Evaluation &e)
Evaluation(const Evaluation &e)
generate all elements in F_p starting from 0
CanonicalForm item() const
CFGenerator * clone() const
generate random elements in F_p
CanonicalForm generate() const
generate all elements in GF starting from 0
CanonicalForm item() const
CFGenerator * clone() const
generate random elements in GF
CanonicalForm generate() const
generate integers starting from 0
CFGenerator * clone() const
CanonicalForm item() const
CanonicalForm generate() const
virtual class for internal CanonicalForm's
void print(OSTREAM &) const
MapPair(const Variable &v, const CanonicalForm &s)
friend OSTREAM & operator<<(OSTREAM &s, const MapPair &p)
OSTREAM & operator << ( OSTREAM & s, const MapPair & p )
MapPair(const MapPair &p)
MapPair & operator=(const MapPair &p)
MapPair & MapPair::operator = ( const MapPair & p )
CanonicalForm subst() const
class to generate random evaluation points
REvaluation(const REvaluation &e)
REvaluation(int min0, int max0, const CFRandom &sample)
REvaluation & operator=(const REvaluation &e)
class to store factors that get removed during char set computation
StoreFactors & operator=(const StoreFactors &value)
CFList FS2
candidate factors that might get removed
CFList FS1
factors that were removed
factory's class for variables
Variable(const Variable &v)
Variable(int l, bool flag)
friend void swap_levels()
static Variable highest()
Variable(int l, char name)
class to do operations mod p^k for int's p and k
CanonicalForm operator()(const CanonicalForm &f, bool symmetric=true) const
modpk & operator=(const modpk &m)
CanonicalForm inverse(const CanonicalForm &f, bool symmetric=true) const
CanonicalForm getpk() const
const CanonicalForm int s
const Variable & v
< [in] a sqrfree bivariate poly
bool FACTORY_PUBLIC isOn(int)
switches
CFList charSetViaCharSetN(const CFList &PS)
compute a characteristic set via medial set
Variable get_max_degree_Variable(const CanonicalForm &f)
get_max_degree_Variable returns Variable with highest degree.
bool isPurePoly(const CanonicalForm &f)
CF_INLINE CanonicalForm operator+(const CanonicalForm &, const CanonicalForm &)
CF_INLINE CanonicalForm operator +, -, *, /, % ( const CanonicalForm & lhs, const CanonicalForm & rhs...
int FACTORY_PUBLIC cf_getNumSmallPrimes()
void setReduce(const Variable &alpha, bool reduce)
int headdegree(const CanonicalForm &f)
static const int SW_USE_QGCD
set to 1 to use Encarnacion GCD over Q(a)
CanonicalForm FACTORY_PUBLIC content(const CanonicalForm &)
CanonicalForm content ( const CanonicalForm & f )
CanonicalForm mapinto(const CanonicalForm &f)
ListCFList charSeries(const CFList &L)
characteristic series
AFactor< CanonicalForm > CFAFactor
CanonicalForm getVars(const CanonicalForm &f)
CanonicalForm getVars ( const CanonicalForm & f )
CanonicalForm FACTORY_PUBLIC blcm(const CanonicalForm &f, const CanonicalForm &g)
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
CFList charSet(const CFList &PS)
characteristic set
CanonicalForm FACTORY_PUBLIC make_cf(const mpz_ptr n)
CF_NO_INLINE FACTORY_PUBLIC CanonicalForm div(const CanonicalForm &, const CanonicalForm &)
int getNumVars(const CanonicalForm &f)
int getNumVars ( const CanonicalForm & f )
CanonicalForm lc(const CanonicalForm &f)
CanonicalForm FACTORY_PUBLIC icontent(const CanonicalForm &f)
CanonicalForm icontent ( const CanonicalForm & f )
ListCFList FACTORY_PUBLIC irrCharSeries(const CFList &PS)
irreducible characteristic series
static const int SW_USE_CHINREM_GCD
set to 1 to use modular gcd over Z
int ilog2(const CanonicalForm &a)
CanonicalForm leftShift(const CanonicalForm &F, int n)
left shift the main variable of F by n
CanonicalForm FACTORY_PUBLIC replacevar(const CanonicalForm &, const Variable &, const Variable &)
CanonicalForm replacevar ( const CanonicalForm & f, const Variable & x1, const Variable & x2 )
CanonicalForm FACTORY_PUBLIC extgcd(const CanonicalForm &f, const CanonicalForm &g, CanonicalForm &a, CanonicalForm &b)
CanonicalForm extgcd ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & a,...
int level(const Variable &v)
IntList FACTORY_PUBLIC neworderint(const CFList &PolyList)
ListIterator< Variable > VarlistIterator
bool isPurePoly_m(const CanonicalForm &f)
char name(const Variable &v)
void FACTORY_PUBLIC Off(int)
switches
void psqr(const CanonicalForm &f, const CanonicalForm &g, CanonicalForm &q, CanonicalForm &r, const Variable &x)
void psqr ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & q, CanonicalForm & r,...
int sign(const CanonicalForm &a)
CanonicalForm FACTORY_PUBLIC gcd(const CanonicalForm &, const CanonicalForm &)
Variable FACTORY_PUBLIC rootOf(const CanonicalForm &, char name='@')
returns a symbolic root of polynomial with name name Use it to define algebraic variables
CanonicalForm tailcoeff(const CanonicalForm &f)
int * degrees(const CanonicalForm &f, int *degs=0)
int * degrees ( const CanonicalForm & f, int * degs )
void prune1(const Variable &alpha)
CanonicalForm FACTORY_PUBLIC determinant(const CFMatrix &M, int n)
CanonicalForm Farey(const CanonicalForm &f, const CanonicalForm &q)
Farey rational reconstruction.
CanonicalForm Prem(const CanonicalForm &F, const CanonicalForm &G)
pseudo remainder of F by G with certain factors of LC (g) cancelled
CF_NO_INLINE FACTORY_PUBLIC CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
EXTERN_VAR void(* factoryError)(const char *s)
int FACTORY_PUBLIC cf_getNumPrimes()
ListIterator< CFAFactor > CFAFListIterator
int taildegree(const CanonicalForm &f)
CFList charSetN(const CFList &PS)
medial set
CF_NO_INLINE FACTORY_PUBLIC CanonicalForm operator%(const CanonicalForm &, const CanonicalForm &)
int FACTORY_PUBLIC probIrredTest(const CanonicalForm &F, double error)
given some error probIrredTest detects irreducibility or reducibility of F with confidence level 1-er...
int degree(const CanonicalForm &f)
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
CanonicalForm deriv(const CanonicalForm &f, const Variable &x)
CFFList FACTORY_PUBLIC sqrFree(const CanonicalForm &f, bool sort=false)
squarefree factorization
CanonicalForm make_cf_from_gf(const int z)
CanonicalForm FACTORY_PUBLIC lcm(const CanonicalForm &, const CanonicalForm &)
CanonicalForm lcm ( const CanonicalForm & f, const CanonicalForm & g )
void getTerms(const CanonicalForm &f, const CanonicalForm &t, CFList &result)
get_Terms: Split the polynomial in the containing terms.
CFList get_Terms(const CanonicalForm &f)
CFArray subResChain(const CanonicalForm &f, const CanonicalForm &g, const Variable &x)
CFArray subResChain ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x )
int size_maxexp(const CanonicalForm &f, int &maxexp)
CFList basicSet(const CFList &PS)
basic set in the sense of Wang a.k.a. minimal ascending set in the sense of Greuel/Pfister
CFList newordercf(const CFList &PolyList)
CanonicalForm maxNorm(const CanonicalForm &f)
CanonicalForm maxNorm ( const CanonicalForm & f )
Varlist neworder(const CFList &PolyList)
CFFList facAlgFunc(const CanonicalForm &f, const CFList &as)
factorize a polynomial f modulo an extension given by an irreducible characteristic set as,...
Array< CanonicalForm > CFArray
CanonicalForm FACTORY_PUBLIC bCommonDen(const CanonicalForm &f)
CanonicalForm bCommonDen ( const CanonicalForm & f )
CanonicalForm FACTORY_PUBLIC vcontent(const CanonicalForm &f, const Variable &x)
CanonicalForm vcontent ( const CanonicalForm & f, const Variable & x )
void FACTORY_PUBLIC setCharacteristic(int c)
bool fdivides(const CanonicalForm &f, const CanonicalForm &g)
bool fdivides ( const CanonicalForm & f, const CanonicalForm & g )
CFFList facAlgFunc2(const CanonicalForm &f, const CFList &as)
factorize a polynomial f that is irreducible over the ground field modulo an extension given by an ir...
int is_imm(const InternalCF *const ptr)
static const int SW_USE_FL_GCD_P
set to 1 to use Flints gcd over F_p
static const int SW_USE_EZGCD_P
set to 1 to use EZGCD over F_q
CF_NO_INLINE FACTORY_PUBLIC CanonicalForm operator-(const CanonicalForm &, const CanonicalForm &)
bool hasFirstAlgVar(const CanonicalForm &f, Variable &a)
check if poly f contains an algebraic variable a
CanonicalForm resultantZ(const CanonicalForm &A, const CanonicalForm &B, const Variable &x, bool prob=true)
modular resultant algorihtm over Z
void FACTORY_PUBLIC chineseRemainder(const CanonicalForm &x1, const CanonicalForm &q1, const CanonicalForm &x2, const CanonicalForm &q2, CanonicalForm &xnew, CanonicalForm &qnew)
void chineseRemainder ( const CanonicalForm & x1, const CanonicalForm & q1, const CanonicalForm & x2,...
ListIterator< CFFactor > CFFListIterator
const char factoryConfiguration[]
CanonicalForm getMipo(const Variable &alpha, const Variable &x)
void factoryError_intern(const char *s)
bool tryFdivides(const CanonicalForm &f, const CanonicalForm &g, const CanonicalForm &M, bool &fail)
same as fdivides but handles zero divisors in Z_p[t]/(f)[x1,...,xn] for reducible f
Matrix< CanonicalForm > CFMatrix
static const int SW_RATIONAL
set to 1 for computations over Q
CanonicalForm abs(const CanonicalForm &f)
inline CanonicalForm abs ( const CanonicalForm & f )
int gf_value(const CanonicalForm &f)
CanonicalForm FACTORY_PUBLIC swapvar(const CanonicalForm &, const Variable &, const Variable &)
swapvar() - swap variables x1 and x2 in f.
static const int SW_USE_NTL_SORT
set to 1 to sort factors in a factorization
CanonicalForm psr(const CanonicalForm &f, const CanonicalForm &g, const Variable &x)
CanonicalForm psr ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x )
List< CFList > ListCFList
static const int SW_USE_FL_FAC_0
set to 1 to prefer flints multivariate factorization over Z/p
CFMatrix *FACTORY_PUBLIC cf_HNF(CFMatrix &A)
The input matrix A is square matrix of integers output: the Hermite Normal Form of A; that is,...
CanonicalForm homogenize(const CanonicalForm &f, const Variable &x)
homogenize homogenizes f with Variable x
bool linearSystemSolve(CFMatrix &M)
ListIterator< CanonicalForm > CFListIterator
CanonicalForm mapdomain(const CanonicalForm &f, CanonicalForm(*mf)(const CanonicalForm &))
CanonicalForm mapdomain ( const CanonicalForm & f, CanonicalForm (*mf)( const CanonicalForm & ) )
CanonicalForm num(const CanonicalForm &f)
CanonicalForm den(const CanonicalForm &f)
int totaldegree(const CanonicalForm &f)
int totaldegree ( const CanonicalForm & f )
CanonicalForm sqrt(const CanonicalForm &a)
CanonicalForm Lc(const CanonicalForm &f)
static const int SW_USE_FF_MOD_GCD
set to 1 to use modular GCD over F_q
ListIterator< CFList > ListCFListIterator
CanonicalForm psq(const CanonicalForm &f, const CanonicalForm &g, const Variable &x)
CanonicalForm psq ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x )
CF_NO_INLINE FACTORY_PUBLIC CanonicalForm operator/(const CanonicalForm &, const CanonicalForm &)
static const int SW_USE_EZGCD
set to 1 to use EZGCD over Z
CanonicalForm FACTORY_PUBLIC gcd_poly(const CanonicalForm &f, const CanonicalForm &g)
CanonicalForm gcd_poly ( const CanonicalForm & f, const CanonicalForm & g )
CanonicalForm head(const CanonicalForm &f)
CanonicalForm getGFGenerator()
static const int SW_SYMMETRIC_FF
set to 1 for symmetric representation over F_q
CFList reorder(const Varlist &betterorder, const CFList &PS)
int FACTORY_PUBLIC cf_getNumBigPrimes()
CanonicalForm FACTORY_PUBLIC power(const CanonicalForm &f, int n)
exponentiation
EXTERN_VAR int singular_homog_flag
static const int SW_FAC_QUADRATICLIFT
CFMatrix *FACTORY_PUBLIC cf_LLL(CFMatrix &A)
performs LLL reduction.
CFList modCharSet(const CFList &PS, StoreFactors &StoredFactors, bool removeContents=true)
modified medial set
int FACTORY_PUBLIC cf_getSmallPrime(int i)
void FACTORY_PUBLIC prune(Variable &alpha)
Factor< CanonicalForm > CFFactor
CanonicalForm reduce(const CanonicalForm &f, const CanonicalForm &M)
polynomials in M.mvar() are considered coefficients M univariate monic polynomial the coefficients of...
static const int SW_USE_FL_GCD_0
set to 1 to use Flints gcd over Q/Z
CF_INLINE CanonicalForm operator*(const CanonicalForm &, const CanonicalForm &)
CanonicalForm euclideanNorm(const CanonicalForm &f)
CanonicalForm euclideanNorm ( const CanonicalForm & f )
CanonicalForm apply(const CanonicalForm &f, void(*mf)(CanonicalForm &, int &))
CanonicalForm apply ( const CanonicalForm & f, void (*mf)( CanonicalForm &, int & ) )
CFAFList FACTORY_PUBLIC absFactorize(const CanonicalForm &G)
absolute factorization of a multivariate poly over Q
int FACTORY_PUBLIC cf_getBigPrime(int i)
void FACTORY_PUBLIC gmp_numerator(const CanonicalForm &f, mpz_ptr result)
CFFList FACTORY_PUBLIC factorize(const CanonicalForm &f, bool issqrfree=false)
factorization over or
static const int SW_USE_FL_FAC_0A
set to 1 to prefer flints multivariate factorization over Z/p(a)
CFList charSetViaModCharSet(const CFList &PS, StoreFactors &StoredFactors, bool removeContents=true)
modified characteristic set, i.e. a characteristic set with certain factors removed
void setMipo(const Variable &alpha, const CanonicalForm &mipo)
int factoryrandom(int n)
random integers with abs less than n
void FACTORY_PUBLIC factoryseed(int s)
random seed initializer
void FACTORY_PUBLIC On(int)
switches
List< CanonicalForm > CFList
ListIterator< MapPair > MPListIterator
CanonicalForm compress(const CanonicalForm &f, CFMap &m)
CanonicalForm compress ( const CanonicalForm & f, CFMap & m )
void FACTORY_PUBLIC gmp_denominator(const CanonicalForm &f, mpz_ptr result)
static const int SW_USE_FL_FAC_P
set to 1 to prefer flints multivariate factorization over Z/p
Variable mvar(const CanonicalForm &f)
CanonicalForm LC(const CanonicalForm &f)
static const int SW_BERLEKAMP
set to 1 to use Factorys Berlekamp alg.
ListIterator< int > IntListIterator
int FACTORY_PUBLIC cf_getPrime(int i)
int FACTORY_PUBLIC ipower(int b, int n)
int ipower ( int b, int m )
List< CFAFactor > CFAFList
int FACTORY_PUBLIC getCharacteristic()
bool hasMipo(const Variable &alpha)
void FACTORY_PUBLIC chineseRemainderCached(const CanonicalForm &x1, const CanonicalForm &q1, const CanonicalForm &x2, const CanonicalForm &q2, CanonicalForm &xnew, CanonicalForm &qnew, CFArray &inv)
CanonicalForm replaceLc(const CanonicalForm &f, const CanonicalForm &c)
CanonicalForm FACTORY_PUBLIC resultant(const CanonicalForm &f, const CanonicalForm &g, const Variable &x)
CanonicalForm resultant ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x )
fglmVector operator-(const fglmVector &v)
ostream & operator<<(ostream &s, const spectrum &spec)
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)