HestonEstimator.HestonCallOptimizationProblem.FindExtremes C# (CSharp) Method

FindExtremes() private method

Finds the couple of integer {i,j} so that the values vector[i], vector[i+1],..., vector[j-1], vector[j] are all included in the interval (bound[0], bound[1]) while vector[i-1] and vector[j+1] are not.
private FindExtremes ( Vector vector, Vector bounds ) : int[]
vector Vector /// Vector to be filtered. ///
bounds Vector /// Bounds to be used for the filtering. ///
return int[]
        private int[] FindExtremes(Vector vector, Vector bounds)
        {
            int[] result = new int[2];
            int i = 0;

            while (vector[i] < bounds[0])
                i++;
            result[0] = i;
            i = vector.Length - 1;
            while (vector[i] > bounds[1])
                i--;
            result[1] = i;
            return result;
        }