I want to write a function matvec_row_variant_scalar(A,x) that implements the scalar-wise, row-variant of the matrix-vector multiplication, where A is a 2D array, and x is a 1D array. It MUST use two nested loops and scalar-wise access to the entries of and . this is what i have tried.
Matrix12 = np.array([[3, 7, 0], [-9,1,4], [4,6,8]])
vector42 = np.array([5,1,9])
def matvec_row_variant_scalar(A,x):
row_sum = []
calc = 0
for row in A:
for i in row:
calc += i * x
return row_sum.append(calc)
matvec_row_variant_scalar(Matrix12, vector42)