166 if (this->
isZero())
return true;
172 int cdeg = -2, dummy;
173 for ( i = *
this; i.
hasTerms(); i++ )
178 if (cdeg == -2) cdeg = dummy;
188 for ( i=termlist; i.
hasItem(); i++ )
234 ASSERT( 0,
"illegal domain" );
247 result += (
power( x,
i.exp() ) *
i.coeff().mapinto());
444 coeffdeg =
i.coeff().degree( v );
445 if ( coeffdeg > result )
614 else if ( what ==
GFMARK )
656 else if ( what ==
GFMARK )
698 else if ( what ==
GFMARK )
710 #if (HAVE_NTL && HAVE_FLINT && __FLINT_RELEASE >= 20400) 716 *
this=
mulNTL (*
this, cf);
752 else if ( what ==
GFMARK )
764 #if (HAVE_NTL && HAVE_FLINT && __FLINT_RELEASE >= 20400) 770 *
this=
divNTL (*
this, cf);
806 else if ( what ==
GFMARK )
852 else if ( what ==
GFMARK )
892 else if ( what ==
GFMARK )
934 else if ( what ==
GFMARK )
977 else if ( what ==
GFMARK )
997 ASSERT( qq != 0 && rr != 0,
"error in divrem" );
1012 else if ( what ==
GFMARK )
1033 ASSERT( qq != 0 && rr != 0,
"error in divrem" );
1057 else if ( what ==
GFMARK )
1082 ASSERT( qq != 0 && rr != 0,
"error in divrem" );
1113 int lastExp = i.
exp();
1117 if ( (lastExp - i.
exp()) == 1 )
1120 result *=
power( f, lastExp - i.
exp() );
1121 result += i.
coeff();
1126 result *=
power( f, lastExp );
1129 int lastExp = i.
exp();
1135 if ( (lastExp - i_exp ) == 1 )
1138 result *=
power( f, lastExp - i_exp );
1139 result += i.
coeff();
1144 result *=
power( f, lastExp );
1167 return (*
this)(
f );
1172 result +=
i.coeff()(
f,
v ) *
power( x,
i.exp() );
1216 ASSERT( i >= 0,
"index to operator [] less than zero" );
1246 result +=
power( x,
i.exp()-1 ) *
i.coeff() *
i.exp();
1259 ASSERT( x.
level() > 0,
"cannot derive with respect to algebraic variables" );
1271 result +=
i.coeff().deriv( x ) *
power( y,
i.exp() );
1325 ASSERT( n >= 0,
"arg to sqrt() less than zero" );
1326 if ( n == 0 || n == 1 )
1334 y = (
unsigned long)(x + n/x)/2;
1360 ASSERT( a > 0,
"arg to ilog2() less or equal zero" );
1418 "incompatible operands" );
1443 "incompatible operands" );
1507 else if ( what ==
FFMARK )
1538 else if ( what ==
FFMARK )
1607 if ( fInt < 0 ) fInt = -fInt;
1608 if ( gInt < 0 ) gInt = -gInt;
1621 long r = fInt % gInt;
1640 if ( fLevel == gLevel )
1646 if ( fLevel == gLevel )
1648 else if ( fLevel < gLevel )
1653 else if ( fLevel < gLevel )
1682 if ( fInt < 0 ) fInt = -fInt;
1683 if ( gInt < 0 ) gInt = -gInt;
1685 if ( gInt > fInt ) {
1691 long u = 1;
long v = 0;
1692 long uNext = 0;
long vNext = 1;
1700 long r = fInt % gInt;
1701 long q = fInt / gInt;
1702 long uSwap = u - q * uNext;
1703 long vSwap = v - q * vNext;
1708 u = uNext; v = vNext;
1709 uNext = uSwap; vNext = vSwap;
1715 if ( gTest > fTest ) {
1720 if ( fTest < 0 ) a = -
a;
1721 if ( gTest < 0 ) b = -
b;
1727 }
else if ( ! g.
isZero() ) {
1740 if ( fLevel == gLevel ) {
1745 if ( fLevel == gLevel )
1747 else if ( fLevel < gLevel )
1752 else if ( fLevel < gLevel )
1770 return (f /
bgcd( f, g )) * g;
1815 else if ( what ==
GFMARK )
1829 else if ( what ==
GFMARK )
1841 ASSERT( n >= 0,
"illegal exponent" );
1844 else if ( f.
isOne() )
int imm_iszero_p(const InternalCF *const ptr)
InternalCF * imm_mod_p(const InternalCF *const, const InternalCF *const )
const CanonicalForm int const CFList const Variable & y
InternalCF * imm_sub(const InternalCF *const lhs, const InternalCF *const rhs)
This file defines functions for conversion to FLINT (www.flintlib.org) and back.
virtual void divremcoeff(InternalCF *, InternalCF *&, InternalCF *&, bool) PVIRT_VOID("divremcoeff")
InternalCF * imm_mod(const InternalCF *const lhs, const InternalCF *const rhs)
virtual int degree()
int InternalCF::degree ()
InternalCF * int2imm(long i)
factory's class for variables
virtual long intval() const
InternalCF * imm_mul_gf(const InternalCF *const lhs, const InternalCF *const rhs)
InternalCF * imm_add_gf(const InternalCF *const lhs, const InternalCF *const rhs)
virtual CanonicalForm LC()
virtual Variable variable() const
virtual bool isUnivariate() const
InternalCF * copyObject()
InternalCF * imm_div_p(const InternalCF *const lhs, const InternalCF *const rhs)
virtual InternalCF * bextgcdsame(InternalCF *, CanonicalForm &, CanonicalForm &)
InternalCF * InternalCF::bextgcdsame ( InternalCF *, CanonicalForm & a, CanonicalForm & b ) ...
virtual bool inQuotDomain() const
virtual InternalCF * divsame(InternalCF *) PVIRT_INTCF("divsame")
int imm_cmp_p(const InternalCF *const lhs, const InternalCF *const rhs)
virtual InternalCF * addsame(InternalCF *) PVIRT_INTCF("addsame")
InternalCF * int2imm_p(long i)
InternalCF * imm_div_gf(const InternalCF *const lhs, const InternalCF *const rhs)
virtual int comparesame(InternalCF *) PVIRT_INT("comparesame")
virtual InternalCF * tryDivsame(InternalCF *, const CanonicalForm &, bool &)
int imm_cmp(const InternalCF *const lhs, const InternalCF *const rhs)
imm_cmp(), imm_cmp_p(), imm_cmp_gf() - compare immediate objects.
virtual class for internal CanonicalForm's
virtual int comparecoeff(InternalCF *) PVIRT_INT("comparecoeff")
virtual InternalCF * subsame(InternalCF *) PVIRT_INTCF("subsame")
CF_NO_INLINE int hasTerms() const
check if iterator has reached < the end of CanonicalForm
virtual InternalCF * modulosame(InternalCF *) PVIRT_INTCF("modulosame")
virtual InternalCF * bgcdsame(const InternalCF *const ) const
InternalCF * InternalCF::bgcdsame, bgcdcoeff ( const InternalCF * const )
void imm_divrem(const InternalCF *const lhs, const InternalCF *const rhs, InternalCF *&q, InternalCF *&r)
virtual InternalCF * genOne() PVIRT_INTCF("genOne")
CF_NO_INLINE CanonicalForm coeff() const
get the current coefficient
bool hasMipo(const Variable &alpha)
virtual int levelcoeff() const
void imm_divrem_gf(const InternalCF *const lhs, const InternalCF *const rhs, InternalCF *&q, InternalCF *&r)
CanonicalForm mulNTL(const CanonicalForm &F, const CanonicalForm &G, const modpk &b)
multiplication of univariate polys using FLINT/NTL over F_p, F_q, Z/p^k, Z/p^k[t]/(f), Z, Q, Q(a), if we are in GF factory's default multiplication is used. If b!= 0 and getCharacteristic() == 0 the input will be considered as elements over Z/p^k or Z/p^k[t]/(f).
int imm_iszero_gf(const InternalCF *const ptr)
Operations in GF, where GF is a finite field of size less than 2^16 represented by a root of Conway p...
virtual InternalCF * subcoeff(InternalCF *, bool) PVIRT_INTCF("subcoeff")
virtual bool tryDivremcoefft(InternalCF *, InternalCF *&, InternalCF *&, bool, const CanonicalForm &, bool &)
virtual InternalCF * divcoeff(InternalCF *, bool) PVIRT_INTCF("divcoeff")
virtual InternalCF * sqrt()
InternalCF * InternalCF::sqrt ()
CanonicalForm divNTL(const CanonicalForm &F, const CanonicalForm &G, const modpk &b)
division of univariate polys using FLINT/NTL over F_p, F_q, Z/p^k, Z/p^k[t]/(f), Z, Q, Q(a), if we are in GF factory's default multiplication is used. If b!= 0 and getCharacteristic() == 0 the input will be considered as elements over Z/p^k or Z/p^k[t]/(f); in this case invertiblity of Lc(G) is not checked
virtual void print(OSTREAM &, char *) PVIRT_VOID("print")
virtual bool inPolyDomain() const
CFList get_Terms(const CanonicalForm &f)
InternalCF * imm_div(const InternalCF *const lhs, const InternalCF *const rhs)
int imm_iszero(const InternalCF *const ptr)
This file defines functions for fast multiplication and division with remainder.
virtual CanonicalForm coeff(int i)
CanonicalForm InternalCF::coeff ( int i )
Interface to generate InternalCF's over various domains from intrinsic types or mpz_t's.
bool getReduce(const Variable &alpha)
void getmpi(InternalCF *value, mpz_t mpi)
long imm_intval(const InternalCF *const op)
virtual CanonicalForm Lc()
virtual bool inBaseDomain() const
static const int SW_RATIONAL
set to 1 for computations over Q
virtual InternalCF * dividesame(InternalCF *) PVIRT_INTCF("dividesame")
InternalCF * int2imm_gf(long i)
Iterators for CanonicalForm's.
virtual int level() const
virtual CanonicalForm tailcoeff()
CanonicalForm InternalCF::tailcoeff (), int InternalCF::taildegree ()
virtual InternalCF * dividecoeff(InternalCF *, bool) PVIRT_INTCF("dividecoeff")
static InternalCF * basic(long value)
virtual bool inExtension() const
virtual InternalCF * tryDivcoeff(InternalCF *, bool, const CanonicalForm &, bool &)
InternalCF * imm_sub_gf(const InternalCF *const lhs, const InternalCF *const rhs)
virtual int sign() const PVIRT_INT("sign")
declarations of higher level algorithms.
virtual bool divremcoefft(InternalCF *, InternalCF *&, InternalCF *&, bool) PVIRT_BOOL("divremcoefft")
InternalCF * imm_mul(InternalCF *lhs, InternalCF *rhs)
virtual InternalCF * modsame(InternalCF *) PVIRT_INTCF("modsame")
virtual InternalCF * den()
InternalCF * imm_sub_p(const InternalCF *const lhs, const InternalCF *const rhs)
virtual InternalCF * deepCopyObject() const PVIRT_INTCF("deepCopyObject")
class to iterate through CanonicalForm's
void imm_print(OSTREAM &os, const InternalCF *const op, const char *const str)
virtual InternalCF * num()
InternalCF * InternalCF::num (), den ()
virtual InternalCF * bextgcdcoeff(InternalCF *, CanonicalForm &, CanonicalForm &)
const Variable & v
< [in] a sqrfree bivariate poly
long imm2int(const InternalCF *const imm)
virtual bool inCoeffDomain() const
InternalCF * imm_mul_p(const InternalCF *const lhs, const InternalCF *const rhs)
CF_NO_INLINE int exp() const
get the current exponent
InternalCF * imm_divrat(const InternalCF *const lhs, const InternalCF *const rhs)
int imm_sign(const InternalCF *const op)
imm_sign() - return sign of immediate object.
virtual InternalCF * addcoeff(InternalCF *) PVIRT_INTCF("addcoeff")
void imm_divrem_p(const InternalCF *const lhs, const InternalCF *const rhs, InternalCF *&q, InternalCF *&r)
operations on immediates, that is elements of F_p, GF, Z, Q that fit into intrinsic int...
InternalCF * imm_mod_gf(const InternalCF *const, const InternalCF *const )
virtual int ilog2()
int InternalCF::ilog2 ()
#define GaloisFieldDomain
virtual bool divremsamet(InternalCF *, InternalCF *&, InternalCF *&) PVIRT_BOOL("divremsamet")
InternalCF * imm_add(const InternalCF *const lhs, const InternalCF *const rhs)
#define cf_glob_switches
CFSwitches cf_glob_switches;.
Factory's internal CanonicalForm's.
InternalCF * imm_add_p(const InternalCF *const lhs, const InternalCF *const rhs)
virtual InternalCF * mulcoeff(InternalCF *) PVIRT_INTCF("mulcoeff")
virtual InternalCF * modulocoeff(InternalCF *, bool) PVIRT_INTCF("dividecoeff")
#define ASSERT(expression, message)
int imm_cmp_gf(const InternalCF *const lhs, const InternalCF *const rhs)
virtual CanonicalForm lc()
CanonicalForm InternalCF::lc (), Lc (), LC ()
virtual InternalCF * modcoeff(InternalCF *, bool) PVIRT_INTCF("modcoeff")
virtual InternalCF * mulsame(InternalCF *) PVIRT_INTCF("mulsame")
virtual void divremsame(InternalCF *, InternalCF *&, InternalCF *&) PVIRT_VOID("divremsame")
virtual bool tryDivremsamet(InternalCF *, InternalCF *&, InternalCF *&, const CanonicalForm &, bool &)
virtual InternalCF * bgcdcoeff(const InternalCF *const )
virtual InternalCF * genZero() PVIRT_INTCF("genZero")
virtual int intmod(int) const
#define FiniteFieldDomain
int ff_symmetric(const int a)