Write a method to do matrix multiplication. Write out some of the computations using array indices...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a method to do matrix multiplication. Write out some of the computations using array indices on paper first to see how you should start programming. On the next slide you will find an example of how to compute multiplication of two 2d arrays. M: 3 x 33 x 2: M2 you can only multiply when these sizes match. The result will always have the leftover sizes. M* M2 will result in a 3x2 array. Recall we can't compute M2 * M in this case because M2: 3 x 23 x 3: M M 012 0 5 7 -9 1 4 0 20 M*M2 0 1 2 0 12 5 28 2 1 2 3 1 17 15 21 M2 012 (5 * 1)+(4 *2)+(1*-1)=5+8+-1=12 (5 * 3)+(4 * 0)+(1 * 2) = 15+0+2=17 3. Then repeat with the rest of the rows. (71)+(0*2)+(2 * -1) = 7+0+-2=5 (73)+(0* 0)+(2 * 2) = 21+0+4=25 0 (-9 * 1)+(20*2)+(3 * -1) = -9+40+-3=28 (-93)+(200)+(3 * 2) = -27+0+5=-21 0 1 2 -1 1 3 0 1. First row of M "dot product" first column of M2 gives first element. 2. First row of M "dot product" second column of M2 gives second element. 2 Write a method to do matrix multiplication. Write out some of the computations using array indices on paper first to see how you should start programming. On the next slide you will find an example of how to compute multiplication of two 2d arrays. M: 3 x 33 x 2: M2 you can only multiply when these sizes match. The result will always have the leftover sizes. M* M2 will result in a 3x2 array. Recall we can't compute M2 * M in this case because M2: 3 x 23 x 3: M M 012 0 5 7 -9 1 4 0 20 M*M2 0 1 2 0 12 5 28 2 1 2 3 1 17 15 21 M2 012 (5 * 1)+(4 *2)+(1*-1)=5+8+-1=12 (5 * 3)+(4 * 0)+(1 * 2) = 15+0+2=17 3. Then repeat with the rest of the rows. (71)+(0*2)+(2 * -1) = 7+0+-2=5 (73)+(0* 0)+(2 * 2) = 21+0+4=25 0 (-9 * 1)+(20*2)+(3 * -1) = -9+40+-3=28 (-93)+(200)+(3 * 2) = -27+0+5=-21 0 1 2 -1 1 3 0 1. First row of M "dot product" first column of M2 gives first element. 2. First row of M "dot product" second column of M2 gives second element. 2
Expert Answer:
Related Book For
Posted Date:
Students also viewed these computer network questions
-
The issue of the functional distribution of income has become fashionable again in light of the the decline in the labour share over the past 2-3 decades, and the macroeconomic implications that flow...
-
It seemed that Giulia was fated to go into a business related to rock-climbing. She loved challenging herself to ascents on sheer rock walls and liked to tell her friends that she was born to it. It...
-
List three specific parts of the Case Guide, Objectives and Strategy Section (See below) that you had the most difficulty understanding. Describe your current understanding of these parts. Provide...
-
National paper Company must purchase a new machine for producing cardboard boxes. The company must choose between two machines. The machines produce boxes of equal quality, so the company will choose...
-
Miskimen Industries uses job costing to calculate the costs of its jobs with direct labor cost as its manufacturing overhead allocation base. The company manufactures a variety of engines for use in...
-
The article "Drying of Pulps in Sprouted Bed: Effect of Composition on Dryer Performance" (M. Medeiros, S. Rocha, et al., Drying Technology, 2002:865-881) presents measurements of pH, viscosity (in...
-
Assume that IHOP sold all 1,000 shares of its treasury stock for \(\$ 15\) per share. The sale of treasury stock a. Decreased total equity by \(\$ 15,000\) b. Increased total equity by \(\$ 5,000\)...
-
The National Center for Education Statistics reported that 47% of college students work to pay for tuition and living expenses. Assume that a sample of 450 college students was used in the study. a....
-
The net income available to stockholders is $230,000. The beginning number of common shares outstanding was 100,000. The ending number of common shares outstanding was 150,000. What is the earnings...
-
On December 31, 2023, Stilton Service Companys year-end, the unadjusted trial balance included the following items: Required 1. Prepare the adjusting entry on the books of Stilton Service Company to...
-
In reference to the Table below: Day 1 Rainfall, mm 11 Water added, mm -5 23.4 16.5 23.8 19.0 2 8 -3 None of the choices 3 13 0 Determine the water lost from the lake in ha-m, if the pan coefficient...
-
Q1 Suppose you have three real numbers so that: The sum of the first and the second number equals 10 The sum of the first and the third number equals 9 The sum of the second and the third number...
-
Zumbahlen Inc. has the following balance sheet. How much total operating capital does the firm have? Cash $ 20.00 Accounts payable $30.00 Short-term investments 50.00 Accruals 50.00 Accounts...
-
The kinetic energy of a relativistic particle is given by K = (y-1)mc where 1 r = 1- v/c Here m is the mass of the particle, v is its speed and c denotes the speed of light. Verify that the...
-
Find sky civ moment of inertia calculator? L-Beam BFw: 40 BFt: 10 LFh: 30 LFt: r: 5 0 LFt H LFh BFw BFt SkyCiv Moment of Inertia Calculator Units: mm Calculate Clear Z Notation A 1 ly Izp lyp p Cz...
-
Discuss the emerging roles of mitochondria in regulating cellular immunity and inflammation, including the modulation of immune cell activation, cytokine production, and the interplay between...
-
Find the derivative of the given functions dy 24. =eln (1+1), y(0) = 1 dt dy 25. H dx 26. dy 112 X y(1) = 3 = -2te-F
-
Dr. Chan obtained a $15,000 demand loan at prime plus 1.5% on September 13 from the Bank of Montreal to purchase a new dental X-ray machine. Fixed payments of $700 will be deducted from the dentists...
-
What are the differences between a friend function and a member function?
-
What does the following preprocessor directive do? #include
-
Write a program that asks the user to enter his or her age. The program then should display the age in months: Enter your age: 29 Your age in months is 384.
-
In an audit of a corporation that has a bond issue outstanding, the trust indenture is reviewed and confirmation as to the issue is obtained from the trustee. List eight matters of importance to the...
-
Robertson Company had accounts receivable of \(\$ 200,000\) at December 31, 200X, and had provided an allowance for uncollectible accounts of \(\$ 6,000\). After performing all normal auditing...
-
Elizabeth Cole, the senior auditor-in-charge of the audit of Thorne Company, a small manufacturer, was busy writing the audit report for another engagement. Accordingly, she sent Martin Joseph, a...
Study smarter with the SolutionInn App