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
expand_more
expand_more
format_list_bulleted
Question
Chapter 5.9, Problem 5.8PP
Program Plan Intro
Given C code:
double aprod(double a[], long n)
{
long i;
double x, y, z;
double r = 1;
for(i=0; i<n-2; i+=3)
{
x = a[i];
y = a[i + 1];
z = a[i+2];
r = r*x*y*z;
}
for(;i<n ; i++)
r*=a[i];
return r;
}
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.
Memory aliasing:
- It denotes a case where two pointers might designate to memory location that is same.
- The compiler should assume that unlike pointers might be aliased for safe optimizations.
- The program aspects that could limit chances for a compiler in generating optimized code denote optimization blockers.
- If a compiler is unable to determine whether two pointers might be aliased, it should adopt that either case would be possible.
- The possible optimization set is been limited in this case.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
4.1.1
Complete solution and answer only no need explanation
Given three data points (1,6), (3,28), and (10, 231), What is the value of y at x = 2 if the function y = 2x2 + 3x + 1 passes through the three data points.
Problem 3 (#2.1.32).Explain why (A×B)×(C×D)and A×(B×C)×D are not the same
Problem 15 (#2.3.30).If f and f◦g are one-to-one, does it follow that g must
be one-to-one? Justify your answer.
Chapter 5 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Knowledge Booster
Similar questions
- 4 We consider the following initial value problem for two functions y(x),z(x): 0=y′′+(y′+6y)cos(z), 5z′=x^2+y^2+z^2, where 0≤x≤2 and y(0)=1.7, y′(0)=−2.7, z(0)=0.5. Approximate the solution of this initial value problem using Euler's method with 100 steps. (use Maple) What approximation value do you obtain for y(2) and z(1)?arrow_forwardQ.) Do given c and d problem belowarrow_forwardWrite a C++ code for the given problem: Given two arrays X and Y of positive integers, find the number of pairs such that xy > yx (raised to power of) where x is an element from X and y is an element from Y. Input: M = 4, X[] = [2 3 4 5] N = 3, Y[] = [1 2 3] Output: 5 Explanation: The pairs for the given input are 21 > 12 , 31 > 13 , 32 > 23 , 41 > 14 , 51 > 15 . Expected Time Complexity: O((N + M)log(N)) Constraints: 1 ≤ M, N ≤ 105 1 ≤ X[i], Y[i] ≤ 103arrow_forward
- Q_5 Suppose f:RZ where fx=2x-1.If A={x |1x 4}, find f(A).If B={3,4,5,6,7}, find f(B).If C={-9, -8}, find f^ - 1(C)arrow_forwardQuestion 3 In 12–17, use the IVT to verify each function has a root in the given interval(s). Then use the Bisection Algorithm to narrow the location of that root to an interval of length less than or equal to 0.1. f(x) = x^2 − 2 on [0, 3] Full explain this question and text typing work only thanksarrow_forwardDesign a reasonably efficient algorithm for solving each of the following problems and determine its efficiency class. d. How many one-digit additions are made by the pen-and-pencil algorithm in multiplying two n-digit integers? (You may disregard potential carries.)arrow_forward
- Show complete solution please. I am at a loss of how to even begin this problem and would like to learn how to work through each step.arrow_forwardGiven f(x) = 2x2+3x+1 and g(x) = 3x−2.Compute (a) (f◦g)(x) =arrow_forward3. Simplify the following Boolean functions, using four-variable Kmaps: (a) F (w, x, y, z) = Σ(1, 4, 5, 6, 12, 14, 15) (b) F (A, B, C, D) = Σ(2, 3, 6, 7, 12, 13, 14) (c) F (w, x, y, z) = Σ(1, 3, 4, 5, 6, 7, 9, 11, 13, 15)arrow_forward
- Python solves. For a building project, a civil engineer needs 4800, 5810, and 5690 m3 of sand, fine gravel, and coarse gravel. Three pits supply these resources. Pit composition is Sand% 52 20 25 30 50 20 Coarse Gravel 18-30-55% The engineer requires how many cubic metres from each pit? Use Python. Form linear algebraic equations first.arrow_forwardComputer Science f(x)= Sin(x) – x 3 + C Where C = Max [0.15, (69/100)] x20, (x is in radian). Apply the false position method three iterations to find the root of the function (Decide the starting values of Xl and Xu yourself)arrow_forward5. (a) Write a function that solves the general linear least-squares problem. The inputs to your function should be a vector of a values, a vector of measured y values, and an anonymous function that calculates a single row of the Z matrix. Inside your function, use the inputted anonymous function to create Z row-by-row, then use Z to create the normal equations. Solve these normal equations to obtain the computed coefficients that define the best-fit of your model. Your function should output these calculated coefficients. Again, include an error check that makes sure the input vectors are the same size. You may not use any built-in MATLAB functions to solve the normal equation. You can use any functions you have developed solves Ax = b via LU-decomposition is one option. e.g. a function you have that (b) Test your function in (a) to fit the following model to the given dataset (see belo y = a + bx (c) Test your function in (a) to fit the following model to the given dataset…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education