Hello
I read in the MMA help for Flatten that
"If the mij are matrices, Flatten[{{m11,m12},{m21,m22}},{{1,3},{2,4}}] effectively constructs a single matrix from the “blocks” mij. "
This line is too me too terse to me as I cannot understand from the parameters {{1,3},{2,4}} the logic behind the construction of that single matrix (what do these parameters correspond to ?) and when you modify the order of these parameters the result is quite puzzlling. .
Let’s take an example.
u = {{a, b}, {c, d}}
exp = {{0 u, u}, {2 u, 3 u}}
Flatten[exp, {{1, 4}, {2, 3}}] // MatrixForm (* Example similar to the one from the Help *)
Flatten[exp, {{3, 4}, {2, 1}}] // MatrixForm (* How do you explain the reordering you get in the matrix from these parameters ? *)
Flatten[exp, {{4, 2}, {1, 3}}] // MatrixForm (* same question *)
Moreover if the initial blocks are not of the same shape, you may get a single matrix from a given order of the parameters between the curly braces:
u = {{a, b}, {c, d, e}}
exp = {{0 u, u}, {2 u, 3 u}}
Flatten[exp, {{1, 4}, {2, 3}}] // MatrixForm (*the result is not a single matrix *)
Flatten[exp, {{3, 4}, {2, 1}}] // MatrixForm (* here it is *)
How do you explain the last example?
Thanks


