Programming Exercise 7.6 describes how to perform matrix multiplication. Suppose you have multiple processors, so you can
Question:
Programming Exercise 7.6 describes how to perform matrix multiplication. Suppose you have multiple processors, so you can speed up the matrix multiplication. Implement the following method in parallel.
Write a test program that measures the execution time for multiplying two 2,000 * 2,000 matrices using the parallel method and sequential method, respectively.
Listing
Transcribed Image Text:
public static double[][] parallelMultiplyMatrix( double[][] a, double[][] b) 1 public class PrimeNumber { public static void main(String[] args) { final int NUMBER_OF_PRIMES = 50; // Number of primes to display final int NUMBER_OF_PRIMES_PER_LINE = 10; // Display 10 per line 2 3 4. 5 int count 0; // Count the number of prime numbers int number = 2; // A number to be tested for primeness System.out.println("The first 50 prime numbers are \n"); // Repeatedly find prime numbers while (count < NUMBER_OF_PRIMES) { // Assume the number is prime boolean isPrime = true; // Is the current number prime? 10 11 12 13 14 15 16 17 18 19 20 21 // Test whether number is prime for (int divisor = 2; divisor <= number / 2; divisor++) { if (number % divisor == 0) { // If true, number is not prime isPrime = false; // Set isPrime to false break; // Exit the for loop 22 // Display the prime number and increase the count if (isPrime) { count++; // Increase the count 23 24 25 26 27 if (count % NUMBER_OF_PRIMES_PER_LINE == 0) { // Display the number and advance to the new line System.out.println(number); 28 29 30 else System.out.print (number + " "); 31 32
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 84% (13 reviews)
Method Definition of parallelMultiplyMatrix double a double b parallelMultiplyMatrix is a method accepting two twodimensional double arrays as input and returning a double variable to the calling stat...View the full answer
Answered By
JAPHETH KOGEI
Hi there. I'm here to assist you to score the highest marks on your assignments and homework. My areas of specialisation are:
Auditing, Financial Accounting, Macroeconomics, Monetary-economics, Business-administration, Advanced-accounting, Corporate Finance, Professional-accounting-ethics, Corporate governance, Financial-risk-analysis, Financial-budgeting, Corporate-social-responsibility, Statistics, Business management, logic, Critical thinking,
So, I look forward to helping you solve your academic problem.
I enjoy teaching and tutoring university and high school students. During my free time, I also read books on motivation, leadership, comedy, emotional intelligence, critical thinking, nature, human nature, innovation, persuasion, performance, negotiations, goals, power, time management, wealth, debates, sales, and finance. Additionally, I am a panellist on an FM radio program on Sunday mornings where we discuss current affairs.
I travel three times a year either to the USA, Europe and around Africa.
As a university student in the USA, I enjoyed interacting with people from different cultures and ethnic groups. Together with friends, we travelled widely in the USA and in Europe (UK, France, Denmark, Germany, Turkey, etc).
So, I look forward to tutoring you. I believe that it will be exciting to meet them.
3.00+
2+ Reviews
10+ Question Solved
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Question Posted:
Students also viewed these Computer science questions
-
Programming Exercise 8.5 describes how to perform matrix addition. Suppose you have multiple processors, so you can speed up the matrix addition. Implement the following method in parallel. Write a...
-
Programming Exercise 7.35 presents a console version of the popular hangman game. Write a GUI program that lets a user play the game. The user guesses a word by entering one letter at a time, as...
-
Programming Exercise 3.32 shows how to test whether a point is on an unbounded line. Revise Programming Exercise 3.32 to test whether a point is on a line segment. Write a program that prompts the...
-
1. Underline the word at right that best describes the client's: 2. Discuss appropriate client objectives: A. Risk B. Return Case Facts Type of mvestorInstututional; endowment Purpose Asset base...
-
Monomethylation of histone Arg residues can be reversed by the action of a peptidylarginine deiminase, which requires water to remove the methyl group along with the imino group of Arg. Draw the...
-
In Exercises test for convergence or divergence, using each test at least once. Identify which test was used. (a) n th-Term Test (b) Geometric Series Test (c) p -Series Test (d) Telescoping Series...
-
Recover pyridine from water using chlorobenzene as solvent in a countercurrent extractor. Feed is \(25.9 \mathrm{wt} \%\) pyridine and \(74.1 \mathrm{wt} \%\) water. Solvent is pure chlorobenzene,...
-
Two eight-year-old boys were seriously injured when riding Honda mini trail bikes provided by their parents. The boys were riding on public streets and ran a stop sign when they were hit by a truck....
-
You are analyzing a project and have developed the following estimates. The depreciation is $4,300 a year and the tax rate is 35.5 percent. What is the worst case operating cash flow? Base Lower...
-
Explain how managers can use a BCG Matrix to manage strategies by analyzing a corporate portfolio.
-
Implement the following method using Fork/Join to find the sum of a list. public static double parallelSum(double[] list) Write a test program that finds the sum in a list of 9,000,000 double values.
-
Write an animation for selection sort, insertion sort, and bubble sort, as shown in Figure 30.31. Create an array of integers 1, 2, . . . , 50. Shuffle it randomly. Create a pane to display the array...
-
In 1991, the U.S. government imposed a stiff import tariff on the active-matrix LCD screens that now appear in next-generation laptop computers. a. Assess the likely consequences of the import duty...
-
what ways do metafictional techniques complicate the relationship between the author, reader, and narrative? provide examples from well-known metafictional works and analyze their effect on...
-
i. ii. iii. iv. Write a program/assembly code to evaluate the arithmetic statement: P = (Q * ((R+ (S* T)) - (U/V))) Using a general register computer with zero address instructions. Using a general...
-
Employees at Company Q are discussing the company's decreasing market share and decreasing stock prices, but they consistently place the blame outside the company. One manager was recently reported...
-
Harmony Inc. uses a job-costing system with two direct cost categories (direct materials and direct manufacturing labor) and one manufacturing overhead cost pool. Harmony allocates manufacturing...
-
What are the key characteristics of transgressive fiction, and how does it challenge societal norms? Can you identify notable authors in this genre and discuss how their works push boundaries ?
-
a) Use a statistical package to find the value of the linear correlation coefficient between "year" and "NYCtemp" b) Is the correlation significant? Explain the reason for your answer c) If the...
-
The company manufactures three products: wooden chairs, tables and dressers. AFC started off as a 'Mom & Pop' shop but has grown rapidly. AFC uses one assembly line to build all three products,...
-
The following true/false questions pertain to Figure 8.28. a. When a host in 172.16.1/24 sends a data-gram to an Amazon.con, server, the router Rl will encrypt the data-gram using IPsec. b. When a...
-
Suppose an SSL session employs a block cipher with CBC. True or false: The server sends to the client the IV in the clear.
-
Suppose Alice and Bob are communicating over an SSL session. Suppose an attacker, who does not have any of the shared keys. Inserts a bogus TCP segment into a packet stream with correct TCP checksum...
-
Suppose Intel stock has a beta of 0.96, whereas Boeing stock has a beta of 2.31. If the risk-free interest rate is 4.07% and the expected return of the market portfolio is 11.89%, according to the...
-
ACCT- 322 Budgeting - Financial Modeling Assignment For this assignment, groups can be formed of up to 3 people. You also have the option of doing the assignment in pairs. Only one person in your...
-
1. Recallthat in question one of the assignment from the last tutorial, we standardized all the values for X (hours spent playing outside with friends) and Y (hours spent playing video games along)...
Study smarter with the SolutionInn App