def _cvm_2samp_fast(prepared_data1, data2, prepared_weights1, weights2, F1, power=2.):
    indices = numpy.searchsorted(prepared_data1, data2)
    weights2 /= numpy.sum(weights2)
    prepared_weights2 = numpy.bincount(indices, weights=weights2, minlength=len(prepared_data1))
    F2 = compute_cdf(prepared_weights2)
    return numpy.average(numpy.abs(F1 - F2) ** power, weights=prepared_weights1)
Pay attention - prepared data should not only be sorted,
dataset/ETHPy150Open anaderi/lhcb_trigger_ml/hep_ml/metrics_utils.py/_cvm_2samp_fast