Skip to content

Commit

Permalink
Rename variables and increase package version number.
Browse files Browse the repository at this point in the history
  • Loading branch information
FilippoBovo committed Mar 26, 2020
1 parent d932ea2 commit 77a6b81
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions c/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
14 changes: 7 additions & 7 deletions c/robustats.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,27 @@
*/
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)
{
n = end - begin + 1; // Length between begin and 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
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 77a6b81

Please sign in to comment.