If I knew the dimensions of each square submatrix m (2x2), and that the dimensionality of a large square matrix M was evenly divisible by the dimensionality m: M modulo m == 0.
Is there an efficient way to rotate submatrices within the following matrix M:
M = array([[ 1., 2., 1., 2.],
[ 3., 4., 3., 4.],
[ 1., 2., 1., 2.],
[ 3., 4., 3., 4.]])
Such that the result is:
M* = array([[ 2., 4., 2., 4.],
[ 1., 3., 1., 3.],
[ 2., 4., 2., 4.],
[ 1., 3., 1., 3.]])
In particular, it would be useful to force the use a function like numpy.rot90(), such that other rotations can be achieved e.g.
180: rot90(x, 2)
270: rot90(x, 3)
etc.