[python] Remove useless code

This commit is contained in:
Émilie Feral
2020-03-26 17:55:48 +01:00
parent f97f56c021
commit 1895b83251

View File

@@ -176,24 +176,6 @@ mp_obj_t modpyplot_grid(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
// Dichotomia to find which bin a value belongs to
size_t belongs_to_bin_of_index(mp_float_t v, mp_obj_t * binsEdges, size_t minIndex, size_t maxIndex) {
assert(mp_obj_get_float(binsEdges[minIndex]) <= v && v <= mp_obj_get_float(binsEdges[maxIndex]));
if (maxIndex - minIndex < 2) {
return minIndex;
}
size_t index = (minIndex+maxIndex)/2;
mp_float_t pivot = mp_obj_get_float(binsEdges[index]);
if (pivot == v) {
return index;
} else if (pivot < v) {
return belongs_to_bin_of_index(v, binsEdges, index, maxIndex);
} else {
assert(pivot > v);
return belongs_to_bin_of_index(v, binsEdges, minIndex, index);
}
}
mp_obj_t modpyplot_hist(mp_obj_t x) {
// Create a list of bins
// TODO: the number of bins can be given as input