12 typedef map<Tree,int>
MP;
54 dst << sep <<
ppsig(p->first);
55 if (p->second != 1) dst <<
"**" << p->second;
183 if (p->second == 0) {
240 for (MP::const_iterator p = m.
fFactors.begin(); p != m.
fFactors.end(); p++) {
254 for (MP::const_iterator p = m.
fFactors.begin(); p != m.
fFactors.end(); p++) {
288 }
else if (a < 0 & b < 0) {
305 for (MP::const_iterator p1 = m1.
fFactors.begin(); p1 != m1.
fFactors.end(); p1++) {
307 MP::const_iterator p2 = m2.
fFactors.find(t);
327 return (b == 0) || (a/b > 0);
339 for (MP::const_iterator p1 = n.
fFactors.begin(); p1 != n.
fFactors.end(); p1++) {
345 MP::const_iterator p2 =
fFactors.find(f);
346 if (p2 ==
fFactors.end())
return false;
378 if (R && A) R =
sigMul(R,A);
388 if (R && A) R =
sigDiv(R,A);
399 cerr <<
"combineMulDiv (" << M <<
"/" << D <<
"*" <<
ppsig(f)<<
"**" << q << endl;
431 if (signatureMode)
return tree(1);
439 for (
int order = 0; order < 4; order++) {
440 A[order] = 0; B[order] = 0;
450 if (A[0] != 0) cerr <<
"A[0] == " << *A[0] << endl;
451 if (B[0] != 0) cerr <<
"B[0] == " << *B[0] << endl;
463 }
else if (negativeMode) {
473 for (
int order = 0; order < 4; order++) {
478 if (RR == 0) RR =
tree(1);
mterm gcd(const mterm &m1, const mterm &m2)
return a mterm that is the greatest common divisor of two mterms
const mterm & operator=(const mterm &m)
replace the content with a copy of m
static void combineMulLeft(Tree &R, Tree A)
Combine R and A doing R = R*A or R = A.
Tree fCoef
constant part of the term (usually 1 or -1)
static void combineDivLeft(Tree &R, Tree A)
Combine R and A doing R = R*A or R = A.
static int common(int a, int b)
return the "common quantity" of two numbers
interval abs(const interval &x)
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
const mterm & operator-=(const mterm &m)
add in place an mterm of same signature
Tree signatureTree() const
return a signature (a normalized tree)
Tree addNums(Tree a, Tree b)
map< Tree, int > fFactors
non constant terms and their power
static bool contains(int a, int b)
We say that a "contains" b if a/b > 0.
static void combineMulDiv(Tree &M, Tree &D, Tree f, int q)
Do M = M * f**q or D = D * f**-q.
double max(double x, double y)
int getSigOrder(Tree sig)
retrieve the order annotation (between 0 and 3) of a signal.
void cleanup()
remove usued factors
Tree mulNums(Tree a, Tree b)
Implements a multiplicative term, a term of type k*x^n*y^m*...
static Tree buildPowTerm(Tree f, int q)
produce the canonical tree correspoding to a mterm
mterm operator/(const mterm &m) const
mterms division
const mterm & operator/=(Tree m)
divide in place by a multiplicative exp
static Tree sigPow(Tree x, int p)
produce x^p with p:int
bool isNotZero() const
true if mterm doesn't represent number 0
const mterm & operator*=(Tree m)
multiply in place by a multiplicative exp
static bool isSigPow(Tree sig, Tree &x, int &n)
match x^p with p:int
bool isSigBinOp(Tree s, int *op, Tree &x, Tree &y)
Tree normalizedTree(bool sign=false, bool neg=false) const
return the normalized tree of the mterm
int complexity() const
return an evaluation of the complexity
bool isSigInt(Tree t, int *i)
mterm operator*(const mterm &m) const
mterms multiplication
void * getUserData(Symbol *sym)
Returns user data.
ostream & print(ostream &dst) const
print a mterm k*x1**n1*x2**n2...
Tree sigMul(Tree x, Tree y)
const mterm & operator+=(const mterm &m)
add in place an mterm of same signature
Tree divExtendedNums(Tree a, Tree b)
bool isNegative() const
true if mterm has a negative coefficient
double min(double x, double y)
Tree sigDiv(Tree x, Tree y)
bool hasDivisor(const mterm &n) const
return true if this can be divided by n
Tree subNums(Tree a, Tree b)
Tree branch(int i) const
return the ith branch (subtree) of a tree
Tree sigInt(int i)
Signals.