| 455 | } |
| 456 | |
| 457 | std::vector<double> histogram::sqrt_rule(const std::vector<double> &x, |
| 458 | double minx, double maxx, |
| 459 | bool hard_limits) { |
| 460 | size_t nbins = |
| 461 | static_cast<size_t>(std::max(ceil(log2(x.size()) + 1.), 1.)); |
| 462 | if (!hard_limits) { |
| 463 | double binwidth = (maxx - minx) / nbins; |
| 464 | if (std::isfinite(binwidth)) { |
| 465 | return bin_picker(minx, maxx, 0, binwidth); |
| 466 | } else { |
| 467 | return bin_picker(minx, maxx, nbins, binwidth); |
| 468 | } |
| 469 | } else { |
| 470 | return linspace(minx, maxx, nbins + 1); |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | std::vector<double> histogram::sturges_rule(const std::vector<double> &x, |
| 475 | double minx, double maxx, |