add C function and cython wrapper to do what we need for quantile search