We have considered several implementations of functions in which the elements of an array are combined...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
We have considered several implementations of functions in which the elements of an array are combined using either addition or multiplication, with both integer and floating point numbers. The specific functions which you will implement are combine3), combine5( ), and combine7( ) using double precision floating point numbers and the operation will be multiplication. The routines are shown in figures 5.9, 5.16, and 5.26 respectively. To eliminate the need for additional functions, tailor the routines to accept as parameters: the array address, the address of the destination, and the array length. Your implementation should correspond to the following prototypes: -- prototype definitions --- */ void combine3(double * A, double * dest, int length); void combine5(double * A, double * dest, int length); void combine7(double * A, double * dest, int length); As you will be multiplying a large number of values together, you may encounter problems with either overflow or underflow. To address that issue, you will want to keep your numbers in a range that is close to 1.0. You can use the following examples to define your array length and parameters for initializing the array elements. #define LENGTH 5000 #define K 10000 double A[LENGTH]; // input matrix for (i=0; i< LENGTH; i++) A[i) = 0.90 + (double )(rand() % K) / 50000.; // initialize the array elements With the three functions, vary the size of the arrays, execute each function, and measure the execution times of each. As you are executing in a multiprocessing environment, you will observe variations in the execution times, so you should conduct the experiment a few times with each array size to get average results. Generate a summary of the results and explain how the different implementations lead to different execution times. Also, submit a copy of your source code. We have considered several implementations of functions in which the elements of an array are combined using either addition or multiplication, with both integer and floating point numbers. The specific functions which you will implement are combine3), combine5( ), and combine7( ) using double precision floating point numbers and the operation will be multiplication. The routines are shown in figures 5.9, 5.16, and 5.26 respectively. To eliminate the need for additional functions, tailor the routines to accept as parameters: the array address, the address of the destination, and the array length. Your implementation should correspond to the following prototypes: -- prototype definitions --- */ void combine3(double * A, double * dest, int length); void combine5(double * A, double * dest, int length); void combine7(double * A, double * dest, int length); As you will be multiplying a large number of values together, you may encounter problems with either overflow or underflow. To address that issue, you will want to keep your numbers in a range that is close to 1.0. You can use the following examples to define your array length and parameters for initializing the array elements. #define LENGTH 5000 #define K 10000 double A[LENGTH]; // input matrix for (i=0; i< LENGTH; i++) A[i) = 0.90 + (double )(rand() % K) / 50000.; // initialize the array elements With the three functions, vary the size of the arrays, execute each function, and measure the execution times of each. As you are executing in a multiprocessing environment, you will observe variations in the execution times, so you should conduct the experiment a few times with each array size to get average results. Generate a summary of the results and explain how the different implementations lead to different execution times. Also, submit a copy of your source code.
Expert Answer:
Answer rating: 100% (QA)
Implement in java CombineArrayElementsjava public class CombineArrayElem... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
The elements of an array are stored in consecutive storage locations in the computers internal memory. True or False
-
A pressure cylinder with a bore diameter (D) of 30 cm is designed for an internal n pressure (p) of 30 kg/cm2. The cylinder cover is fastened to its flangesn by means of 12 bolts which are made of...
-
In exercise 27.3, we considered some ways in which we can differentiate between goods that lie in between the extremes of pure private and pure public goods. A: Consider the case where there is a...
-
Review Questions: 1. What is the theory on which Rockwell hardness testing is based? 2. What is the purpose of the minor load in Rockwell hardness testing? 3. What are the advantages of the Rockwell...
-
Now consider the same basic ideas from Food Corp's perspective. Rank the four ideas presented to the CEO from most worthy of consideration ("1") to least worthy ("4") of consideration for the...
-
Superconducting power transmission the use of superconductors has been proposed for power transmission lines. A single coaxial cable (Fig P32.78) could carry 1.00 x 103 MW (the output of a large...
-
Discuss the differences between the characteristics of low- and high-value sales.
-
EL Computer produces its multimedia notebook computer on a production line that has an annual capacity of 16,000 units. EL Computer estimates the annual demand for this model at 6000 units. The cost...
-
Weight Watchers really wants to let you know that it's not just a diet company -- so much so that it's changing its name to WW. The company announced Monday that the new WW (WTW) name reflects its...
-
A person going for a walk follows the path shown in the figure, where y measured from the starting point? magnitude direction x = 320 m and 0 = 56.0. The total trip consists of four straight-line...
-
Textra Plastics produces parts for a variety of small machine manufacturers. Most products go through two operations, molding and trimming, before they are ready for packaging. Expected costs and...
-
You need to calculate the anticipated database capacity for constructing a database with four tables, is shown below: Table 1 will be initially loaded with 200,000 records, Table 2 with 100,000...
-
In transforming a logical data model into 2 physical relational database schema, what options does the database administrator have in how super type/subtype entities are implemented? Table 1 Table 2...
-
Use the graph below that shows the effect of a $4 per-unit tax on suppliers to answer the following questions: a. What are equilibrium price and quantity before the tax? After the tax? b. What is...
-
a. The equation of the Phillips curve from 1970 to 1995 is: \[\pi_{t}-\pi_{t-1}=7.4 \%-1.2 u_{t}\] Calculate and define the natural rate of unemployment using this curve. b. The equation of the...
-
Muscle FitnessMagazine surveyed 76 adults ages 18-25regarding their exercise programs. The following results wereobtained 30 were using Zumba dance 29 were using Yoga 26 men responded to the survey...
-
Consider a closed, rigid tank with a volume of 0.8L, filled with cold water initially at 27C. The tank is filled such that there are no voids (air pockets) within. The initial pressure within the...
-
A linear operator Ä is anti-Hermitian if for all pairs of well-behaved functions. (a) Show that d/dx is anti-Hermitian. (II8) =-(gllf)*
-
(a) The infrared absorption spectrum of 1H35Cl has its strongest band at 8.65 1013 Hz. Calculate the force constant of the bond in this molecule. (b) Find the approximate zero-point vibrational...
-
To properly apply the DQMC method, one must allow for the nodes produced by the antisymmetry requirement. (a) Consider a system of three electrons in a one-dimensional box, where we shall pretend...
-
Blatt Consulting Services is interested in comparing the number of customer accounts managed by its consultants. The chart below is a default chart produced in Excel. a. Which preattentive attributes...
-
Red Sky Delivery performs last-mile delivery services for online retailers such as Amazon. Red Sky employs delivery drivers who deliver packages to individual residence and business locations from a...
-
The file beveragedistributor contains data on the monthly revenue for a large regional distributor of beverages. a. Create a line chart to depict the revenue time series at the annual level. What...
Study smarter with the SolutionInn App