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

Function analyse_samples

test/expected/catch.hpp:7725–7766  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7723 }
7724
7725 bootstrap_analysis analyse_samples(double confidence_level, int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last) {
7726 CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
7727 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
7728 static std::random_device entropy;
7729 CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
7730
7731 auto n = static_cast<int>(last - first); // seriously, one can't use integral types without hell in C++
7732
7733 auto mean = &Detail::mean<std::vector<double>::iterator>;
7734 auto stddev = &standard_deviation;
7735
7736#if defined(CATCH_CONFIG_USE_ASYNC)
7737 auto Estimate = [=](double(*f)(std::vector<double>::iterator, std::vector<double>::iterator)) {
7738 auto seed = entropy();
7739 return std::async(std::launch::async, [=] {
7740 std::mt19937 rng(seed);
7741 auto resampled = resample(rng, n_resamples, first, last, f);
7742 return bootstrap(confidence_level, first, last, resampled, f);
7743 });
7744 };
7745
7746 auto mean_future = Estimate(mean);
7747 auto stddev_future = Estimate(stddev);
7748
7749 auto mean_estimate = mean_future.get();
7750 auto stddev_estimate = stddev_future.get();
7751#else
7752 auto Estimate = [=](double(*f)(std::vector<double>::iterator, std::vector<double>::iterator)) {
7753 auto seed = entropy();
7754 std::mt19937 rng(seed);
7755 auto resampled = resample(rng, n_resamples, first, last, f);
7756 return bootstrap(confidence_level, first, last, resampled, f);
7757 };
7758
7759 auto mean_estimate = Estimate(mean);
7760 auto stddev_estimate = Estimate(stddev);
7761#endif // CATCH_USE_ASYNC
7762
7763 double outlier_variance = Detail::outlier_variance(mean_estimate, stddev_estimate, n);
7764
7765 return { mean_estimate, stddev_estimate, outlier_variance };
7766 }
7767 } // namespace Detail
7768 } // namespace Benchmark
7769} // 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