make format

This commit is contained in:
NunoSempere 2024-02-02 18:05:49 +01:00
parent 19367b04cd
commit 4874f1fa9c

View File

@ -189,7 +189,8 @@ ci array_get_90_ci(double xs[], int n)
return array_get_ci((ci) { .low = 0.05, .high = 0.95 }, xs, n); return array_get_ci((ci) { .low = 0.05, .high = 0.95 }, xs, n);
} }
double array_get_median(double xs[], int n){ double array_get_median(double xs[], int n)
{
int median_k = (int)floor(0.5 * n); int median_k = (int)floor(0.5 * n);
return quickselect(median_k, xs, n); return quickselect(median_k, xs, n);
} }
@ -205,7 +206,8 @@ void array_print(double xs[], int n)
printf("]\n"); printf("]\n");
} }
void array_print_stats(double xs[], int n){ void array_print_stats(double xs[], int n)
{
ci ci_90 = array_get_ci((ci) { .low = 0.05, .high = 0.95 }, xs, n); ci ci_90 = array_get_ci((ci) { .low = 0.05, .high = 0.95 }, xs, n);
ci ci_80 = array_get_ci((ci) { .low = 0.1, .high = 0.9 }, xs, n); ci ci_80 = array_get_ci((ci) { .low = 0.1, .high = 0.9 }, xs, n);
ci ci_50 = array_get_ci((ci) { .low = 0.25, .high = 0.75 }, xs, n); ci ci_50 = array_get_ci((ci) { .low = 0.25, .high = 0.75 }, xs, n);
@ -224,8 +226,8 @@ void array_print_stats(double xs[], int n){
mean, std, ci_90.low, ci_80.low, ci_50.low, median, ci_50.high, ci_80.high, ci_90.high); mean, std, ci_90.low, ci_80.low, ci_50.low, median, ci_50.high, ci_80.high, ci_90.high);
} }
void array_print_histogram(double* xs, int n_samples, int n_bins)
void array_print_histogram(double* xs, int n_samples, int n_bins) { {
// Interface inspired by <https://github.com/red-data-tools/YouPlot> // Interface inspired by <https://github.com/red-data-tools/YouPlot>
// Generated with the help of an llm; there might be subtle off-by-one errors // Generated with the help of an llm; there might be subtle off-by-one errors
if (n_bins <= 1) { if (n_bins <= 1) {
@ -309,7 +311,8 @@ void array_print_histogram(double* xs, int n_samples, int n_bins) {
free(bins); free(bins);
} }
void array_print_90_ci_histogram(double* xs, int n_samples, int n_bins){ void array_print_90_ci_histogram(double* xs, int n_samples, int n_bins)
{
// Code duplicated from previous function // Code duplicated from previous function
// I'll consider simplifying it at some future point // I'll consider simplifying it at some future point
// Possible ideas: // Possible ideas: