Faster way of writing this code: (finding index)
3 views (last 30 days)
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.
Matt Fig on 22 Dec 2012
That code does not return an index, but it does return the number of values in vector quantiles that are smaller than input.