Faster way of writing this code: (finding index)
조회 수: 3(최근 30일)
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 2012년 12월 22일
That code does not return an index, but it does return the number of values in vector quantiles that are smaller than input.