I have a set of 9 different arrays, all n by n in size. I need to combine them element wise in order to yield a specific array.
Ex.: Given a set of 9 equally sized arrays:
a1 = np.array([[11, 12, 13], [14, 15, 16], [17, 18, 19]])
a2 = np.array([[21, 22, 23], [24, 25, 26], [27, 28, 29]])
a3 = np.array([[31, 32, 33], [34, 35, 36], [37, 38, 39]])
a4 = np.array([[41, 42, 43], [44, 45, 46], [47, 48, 49]])
a5 = np.array([[51, 52, 53], [54, 55, 56], [57, 58, 59]])
a6 = np.array([[61, 62, 63], [64, 65, 66], [67, 68, 69]])
a7 = np.array([[71, 72, 73], [74, 75, 76], [77, 78, 79]])
a8 = np.array([[81, 82, 83], [84, 85, 86], [87, 88, 89]])
a9 = np.array([[91, 92, 93], [94, 95, 96], [97, 98, 99]])
The desired result would be
b = np.array([[11, 21, 31, 12, 22, 32, 13, 23, 33],
[41, 51, 61, 42, 52, 62, 43, 53, 63],
[71, 81, 91, 72, 82, 92, 73, 83, 94],
[14, 24, 34, 15, 25, 35, 16, 26, 36],
[44, 54, 64, 45, 55, 65, 46, 56, 66],
[74, 84, 94, 75, 85, 95, 76, 86, 96],
[17, 27, 37, 18, 28, 38, 19, 29, 39],
[47, 57, 67, 48, 58, 68, 49, 59, 69],
[77, 87, 97, 78, 88, 98, 79, 89, 99]])
So the first row of array b is made up of the first rows of a1, a2, and a3, combined element wise.
The second row of array b is made up of the first rows of a4, a5, and a6, combined element wise.
The third row is made up of the first rows of a7, a8, and a9, combined element wise.
And then the same pattern continues for the rest of the rows in a1-a9.
This needs to work for any size of the a1-a9 arrays, as in the arrays being n by n in size. I've tried tinkering with np.concatenate, zip, and np.einsum, all with no luck.