Building block matrix with numpy

Viewed 19

I'm trying to build up a block matrix from another one, but I can't figure out which numpy function I should use. Here is what I want:

Input:

[[1,2,3],
 [4,5,6],   and [1,3,2]
 [7,8,9]]

Wanted output:

[[1,2,2,2,3,3],
 [4,5,5,5,6,6],
 [4,5,5,5,6,6],
 [4,5,5,5,6,6],
 [7,8,8,8,9,9],
 [7,8,8,8,9,9]]

I've tried to se numpy.repeat and numpy.block, but I din't figure out to do it.

Can you help me?

Thanks in advance!

0 Answers
Related