I try to go through the matrix and gradually chain the values according to the sequence. First combine the first two values in the first row with the second value in the second row, then combine the first two values in the second row with the second value in the third row, and so on. If it then passes the last line, it returns to the beginning and takes the first three values from the first line and the third value in the second line. Then the first 3 values in the second row with the third value in the fourth row and continues in the same way until the end of the matrix. This is better seen in the example below.
Size matrix is not fixed
Example:
import numpy as np
np.array([[11,12,13,14],
[21,22,23,24],
[31,32,33,34],
[41,42,43,44],
[51,52,53,54]])
required output:
[11 21]
[21 31]
[31 41]
[41 51]
[11 12 22]
[21 22 32]
[31 32 42]
[41 42 52]
[11 12 13 23]
[21 22 23 33]
[31 32 33 43]
[41 42 43 53]
can anyone help me?