Compare commits
No commits in common. "1e061095d92a209ebe075f2ab960868a2c70966b" and "2744136d68ab1cceed4737c54c9d5ee3f02367bf" have entirely different histories.
1e061095d9
...
2744136d68
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -334,13 +334,8 @@ void array_print_90_ci_histogram(double* xs, int n_samples, int n_bins){
|
|||
double bin_width = range / n_bins;
|
||||
|
||||
// Fill the bins with sample counts
|
||||
int below_min = 0, above_max = 0;
|
||||
for (int i = 0; i < n_samples; i++) {
|
||||
if(xs[i] < min_value){
|
||||
below_min++;
|
||||
}else if (xs[i] > max_value){
|
||||
above_max++;
|
||||
}else{
|
||||
if((x[i] > min_value) && (x[i] < max_value)){
|
||||
int bin_index = (int)((xs[i] - min_value) / bin_width);
|
||||
if (bin_index == n_bins) {
|
||||
bin_index--; // Last bin includes max_value
|
||||
|
@ -360,17 +355,16 @@ void array_print_90_ci_histogram(double* xs, int n_samples, int n_bins){
|
|||
double scale = max_bin_count > MAX_WIDTH ? (double)MAX_WIDTH / max_bin_count : 1.0;
|
||||
|
||||
// Print the histogram
|
||||
for (int i = 0; i < n_bins; i++) {
|
||||
double bin_start = min_value + i * bin_width;
|
||||
double bin_end = bin_start + bin_width;
|
||||
|
||||
int decimalPlaces = 1;
|
||||
if((0 < bin_width) && (bin_width < 1)){
|
||||
int magnitude = (int) floor(log10(bin_width));
|
||||
decimalPlaces = -magnitude;
|
||||
decimalPlaces = decimalPlaces > 10 ? 10 : decimalPlaces;
|
||||
}
|
||||
printf( " (-∞, %*.*f): %d\n", 4+decimalPlaces, decimalPlaces, min_value, below_min);
|
||||
for (int i = 0; i < n_bins; i++) {
|
||||
double bin_start = min_value + i * bin_width;
|
||||
double bin_end = bin_start + bin_width;
|
||||
|
||||
printf(" [%*.*f, %*.*f", 4+decimalPlaces, decimalPlaces, bin_start, 4+decimalPlaces, decimalPlaces, bin_end);
|
||||
char interval_delimiter = ')';
|
||||
if(i == (n_bins-1)){
|
||||
|
@ -384,7 +378,6 @@ void array_print_90_ci_histogram(double* xs, int n_samples, int n_bins){
|
|||
}
|
||||
printf(" %d\n", bins[i]);
|
||||
}
|
||||
printf( " (%*.*f, +∞): %d\n", 4+decimalPlaces, decimalPlaces, max_value, above_max);
|
||||
|
||||
// Free the allocated memory for bins
|
||||
free(bins);
|
||||
|
|
Loading…
Reference in New Issue
Block a user