From 58b3e6b8b864b957ce05a2a87e03bb9427d2f530 Mon Sep 17 00:00:00 2001 From: Stan Jenkins Date: Tue, 1 Aug 2023 04:40:40 -0400 Subject: [PATCH] [Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1 --- stan/math/prim/functor/hcubature.hpp | 8 ++-- stan/math/prim/prob/wiener_full_lpdf.hpp | 3 +- .../unit/math/prim/functor/hcubature_test.cpp | 42 +++++++++---------- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/stan/math/prim/functor/hcubature.hpp b/stan/math/prim/functor/hcubature.hpp index 4066d4999a2..e0668850be2 100644 --- a/stan/math/prim/functor/hcubature.hpp +++ b/stan/math/prim/functor/hcubature.hpp @@ -192,7 +192,7 @@ template std::pair gauss_kronrod(const F& integrand, const double a, const double b, const ParsPairT& pars_pair) { - Eigen::VectorXd c {{0.5 * (a + b)}}; + Eigen::VectorXd c{{0.5 * (a + b)}}; Eigen::VectorXd cp(1); Eigen::VectorXd cm(1); double delta = 0.5 * (b - a); @@ -520,10 +520,12 @@ double hcubature(const F& integrand, const ParsTuple& pars, const int dim, auto&& box = ms[err_idx]; double w = (box.b_[box.kdiv_] - box.a_[box.kdiv_]) / 2; - Eigen::VectorXd ma = Eigen::Map(box.a_.data(), box.a_.size()); + Eigen::VectorXd ma + = Eigen::Map(box.a_.data(), box.a_.size()); ma[box.kdiv_] += w; - Eigen::VectorXd mb = Eigen::Map(box.b_.data(), box.b_.size()); + Eigen::VectorXd mb + = Eigen::Map(box.b_.data(), box.b_.size()); mb[box.kdiv_] -= w; double result_1; diff --git a/stan/math/prim/prob/wiener_full_lpdf.hpp b/stan/math/prim/prob/wiener_full_lpdf.hpp index 88e8e5246db..b0431524cb9 100644 --- a/stan/math/prim/prob/wiener_full_lpdf.hpp +++ b/stan/math/prim/prob/wiener_full_lpdf.hpp @@ -288,7 +288,7 @@ inline ReturnT wiener_full_lpdf(const T_y& y, const T_a& a, const T_t0& t0, T_st0>::value) { return 0; } - + using T_y_ref = ref_type_t; using T_a_ref = ref_type_t; using T_v_ref = ref_type_t; @@ -392,7 +392,6 @@ inline ReturnT wiener_full_lpdf(const T_y& y, const T_a& a, const T_t0& t0, } } - const double log_error_density = log(1e-6); // precision for density const double error_bound = precision_derivatives; // precision for // derivatives (controllable by user) diff --git a/test/unit/math/prim/functor/hcubature_test.cpp b/test/unit/math/prim/functor/hcubature_test.cpp index 2b1df83761d..774b1464a56 100644 --- a/test/unit/math/prim/functor/hcubature_test.cpp +++ b/test/unit/math/prim/functor/hcubature_test.cpp @@ -105,9 +105,9 @@ stan::return_type_t f7(const T_x& x, double a) { template void test_integration(const F& f, const ArgsTupleT& pars, int dim, - const Eigen::VectorXd& a, const Eigen::VectorXd& b, int maxEval, - double reqAbsError, const Eigen::VectorXd& reqRelError, - double val) { + const Eigen::VectorXd& a, const Eigen::VectorXd& b, + int maxEval, double reqAbsError, + const Eigen::VectorXd& reqRelError, double val) { using stan::math::hcubature; for (auto tolerance : reqRelError) { @@ -122,44 +122,44 @@ TEST(StanMath_hcubature_prim, test1) { // https://www.quantargo.com/help/r/latest/packages/cubature/2.0.4.1/hcubature int dim = 1; - const Eigen::VectorXd a {{0.0}}; - const Eigen::VectorXd b {{1.0}}; - const Eigen::VectorXd reqRelError {{1e-4, 1e-6, 1e-7}}; + const Eigen::VectorXd a{{0.0}}; + const Eigen::VectorXd b{{1.0}}; + const Eigen::VectorXd reqRelError{{1e-4, 1e-6, 1e-7}}; test_integration(hcubature_test::f1, std::make_tuple(), dim, a, b, 6000, 0.0, reqRelError, 0.841471); dim = 2; - const Eigen::VectorXd a_2 {{0.0, 0.0}}; - const Eigen::VectorXd b_2 {{1.0, 1.0}}; + const Eigen::VectorXd a_2{{0.0, 0.0}}; + const Eigen::VectorXd b_2{{1.0, 1.0}}; test_integration(hcubature_test::f2, std::make_tuple(), dim, a_2, b_2, 6000, 0.0, reqRelError, 0.7080734); - const Eigen::VectorXd reqRelError_2 {{1e-4}}; + const Eigen::VectorXd reqRelError_2{{1e-4}}; test_integration(hcubature_test::f3, - std::make_tuple(0.50124145262344534123412), dim, a_2, b_2, 10000, - 0.0, reqRelError_2, 0.1972807); + std::make_tuple(0.50124145262344534123412), dim, a_2, b_2, + 10000, 0.0, reqRelError_2, 0.1972807); // (Gaussian centered at 1/2) test_integration(hcubature_test::f4, - std::make_tuple(0.1), dim, a_2, b_2, 6000, 0.0, reqRelError, 1); + std::make_tuple(0.1), dim, a_2, b_2, 6000, 0.0, reqRelError, + 1); dim = 3; - const Eigen::VectorXd a_3 {{0.0, 0.0, 0.0}}; - const Eigen::VectorXd b_3 {{1.0, 1.0, 1.0}}; - const Eigen::VectorXd reqRelError_3 {{1e-4, 1e-6}}; + const Eigen::VectorXd a_3{{0.0, 0.0, 0.0}}; + const Eigen::VectorXd b_3{{1.0, 1.0, 1.0}}; + const Eigen::VectorXd reqRelError_3{{1e-4, 1e-6}}; test_integration(hcubature_test::f5, std::make_tuple(), dim, a_3, b_3, 6000, 0.0, reqRelError_3, 1.00001); - const Eigen::VectorXd reqRelError_4 {{1e-4, 1e-6, 1e-8}}; + const Eigen::VectorXd reqRelError_4{{1e-4, 1e-6, 1e-8}}; test_integration(hcubature_test::f6, std::make_tuple(), dim, a_3, b_3, 6000, 0.0, reqRelError_4, 1); // (Tsuda's example) dim = 4; - const Eigen::VectorXd a_4 {{0.0, 0.0, 0.0, 0.0}}; - const Eigen::VectorXd b_4 {{1.0, 1.0, 1.0, 1.0}}; + const Eigen::VectorXd a_4{{0.0, 0.0, 0.0, 0.0}}; + const Eigen::VectorXd b_4{{1.0, 1.0, 1.0, 1.0}}; test_integration(hcubature_test::f7, - std::make_tuple((1 + sqrt(10.0)) / 9.0), dim, a_4, b_4, 20000, - 0.0, reqRelError_3, 0.999998); - + std::make_tuple((1 + sqrt(10.0)) / 9.0), dim, a_4, b_4, + 20000, 0.0, reqRelError_3, 0.999998); }