I have a set of (numpy) 2d arrays of size N Each element is a 2d numpy array like
set_of_arrays[7] == array([[ 5, 3],
[ 1, 5],
[ 8, -1],
[ 6, 6]])
set_of_arrays[123] = array([[ 5, 3, 1, 5, 8, -1, 6, 6],
[ 5, 3, 1, 5, 8, -1, 6, 6]])
and so on. The size and shape of each element of set_of_arrays is known. It turns out, that each element of set_of_arrays represents a submatrix (subarray). The question is: for a given 2-d array M, which shape is also known, we want to construct M consistent of subarrays from set_of_arrays. How to construct the matrix M in an automatic way? I saw the np.block() function, but the subarrays should be given explicitely like
M = np.block([[set_of_arrays[0], set_of_arrays[1]], [set_of_arrays[3], set_of_arrays[4]], ...])
However, this needs a lot of hands programming, a lot of brackets [[], [], [], []]. I dont know the number N of subblocks, but it is assured, that the (sub)arrays from set_of_arrays all has correct sizes, allowing to create the matrix M. How to do that? ideally would be something like
Thanks for aswering