Is there a built-in way to rotate all values in a matrix (nalgebra)?

59 Views Asked by At

Left rotation example:

[1,2] -> [2,4] -> [4,3]
[3,4] -> [1,3] -> [2,1]

Is there a built-in way to do this? if not, what's a simple alternative solution?

1

There are 1 best solutions below

1
On

That can be implemented as a reflection and a transpose, e.g.:

matrix![0, 1;
        1, 0] * m.transpose()