Question: You are given the rowOperation function we have studied in the class. Write function reduceColumn(matrix, i) which uses row operations to transform the matrix such
You are given the rowOperation function we have studied in the class. Write function reduceColumn(matrix, i) which uses row operations to transform the matrix such that the i'th column of the matrix will have 1 on the diagonal and 0 in all other rows. Your output might not look exactly like the expected output, you will get full credit as long as your function works.
def rowOperation(matrix, i, j, multiplier): #multiplies the ith row of #the matrix and adds it to jth columlength=len(matrix[0]) for k in range(columlength): matrix[j][k]=multiplier*matrix[i][k]+matrix[j][k]
def reduceColumn(matrix, i): #You're going to implement this function
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
