From 77a6b8127b1e46859d1b4d333f910d8023fab57d Mon Sep 17 00:00:00 2001 From: FilippoBovo Date: Thu, 26 Mar 2020 11:43:57 +0000 Subject: [PATCH] Rename variables and increase package version number. --- c/base.c | 5 +++-- c/robustats.c | 14 +++++++------- setup.py | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/c/base.c b/c/base.c index af28a58..aec12f8 100644 --- a/c/base.c +++ b/c/base.c @@ -550,7 +550,8 @@ double select_kth_smallest(double *x, int64_t n, int64_t k) x_copy[i] = x[i]; } - double ret = partition_on_kth_smallest(x_copy, 0, n - 1, k); + double kth_smallest = partition_on_kth_smallest(x_copy, 0, n - 1, k); free(x_copy); - return ret; + + return kth_smallest; } diff --git a/c/robustats.c b/c/robustats.c index 249eefe..c1e1282 100644 --- a/c/robustats.c +++ b/c/robustats.c @@ -23,14 +23,14 @@ */ double weighted_median(double *x, double *w, int64_t begin, int64_t end) { - int64_t dn, n, i, median_index; + int64_t xw_n, n, i, median_index; double median, w_middle; double w_lower_sum, w_lower_sum_norm, w_higher_sum, w_higher_sum_norm; - dn = end - begin + 1; // Length between begin and end - double **xw = zip(x, w, dn); + xw_n = end - begin + 1; // Length between begin and end + double **xw = zip(x, w, xw_n); - double w_sum = sum_double(w, dn); + double w_sum = sum_double(w, xw_n); while (1) { @@ -38,12 +38,12 @@ double weighted_median(double *x, double *w, int64_t begin, int64_t end) if (n == 1) { - free_zip_memory(xw, dn); + free_zip_memory(xw, xw_n); return x[begin]; } else if (n == 2) { - free_zip_memory(xw, dn); + free_zip_memory(xw, xw_n); if (w[begin] >= w[end]) return x[begin]; else @@ -69,7 +69,7 @@ double weighted_median(double *x, double *w, int64_t begin, int64_t end) if (w_lower_sum_norm < 0.5 && w_higher_sum_norm < 0.5) { - free_zip_memory(xw, dn); + free_zip_memory(xw, xw_n); return median; } else if (w_lower_sum_norm > 0.5) diff --git a/setup.py b/setup.py index d2820eb..a5faece 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name = 'robustats', - version = '0.1.3', + version = '0.1.4', description = 'Robustats is a Python library for high-performance ' 'computation of robust statistical estimators.', long_description=long_description,