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: 83% (12 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...
-
Express the reciprocity criteria in terms of h-, g-, and T-parameters.
-
In a contract dispute between a US company and a Canadian company, the contract itself referred to provisions of the Uniform Commercial Code. Do these references alone preempt the contract from being...
-
For the following independent situations, assume that you are the audit partner on the engagement: 1. In the last 3 months of the current year, Oil Refining Company decided to change direction and go...
-
The given code starts by initializing some sets and functions f , g , and h . Block 1 is a function ( called hasInverse ) that takes as input another function ( called func ) , and two sets ( D and T...
-
The Fitzgerald Company maintains a checking account at the Bank of the North. The bank provides a bank statement along with canceled checks on the last day of each month. The October 31, 2007 bank...
-
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...
-
A partial amortization schedule for a 10-year note payable issued on January 1, Year 1, is shown next: Required a. Using a financial statements model like the one shown next, record the appropriate...
-
What impacts could the use of a contracted project manager as opposed to an employee project manager have on a project in a healthcare setting? Does the PM need healthcare experience? What is your...
-
The Accounts Receivable balance for Arbor Corporation as of December 31, 2023 is $2,100,000. Before calculating and recording 2023 bad debt expense, the Allowance for Doubtful Accounts has a credit...
-
Borrowing and Political Equilibrium Tax is not the only way to finance the government expenditures. Government borrowing has been a major mechanism to sustain the large outlays in the recent decades....
-
In 2016 financial commentators noted that a push by the FASB to expand the use of fair value accounting had rekindled the debate about its costs and benefits. Discuss the trade-offs between relevance...
-
This weeks discussion board is focused on radio advertising. This week you will listen to 4 radio ad's available on this link: https://www.babble-on-recording.com/samples/ As you listen summarize the...
-
Carl Carson, a single taxpayer, owns 100% of Delta Corporation. During 2014, Delta reports $150,000 of taxable income. Carl reports no income other than that earned from Delta, and Carl claims 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...
-
Assume that an economy is based on two industrial sectors, agriculture (A) and energy (E). The technology matrix M is: A E A-> 0.6 0.1 =M E-> 0.1 0.7 How much input from A and E are required to...
-
Data Analytics Problem DAPS.1 Data Analytics Wheels and Skis Inc. is a seasonal business that sells bikes and skis. Offering products for both summer and winter outdoor activities allows sales to be...
-
P/R End Date Check Date 2/10/2023 2/14/2023 Company Name: Prevosti Farms and Sugarhous Number Number of Name Filing Status Dependents Dependents Hourly Rate or Under 17 Over 17 Period Wage of Regular...
Study smarter with the SolutionInn App