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). |
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().
00033 { 00034 #ifdef TRACE 00035 cerr << "START normalizeAddTerm : " << ppsig(t) << endl; 00036 #endif 00037 00038 aterm A(t); 00039 //cerr << "ATERM IS : " << A << endl; 00040 mterm D = A.greatestDivisor(); 00041 while (D.isNotZero() && D.complexity() > 0) { 00042 //cerr << "GREAT DIV : " << D << endl; 00043 A = A.factorize(D); 00044 D = A.greatestDivisor(); 00045 } 00046 return A.normalizedTree(); 00047 }
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().
00060 { 00061 return normalizeFixedDelayTerm(s, tree(1)); 00062 }
Compute the normal form of a fixed delay term (s).
The normalisation rules are : s -> 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 + et - becaue the value of the first d samples would be wrong. We could also add delays such that
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().
00082 { 00083 Tree x, y, r; 00084 int i; 00085 00086 if (isZero(d) && ! isProj(s, &i, r)) { 00087 00088 return s; 00089 00090 } else if (isZero(s)) { 00091 00092 return s; 00093 00094 } else if (isSigMul(s, x, y)) { 00095 00096 if (getSigOrder(x) < 2) { 00097 return simplify(sigMul(x,normalizeFixedDelayTerm(y,d))); 00098 } else if (getSigOrder(y) < 2) { 00099 return simplify(sigMul(y,normalizeFixedDelayTerm(x,d))); 00100 } else { 00101 return sigFixDelay(s,d); 00102 } 00103 00104 } else if (isSigDiv(s, x, y)) { 00105 00106 if (getSigOrder(y) < 2) { 00107 return simplify(sigDiv(normalizeFixedDelayTerm(x,d),y)); 00108 } else { 00109 return sigFixDelay(s,d); 00110 } 00111 00112 } else if (isSigFixDelay(s, x, y)) { 00113 // (x@n)@m = x@(n+m) 00114 // return sigFixDelay(x,tree(tree2int(d)+tree2int(y))); 00115 return normalizeFixedDelayTerm(x,simplify(sigAdd(d,y))); 00116 00117 } else { 00118 00119 return sigFixDelay(s,d); 00120 } 00121 }