|
FAUST compiler
0.9.9.6b8
|

Go to the source code of this file.
Functions | |
| Tree | normalizeAddTerm (Tree t) |
| Compute the Add-Normal form of a term t. | |
| Tree | normalizeDelay1Term (Tree s) |
| Compute the normal form of a 1-sample delay term s'. | |
| Tree | normalizeFixedDelayTerm (Tree s, Tree d) |
| Compute the normal form of a fixed delay term (s). | |
| Tree normalizeAddTerm | ( | Tree | t | ) |
Compute the Add-Normal form of a term t.
| t | the term to be normalized |
Definition at line 32 of file normalize.cpp.
References mterm::complexity(), aterm::factorize(), aterm::greatestDivisor(), mterm::isNotZero(), and aterm::normalizedTree().
Referenced by simplification().
{
#ifdef TRACE
cerr << "START normalizeAddTerm : " << ppsig(t) << endl;
#endif
aterm A(t);
//cerr << "ATERM IS : " << A << endl;
mterm D = A.greatestDivisor();
while (D.isNotZero() && D.complexity() > 0) {
//cerr << "GREAT DIV : " << D << endl;
A = A.factorize(D);
D = A.greatestDivisor();
}
return A.normalizedTree();
}


| Tree normalizeDelay1Term | ( | Tree | s | ) |
Compute the normal form of a 1-sample delay term s'.
The normalisation rules are : 0' -> 0 /// INACTIVATE dec07 bug recursion (k*s)' -> k*s' (s/k)' -> s'/k
| s | the term to be delayed by 1 sample |
Definition at line 59 of file normalize.cpp.
References normalizeFixedDelayTerm(), and tree().
Referenced by simplification().
{
return normalizeFixedDelayTerm(s, tree(1));
}


| Tree normalizeFixedDelayTerm | ( | Tree | s, |
| Tree | d | ||
| ) |
Compute the normal form of a fixed delay term (s).
The normalisation rules are : s@0 -> s 0 -> 0 (k*s) -> k*(s) (s/k) -> (s)/k (s
) -> s@(n+m) Note that the same rules can't be applied to
| s | the term to be delayed |
| d | the value of the delay |
Definition at line 81 of file normalize.cpp.
References getSigOrder(), isProj(), isSigDiv(), isSigFixDelay(), isSigMul(), isZero(), normalizeFixedDelayTerm(), sigAdd(), sigDiv(), sigFixDelay(), sigMul(), and simplify().
Referenced by normalizeDelay1Term(), normalizeFixedDelayTerm(), and simplification().
{
Tree x, y, r;
int i;
if (isZero(d) && ! isProj(s, &i, r)) {
return s;
} else if (isZero(s)) {
return s;
} else if (isSigMul(s, x, y)) {
if (getSigOrder(x) < 2) {
return /*simplify*/(sigMul(x,normalizeFixedDelayTerm(y,d)));
} else if (getSigOrder(y) < 2) {
return /*simplify*/(sigMul(y,normalizeFixedDelayTerm(x,d)));
} else {
return sigFixDelay(s,d);
}
} else if (isSigDiv(s, x, y)) {
if (getSigOrder(y) < 2) {
return /*simplify*/(sigDiv(normalizeFixedDelayTerm(x,d),y));
} else {
return sigFixDelay(s,d);
}
} else if (isSigFixDelay(s, x, y)) {
// (x@n)@m = x@(n+m)
// return sigFixDelay(x,tree(tree2int(d)+tree2int(y)));
return normalizeFixedDelayTerm(x,simplify(sigAdd(d,y)));
} else {
return sigFixDelay(s,d);
}
}


1.8.0