Question: A function, mat mul0), that takes 2 file path strings as input parameters. The function reads two matrices in the files indicated by the
A function, mat mul0), that takes 2 file path strings as input parameters. The function reads two matrices in the files indicated by the two file path strings, and then multiples those two matrices to get the product matrix. The output of the function is the product matrix organized in a list of lists. Each of input files has the following format: 1. It is a text file 2. Each line is a row in the matrix, including numbers separeated from others by a white space Note that the sizes of the two matrices are valid to compute the product. You do not need to verify that in your code. For example, here are 2 input files and the output file 1 is a matrix 3 x 3 123 456 789 file 2 is a matrix 3 x 2 12 45 78 output [[30.0, 36.0], [66.0, 81.0], [102.0, 126.0]] def mat_mul(f1, f2): #code here
Step by Step Solution
3.51 Rating (154 Votes )
There are 3 Steps involved in it
Heres a Python function that reads two matrices from the specified text files and returns the... View full answer
Get step-by-step solutions from verified subject matter experts
