33 using Variant =
decltype(Result::fit);
34 std::optional<Variant> best;
35 double bestValue = std::numeric_limits<double>::infinity();
36 std::size_t bestIndex = 0;
37 std::size_t index = 0;
38 auto consider = [&]<
class Distribution>() {
40 auto candidate = fit<Distribution>(sample);
41 const double value = criterion == Criterion::AIC ? candidate.aic : candidate.bic;
42 if (candidate.converged && std::isfinite(value) && value < bestValue) {
43 best.emplace(std::move(candidate));
47 }
catch (
const std::exception &) {
51 consider.template operator()<First>();
52 (consider.template operator()<Rest>(), ...);
55 return {std::move(*best), bestIndex, criterion, bestValue};
Real standardNormal(G &g)
Ziggurat algorithm of Marsaglia and Tsang with 256 layers and an explicit sign bit.
Definition variates.hpp:45