| 345 | } |
| 346 | |
| 347 | std::vector<double> bin_pickerbl(double xmin, double xmax, double minlimit, |
| 348 | double maxlimit, double bin_width) { |
| 349 | double xscale = std::max(std::abs(xmin), std::abs(xmax)); |
| 350 | double xrange = xmax - xmin; |
| 351 | bin_width = std::max(bin_width, nextafter(xscale, xscale + 1 - xscale)); |
| 352 | bool non_constant_data = |
| 353 | xrange > std::max(sqrt(nextafter(xscale, xscale + 1 - xscale)), |
| 354 | std::numeric_limits<double>::min()); |
| 355 | if (non_constant_data) { |
| 356 | size_t nbins = std::max( |
| 357 | static_cast<size_t>(((maxlimit - minlimit) / bin_width) + 0.5), |
| 358 | static_cast<size_t>(1)); |
| 359 | return linspace(minlimit, maxlimit, nbins + 1); |
| 360 | } else { |
| 361 | return std::vector<double>({minlimit, maxlimit}); |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | std::vector<double> histogram::scotts_rule(const std::vector<double> &x, |
| 366 | double minx, double maxx, |
no test coverage detected