The code I want to optimize is:
index_min = sum( input > quantiles );
where quantiles is a vector of doubles in increasing order. I am using the sum function to find the index of quantiles that corresponds to the value of input. I think the "find" function is actually slower.