A matrix is a rectangle of numbers in rows and columns. A 1xN matrix has one...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
A matrix is a rectangle of numbers in rows and columns. A 1xN matrix has one row and N columns. An NxN matrix has N rows and N columns. Multiplying a 1xN matrix A and an NxN matrix B produces a 1xN matrix C. To determine the Nth element of C multiply each element of A by each element of the Nth column of B and sum the results. Helpful information can be found at matrix multiplication. Write a program that reads a 1xN matrix A and an NXN matrix B from input and outputs the 1xN matrix product, C. The first integer input is N, followed by one row of N integers for matrix A and then N rows of N integers for matrix B. N can be of any size >= 2. For coding simplicity, follow each output integer by a space, even the last one. The output ends with a newline. Ex: If the input is: 2 23 12 3.4 A contains 2 and 3, the first row of B contains 1 and 2, and the second row of B contains 3 and 4. The first element of C is (21) + (3*3), and the second element of C is (2*2)+(3 * 4). The program output is: 11 16 Note: Store matrices A and C into one-dimensional arrays and matrix B into a two-dimensional array. Note: The name of the file should be Matrix.java and the name of the class should be Matrix. 42306227129907 LAB ACTIVITY 5.21.1: LAB: 1xN and NxN Matrix multiplication Submission Instructions 0/10 A matrix is a rectangle of numbers in rows and columns. A 1xN matrix has one row and N columns. An NxN matrix has N rows and N columns. Multiplying a 1xN matrix A and an NxN matrix B produces a 1xN matrix C. To determine the Nth element of C multiply each element of A by each element of the Nth column of B and sum the results. Helpful information can be found at matrix multiplication. Write a program that reads a 1xN matrix A and an NXN matrix B from input and outputs the 1xN matrix product, C. The first integer input is N, followed by one row of N integers for matrix A and then N rows of N integers for matrix B. N can be of any size >= 2. For coding simplicity, follow each output integer by a space, even the last one. The output ends with a newline. Ex: If the input is: 2 23 12 3.4 A contains 2 and 3, the first row of B contains 1 and 2, and the second row of B contains 3 and 4. The first element of C is (21) + (3*3), and the second element of C is (2*2)+(3 * 4). The program output is: 11 16 Note: Store matrices A and C into one-dimensional arrays and matrix B into a two-dimensional array. Note: The name of the file should be Matrix.java and the name of the class should be Matrix. 42306227129907 LAB ACTIVITY 5.21.1: LAB: 1xN and NxN Matrix multiplication Submission Instructions 0/10
Expert Answer:
Answer rating: 100% (QA)
Heres a simple Java program that fulfills the requirements import javautilSc... View the full answer
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Posted Date:
Students also viewed these programming questions
-
Which components will you include in your analysis if you need to justify technology implementation (either new or upgrade) in your existing operation? Why?
-
mw Assumption Maximization (EM) (25 focuses) In this question you will carry out the EM calculation for Gaussian Mixture Models. A decent perused on gaussian combination EM can be found at this...
-
(a) Use the following text to derive distributions for rat and chased. Use a five-word window, including open- and closed- class words, ignore case, punctuation and sentence boundaries and weight...
-
They are considering trading their car in for a newer used vehicle so that Harry can have dependable transportation for commuting to work. The couple still owes $5,130 to the credit union for their...
-
Jim plans to take a picture of McGraw Tower with a 35-mm camera that has a 50.0-mm focal length lens. A roll of 35-mm film is 35 mm wide; each frame is 24 mm by 36 mm. The tower has a height of 52 m...
-
4. stringDigit.py (20 Points) Write a program that asks the user to enter a series of single-digit numbers with nothing separating them. The program should display the sum of all the single digit
-
Lake Company has the following shares outstanding: 20,000 shares of \(\$ 50\) par value, five percent cumulative preferred stock and 80,000 shares of \(\$ 10\) par value common stock. The company...
-
Stevens Co. bought a machine on January 1, 2006 for $875,000. It had a $75,000 estimated residual value and a ten-year life. An expense account was debited on the purchase date. Stevens uses...
-
Explain what an operations strategy is and the importance of competing priorities. Give an example from an organization (public or private, manufacturing or service). please give me the upper...
-
Let G be the group of symmetries of a rhombus then G is isomorphic to Z OZ x Z Z trivial group {e}
-
Determine the meaning of words and phrases as they are used in the text, including figurative and connotative meanings. In the figurative language inAct IV, Scene iii, lines 39-41, of The Tragedy of...
-
Runge Company purchased machinery on January 1 at a list price of $300,000, with credit terms 2/10, n/30. Payment was made within the discount period. Runge paid $15,000 sales tax on the machinery...
-
Write a function to find the shortest path between two nodes in a graph using Dijkstra's algorithm.
-
Jackson Co. has the following information for the first 4 months of this year: Machine hours Cleaning Hours Expense January 2,100. $900 February 2,600 1,200 March 1,600 800 April 2,000 1,000...
-
Identify the problem statement for Apple bites back. Next, identify what will Apple need to do to maintain product innovation and customer loyalty? How has Apple developed extreme loyalty among...
-
The transmission of electric power occurs at the highest possible voltage to reduce losses. If the voltage were raised by a factor of 3.2, by what factor would the power loss be reduced? A: 7.48 B:...
-
Write a paper about medication error system 2016.
-
Show that, with the array representation for storing an n-element heap, the leaves are the nodes indexed by n/2 + 1, n/2 + 2, . . . ,n.
-
Modify the pseudocode for depth-first search so that it prints out every edge in the directed graph G, together with its type. Show what modifications, if any, you need to make if G is undirected.
-
Solve the following linear program using SIMPLEX: maximize 5x 3x2 subject to X1 X2 < 1 X2 < 2 > 0. 2x1 + X1, X2 |
-
Determine the quick ratio for the commercial construction company in Figures 6-1 and 6-2 . What insight does this give you into the companys financial operations? Data From Figures 6-1 Figure 6-2...
-
In 2010, your company purchased a front-end loader for \($150,000,\) a dump truck for \($85,000,\) and a dumping trailer (pup) for the dump truck for \($38,000.\) The front-end loader was placed in...
-
For the current tax year, what are the maximum Section 179 deductions and the amount where Section 179 begins to be phased out?
Study smarter with the SolutionInn App