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)
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 OUStep 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