How to rotate the positions of a matrix by 90 degrees I have a 5x5 matrix of values. I'm looking for a simple formula that I can use to rotate the position of the values (not the values themselves) 90 degrees within the matrix.
For example, here is the original matrix:
01 02 03 04 05
06 07 08 09 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25

and then when the position of the values are rotated 90 degrees, it would look like this:
21 16 11 06 01
22 17 12 07 02
23 18 13 08 03
24 19 14 09 04
25 20 15 10 05

I found this post and this one, and I'm sure the answer I'm after is in there somewhere, but I've been out of university for quite a few years and am having trouble following the algorithm.
I need this for a C# program I'm writing and will be using Math.Net Numberics. I'm hoping there is just a simple rotation matrix/vector I can use to multiply my matrix with that will give me the result I'm after. Any suggestions are appreciated.
 A: A rotation by 90 degrees can be accomplished by two reflections at a 45 degree angle so if you take the transpose of the matrix and then multiply it by the permutation matrix with all ones on the minor diagonal and all zeros everywhere else you will get a clockwise rotation by 90 degrees.  For a 2x2 matrix this would look like:
A B
C D

Transpose:
A C
B D

Permute, reversing order of columns:
C A
D B

However, in a programming context, it would probably be better to solve this problem by moving the data around.
A: Transpose the matrix, then reverse the order of the columns. So $$M\mapsto M^T\begin{bmatrix}0&0&\cdots&0&1\\0&0&\cdots&1&0\\\vdots&\vdots&&\vdots&\vdots\\0&1&\cdots&0&0\\1&0&\cdots&0&0\end{bmatrix}$$
For instance $$\begin{bmatrix}a&b&c\\d&e&f\\g&h&i\end{bmatrix}\mapsto\begin{bmatrix}a&b&c\\d&e&f\\g&h&i\end{bmatrix}^T\begin{bmatrix}0&0&1\\0&1&0\\1&0&0\end{bmatrix}=\begin{bmatrix}a&d&g\\b&e&h\\c&f&i\end{bmatrix}\begin{bmatrix}0&0&1\\0&1&0\\1&0&0\end{bmatrix}=\begin{bmatrix}g&d&a\\h&e&b\\i&f&c\end{bmatrix}$$
A: As best I understand the question, it's about how to transpose a matrix around its secondary diagonal. If I'm right, it might be something like this: $I^{T^{*}}=I_0A^TI_0$, where $(I_0)_{ij}=\delta_{n+1-i-j}$
