Computer Systems: A Programmer's Perspective (3rd Edition)
Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
Publisher: PEARSON
Question
Book Icon
Chapter 5, Problem 5.18HW
Program Plan Intro

Given C Code:

double poly(double a[], double x, long degree)

{

long i;

double result = a[0];

double xpwr = x;

for (i = 1; i <= degree; i++)

{

result += a[i] * xpwr;

xpwr = x * xpwr;

}

return result;

}

double polyh(double a[], double x, long degree)

{

long i;

double result = a[degree];

for(i=degree-1; i>=0; i--)

result = a[i] + x*result;

return result;

}

Cycles per element (CPE):

  • The CPE denotes performance of program that helps in improving code.
  • It helps to understand detailed level loop performance for an iterative program.
  • It is appropriate for programs that use a repetitive computation.
  • The processor’s activity sequencing is controlled by a clock that provides regular signal of some frequency.

Loop unrolling:

  • It denotes a program transformation that would reduce count of iterations for a loop.
  • It increases count of elements computed in each iteration.
  • It reduces number of operations that is not dependent to program directly.
  • It reduces count of operations in critical paths of overall computations.

Blurred answer
Students have asked these similar questions
5. Consider the trisection method, which is analogous to bisection except that at each iteration, it creates 3 intervals instead of 2 and keeps one interval where there is a sign change. (c) The main computational cost of bisection and trisection is function evalu- ations. The other operations it does are a few additions and divisions, but the evaluation of most functions, including sin, cos, exp, etc. are much more costly. Based on this information, explain why you would never want to use trisection over bisection.
Write a user-defined MatLab function I=Simp38(FunName,a,b) using the composite Simpson's 3/8 method. FunName is a handle function that calculates the value of the function to be integrated, a and b are the limits of integration and I is the value of the integral. The function should calculate the value of the integral in iterations. In the first iteration the interval [a,b] is divided in two subintervals and in every iterations that follows the number of subintervals should be doubled. Stop the iterations when the difference in the value between two successive iterations is smaller than 1%.
Create a limit evaluation problem that requires substitution with an answer of 1. Please show the steps to solve the problem.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education