COMPUTER SYSTEMS&MOD MSGT/ET SA AC PKG
3rd Edition
ISBN: 9780134671123
Author: Bryant
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 5, Problem 5.13HW
A.
Program Plan Intro
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 suitable for programs that use a repetitive calculation.
- The processor’s activity sequencing is measured by a clock that provides signal of some frequency.
A.
Expert Solution
Explanation of Solution
Diagram for instruction sequence:
Explanation:
- The data dependencies between instructions are been depicted in diagram.
- The given instruction sequence is been decoded into operations.
- It creates a critical path of operations.
- The data flow between instructions is been shown in diagram.
B.
Program Plan Intro
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 suitable for programs that use a repetitive calculation.
- The processor’s activity sequencing is measured by a clock that provides signal of some frequency.
B.
Expert Solution
Explanation of Solution
Lower bound on CPE:
- The lower bound on CPE is been determined by critical path.
- For data type “double”, it denotes the float add cell.
- The lower bound on CPE is 3.0 based on the architecture.
C.
Program Plan Intro
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 suitable for programs that use a repetitive calculation.
- The processor’s activity sequencing is measured by a clock that provides signal of some frequency.
C.
Expert Solution
Explanation of Solution
Lower bound on CPE:
- The lower bound on CPE is been determined by critical path.
- For data type “integer”, it denotes the long add cell.
- The lower bound on CPE is 1.0 based on the architecture.
D.
Program Plan Intro
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 suitable for programs that use a repetitive calculation.
- The processor’s activity sequencing is measured by a clock that provides signal of some frequency.
D.
Expert Solution
Explanation of Solution
Given C Code:
// Define method inner4
void inner4(vec_ptr u, vec_ptr v, data_t *dest)
{
// Declare variable
long i;
//Compute length of vector
long length = vec_length(u);
//Get first vector
data_t *udata = get_vec_start(u);
//Get second vector
data_t *vdata = get_vec_start(v);
//Initialize variable
data_t sum = (data_t) 0;
//Loop
for (i = 0; i < length; i++)
{
//Compute product and add
sum = sum + udata[i] * vdata[i];
}
//Store result
*dest = sum;
}
CPE value for floating-point versions:
- The inner product computed is been accumulated in temporary.
- The float add operation is only on key path.
- The multiplication operation takes 5 clock cycles.
- The overall operation takes 3 cycles to complete on average.
- Hence, CPE value for floating-point versions is 3.0.
Want to see more full solutions like this?
Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
Write a python function, matrix_multiplication, that takes two integer matrices, A and B, and returns their dot product.
NOTE: Sample Test cases are attached below
Write a program that can inverse a matrix by using an approach to find its minor, cofactor and adjugate matrix.
Test your program with the given matrix ?
Please provide in Python program
Write pseudocode for a function Det-Quicksort(A, p, r) that receives array A[1..n], and indices p and r. The function should sort the subarray A[p..r] recursively (meaning you should call itself). You can also use a function LinearSearch(A, p, r, v) that searches subarray A[p..r] for an element of value v and return its index (in case it exists) in O(r − p) time. (Just to give you something to compare to, the solution has 8 lines.)
Chapter 5 Solutions
COMPUTER SYSTEMS&MOD MSGT/ET SA AC PKG
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- In c++ please help me answer this question I will give you a good rating :) implement the three versions of the addupto20() function: iterative, recursive, and divide-and-conquer approach test these functions with a few inputs from your main() Iterative solution * check if there exsits two numbers from vector data that add up to 20 e.g., if data=[2,5,3,15], the function returns true, as data [0] +data [3]==20 e.g., if data=[3,4,0,8], the function return false precondition: vector data has been initialized postcondition: if there are two numbers from list add up to 20, return true; otherwise, return false */ bool AddupTo20 (const vector‹int> & data){ } Come up with a recursive solution to the problem, following the hints given below: * check if there exsits two numbers from vector data[first...right] add up to 20 e.g., if data=[2,5,3,15], first=0, last=3, the function returns true, as data [0] +data [3]==20 e.g., if data=[2,5,3,15], first=2, last=3, the function returns…arrow_forwardInitialize a vector v1 with the following values: 0 23 -7 8 -22 3 14 Write a MATLAB program from the values in v1. The vector v2 should contain the values in v1 transformed as follows: that uses a for-loop and if-statements to make a new vector v2 multiply each positive even element in v1 by 3, multiply each positive odd element of v1 by -2, and change the sign of the negative elements in v1. Then, output the new vector to the command window as follows: The new vector is: -46 7 24 22 -6 42 Also, compute and output the mean of the values in the new vector: The mean of the new vector is: xxxx Above, xxxx is the mean of the values in the new vector with 1 decimal place.arrow_forwardProgram in python There is function F. Give an integer n (n ≥ 2), consider the prime factorization n=PI¹1 P2¹2 Prr Let g=gcd(k₁, k2.... kr) and m, = k₁/g The function F is defined as: F(n) = P11 P22- Pr Now, we have to summing up the value of this function for the first N natural numbers, we have w to evaluate the following expression for a given value of N. F(2) + F(3)+...+F(N). As the above sum can be extremely large Example if F(125)=5, thus the answer for this is by five more than for the previous one.arrow_forward
- In a Python function, represent the mathematical functionf(x)= exp(-x2) cos(2*pi*x) on a mesh consisting of q + 1 equally spaced points on [-1,1], and return 1) the interpolated function value at x = -0.45 and 2) the error in the interpolated value.Call the function and write out the error for q = 2,4,8,16arrow_forwardProgramming Language : C We have to Swape both the diagonalarrow_forwardWrite a c++ programarrow_forward
- The GMP library, using C or C++ The prefered solution is to use the Sage library. 2 Fermat test 1. Implement the Fermat test of primality with small integers. 2. Write a function to generate random k-bit prime numbers. 3 RSA 1. Write the key-generation function function of RSA. The function should generate two random primes p and q of size k/2 bits. 2. Implement the RSA encryption function 3. Implement the RSA decryption function 4. Check that decryption worksarrow_forwardWrite a function REVCOL (in PI [5), int int int M) in C++ to display the content of a two dimensional array, with each column content in reverse order. Note : Array may contain any number of rows. For example, if the content of array is as follows : 15 12 56 45 51 13 91 92 87 63 11 23 61 46 81 The function should display output as: 11 23 61 46 81 13 91 92 87 63 15 12 56 45 51arrow_forwardWrite a function C(n, r) which computes the number of r-combinations of a set of size n.arrow_forward
- The drawback of this approach, is that with each recursive function call, we only reduce the size of the array by one element, and we use a storage space for one activation record. A faster approach is, with each recursive call, reduce the size of the array by 3 elements. a. Write a reduce-and-conquer recursive function FastRecSum()(C++ or python) that find the sum of all float (real) elements in an array of size n. b. Using addition of float (real) values as a basic operation, set up and solve a recurrence relationship to compute the complexity of your code, as a function of the size n of the array.arrow_forwardImplement a recursive C++ function which takes an array of integers (arr) and the starting (start) and ending (end) indices of a portion (part) of this array, and returns the index of the second smallest element present in that portion of array arr. The prototype of your function should be: int findSecondSmallest (int* arr, int start, int end) For example, the function call findSecondSmallest(arr,3,8) should determine and return the index of the second smallest element present in the array arr between the indices 3 and 8 (both inclusive).arrow_forwardCode this in C program A set of integers 0..MAX may be implemented using an array of boolean values. This particular implementation is called a bit-vector implementation of a Set. Since C doesn’t have the Boolean data type, then substitute TRUE with 1 and FALSE with 0, or define 1 and 0 as TRUE and FALSE, respectively.For example, if the integer 3 is an element of the set, then the array element indexed by 3 is TRUE. On the other hand, if 3 is not an element, then the array element indexed by 3 is FALSE. For example: if s = {3,4,6,8}, the array looks like this: 0 1 2 3 4 5 6 7 8 9 FALSE FALSE FALSE TRUE TRUE FALSE TRUE FALSE TRUE FALSE Implement a programmer-defined data type called BitSet to represent a set as follows:typedef int BitSet[MAX];Implement the following functions:void initialize(BitSet s); - set all array elements to FALSEvoid add(int elem,BitSet s);- set the item indexed by elem to TRUEvoid display(BitSet s);- display the set on the screen using set notation,…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