Skip to content

Commit

Permalink
[Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1
Browse files Browse the repository at this point in the history
  • Loading branch information
stan-buildbot committed Apr 19, 2024
1 parent 3cb8e97 commit da5bb8d
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ inline std::pair<double, double> compute_potential_scale_reduction_rank(
*/
inline double compute_potential_scale_reduction(
const std::vector<const double*>& draws, const std::vector<size_t>& sizes) {
return compute_potential_scale_reduction_rank(draws, sizes).first;
return compute_potential_scale_reduction_rank(draws, sizes).first;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/stan/mcmc/chains.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,8 @@ class chains {
sizes[chain] = n_kept_samples;
}

return analyze::compute_split_potential_scale_reduction_rank(draws, sizes).first;
return analyze::compute_split_potential_scale_reduction_rank(draws, sizes)
.first;
}

std::pair<double, double> split_potential_scale_reduction_rank(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ TEST_F(ComputeRhat, compute_potential_scale_reduction) {
chains.add(blocker2);

Eigen::VectorXd rhat(48);
rhat << 1.00067, 0.999789, 0.999656, 1.00055, 1.0011, 1.00088, 1.00032, 0.999969, 1.00201, 0.999558, 0.999555, 0.9995, 1.00292, 1.00516, 1.00591, 0.999753, 1.00088, 1.00895, 1.00079, 0.99953, 1.00092, 1.00044, 1.01005, 0.999598, 1.00151, 0.999659, 0.999648, 0.999627, 1.00315, 1.00277, 1.00247, 1.00003, 0.999937, 1.00116, 0.999521, 1.0005, 1.00091, 1.00213, 1.00019, 0.999767, 1.0003, 0.999815, 1.00003, 0.999672, 1.00306, 1.00072, 0.999602, 0.999789;
rhat << 1.00067, 0.999789, 0.999656, 1.00055, 1.0011, 1.00088, 1.00032,
0.999969, 1.00201, 0.999558, 0.999555, 0.9995, 1.00292, 1.00516, 1.00591,
0.999753, 1.00088, 1.00895, 1.00079, 0.99953, 1.00092, 1.00044, 1.01005,
0.999598, 1.00151, 0.999659, 0.999648, 0.999627, 1.00315, 1.00277,
1.00247, 1.00003, 0.999937, 1.00116, 0.999521, 1.0005, 1.00091, 1.00213,
1.00019, 0.999767, 1.0003, 0.999815, 1.00003, 0.999672, 1.00306, 1.00072,
0.999602, 0.999789;

// replicates calls to stan::analyze::compute_effective_sample_size
// for any interface *without* access to chains class
Expand All @@ -46,7 +52,8 @@ TEST_F(ComputeRhat, compute_potential_scale_reduction) {
sizes[chain] = samples(chain).size();
}
ASSERT_NEAR(rhat(index - 4),
stan::analyze::compute_potential_scale_reduction(draws, sizes), 1e-4)
stan::analyze::compute_potential_scale_reduction(draws, sizes),
1e-4)
<< "rhat for index: " << index
<< ", parameter: " << chains.param_name(index);
}
Expand Down Expand Up @@ -122,7 +129,13 @@ TEST_F(ComputeRhat, compute_potential_scale_reduction_convenience) {
chains.add(blocker2);

Eigen::VectorXd rhat(48);
rhat << 1.00067, 0.999789, 0.999656, 1.00055, 1.0011, 1.00088, 1.00032, 0.999969, 1.00201, 0.999558, 0.999555, 0.9995, 1.00292, 1.00516, 1.00591, 0.999753, 1.00088, 1.00895, 1.00079, 0.99953, 1.00092, 1.00044, 1.01005, 0.999598, 1.00151, 0.999659, 0.999648, 0.999627, 1.00315, 1.00277, 1.00247, 1.00003, 0.999937, 1.00116, 0.999521, 1.0005, 1.00091, 1.00213, 1.00019, 0.999767, 1.0003, 0.999815, 1.00003, 0.999672, 1.00306, 1.00072, 0.999602, 0.999789;
rhat << 1.00067, 0.999789, 0.999656, 1.00055, 1.0011, 1.00088, 1.00032,
0.999969, 1.00201, 0.999558, 0.999555, 0.9995, 1.00292, 1.00516, 1.00591,
0.999753, 1.00088, 1.00895, 1.00079, 0.99953, 1.00092, 1.00044, 1.01005,
0.999598, 1.00151, 0.999659, 0.999648, 0.999627, 1.00315, 1.00277,
1.00247, 1.00003, 0.999937, 1.00116, 0.999521, 1.0005, 1.00091, 1.00213,
1.00019, 0.999767, 1.0003, 0.999815, 1.00003, 0.999672, 1.00306, 1.00072,
0.999602, 0.999789;

Eigen::Matrix<Eigen::VectorXd, Eigen::Dynamic, 1> samples(
chains.num_chains());
Expand Down Expand Up @@ -209,7 +222,12 @@ TEST_F(ComputeRhat, chains_compute_split_potential_scale_reduction) {
chains.add(blocker2);

Eigen::VectorXd rhat(48);
rhat << 1.0078, 1.0109, 0.999187, 1.001, 1.00401, 1.00992, 1.00182, 1.00519, 1.00095, 1.00351, 1.00554, 1.00075, 1.00595, 1.00473, 1.00546, 1.01304, 1.00166, 1.0074, 1.00178, 1.00588, 1.00406, 1.00129, 1.00976, 1.0013, 1.00193, 1.00104, 0.999383, 1.00025, 1.01082, 1.0019, 1.00354, 1.0043, 1.00111, 1.00281, 1.00436, 1.00515, 1.00325, 1.0089, 1.00222, 1.00118, 1.00191, 1.00283, 1.0003, 1.00216, 1.00335, 1.00133, 1.00023, 1.0109;
rhat << 1.0078, 1.0109, 0.999187, 1.001, 1.00401, 1.00992, 1.00182, 1.00519,
1.00095, 1.00351, 1.00554, 1.00075, 1.00595, 1.00473, 1.00546, 1.01304,
1.00166, 1.0074, 1.00178, 1.00588, 1.00406, 1.00129, 1.00976, 1.0013,
1.00193, 1.00104, 0.999383, 1.00025, 1.01082, 1.0019, 1.00354, 1.0043,
1.00111, 1.00281, 1.00436, 1.00515, 1.00325, 1.0089, 1.00222, 1.00118,
1.00191, 1.00283, 1.0003, 1.00216, 1.00335, 1.00133, 1.00023, 1.0109;
for (int index = 4; index < chains.num_params(); index++) {
ASSERT_NEAR(rhat(index - 4), chains.split_potential_scale_reduction(index),
1e-4)
Expand Down Expand Up @@ -286,7 +304,12 @@ TEST_F(ComputeRhat, compute_split_potential_scale_reduction) {
chains.add(blocker2);

Eigen::VectorXd rhat(48);
rhat << 1.0078, 1.0109, 0.999187, 1.001, 1.00401, 1.00992, 1.00182, 1.00519, 1.00095, 1.00351, 1.00554, 1.00075, 1.00595, 1.00473, 1.00546, 1.01304, 1.00166, 1.0074, 1.00178, 1.00588, 1.00406, 1.00129, 1.00976, 1.0013, 1.00193, 1.00104, 0.999383, 1.00025, 1.01082, 1.0019, 1.00354, 1.0043, 1.00111, 1.00281, 1.00436, 1.00515, 1.00325, 1.0089, 1.00222, 1.00118, 1.00191, 1.00283, 1.0003, 1.00216, 1.00335, 1.00133, 1.00023, 1.0109;
rhat << 1.0078, 1.0109, 0.999187, 1.001, 1.00401, 1.00992, 1.00182, 1.00519,
1.00095, 1.00351, 1.00554, 1.00075, 1.00595, 1.00473, 1.00546, 1.01304,
1.00166, 1.0074, 1.00178, 1.00588, 1.00406, 1.00129, 1.00976, 1.0013,
1.00193, 1.00104, 0.999383, 1.00025, 1.01082, 1.0019, 1.00354, 1.0043,
1.00111, 1.00281, 1.00436, 1.00515, 1.00325, 1.0089, 1.00222, 1.00118,
1.00191, 1.00283, 1.0003, 1.00216, 1.00335, 1.00133, 1.00023, 1.0109;

// replicates calls to stan::analyze::compute_effective_sample_size
// for any interface *without* access to chains class
Expand Down Expand Up @@ -379,7 +402,12 @@ TEST_F(ComputeRhat, compute_split_potential_scale_reduction_convenience) {
chains.add(blocker2);

Eigen::VectorXd rhat(48);
rhat << 1.0078, 1.0109, 0.999187, 1.001, 1.00401, 1.00992, 1.00182, 1.00519, 1.00095, 1.00351, 1.00554, 1.00075, 1.00595, 1.00473, 1.00546, 1.01304, 1.00166, 1.0074, 1.00178, 1.00588, 1.00406, 1.00129, 1.00976, 1.0013, 1.00193, 1.00104, 0.999383, 1.00025, 1.01082, 1.0019, 1.00354, 1.0043, 1.00111, 1.00281, 1.00436, 1.00515, 1.00325, 1.0089, 1.00222, 1.00118, 1.00191, 1.00283, 1.0003, 1.00216, 1.00335, 1.00133, 1.00023, 1.0109;
rhat << 1.0078, 1.0109, 0.999187, 1.001, 1.00401, 1.00992, 1.00182, 1.00519,
1.00095, 1.00351, 1.00554, 1.00075, 1.00595, 1.00473, 1.00546, 1.01304,
1.00166, 1.0074, 1.00178, 1.00588, 1.00406, 1.00129, 1.00976, 1.0013,
1.00193, 1.00104, 0.999383, 1.00025, 1.01082, 1.0019, 1.00354, 1.0043,
1.00111, 1.00281, 1.00436, 1.00515, 1.00325, 1.0089, 1.00222, 1.00118,
1.00191, 1.00283, 1.0003, 1.00216, 1.00335, 1.00133, 1.00023, 1.0109;

Eigen::Matrix<Eigen::VectorXd, Eigen::Dynamic, 1> samples(
chains.num_chains());
Expand All @@ -397,7 +425,6 @@ TEST_F(ComputeRhat, compute_split_potential_scale_reduction_convenience) {
1e-4)
<< "rhat for index: " << index
<< ", parameter: " << chains.param_name(index);

}
}

Expand Down
13 changes: 6 additions & 7 deletions src/test/unit/mcmc/chains_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -853,13 +853,12 @@ TEST_F(McmcChains, blocker_split_potential_scale_reduction) {
chains.add(blocker2);

Eigen::VectorXd rhat(48);
rhat << 1.0078, 1.0109, 0.99919, 1.001, 1.00401, 1.00992, 1.00182,
1.00519, 1.00095, 1.00351, 1.00554, 1.00075, 1.00595, 1.00473, 1.00546,
1.01304, 1.00166, 1.0074, 1.00178, 1.00588, 1.00406, 1.00129, 1.00976,
1.0013, 1.00193, 1.00104, 0.99938, 1.00025, 1.01082, 1.0019, 1.00354,
1.0043, 1.00111, 1.00281, 1.00436, 1.00515, 1.00325, 1.0089, 1.00222,
1.00118, 1.00191, 1.00283, 1.0003, 1.00216, 1.00335, 1.00133, 1.00023,
1.0109;
rhat << 1.0078, 1.0109, 0.99919, 1.001, 1.00401, 1.00992, 1.00182, 1.00519,
1.00095, 1.00351, 1.00554, 1.00075, 1.00595, 1.00473, 1.00546, 1.01304,
1.00166, 1.0074, 1.00178, 1.00588, 1.00406, 1.00129, 1.00976, 1.0013,
1.00193, 1.00104, 0.99938, 1.00025, 1.01082, 1.0019, 1.00354, 1.0043,
1.00111, 1.00281, 1.00436, 1.00515, 1.00325, 1.0089, 1.00222, 1.00118,
1.00191, 1.00283, 1.0003, 1.00216, 1.00335, 1.00133, 1.00023, 1.0109;

for (int index = 4; index < chains.num_params(); index++) {
ASSERT_NEAR(rhat(index - 4), chains.split_potential_scale_reduction(index),
Expand Down

0 comments on commit da5bb8d

Please sign in to comment.