next up previous contents
Next: Running the implementation Up: Experimental Results Previous: Experimental Results

The Example

Since the method is geared towards the evaluation of recursive functions that have some redundancy, the example that I have chosen is of this form. It is a function f with four sub functions, a,b,c,d, two of which commute (a,b), see fig. 7.1. We can then compare the run-times when exploiting the commutativity with the results obtained when we do not.


  
Figure 7.1: The example function f(x)
\begin{figure}
\begin{verbatim}
f(x) = if (x=0 or x=1) then 1
 else f(a(x)) + f(...
 ...se x - 1

d(x) = if (x is even) then x - 1
 else x - 2\end{verbatim}\end{figure}



 

Timothy Lewis
11/12/1997