I currently have code that's working but inefficient due to nested for loops, and I would like to vectorize it as possible. My data set is a higher dimensional array (a,b,.....z), and I'd like to find the maximum of each vector of z subject to a constraint based on the values of the other vectors.
For example, take a 3 dimensional array (a,b,c). I will have calculated a matrix (a x b-sized) of a constraint. I'd like to find a (a x b-sized) matrix that gives the maximum of each c vector that is measured only on the domain of (constraint:end). Let me know if there is a way to do this without for loops.
(edited for clarity)