Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions