From 67eb782b43d1c768887eab5ad6cdc79782c9c335 Mon Sep 17 00:00:00 2001 From: Steve Bronder Date: Fri, 5 Jun 2026 12:09:53 -0400 Subject: [PATCH 1/3] use instead of in tuple_to_laplace_options --- stan/math/mix/functor/laplace_marginal_density_estimator.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stan/math/mix/functor/laplace_marginal_density_estimator.hpp b/stan/math/mix/functor/laplace_marginal_density_estimator.hpp index 25d419bf6c4..762da16b474 100644 --- a/stan/math/mix/functor/laplace_marginal_density_estimator.hpp +++ b/stan/math/mix/functor/laplace_marginal_density_estimator.hpp @@ -154,7 +154,7 @@ inline constexpr auto tuple_to_laplace_options(Options&& ops) { } auto defaults = laplace_options_default{}; return laplace_options_user_supplied{ - value_of(std::get<0>(std::forward(ops))), + value_of(std::get<0>(std::forward(ops))), std::get<1>(ops), std::get<2>(ops), defaults.hessian_block_size, @@ -163,7 +163,7 @@ inline constexpr auto tuple_to_laplace_options(Options&& ops) { (std::get<5>(ops) > 0) ? true : false, }; } else { - return std::forward(ops); + return std::forward(ops); } } From 8748942623516827a2ca45242b8202d9baf78cb6 Mon Sep 17 00:00:00 2001 From: Steve Bronder Date: Fri, 5 Jun 2026 15:05:52 -0400 Subject: [PATCH 2/3] add tests for forwarding --- .../laplace/tuple_to_laplace_options_test.cpp | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/unit/math/laplace/tuple_to_laplace_options_test.cpp diff --git a/test/unit/math/laplace/tuple_to_laplace_options_test.cpp b/test/unit/math/laplace/tuple_to_laplace_options_test.cpp new file mode 100644 index 00000000000..e8d57bd1eed --- /dev/null +++ b/test/unit/math/laplace/tuple_to_laplace_options_test.cpp @@ -0,0 +1,34 @@ +#include +#include + +TEST(laplace_utils, tuple_to_laplace_options) { + using stan::math::laplace_options_user_supplied; + using stan::math::internal::tuple_to_laplace_options; + + auto ops = std::make_tuple(Eigen::VectorXd::Zero(3), 1e-6, 100, 1, 2, 0); + auto laplace_opts = tuple_to_laplace_options(ops); + EXPECT_EQ(laplace_opts.hessian_block_size, 1); + EXPECT_EQ(laplace_opts.solver, 1); + EXPECT_EQ(laplace_opts.tolerance, 1e-6); + EXPECT_EQ(laplace_opts.max_num_steps, 100); + EXPECT_EQ(laplace_opts.line_search.max_iterations, 2); + EXPECT_EQ(laplace_opts.allow_fallthrough, false); + EXPECT_EQ(laplace_opts.theta_0, Eigen::VectorXd::Zero(3)); + static_assert(std::is_same_v); +} + +TEST(laplace_utils, tuple_to_laplace_options_move) { + using stan::math::laplace_options_user_supplied; + using stan::math::internal::tuple_to_laplace_options; + + auto ops = std::make_tuple(Eigen::VectorXd::Zero(3), 1e-6, 100, 1, 2, 1); + auto laplace_opts = tuple_to_laplace_options(std::move(ops)); + EXPECT_EQ(laplace_opts.hessian_block_size, 1); + EXPECT_EQ(laplace_opts.solver, 1); + EXPECT_EQ(laplace_opts.tolerance, 1e-6); + EXPECT_EQ(laplace_opts.max_num_steps, 100); + EXPECT_EQ(laplace_opts.line_search.max_iterations, 2); + EXPECT_EQ(laplace_opts.allow_fallthrough, true); + EXPECT_EQ(laplace_opts.theta_0, Eigen::VectorXd::Zero(3)); + static_assert(std::is_same_v); +} From 7233ad07b8d35af83adcd13d79c86727a5f9f745 Mon Sep 17 00:00:00 2001 From: Stan Jenkins Date: Fri, 5 Jun 2026 15:06:55 -0400 Subject: [PATCH 3/3] [Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1 --- test/unit/math/laplace/tuple_to_laplace_options_test.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/unit/math/laplace/tuple_to_laplace_options_test.cpp b/test/unit/math/laplace/tuple_to_laplace_options_test.cpp index e8d57bd1eed..c1ba5913bfb 100644 --- a/test/unit/math/laplace/tuple_to_laplace_options_test.cpp +++ b/test/unit/math/laplace/tuple_to_laplace_options_test.cpp @@ -14,7 +14,8 @@ TEST(laplace_utils, tuple_to_laplace_options) { EXPECT_EQ(laplace_opts.line_search.max_iterations, 2); EXPECT_EQ(laplace_opts.allow_fallthrough, false); EXPECT_EQ(laplace_opts.theta_0, Eigen::VectorXd::Zero(3)); - static_assert(std::is_same_v); + static_assert( + std::is_same_v); } TEST(laplace_utils, tuple_to_laplace_options_move) { @@ -30,5 +31,6 @@ TEST(laplace_utils, tuple_to_laplace_options_move) { EXPECT_EQ(laplace_opts.line_search.max_iterations, 2); EXPECT_EQ(laplace_opts.allow_fallthrough, true); EXPECT_EQ(laplace_opts.theta_0, Eigen::VectorXd::Zero(3)); - static_assert(std::is_same_v); + static_assert( + std::is_same_v); }