We want to switch rows of an input nxn matrix A according to the following rul: For a column, say the kth column, we will compare the absolute values of forms Alk.). Alk+1,K), Alk+2.). Ain.), if the form on the p-throw, that is Alp.) has the maximum absolute value. I will switch the p-throw and throw of the matrix. We will apply this procedure to the 1st column, then the 2nd column and so on For example, A (1 2 6: 4 8 -1; 2 3-51 When we use the above procedure to the 1st column, we have to switch the 1st and the 2nd rows and the matrix becomes C-148 -1; 12.6: 23 -51 Then apply the procedure to the second column and notice you only need to compare the absolute value of A12.2) and (3.2), and All.2) will not be compared Then you may find you need switch the 2nd and the 3rd rows Aller interchanging rows, matrix becomes B=[4 8 -1; 2 3-5; 1 2 61 There is no need to deal with the last column (why?) I want you to write a FUNCTION to realize such switching for ANY nXn matrix A. It should begin with function 18,P] = rearrange(A) The first output Bis the switched matrix the second output P is such a matrix whose ith row.ith column alement is one if the ith row of matrix B was originally the jth row of matrix A. The other elements of P are all zeros. Using the above example, the corresponding P matric should be P:10 10: 001: 100) Thic.metinden We want to switch rows of an input nxn matrix A according to the following rul: For a column, say the kth column, we will compare the absolute values of forms Alk.). Alk+1,K), Alk+2.). Ain.), if the form on the p-throw, that is Alp.) has the maximum absolute value. I will switch the p-throw and throw of the matrix. We will apply this procedure to the 1st column, then the 2nd column and so on For example, A (1 2 6: 4 8 -1; 2 3-51 When we use the above procedure to the 1st column, we have to switch the 1st and the 2nd rows and the matrix becomes C-148 -1; 12.6: 23 -51 Then apply the procedure to the second column and notice you only need to compare the absolute value of A12.2) and (3.2), and All.2) will not be compared Then you may find you need switch the 2nd and the 3rd rows Aller interchanging rows, matrix becomes B=[4 8 -1; 2 3-5; 1 2 61 There is no need to deal with the last column (why?) I want you to write a FUNCTION to realize such switching for ANY nXn matrix A. It should begin with function 18,P] = rearrange(A) The first output Bis the switched matrix the second output P is such a matrix whose ith row.ith column alement is one if the ith row of matrix B was originally the jth row of matrix A. The other elements of P are all zeros. Using the above example, the corresponding P matric should be P:10 10: 001: 100) Thic.metinden