I would like to better understand how to slice matrices of matrices.
For example, I initialise a matrix of matrices this way:
M = [[1 0; 0 2] for i = 1:2, j=1:2]
If I slice it this way: M[1,1][:,:]
I obtain the result [1 0; 0 2]
, which is what I would expect. It correspond to the entry (1,1) of M
.
However of I slice is that way M[:,:][1,1]
I obtain a similar result. I would expect to obtain the result [1 1; 1 1]
because each matrix of M
has 1 in position (1,1).
Is it possible to obtain this results using slicing? Or does one need to iterate explicitly over M
to extract this information ?
thanks in advance & best regards !