Generate an array of matrices

For 2x2 matrices I would use StaticArrays:

using StaticArrays 
A = fill(SA[0.5 0.0; 0.0 0.5], 10)
A[2] = SA[1.0 1.0;1.0 0.0] 

SArrays are immutable, so you cannot use dot-assignment in the last line, but you can use fill.

This will be much more efficient than regular arrays.

4 Likes