Question: In hw4Code.py I have provided function protoypes for three functions: innerProduct(a,b) AxIP(A,x) AxVS(A,x) implement these three functions. The function innerProduct takes two vectors and returns

In hw4Code.py I have provided function protoypes for three functions:

innerProduct(a,b)

AxIP(A,x)

AxVS(A,x)

In hw4Code.py I have provided function protoypes for three functions: innerProduct(a,b) AxIP(A,x)

implement these three functions. The function innerProduct takes two vectors and returns their inner product. 1 The next two functions each perform Matrix-vector multiplication. That is, given A and x, the functions compute Ax. The functions differ in the way that they organize the computation. Of course, both functions should return the same result, given the same inputs.

The function AxIP should compute the resulting vector (call it b) using inner products, as described toward the end of the lecture on Ax = b. Each element of b should be constructed using your innerProduct() function. Hence the only references to A inside AxIP should be of the form A[i,:].

The function AxVS should compute the resulting vector b as a vector sum, as described at the beginning of the lecture on Ax = b. Hence the only references to A inside AxVS should be of the form A[:,i]

import numpy as np A 3 def innerProduct(a,b): Takes two vectors a and b, of equal length, and returns their inner product VOU 8 def AXIP(A,x): Takes a matrix A and a vector x and returns their product 3 def AxVS (A,x): Takes a matrix A and a vector x and returns their product OO OU import numpy as np A 3 def innerProduct(a,b): Takes two vectors a and b, of equal length, and returns their inner product VOU 8 def AXIP(A,x): Takes a matrix A and a vector x and returns their product 3 def AxVS (A,x): Takes a matrix A and a vector x and returns their product OO OU

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!