Question
Write a function in Matlab that takes as input the number n, the size of matrices and vectors; m, the number of nonzero elements of
Write a function in Matlab that takes as input the number n, the size of matrices and vectors; m, the number of nonzero elements of a sparse matrix; and the sparse matrix whose nonzeros are given in m-component column vectors r, c, and v: the rk row, ck column entry of the matrix is nonzero with value vk, for k = 1, . . . , m. Finish the program in the following way:
(a) Have the function output the actual n n matrix A represented. Write out or print out your function.
(b) Have the function accept also the input of x, an n-component vector, and, working directly with the r, c, and v, output the matrix-vector multiplication between the sparse matrix and the vector x, and the number of flops involved. Write out or print out your function.
(c) Assuming the sparse matrix is lower triangular and c is in non-decreasing order, have the function accept also the input of b, an n-component vector, and, working directly with the r, c, and v, output column-oriented forward substitution solving for A1 b, and the number of flops involved. Write out or print out your function.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started