From 199155d81c7930df2a065ada1ccf0aa2f2c2ce08 Mon Sep 17 00:00:00 2001 From: Stan Jenkins Date: Mon, 21 Oct 2024 16:24:19 -0400 Subject: [PATCH] [Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1 --- .../mcmc/compute_effective_sample_size.hpp | 19 ++++++++++-------- .../compute_potential_scale_reduction.hpp | 20 +++++++++++-------- src/stan/analyze/mcmc/ess.hpp | 2 +- src/test/unit/mcmc/chainset_test.cpp | 14 ++++++------- 4 files changed, 30 insertions(+), 25 deletions(-) diff --git a/src/stan/analyze/mcmc/compute_effective_sample_size.hpp b/src/stan/analyze/mcmc/compute_effective_sample_size.hpp index bdfbbfd142..cb17a83223 100644 --- a/src/stan/analyze/mcmc/compute_effective_sample_size.hpp +++ b/src/stan/analyze/mcmc/compute_effective_sample_size.hpp @@ -36,8 +36,9 @@ __attribute__((deprecated)) #elif defined(_MSC_VER) __declspec(deprecated) #endif -inline double compute_effective_sample_size(std::vector draws, - std::vector sizes) { +inline double +compute_effective_sample_size(std::vector draws, + std::vector sizes) { int num_chains = sizes.size(); size_t num_draws = sizes[0]; for (int chain = 1; chain < num_chains; ++chain) { @@ -170,8 +171,8 @@ __attribute__((deprecated)) #elif defined(_MSC_VER) __declspec(deprecated) #endif -inline double compute_effective_sample_size(std::vector draws, - size_t size) { +inline double +compute_effective_sample_size(std::vector draws, size_t size) { int num_chains = draws.size(); std::vector sizes(num_chains, size); return compute_effective_sample_size(draws, sizes); @@ -203,8 +204,9 @@ __attribute__((deprecated)) #elif defined(_MSC_VER) __declspec(deprecated) #endif -inline double compute_split_effective_sample_size( - std::vector draws, std::vector sizes) { +inline double +compute_split_effective_sample_size(std::vector draws, + std::vector sizes) { int num_chains = sizes.size(); size_t num_draws = sizes[0]; for (int chain = 1; chain < num_chains; ++chain) { @@ -246,8 +248,9 @@ __attribute__((deprecated)) #elif defined(_MSC_VER) __declspec(deprecated) #endif -inline double compute_split_effective_sample_size( - std::vector draws, size_t size) { +inline double +compute_split_effective_sample_size(std::vector draws, + size_t size) { int num_chains = draws.size(); std::vector sizes(num_chains, size); return compute_split_effective_sample_size(draws, sizes); diff --git a/src/stan/analyze/mcmc/compute_potential_scale_reduction.hpp b/src/stan/analyze/mcmc/compute_potential_scale_reduction.hpp index ff2363e643..0404401071 100644 --- a/src/stan/analyze/mcmc/compute_potential_scale_reduction.hpp +++ b/src/stan/analyze/mcmc/compute_potential_scale_reduction.hpp @@ -39,8 +39,9 @@ __attribute__((deprecated)) #elif defined(_MSC_VER) __declspec(deprecated) #endif -inline double compute_potential_scale_reduction( - std::vector draws, std::vector sizes) { +inline double +compute_potential_scale_reduction(std::vector draws, + std::vector sizes) { int num_chains = sizes.size(); size_t num_draws = sizes[0]; if (num_draws == 0) { @@ -131,8 +132,9 @@ __attribute__((deprecated)) #elif defined(_MSC_VER) __declspec(deprecated) #endif -inline double compute_potential_scale_reduction( - std::vector draws, size_t size) { +inline double +compute_potential_scale_reduction(std::vector draws, + size_t size) { int num_chains = draws.size(); std::vector sizes(num_chains, size); return compute_potential_scale_reduction(draws, sizes); @@ -161,8 +163,9 @@ __attribute__((deprecated)) #elif defined(_MSC_VER) __declspec(deprecated) #endif -inline double compute_split_potential_scale_reduction( - std::vector draws, std::vector sizes) { +inline double +compute_split_potential_scale_reduction(std::vector draws, + std::vector sizes) { int num_chains = sizes.size(); size_t num_draws = sizes[0]; for (int chain = 1; chain < num_chains; ++chain) { @@ -201,8 +204,9 @@ __attribute__((deprecated)) #elif defined(_MSC_VER) __declspec(deprecated) #endif -inline double compute_split_potential_scale_reduction( - std::vector draws, size_t size) { +inline double +compute_split_potential_scale_reduction(std::vector draws, + size_t size) { int num_chains = draws.size(); std::vector sizes(num_chains, size); return compute_split_potential_scale_reduction(draws, sizes); diff --git a/src/stan/analyze/mcmc/ess.hpp b/src/stan/analyze/mcmc/ess.hpp index dedc0f7b50..33342ce68a 100644 --- a/src/stan/analyze/mcmc/ess.hpp +++ b/src/stan/analyze/mcmc/ess.hpp @@ -21,7 +21,7 @@ namespace analyze { * which normalizes lag-k autocorrelation estimators by N instead of (N - k), * yielding biased but more stable estimators as discussed in Geyer (1992); see * https://projecteuclid.org/euclid.ss/1177011137. - * + * * @param chains matrix of draws across all chains * @return effective sample size for the specified parameter */ diff --git a/src/test/unit/mcmc/chainset_test.cpp b/src/test/unit/mcmc/chainset_test.cpp index 6d5db4bd19..5647652485 100644 --- a/src/test/unit/mcmc/chainset_test.cpp +++ b/src/test/unit/mcmc/chainset_test.cpp @@ -170,8 +170,7 @@ TEST_F(McmcChains, summary_stats) { EXPECT_NEAR(theta_sd_expect, bern_chains.sd("theta"), 1e-5); double theta_mad_expect = 0.12309; - EXPECT_NEAR(theta_mad_expect, bern_chains.max_abs_deviation("theta"), - 1e-5); + EXPECT_NEAR(theta_mad_expect, bern_chains.max_abs_deviation("theta"), 1e-5); double theta_mcse_mean_expect = 0.003234; EXPECT_NEAR(theta_mcse_mean_expect, bern_chains.mcse_mean("theta"), 1e-4); @@ -182,8 +181,8 @@ TEST_F(McmcChains, summary_stats) { Eigen::VectorXd probs(6); probs << 0.0, 0.01, 0.05, 0.95, 0.99, 1.0; Eigen::VectorXd quantiles_expect(6); - quantiles_expect << 0.004072, 0.046281, 0.077169, 0.473885, - 0.574524, 0.698401; + quantiles_expect << 0.004072, 0.046281, 0.077169, 0.473885, 0.574524, + 0.698401; Eigen::VectorXd theta_quantiles = bern_chains.quantiles("theta", probs); for (size_t i = 0; i < probs.size(); ++i) { EXPECT_NEAR(quantiles_expect(i), theta_quantiles(i), 1e-5); @@ -196,14 +195,13 @@ TEST_F(McmcChains, summary_stats) { double theta_ess_bulk_expect = 1407.5124; double theta_ess_tail_expect = 1291.7131; auto ess = bern_chains.split_rank_normalized_ess("theta"); - EXPECT_NEAR(theta_ess_bulk_expect, ess.first, 1e-4); + EXPECT_NEAR(theta_ess_bulk_expect, ess.first, 1e-4); EXPECT_NEAR(theta_ess_tail_expect, ess.second, 1e-4); // autocorrelation - first 10 lags Eigen::VectorXd theta_ac_expect(10); - theta_ac_expect << 1.00000, 0.42204, 0.20683, - 0.08383, 0.037326, 0.02507, 0.02003, - 0.01347, 0.00476, 0.029495; + theta_ac_expect << 1.00000, 0.42204, 0.20683, 0.08383, 0.037326, 0.02507, + 0.02003, 0.01347, 0.00476, 0.029495; auto theta_ac = bern_chains.autocorrelation(0, "theta"); for (size_t i = 0; i < 10; ++i) { EXPECT_NEAR(theta_ac(i), theta_ac_expect(i), 0.0005);