# How can I apply a matrix manipulation operation to each matrix in a list? [closed]

I have a list of matrices generated by the code

HZ = (0.03/4)*(KroneckerProduct[PauliMatrix[1], PauliMatrix[1]] +
KroneckerProduct[PauliMatrix[2], PauliMatrix[2]] +
KroneckerProduct[PauliMatrix[3], PauliMatrix[3]]);

UZ[t_] = MatrixExp[-I HZ*t];

rin = {{0, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};

routZ[t_] = UZ[t].rin.ConjugateTranspose[UZ[t]];

matrices = Table[routZ[t], {t, 0, 5}]


I want to apply an operation to each matrix in this list individually. I can get the operation I need to work on the first matrix in the list by applying the code

matrices1 = ArrayFlatten[Part[matrices, {1}], 1];

matrices2 = Partition[matrices1, {2, 2}];

matrices3 = {{matrices2[[1, 1]], Transpose@matrices2[[1, 2]]},
{Transpose@matrices2[[2, 1]], matrices2[[2, 2]]}};

matrices4 = ArrayFlatten[matrices3];


but I'm not sure how to extend this to apply to all of the matrices in the list rather than just the first.

• Map, Map, Map. – Henrik Schumacher Apr 27 '18 at 15:27

operation[matrix_List] :=

Now, just use Mapto get the transformed set of matrices:
operation /@ matrices