Consider this 2D array:
import numpy as np
a = np.array([[3,1,5,3],[1,4,8,2],[4,2,1,2],[9,2,4,4]])
I know how to find the maximum entry of each row: np.amax(a, axis=1). This returns array([5,8,4,9])
What I would like to do, however, is to get the maximum entry of each row after a certain index n, i.e. ignoring the first n terms and just looking for the maximum amongst the remaining entries in that row, for each row.
One complication: the point at which I "slice" each row is different for each row.
Example: I want to calculate the maximum of each row, but only amongst the last 2 entries in the first row, the last 3 entries in the second row, the last 2 in the third row, and the last 1 in the fourth row. This should return array([5,8,2,4])
If this can be done without for or while loops, that would be great -- I really cannot use them due to computational time limits.
[5,8,4,9]forn=0,[8,4,9]forn=1,[4,9]forn=2, etc