Question: Study the function matrix_mult that takes two 2D arrays and performs a matrix multiplication and returns a new two-dimensional array. Each array should be represented

 Study the function matrix_mult that takes two 2D arrays and performs

Study the function matrix_mult that takes two 2D arrays and performs a matrix multiplication and returns a new two-dimensional array. Each array should be represented as a list of lists. For example, A = [[1, 2, 3], [-2, 3, 7]] B = [[1,0,0],[0,1,0],[0,0,1]] matrix_mult(A,B) [[1, 2, 3], [-2, 3, 7]] Identify all lines that are in error - that is, select all answers that are correct. 1. def matrix_mult (A, B): 2. A_n = len(A) 3. A_m - len(A[@]) 4. Bun = len(B) B_m = len (B[@]) assert A_m = B_n 7. R_N = A_n R_m = B_m R = [[e for j in range(R_m)] for i in range(R_n)] def row(M,r); return v[c] for v in M def col(M, c): return M[r] def dot (vi, v2); return sum([x*y for x, y in zip(vi, v2)]) for i in range(R_n): for j in range(R_m): R[i][j] = dot(row(A,i), col(8,3)) 5. 6. 8. 9. 10. 11. 12. 13. 14. return R

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!