I cannot understand why retrieved value of original Matrix isn't the good one. For instance, value of Matrix[0,3] should give 3 but gives 0 so that I am unable to get the correct 90° Matrix rotation:
import numpy as np
x = np.matrix(np.arange(16).reshape((4,4)))
print(x)
def rotate_90(matrix):
rot_Mat = matrix
len = matrix.shape[0]
# len_range = range(len)
# rev_range = reversed(len_range)
for i in range(0, len):
for j in range(0, len):
value = matrix[i,j]
print(i , j , value)
rot_Mat[j,len - i -1] = value
print(rot_Mat)
rotate_90(x)