I try to remove the values from the matrix according to the sequence, so that in the first line the highest value remains in the last position and in the last in the last position the lowest which is entered according to the condition. For example, I want to make a matrix from a 7x4 matrix 4x4 so the highest value in the last row will be 44 and will gradually increase line by line until the last value in the first row is 17 This can be better seen in a specific example
I remove the columns according to the formula:
n-b+1=The number of columns how many should remain in the matrix
where
n=number of columns
b= numbers of rows
Examples
input1
import numpy as np
a1 = np.array([[11, 12, 13, 14,15,16,17],
[21, 22, 23, 24,25,26,27],
[31, 32, 33, 34,35,36,37],
[41, 42, 43, 44,45,46,47]])
required output1= n-b+1=7-4+1=4
a1 = np.array([[14,15,16,17],
[23,24,25,26],
[32,33,34,35],
[41, 42, 43,44]])
input2
a2 = np.array([[11 12, 13, 14,15],
[21, 22, 23, 24,25],
[31, 32, 33, 34,35]])
required output2= n-b+1=5-3+1=3
a2 = np.array([[13, 14,15],
[22, 23, 24],
[31, 32, 33]])
It is possible?