MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / analyse_samples

Function analyse_samples

Source/ThirdParty/catch2/catch.hpp:7805–7846  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7803 }
7804
7805 bootstrap_analysis analyse_samples(double confidence_level, int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last) {
7806 CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
7807 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
7808 static std::random_device entropy;
7809 CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
7810
7811 auto n = static_cast<int>(last - first); // seriously, one can't use integral types without hell in C++
7812
7813 auto mean = &Detail::mean<std::vector<double>::iterator>;
7814 auto stddev = &standard_deviation;
7815
7816#if defined(CATCH_CONFIG_USE_ASYNC)
7817 auto Estimate = [=](double(*f)(std::vector<double>::iterator, std::vector<double>::iterator)) {
7818 auto seed = entropy();
7819 return std::async(std::launch::async, [=] {
7820 std::mt19937 rng(seed);
7821 auto resampled = resample(rng, n_resamples, first, last, f);
7822 return bootstrap(confidence_level, first, last, resampled, f);
7823 });
7824 };
7825
7826 auto mean_future = Estimate(mean);
7827 auto stddev_future = Estimate(stddev);
7828
7829 auto mean_estimate = mean_future.get();
7830 auto stddev_estimate = stddev_future.get();
7831#else
7832 auto Estimate = [=](double(*f)(std::vector<double>::iterator, std::vector<double>::iterator)) {
7833 auto seed = entropy();
7834 std::mt19937 rng(seed);
7835 auto resampled = resample(rng, n_resamples, first, last, f);
7836 return bootstrap(confidence_level, first, last, resampled, f);
7837 };
7838
7839 auto mean_estimate = Estimate(mean);
7840 auto stddev_estimate = Estimate(stddev);
7841#endif // CATCH_USE_ASYNC
7842
7843 double outlier_variance = Detail::outlier_variance(mean_estimate, stddev_estimate, n);
7844
7845 return { mean_estimate, stddev_estimate, outlier_variance };
7846 }
7847 } // namespace Detail
7848 } // namespace Benchmark
7849} // namespace Catch

Callers 1

analyseFunction · 0.85

Calls 5

resampleFunction · 0.85
bootstrapFunction · 0.85
EstimateClass · 0.85
outlier_varianceFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected