Question: Using with MAT LAB 4. Consider the matrix multiplication C AB. Compare the computing time required by each of the following methods and the matlab
Using with MAT LAB 4. Consider the matrix multiplication C AB. Compare the computing time required by each of the following methods and the matlab implementation C-A+B for n = 2, 16, 64, 256, 512, 1024, 4096,8192. Is the computation time propor- tional to the number of operations for each method? Why are the methods result in different computation times although the amount of operations are the same? (a) Compute colums of C by multiplying A with columns of B. C(,A B(:,) (b) Compute rows of C by multiplying rows of A with B. cG,:)AB) c) Compute each element of C by using three nested loops (d) Same as above but the the order of the outermost two loops are changed Note that the last two methods are very inefficient and may require very long computation times. You may limit the n values which results in approximately 60 seconds of computation time. You should implement the above methods in a function whose interface is function c-MO ID (a, b,method) a input square matrix b : input square matrix method: character variable which shows the method to be used for example if method-'b' means use the mehod described in section b above c :output matrix
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
