Question: Please, writing in MATLAB. 2. Matrix vector multiplication is a basic building block in many applications and efficiently computing such products is important. Depending on

 Please, writing in MATLAB. 2. Matrix vector multiplication is a basic Please, writing in MATLAB.

2. Matrix vector multiplication is a basic building block in many applications and efficiently computing such products is important. Depending on the numerical method used the resulting matrices have a special structure. Consider a case in which the resulting matrix has non-zero elements only in the first row, the first column and on the diagonal. One can take advantage of the matrix structure to develop a highly efficient matrix multiplication algorithm by avoiding operations and storage of zeros. Develop a matrix vector multiplication function which will return the the matrix product y = Ax given the the diagonal elements of the A, the first row of the A and the first column of the A. Your function statement should be as the following code segment. function y-MX2 ID (ad, ar, ac, x) % ad : vector containing the diagonal elements of the A matrix (input) % ar : vector containng the first row of the A matrix (input) % ac : vector containing the the first column of the A matrix (input) % x : the vector to multiply A with (input) % y : the result of Ax (output) Substitute ID in the function with your student ID. Note that with the first elements of the ad, ar,ac arrays should be equal. Also note that one does not need to use for loop but use array operations resulting in more efficient code. (a) Describe your algorithm (b) Show that your function gives numerically correct results (c) Estimate how much computational time and memory one would save by using your function rather using the full matrix operation for matrix sizes 10k where k = 1, 2, 3, 4, 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!