9.5 DESIGN 1: USING HORNER’S RULE FOR BROADCAST INPUT AND PIPELINED OUTPUT
Suppose we want to evaluate the polynomial for a certain value of x:
(9.8)
We can rewrite the polynomial using Horner’s scheme as
(9.9)
Now the polynomial is recursively evaluated through the following steps:
1. Evaluate the innermost term y0 = 2x + 4.
2. Evaluate the next innermost term y1 = y0 x + 5.
3. Evaluate the term y2 = y1x + 3.
4. Evaluate the term y3 = y2x + 9.
5. Evaluate p(x) to y3.
Now we apply Horner’s’ scheme to Eq. 9.7 to obtain the recursive expression
(9.10)
The above equation can be written as
(9.12)
(9.13)
(9.14)
Based on the above iterative expression, task T (i) computes Yi in Eq. 9.11 using one multiplication and one addition:
(9.15)
The output of ...
Get Algorithms and Parallel Computing now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.