1

For example, I got the following 2D array

a= np.array([[1,2,3],
[2,5,6],
[3,6,9]])

If I know the dimension of each block square matrix of diagonal, i.e

2,3,2

How can I generate the following 2D block array

[[1,1,2,2,2,3,3],
[1,1,2,2,2,3,3],
[2,2,5,5,5,6,6],
[2,2,5,5,5,6,6],
[2,2,5,5,5,6,6],
[3,3,6,6,6,9,9],
[3,3,6,6,6,9,9]]
Nicolas H
  • 535
  • 3
  • 13

0 Answers0