diff --git a/stan/math/opencl/double_d.hpp b/stan/math/opencl/double_d.hpp index 39f3a6870b6..54cf3114500 100644 --- a/stan/math/opencl/double_d.hpp +++ b/stan/math/opencl/double_d.hpp @@ -86,7 +86,7 @@ inline double_d mul_d_d(double a, double b) { } // \cond -static const char* double_d_src = STRINGIFY( +static constexpr const char* double_d_src = STRINGIFY( // \endcond typedef struct { double high; diff --git a/stan/math/opencl/kernel_generator/colwise_reduction.hpp b/stan/math/opencl/kernel_generator/colwise_reduction.hpp index e402ad1edeb..2a31d36ab71 100644 --- a/stan/math/opencl/kernel_generator/colwise_reduction.hpp +++ b/stan/math/opencl/kernel_generator/colwise_reduction.hpp @@ -66,7 +66,7 @@ class colwise_reduction using Scalar = typename std::remove_reference_t::Scalar; using base = operation_cl; using base::var_name_; - static const bool require_specific_local_size = true; + static constexpr bool require_specific_local_size = true; protected: std::string init_; diff --git a/stan/math/opencl/kernel_generator/multi_result_kernel.hpp b/stan/math/opencl/kernel_generator/multi_result_kernel.hpp index 3fe16779676..2cf0bcb2676 100644 --- a/stan/math/opencl/kernel_generator/multi_result_kernel.hpp +++ b/stan/math/opencl/kernel_generator/multi_result_kernel.hpp @@ -72,7 +72,7 @@ struct multi_result_kernel_internal { next::check_assign_dimensions(n_rows, n_cols, assignment_pairs); const auto& expression = std::get(assignment_pairs).second; const auto& result = std::get(assignment_pairs).first; - const char* function = "results.operator="; + constexpr const char* function = "results.operator="; int expression_rows = expression.rows(); int expression_cols = expression.cols(); @@ -437,8 +437,9 @@ class results_cl { using impl = typename internal::multi_result_kernel_internal< std::tuple_size>::value - 1, T_res...>::template inner; - static const bool require_specific_local_size = std::max( - {std::decay_t::Deriv::require_specific_local_size...}); + static constexpr bool require_specific_local_size + = stan::math::disjunction::Deriv::require_specific_local_size>...>::value; name_generator ng; std::unordered_map generated; @@ -503,14 +504,16 @@ class results_cl { std::tuple_size>::value - 1, T_res...>::template inner; - static const bool any_output = std::max( - {false, !is_without_output>::value...}); + static constexpr bool any_output + = stan::math::disjunction>::value>...>::value; if (!any_output) { return; } - static const bool require_specific_local_size = std::max( - {std::decay_t::Deriv::require_specific_local_size...}); + static constexpr bool require_specific_local_size + = stan::math::disjunction::Deriv::require_specific_local_size>...>::value; int n_rows = std::get<0>(assignment_pairs).second.thread_rows(); int n_cols = std::get<0>(assignment_pairs).second.thread_cols(); diff --git a/stan/math/opencl/kernel_generator/operation_cl.hpp b/stan/math/opencl/kernel_generator/operation_cl.hpp index fcef4aa1c14..6372358f042 100644 --- a/stan/math/opencl/kernel_generator/operation_cl.hpp +++ b/stan/math/opencl/kernel_generator/operation_cl.hpp @@ -133,7 +133,7 @@ class operation_cl : public operation_cl_base { static constexpr int N = sizeof...(Args); using view_transitivity = std::tuple...>; // value representing a not yet determined size - static const int dynamic = -1; + static constexpr int dynamic = -1; /** Returns an argument to this operation diff --git a/stan/math/opencl/kernel_generator/reduction_2d.hpp b/stan/math/opencl/kernel_generator/reduction_2d.hpp index 33c957ea5f6..4d019f1012c 100644 --- a/stan/math/opencl/kernel_generator/reduction_2d.hpp +++ b/stan/math/opencl/kernel_generator/reduction_2d.hpp @@ -50,7 +50,7 @@ class reduction_2d using Scalar = typename std::remove_reference_t::Scalar; using base = operation_cl; using base::var_name_; - static const bool require_specific_local_size = true; + static constexpr bool require_specific_local_size = true; protected: std::string init_; diff --git a/stan/math/opencl/kernels/add.hpp b/stan/math/opencl/kernels/add.hpp index 7b558476220..e37e2b21cdc 100644 --- a/stan/math/opencl/kernels/add.hpp +++ b/stan/math/opencl/kernels/add.hpp @@ -12,7 +12,7 @@ namespace math { namespace opencl_kernels { // \cond -static const std::string add_batch_kernel_code = STRINGIFY( +static constexpr const char *add_batch_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * Sums a batch of matrices. Buffer A contains diff --git a/stan/math/opencl/kernels/batch_identity.hpp b/stan/math/opencl/kernels/batch_identity.hpp index c067960a71d..dda23be8b0f 100644 --- a/stan/math/opencl/kernels/batch_identity.hpp +++ b/stan/math/opencl/kernels/batch_identity.hpp @@ -10,7 +10,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const std::string batch_identity_kernel_code = STRINGIFY( +static constexpr const char* batch_identity_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels diff --git a/stan/math/opencl/kernels/categorical_logit_glm_lpmf.hpp b/stan/math/opencl/kernels/categorical_logit_glm_lpmf.hpp index 55dde06808f..8af85009a73 100644 --- a/stan/math/opencl/kernels/categorical_logit_glm_lpmf.hpp +++ b/stan/math/opencl/kernels/categorical_logit_glm_lpmf.hpp @@ -10,7 +10,7 @@ namespace math { namespace opencl_kernels { // \cond -static const std::string categorical_logit_glm_kernel_code = STRINGIFY( +static constexpr const char* categorical_logit_glm_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * GPU implementation of Generalized Linear Model (GLM) diff --git a/stan/math/opencl/kernels/check_symmetric.hpp b/stan/math/opencl/kernels/check_symmetric.hpp index f2e38234124..81efa9f5d9c 100644 --- a/stan/math/opencl/kernels/check_symmetric.hpp +++ b/stan/math/opencl/kernels/check_symmetric.hpp @@ -10,7 +10,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const std::string is_symmetric_kernel_code = STRINGIFY( +static constexpr const char *is_symmetric_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * Check if the matrix_cl is symmetric diff --git a/stan/math/opencl/kernels/cholesky_decompose.hpp b/stan/math/opencl/kernels/cholesky_decompose.hpp index a2f1eefd489..cac42c651bd 100644 --- a/stan/math/opencl/kernels/cholesky_decompose.hpp +++ b/stan/math/opencl/kernels/cholesky_decompose.hpp @@ -10,7 +10,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const std::string cholesky_decompose_kernel_code = STRINGIFY( +static constexpr const char* cholesky_decompose_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * Calculates the Cholesky Decomposition of a matrix on an OpenCL @@ -30,7 +30,7 @@ static const std::string cholesky_decompose_kernel_code = STRINGIFY( * This kernel uses the helper macros available in helpers.cl. * */ - __kernel void cholesky_decompose(__global double *A, int rows) { + __kernel void cholesky_decompose(__global double* A, int rows) { const int local_index = get_local_id(0); // The following code is the sequential version of the inplace // cholesky decomposition. Only the innermost loops are parallelized. The diff --git a/stan/math/opencl/kernels/cumulative_sum.hpp b/stan/math/opencl/kernels/cumulative_sum.hpp index 848647c7ac2..12e5d94ca97 100644 --- a/stan/math/opencl/kernels/cumulative_sum.hpp +++ b/stan/math/opencl/kernels/cumulative_sum.hpp @@ -12,7 +12,7 @@ namespace math { namespace opencl_kernels { // \cond -static const char *cumulative_sum1_kernel_code = STRINGIFY( +static constexpr const char *cumulative_sum1_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * First kernel of the cumulative sum implementation. Each thread sums the @@ -62,7 +62,7 @@ static const char *cumulative_sum1_kernel_code = STRINGIFY( // \endcond // \cond -static const char *cumulative_sum2_kernel_code = STRINGIFY( +static constexpr const char *cumulative_sum2_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * Second kernel of the cumulative sum implementation. Calculates prefix sum @@ -116,7 +116,7 @@ static const char *cumulative_sum2_kernel_code = STRINGIFY( // \endcond // \cond -static const char *cumulative_sum3_kernel_code = STRINGIFY( +static constexpr const char *cumulative_sum3_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * Third kernel of the cumulative sum implementation. Given sums of threads diff --git a/stan/math/opencl/kernels/device_functions/Phi.hpp b/stan/math/opencl/kernels/device_functions/Phi.hpp index 6946fc6fd28..0db9aa2167b 100644 --- a/stan/math/opencl/kernels/device_functions/Phi.hpp +++ b/stan/math/opencl/kernels/device_functions/Phi.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const char* phi_device_function +static constexpr const char* phi_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_PHI\n" "#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_PHI\n" STRINGIFY( diff --git a/stan/math/opencl/kernels/device_functions/Phi_approx.hpp b/stan/math/opencl/kernels/device_functions/Phi_approx.hpp index 343710e7acc..a86c3563951 100644 --- a/stan/math/opencl/kernels/device_functions/Phi_approx.hpp +++ b/stan/math/opencl/kernels/device_functions/Phi_approx.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const char* phi_approx_device_function +static constexpr const char* phi_approx_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_PHI_APPROX\n" "#define " diff --git a/stan/math/opencl/kernels/device_functions/atomic_add_double.hpp b/stan/math/opencl/kernels/device_functions/atomic_add_double.hpp index 58a1de75892..b07e1246d24 100644 --- a/stan/math/opencl/kernels/device_functions/atomic_add_double.hpp +++ b/stan/math/opencl/kernels/device_functions/atomic_add_double.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const char *atomic_add_double_device_function +static constexpr const char *atomic_add_double_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_ATOMIC_ADD_DOUBLE\n" "#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_ATOMIC_ADD_DOUBLE\n" diff --git a/stan/math/opencl/kernels/device_functions/beta.hpp b/stan/math/opencl/kernels/device_functions/beta.hpp index 8a193db3f4d..e634cddb07c 100644 --- a/stan/math/opencl/kernels/device_functions/beta.hpp +++ b/stan/math/opencl/kernels/device_functions/beta.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const char* beta_device_function +static constexpr const char* beta_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_BETA\n" "#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_BETA\n" STRINGIFY( diff --git a/stan/math/opencl/kernels/device_functions/binomial_coefficient_log.hpp b/stan/math/opencl/kernels/device_functions/binomial_coefficient_log.hpp index b1d6d5f99fa..ac15cb19e17 100644 --- a/stan/math/opencl/kernels/device_functions/binomial_coefficient_log.hpp +++ b/stan/math/opencl/kernels/device_functions/binomial_coefficient_log.hpp @@ -10,7 +10,7 @@ namespace math { namespace opencl_kernels { // \cond -static const char* binomial_coefficient_log_device_function +static constexpr const char* binomial_coefficient_log_device_function = "\n" "#ifndef " "STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_BINOMIAL_COEFFICIENT_LOG\n" diff --git a/stan/math/opencl/kernels/device_functions/digamma.hpp b/stan/math/opencl/kernels/device_functions/digamma.hpp index f4ffc7b17d5..5552cfd822f 100644 --- a/stan/math/opencl/kernels/device_functions/digamma.hpp +++ b/stan/math/opencl/kernels/device_functions/digamma.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const char* digamma_device_function +static constexpr const char* digamma_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_DIGAMMA\n" "#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_DIGAMMA\n" STRINGIFY( diff --git a/stan/math/opencl/kernels/device_functions/inv_Phi.hpp b/stan/math/opencl/kernels/device_functions/inv_Phi.hpp index 68200168438..bec6070505a 100644 --- a/stan/math/opencl/kernels/device_functions/inv_Phi.hpp +++ b/stan/math/opencl/kernels/device_functions/inv_Phi.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const char* inv_phi_device_function +static constexpr const char* inv_phi_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_INV_PHI\n" "#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_INV_PHI\n" STRINGIFY( diff --git a/stan/math/opencl/kernels/device_functions/inv_logit.hpp b/stan/math/opencl/kernels/device_functions/inv_logit.hpp index 34c526e4fae..827b917496c 100644 --- a/stan/math/opencl/kernels/device_functions/inv_logit.hpp +++ b/stan/math/opencl/kernels/device_functions/inv_logit.hpp @@ -10,7 +10,7 @@ namespace math { namespace opencl_kernels { // \cond -static const char* inv_logit_device_function +static constexpr const char* inv_logit_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_INV_LOGIT\n" "#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_INV_LOGIT\n" STRINGIFY( diff --git a/stan/math/opencl/kernels/device_functions/inv_square.hpp b/stan/math/opencl/kernels/device_functions/inv_square.hpp index 7ec970eeeb6..90d2c89549d 100644 --- a/stan/math/opencl/kernels/device_functions/inv_square.hpp +++ b/stan/math/opencl/kernels/device_functions/inv_square.hpp @@ -10,7 +10,7 @@ namespace math { namespace opencl_kernels { // \cond -static const char* inv_square_device_function +static constexpr const char* inv_square_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_INV_SQUARE\n" "#define " diff --git a/stan/math/opencl/kernels/device_functions/lbeta.hpp b/stan/math/opencl/kernels/device_functions/lbeta.hpp index 0e8e4d139d3..3fe6fe89056 100644 --- a/stan/math/opencl/kernels/device_functions/lbeta.hpp +++ b/stan/math/opencl/kernels/device_functions/lbeta.hpp @@ -10,7 +10,7 @@ namespace math { namespace opencl_kernels { // \cond -static const char* lbeta_device_function +static constexpr const char* lbeta_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LBETA\n" "#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LBETA\n" STRINGIFY( diff --git a/stan/math/opencl/kernels/device_functions/lgamma_stirling.hpp b/stan/math/opencl/kernels/device_functions/lgamma_stirling.hpp index 3934fe11600..a62510a5ef3 100644 --- a/stan/math/opencl/kernels/device_functions/lgamma_stirling.hpp +++ b/stan/math/opencl/kernels/device_functions/lgamma_stirling.hpp @@ -10,7 +10,7 @@ namespace math { namespace opencl_kernels { // \cond -static const char* lgamma_stirling_device_function +static constexpr const char* lgamma_stirling_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LGAMMA_STIRLING\n" "#define " diff --git a/stan/math/opencl/kernels/device_functions/lgamma_stirling_diff.hpp b/stan/math/opencl/kernels/device_functions/lgamma_stirling_diff.hpp index 78118f3f9d3..87e11dce6ff 100644 --- a/stan/math/opencl/kernels/device_functions/lgamma_stirling_diff.hpp +++ b/stan/math/opencl/kernels/device_functions/lgamma_stirling_diff.hpp @@ -10,7 +10,7 @@ namespace math { namespace opencl_kernels { // \cond -static const char* lgamma_stirling_diff_device_function +static constexpr const char* lgamma_stirling_diff_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LGAMMA_STIRLING_DIFF\n" "#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LGAMMA_STIRLING_DIFF\n" diff --git a/stan/math/opencl/kernels/device_functions/lmultiply.hpp b/stan/math/opencl/kernels/device_functions/lmultiply.hpp index 9f06058a83c..8f8e6077a4c 100644 --- a/stan/math/opencl/kernels/device_functions/lmultiply.hpp +++ b/stan/math/opencl/kernels/device_functions/lmultiply.hpp @@ -10,7 +10,7 @@ namespace math { namespace opencl_kernels { // \cond -static const char* lmultiply_device_function +static constexpr const char* lmultiply_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LMULTIPLY\n" "#define " diff --git a/stan/math/opencl/kernels/device_functions/log1m.hpp b/stan/math/opencl/kernels/device_functions/log1m.hpp index 2f43bf10ad2..62bdbdfa1dc 100644 --- a/stan/math/opencl/kernels/device_functions/log1m.hpp +++ b/stan/math/opencl/kernels/device_functions/log1m.hpp @@ -10,7 +10,7 @@ namespace math { namespace opencl_kernels { // \cond -static const char* log1m_device_function +static constexpr const char* log1m_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG1M\n" "#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG1M\n" STRINGIFY( diff --git a/stan/math/opencl/kernels/device_functions/log1m_exp.hpp b/stan/math/opencl/kernels/device_functions/log1m_exp.hpp index 1ec7af2a379..54993594780 100644 --- a/stan/math/opencl/kernels/device_functions/log1m_exp.hpp +++ b/stan/math/opencl/kernels/device_functions/log1m_exp.hpp @@ -10,7 +10,7 @@ namespace math { namespace opencl_kernels { // \cond -static const char* log1m_exp_device_function +static constexpr const char* log1m_exp_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG1M_EXP\n" "#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG1M_EXP\n" STRINGIFY( diff --git a/stan/math/opencl/kernels/device_functions/log1m_inv_logit.hpp b/stan/math/opencl/kernels/device_functions/log1m_inv_logit.hpp index 8d0921aeafc..11f5c0806ec 100644 --- a/stan/math/opencl/kernels/device_functions/log1m_inv_logit.hpp +++ b/stan/math/opencl/kernels/device_functions/log1m_inv_logit.hpp @@ -10,7 +10,7 @@ namespace math { namespace opencl_kernels { // \cond -static const char* log1m_inv_logit_device_function +static constexpr const char* log1m_inv_logit_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG1M_INV_LOGIT\n" "#define " diff --git a/stan/math/opencl/kernels/device_functions/log1p_exp.hpp b/stan/math/opencl/kernels/device_functions/log1p_exp.hpp index 786bd0c9900..2198bbe59a7 100644 --- a/stan/math/opencl/kernels/device_functions/log1p_exp.hpp +++ b/stan/math/opencl/kernels/device_functions/log1p_exp.hpp @@ -10,7 +10,7 @@ namespace math { namespace opencl_kernels { // \cond -static const char* log1p_exp_device_function +static constexpr const char* log1p_exp_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG1P_EXP\n" "#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG1P_EXP\n" STRINGIFY( diff --git a/stan/math/opencl/kernels/device_functions/log_diff_exp.hpp b/stan/math/opencl/kernels/device_functions/log_diff_exp.hpp index 649cb84ee6a..bbcdfc1ac09 100644 --- a/stan/math/opencl/kernels/device_functions/log_diff_exp.hpp +++ b/stan/math/opencl/kernels/device_functions/log_diff_exp.hpp @@ -10,7 +10,7 @@ namespace math { namespace opencl_kernels { // \cond -static const char* log_diff_exp_device_function +static constexpr const char* log_diff_exp_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG_DIFF_EXP\n" "#define " diff --git a/stan/math/opencl/kernels/device_functions/log_inv_logit.hpp b/stan/math/opencl/kernels/device_functions/log_inv_logit.hpp index 87be712ce56..cd82005fc0f 100644 --- a/stan/math/opencl/kernels/device_functions/log_inv_logit.hpp +++ b/stan/math/opencl/kernels/device_functions/log_inv_logit.hpp @@ -10,7 +10,7 @@ namespace math { namespace opencl_kernels { // \cond -static const char* log_inv_logit_device_function +static constexpr const char* log_inv_logit_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG_INV_LOGIT\n" "#define " diff --git a/stan/math/opencl/kernels/device_functions/log_inv_logit_diff.hpp b/stan/math/opencl/kernels/device_functions/log_inv_logit_diff.hpp index 7756c79bde0..201064d3212 100644 --- a/stan/math/opencl/kernels/device_functions/log_inv_logit_diff.hpp +++ b/stan/math/opencl/kernels/device_functions/log_inv_logit_diff.hpp @@ -10,7 +10,7 @@ namespace math { namespace opencl_kernels { // \cond -static const char* log_inv_logit_diff_device_function +static constexpr const char* log_inv_logit_diff_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOG_INV_LOGIT_DIFF\n" "#define " diff --git a/stan/math/opencl/kernels/device_functions/logit.hpp b/stan/math/opencl/kernels/device_functions/logit.hpp index b0b4524214e..533750a5a37 100644 --- a/stan/math/opencl/kernels/device_functions/logit.hpp +++ b/stan/math/opencl/kernels/device_functions/logit.hpp @@ -10,7 +10,7 @@ namespace math { namespace opencl_kernels { // \cond -static const char* logit_device_function +static constexpr const char* logit_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOGIT\n" "#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_LOGIT\n" STRINGIFY( diff --git a/stan/math/opencl/kernels/device_functions/multiply_log.hpp b/stan/math/opencl/kernels/device_functions/multiply_log.hpp index eb5cde66104..b1f5071b070 100644 --- a/stan/math/opencl/kernels/device_functions/multiply_log.hpp +++ b/stan/math/opencl/kernels/device_functions/multiply_log.hpp @@ -10,7 +10,7 @@ namespace math { namespace opencl_kernels { // \cond -static const char* multiply_log_device_function +static constexpr const char* multiply_log_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_MULTIPLY_LOG\n" "#define " diff --git a/stan/math/opencl/kernels/device_functions/trigamma.hpp b/stan/math/opencl/kernels/device_functions/trigamma.hpp index 31d67e9d3b4..f93db4f724f 100644 --- a/stan/math/opencl/kernels/device_functions/trigamma.hpp +++ b/stan/math/opencl/kernels/device_functions/trigamma.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const char* trigamma_device_function +static constexpr const char* trigamma_device_function = "\n" "#ifndef STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_TRIGAMMA\n" "#define STAN_MATH_OPENCL_KERNELS_DEVICE_FUNCTIONS_TRIGAMMA\n" STRINGIFY( diff --git a/stan/math/opencl/kernels/diag_inv.hpp b/stan/math/opencl/kernels/diag_inv.hpp index 707971e7f49..b8af6a9aa5e 100644 --- a/stan/math/opencl/kernels/diag_inv.hpp +++ b/stan/math/opencl/kernels/diag_inv.hpp @@ -10,7 +10,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const std::string diag_inv_kernel_code = STRINGIFY( +static constexpr const char* diag_inv_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * Calculates inplace submatrix inversions along the matrix diagonal. diff --git a/stan/math/opencl/kernels/divide_columns.hpp b/stan/math/opencl/kernels/divide_columns.hpp index 2f929a70cf7..9bad330ebaa 100644 --- a/stan/math/opencl/kernels/divide_columns.hpp +++ b/stan/math/opencl/kernels/divide_columns.hpp @@ -10,7 +10,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const std::string divide_columns_kernel_code = STRINGIFY( +static constexpr const char *divide_columns_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * Takes vector A and divides columns vector in A element-wise by the values diff --git a/stan/math/opencl/kernels/fill_strict_tri.hpp b/stan/math/opencl/kernels/fill_strict_tri.hpp index 0c5d6f2551c..ee059e2226d 100644 --- a/stan/math/opencl/kernels/fill_strict_tri.hpp +++ b/stan/math/opencl/kernels/fill_strict_tri.hpp @@ -11,7 +11,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const std::string fill_strict_tri_kernel_code = STRINGIFY( +static constexpr const char* fill_strict_tri_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * Stores constant in the triangular part of a matrix diff --git a/stan/math/opencl/kernels/gp_exp_quad_cov.hpp b/stan/math/opencl/kernels/gp_exp_quad_cov.hpp index d9f293e5293..8e6d47f6b81 100644 --- a/stan/math/opencl/kernels/gp_exp_quad_cov.hpp +++ b/stan/math/opencl/kernels/gp_exp_quad_cov.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const std::string gp_exp_quad_cov_kernel_code = STRINGIFY( +static constexpr const char* gp_exp_quad_cov_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * GPU part of calculation of squared exponential kernel. @@ -51,7 +51,7 @@ const kernel_cl gp_exp_quad_cov("gp_exp_quad_cov", {gp_exp_quad_cov_kernel_code}); // \cond -static const std::string gp_exp_quad_cov_cross_kernel_code = STRINGIFY( +static constexpr const char* gp_exp_quad_cov_cross_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * GPU part of calculation of squared exponential kernel. diff --git a/stan/math/opencl/kernels/gp_exponential_cov.hpp b/stan/math/opencl/kernels/gp_exponential_cov.hpp index 73afa4e8922..722d50cb11b 100644 --- a/stan/math/opencl/kernels/gp_exponential_cov.hpp +++ b/stan/math/opencl/kernels/gp_exponential_cov.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const std::string gp_exponential_cov_kernel_code = STRINGIFY( +static constexpr const char* gp_exponential_cov_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * GPU part of calculation of Matern exponential kernel. @@ -53,7 +53,7 @@ const kernel_cl gp_exponential_cov("gp_exponential_cov", {gp_exponential_cov_kernel_code}); // \cond -static const std::string gp_exponential_cov_cross_kernel_code = STRINGIFY( +static constexpr const char* gp_exponential_cov_cross_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * GPU part of calculation of Matern exponential kernel. diff --git a/stan/math/opencl/kernels/gp_matern32_cov.hpp b/stan/math/opencl/kernels/gp_matern32_cov.hpp index e807e18aeee..973e58a6670 100644 --- a/stan/math/opencl/kernels/gp_matern32_cov.hpp +++ b/stan/math/opencl/kernels/gp_matern32_cov.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const std::string gp_matern32_cov_kernel_code = STRINGIFY( +static constexpr const char* gp_matern32_cov_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * GPU part of calculation of Matern 3/2 kernel. @@ -54,7 +54,7 @@ const kernel_cl gp_matern32_cov("gp_matern32_cov", {gp_matern32_cov_kernel_code}); // \cond -static const std::string gp_matern32_cov_cross_kernel_code = STRINGIFY( +static constexpr const char* gp_matern32_cov_cross_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * GPU part of calculation of Matern 3/2 kernel. diff --git a/stan/math/opencl/kernels/gp_matern52_cov.hpp b/stan/math/opencl/kernels/gp_matern52_cov.hpp index d2cc63ac666..75d229872cf 100644 --- a/stan/math/opencl/kernels/gp_matern52_cov.hpp +++ b/stan/math/opencl/kernels/gp_matern52_cov.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const std::string gp_matern52_cov_kernel_code = STRINGIFY( +static constexpr const char* gp_matern52_cov_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * GPU part of calculation of Matern 5/2 kernel. @@ -56,7 +56,7 @@ const kernel_cl gp_matern52_cov("gp_matern52_cov", {gp_matern52_cov_kernel_code}); // \cond -static const std::string gp_matern52_cov_cross_kernel_code = STRINGIFY( +static constexpr const char* gp_matern52_cov_cross_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * GPU part of calculation of Matern 5/2 kernel. diff --git a/stan/math/opencl/kernels/indexing_rev.hpp b/stan/math/opencl/kernels/indexing_rev.hpp index aafcdb1d3a0..c69d5d3f094 100644 --- a/stan/math/opencl/kernels/indexing_rev.hpp +++ b/stan/math/opencl/kernels/indexing_rev.hpp @@ -13,7 +13,7 @@ namespace math { namespace opencl_kernels { // \cond -static const std::string indexing_rev_global_atomic_kernel_code = STRINGIFY( +static constexpr const char* indexing_rev_global_atomic_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * @@ -51,7 +51,7 @@ const kernel_cl indexing_rev_global_atomic_kernel_code}); // \cond -static const std::string indexing_rev_local_atomic_kernel_code = STRINGIFY( +static constexpr const char* indexing_rev_local_atomic_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * @@ -102,56 +102,57 @@ const kernel_clconst char* held in - * add_batch_kernel_code. - */ - __kernel void indexing_rev(__global double* adj, const __global int* index, - const __global double* res, - __local double* adj_loc, int index_size, - int adj_size) { - const int gid = get_global_id(0); - const int lid = get_local_id(0); - const int gsize = get_global_size(0); - const int lsize = get_local_size(0); - for (int i = lid; i < adj_size * lsize; i += lsize) { - adj_loc[i] = 0; - } - barrier(CLK_LOCAL_MEM_FENCE); - for (int i = gid; i < index_size; i += gsize) { - adj_loc[index[i] + lid * adj_size] += res[i]; - } - barrier(CLK_LOCAL_MEM_FENCE); - for (int i = lid; i < adj_size; i += lsize) { - double p = adj_loc[i + adj_size]; - for (int j = 2; j < lsize; j++) { - p += adj_loc[i + j * adj_size]; +static constexpr const char* indexing_rev_local_independent_kernel_code + = STRINGIFY( + // \endcond + /** \ingroup opencl_kernels + * + * Increments adjoint of the indexing operation argument given the + * indices and adjoints of the indexing result. + * + * This kernel makes each thread build its own copy of the adjoints + * before combining them. It is the fastest (and only works for) small + * size of the indexed matrix. + * + * @param[in,out] adj adjoint to increment + * @param index int array index + * @param res adjoint of the result of indexing + * @param adj_loc + * @param index_size number of elements in index + * @param adj_size + * @note Code is a const char* held in + * add_batch_kernel_code. + */ + __kernel void indexing_rev( + __global double* adj, const __global int* index, + const __global double* res, __local double* adj_loc, int index_size, + int adj_size) { + const int gid = get_global_id(0); + const int lid = get_local_id(0); + const int gsize = get_global_size(0); + const int lsize = get_local_size(0); + for (int i = lid; i < adj_size * lsize; i += lsize) { + adj_loc[i] = 0; + } + barrier(CLK_LOCAL_MEM_FENCE); + for (int i = gid; i < index_size; i += gsize) { + adj_loc[index[i] + lid * adj_size] += res[i]; + } + barrier(CLK_LOCAL_MEM_FENCE); + for (int i = lid; i < adj_size; i += lsize) { + double p = adj_loc[i + adj_size]; + for (int j = 2; j < lsize; j++) { + p += adj_loc[i + j * adj_size]; + } + adj_loc[i] += p; + } + barrier(CLK_LOCAL_MEM_FENCE); + for (int i = lid; i < adj_size; i += lsize) { + atomic_add_double(adj + i, adj_loc[i]); + } } - adj_loc[i] += p; - } - barrier(CLK_LOCAL_MEM_FENCE); - for (int i = lid; i < adj_size; i += lsize) { - atomic_add_double(adj + i, adj_loc[i]); - } - } - // \cond -); + // \cond + ); // NOLINT(whitespace/parens) // \endcond /** \ingroup opencl_kernels diff --git a/stan/math/opencl/kernels/inv_lower_tri_multiply.hpp b/stan/math/opencl/kernels/inv_lower_tri_multiply.hpp index a9fca0eb5fe..2052ce374cf 100644 --- a/stan/math/opencl/kernels/inv_lower_tri_multiply.hpp +++ b/stan/math/opencl/kernels/inv_lower_tri_multiply.hpp @@ -10,7 +10,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const std::string inv_lower_tri_multiply_kernel_code = STRINGIFY( +static constexpr const char* inv_lower_tri_multiply_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * Calculates B = C * A. C is an inverse matrix and A is lower triangular. diff --git a/stan/math/opencl/kernels/matrix_multiply.hpp b/stan/math/opencl/kernels/matrix_multiply.hpp index e2303987988..eb8b8f3e890 100644 --- a/stan/math/opencl/kernels/matrix_multiply.hpp +++ b/stan/math/opencl/kernels/matrix_multiply.hpp @@ -11,7 +11,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const std::string matrix_multiply_kernel_code = STRINGIFY( +static constexpr const char* matrix_multiply_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * Matrix multiplication on the OpenCL device @@ -293,7 +293,7 @@ const kernel_clhere. - * - * ![Inverse Calculation](https://goo.gl/6jBjEG) - * - * Graphically, this kernel calculates `-temp * C1` where temp is the - * C2 * A3 calculation from - * \link kernels/inv_lower_tri_multiply.hpp inv_lower_tri_multiply() - \endlink - * The kernel is executed using (N, N, m) threads, where N is the size of - * the input matrices. +static constexpr const char* neg_rect_lower_tri_multiply_kernel_code + = STRINGIFY( + // \endcond + /** \ingroup opencl_kernels + * Calculates C = -B * A where B is rectangular and A is a lower + * triangular. + * For a full guide to the inverse lower triangular kernels see the + link + * here. + * + * ![Inverse Calculation](https://goo.gl/6jBjEG) + * + * Graphically, this kernel calculates `-temp * C1` where temp is the + * C2 * A3 calculation from + * \link kernels/inv_lower_tri_multiply.hpp inv_lower_tri_multiply() + \endlink + * The kernel is executed using (N, N, m) threads, where N is the size + of + * the input matrices. - * @param[in, out] A Input matrix that is being inverted. - * @param[in] temp Temporary matrix with the intermediate results. - * @param A_rows Number of rows for A. - * @param rows The number of rows in a single matrix of the batch - * @note Code is a const char* held in - * neg_rect_lower_tri_multiply_kernel_code - * Used in math/opencl/tri_inverse.hpp. - * This kernel uses the helper macros available in helpers.cl. - */ - __kernel void neg_rect_lower_tri_multiply( - __global double* A, const __global double* temp, const int A_rows, - const int rows) { - int result_matrix_id = get_global_id(2); - int offset = result_matrix_id * rows * 2; - const int thread_block_row = get_local_id(0); - const int thread_block_col = get_local_id(1); - const int i = THREAD_BLOCK_SIZE * get_group_id(0) + thread_block_row; - const int j = THREAD_BLOCK_SIZE * get_group_id(1) + thread_block_col; + * @param[in, out] A Input matrix that is being inverted. + * @param[in] temp Temporary matrix with the intermediate results. + * @param A_rows Number of rows for A. + * @param rows The number of rows in a single matrix of the batch + * @note Code is a const char* held in + * neg_rect_lower_tri_multiply_kernel_code + * Used in math/opencl/tri_inverse.hpp. + * This kernel uses the helper macros available in helpers.cl. + */ + __kernel void neg_rect_lower_tri_multiply( + __global double* A, const __global double* temp, const int A_rows, + const int rows) { + int result_matrix_id = get_global_id(2); + int offset = result_matrix_id * rows * 2; + const int thread_block_row = get_local_id(0); + const int thread_block_col = get_local_id(1); + const int i = THREAD_BLOCK_SIZE * get_group_id(0) + thread_block_row; + const int j = THREAD_BLOCK_SIZE * get_group_id(1) + thread_block_col; - __local double temp_local[THREAD_BLOCK_SIZE][THREAD_BLOCK_SIZE]; - __local double C1_local[THREAD_BLOCK_SIZE][THREAD_BLOCK_SIZE]; + __local double temp_local[THREAD_BLOCK_SIZE][THREAD_BLOCK_SIZE]; + __local double C1_local[THREAD_BLOCK_SIZE][THREAD_BLOCK_SIZE]; - double acc[WORK_PER_THREAD] = {0}; + double acc[WORK_PER_THREAD] = {0}; - const int num_tiles = (rows + THREAD_BLOCK_SIZE - 1) / THREAD_BLOCK_SIZE; - for (int tile_ind = 0; tile_ind < num_tiles; tile_ind++) { - // each thread copies WORK_PER_THREAD values to the local - // memory - for (int w = 0; w < WORK_PER_THREAD; w++) { - const int tiled_i = THREAD_BLOCK_SIZE * tile_ind + thread_block_row; - const int tiled_j = THREAD_BLOCK_SIZE * tile_ind + thread_block_col; - const int temp_global_col = tiled_j + w * THREAD_BLOCK_SIZE_COL; - // {C2}{A2}_global_{col}{row} specifies which global element for each - // matrix the thread is in charge of moving to local memory. - const int C1_global_col = offset + j + w * THREAD_BLOCK_SIZE_COL; - const int C1_global_row = tiled_i + offset; - // Which {col}{row} location in the local memory the thread is in - // charge of. - const int local_col = thread_block_col + w * THREAD_BLOCK_SIZE_COL; - const int local_row = thread_block_row; - if ((temp_global_col) < rows && i < rows) { - temp_local[local_col][local_row] - = temp[result_matrix_id * rows * rows + temp_global_col * rows - + i]; - } else { - temp_local[local_col][local_row] = 0.0; + const int num_tiles + = (rows + THREAD_BLOCK_SIZE - 1) / THREAD_BLOCK_SIZE; + for (int tile_ind = 0; tile_ind < num_tiles; tile_ind++) { + // each thread copies WORK_PER_THREAD values to the local + // memory + for (int w = 0; w < WORK_PER_THREAD; w++) { + const int tiled_i + = THREAD_BLOCK_SIZE * tile_ind + thread_block_row; + const int tiled_j + = THREAD_BLOCK_SIZE * tile_ind + thread_block_col; + const int temp_global_col = tiled_j + w * THREAD_BLOCK_SIZE_COL; + // {C2}{A2}_global_{col}{row} specifies which global element for + // each matrix the thread is in charge of moving to local memory. + const int C1_global_col = offset + j + w * THREAD_BLOCK_SIZE_COL; + const int C1_global_row = tiled_i + offset; + // Which {col}{row} location in the local memory the thread is in + // charge of. + const int local_col + = thread_block_col + w * THREAD_BLOCK_SIZE_COL; + const int local_row = thread_block_row; + if ((temp_global_col) < rows && i < rows) { + temp_local[local_col][local_row] + = temp[result_matrix_id * rows * rows + + temp_global_col * rows + i]; + } else { + temp_local[local_col][local_row] = 0.0; + } + // Element above the diagonal will not be transferred. + if (C1_global_col <= C1_global_row && C1_global_col < A_rows + && C1_global_row < A_rows) { + C1_local[local_col][local_row] + = A[C1_global_col * A_rows + C1_global_row]; + } else { + C1_local[local_col][local_row] = 0; + } + } + // wait until all tile values are loaded to the local memory + barrier(CLK_LOCAL_MEM_FENCE); + for (int block_ind = 0; block_ind < THREAD_BLOCK_SIZE; + block_ind++) { + for (int w = 0; w < WORK_PER_THREAD; w++) { + // Which {col}{row} location in the local memory the thread is + // in + // charge of. + const int local_col + = thread_block_col + w * THREAD_BLOCK_SIZE_COL; + const int local_row = thread_block_row; + acc[w] += temp_local[block_ind][local_row] + * C1_local[local_col][block_ind]; + } + } + barrier(CLK_LOCAL_MEM_FENCE); } - // Element above the diagonal will not be transferred. - if (C1_global_col <= C1_global_row && C1_global_col < A_rows - && C1_global_row < A_rows) { - C1_local[local_col][local_row] - = A[C1_global_col * A_rows + C1_global_row]; - } else { - C1_local[local_col][local_row] = 0; - } - } - // wait until all tile values are loaded to the local memory - barrier(CLK_LOCAL_MEM_FENCE); - for (int block_ind = 0; block_ind < THREAD_BLOCK_SIZE; block_ind++) { + // A_global_{row}{col} tells the thread which local memory it needs + // to move to the final output + const int A_global_row = i + rows + offset; + const int A_global_col_offset = offset + j; + // each thread saves WORK_PER_THREAD values for (int w = 0; w < WORK_PER_THREAD; w++) { - // Which {col}{row} location in the local memory the thread is in - // charge of. - const int local_col = thread_block_col + w * THREAD_BLOCK_SIZE_COL; - const int local_row = thread_block_row; - acc[w] += temp_local[block_ind][local_row] - * C1_local[local_col][block_ind]; + const int A_global_col + = A_global_col_offset + w * THREAD_BLOCK_SIZE_COL; + if (A_global_col < A_rows && (i + rows + offset) < A_rows) { + A[A_global_col * A_rows + i + rows + offset] = -acc[w]; + } } } - barrier(CLK_LOCAL_MEM_FENCE); - } - // A_global_{row}{col} tells the thread which local memory it needs - // to move to the final output - const int A_global_row = i + rows + offset; - const int A_global_col_offset = offset + j; - // each thread saves WORK_PER_THREAD values - for (int w = 0; w < WORK_PER_THREAD; w++) { - const int A_global_col - = A_global_col_offset + w * THREAD_BLOCK_SIZE_COL; - if (A_global_col < A_rows && (i + rows + offset) < A_rows) { - A[A_global_col * A_rows + i + rows + offset] = -acc[w]; - } - } - } - // \cond -); + // \cond + ); // NOLINT(whitespace/parens) // \endcond /** \ingroup opencl_kernels diff --git a/stan/math/opencl/kernels/ordered_logistic_glm_lpmf.hpp b/stan/math/opencl/kernels/ordered_logistic_glm_lpmf.hpp index 3b1727b1aa9..751dc9be697 100644 --- a/stan/math/opencl/kernels/ordered_logistic_glm_lpmf.hpp +++ b/stan/math/opencl/kernels/ordered_logistic_glm_lpmf.hpp @@ -12,7 +12,7 @@ namespace math { namespace opencl_kernels { // \cond -static const char* ordered_logistic_glm_kernel_code = STRINGIFY( +static constexpr const char* ordered_logistic_glm_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * GPU implementation of ordinal regression Generalized Linear Model (GLM). diff --git a/stan/math/opencl/kernels/ordered_logistic_lpmf.hpp b/stan/math/opencl/kernels/ordered_logistic_lpmf.hpp index 7b5dbddc169..4098872e7e6 100644 --- a/stan/math/opencl/kernels/ordered_logistic_lpmf.hpp +++ b/stan/math/opencl/kernels/ordered_logistic_lpmf.hpp @@ -12,7 +12,7 @@ namespace math { namespace opencl_kernels { // \cond -static const char* ordered_logistic_kernel_code = STRINGIFY( +static constexpr const char* ordered_logistic_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * GPU implementation of ordinal regression. diff --git a/stan/math/opencl/kernels/pack.hpp b/stan/math/opencl/kernels/pack.hpp index d470b3c9e0c..111f9202efa 100644 --- a/stan/math/opencl/kernels/pack.hpp +++ b/stan/math/opencl/kernels/pack.hpp @@ -10,7 +10,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const std::string pack_kernel_code = STRINGIFY( +static constexpr const char* pack_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * Packs a flat matrix to a packed triangular matrix diff --git a/stan/math/opencl/kernels/rep_matrix.hpp b/stan/math/opencl/kernels/rep_matrix.hpp index b47b605b471..efc699293b1 100644 --- a/stan/math/opencl/kernels/rep_matrix.hpp +++ b/stan/math/opencl/kernels/rep_matrix.hpp @@ -11,7 +11,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const std::string rep_matrix_rev_kernel_code = STRINGIFY( +static constexpr const char* rep_matrix_rev_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * Implements reverse pass of rep_matrix. diff --git a/stan/math/opencl/kernels/tridiagonalization.hpp b/stan/math/opencl/kernels/tridiagonalization.hpp index 0e0c11ca5ed..c8369dbd2fc 100644 --- a/stan/math/opencl/kernels/tridiagonalization.hpp +++ b/stan/math/opencl/kernels/tridiagonalization.hpp @@ -10,292 +10,292 @@ namespace math { namespace opencl_kernels { // \cond -static const char* tridiagonalization_householder_kernel_code = STRINGIFY( - // \endcond - /** - * Calculates householder vector and first element of the vector v. - * Must be run with 1 workgroup of LOCAL_SIZE_ threads. - * @param[in,out] P packed matrix being constructed - * @param[in,out] V matrix V - * @param[out] q_glob q - * @param P_rows Number of rows of the packed matrix - * @param V_rows Number of rows of the matrix V - * @param j Start column of the block to work on - * @param k Index of the householder vector in the block to create - */ - __kernel void tridiagonalization_householder( - __global double* P, __global double* V, __global double* q_glob, - const int P_rows, const int V_rows, const int j, const int k) { - const int lid = get_local_id(0); - const int gid = get_global_id(0); - const int gsize = get_global_size(0); - const int lsize = get_local_size(0); - const int ngroups = get_num_groups(0); - const int wgid = get_group_id(0); +static constexpr const char* tridiagonalization_householder_kernel_code + = STRINGIFY( + // \endcond + /** + * Calculates householder vector and first element of the vector v. + * Must be run with 1 workgroup of LOCAL_SIZE_ threads. + * @param[in,out] P packed matrix being constructed + * @param[in,out] V matrix V + * @param[out] q_glob q + * @param P_rows Number of rows of the packed matrix + * @param V_rows Number of rows of the matrix V + * @param j Start column of the block to work on + * @param k Index of the householder vector in the block to create + */ + __kernel void tridiagonalization_householder( + __global double* P, __global double* V, __global double* q_glob, + const int P_rows, const int V_rows, const int j, const int k) { + const int lid = get_local_id(0); + const int gid = get_global_id(0); + const int gsize = get_global_size(0); + const int lsize = get_local_size(0); + const int ngroups = get_num_groups(0); + const int wgid = get_group_id(0); - double q = 0; + double q = 0; - const int P_start = P_rows * (k + j) + k + j; - const int P_span = P_rows * (k + j + 1) - P_start; - for (int i = lid; i < P_span; i += lsize) { - double acc = 0; - // apply previous householder reflections from current block to the - // column we are making the Householder vector from - for (int l = 0; l < j; l++) { - acc += P[P_rows * (k + l) + k + j + i] * V[V_rows * l + j - 1] - + V[V_rows * l + j - 1 + i] * P[P_rows * (k + l) + k + j]; - } - double tmp = P[P_start + i] - acc; - P[P_start + i] = tmp; - if (i != 0) { - q += tmp * tmp; - } - } - // calculate column norm between threads - __local double q_local[LOCAL_SIZE_]; - q_local[lid] = q; - barrier(CLK_LOCAL_MEM_FENCE); - for (int step = lsize / REDUCTION_STEP_SIZE; step > 0; - step /= REDUCTION_STEP_SIZE) { - if (lid < step) { - for (int i = 1; i < REDUCTION_STEP_SIZE; i++) { - q_local[lid] += q_local[lid + step * i]; + const int P_start = P_rows * (k + j) + k + j; + const int P_span = P_rows * (k + j + 1) - P_start; + for (int i = lid; i < P_span; i += lsize) { + double acc = 0; + // apply previous householder reflections from current block to the + // column we are making the Householder vector from + for (int l = 0; l < j; l++) { + acc += P[P_rows * (k + l) + k + j + i] * V[V_rows * l + j - 1] + + V[V_rows * l + j - 1 + i] * P[P_rows * (k + l) + k + j]; + } + double tmp = P[P_start + i] - acc; + P[P_start + i] = tmp; + if (i != 0) { + q += tmp * tmp; + } + } + // calculate column norm between threads + __local double q_local[LOCAL_SIZE_]; + q_local[lid] = q; + barrier(CLK_LOCAL_MEM_FENCE); + for (int step = lsize / REDUCTION_STEP_SIZE; step > 0; + step /= REDUCTION_STEP_SIZE) { + if (lid < step) { + for (int i = 1; i < REDUCTION_STEP_SIZE; i++) { + q_local[lid] += q_local[lid + step * i]; + } + } + barrier(CLK_LOCAL_MEM_FENCE); } - } - barrier(CLK_LOCAL_MEM_FENCE); - } - double alpha; - if (lid == 0) { - q = q_local[0]; - double p1 = P[P_start + 1]; - // make Householder vector - alpha = -copysign(sqrt(q), P[P_start]); - q -= p1 * p1; - p1 -= alpha; - P[P_start + 1] = p1; - q += p1 * p1; - q = sqrt(q); - q_local[0] = q; - q_local[1] = alpha; - *q_glob = q; - } - barrier(CLK_LOCAL_MEM_FENCE); - q = q_local[0]; - alpha = q_local[1]; - if (q != 0) { - double multi = M_SQRT2 / q; - // normalize the Householder vector - for (int i = lid + 1; i < P_span; i += lsize) { - P[P_start + i] *= multi; - } - } - if (gid == 0) { - P[P_rows * (k + j + 1) + k + j] - = P[P_rows * (k + j) + k + j + 1] * q / M_SQRT2 + alpha; - } - } - // \cond -); + double alpha; + if (lid == 0) { + q = q_local[0]; + double p1 = P[P_start + 1]; + // make Householder vector + alpha = -copysign(sqrt(q), P[P_start]); + q -= p1 * p1; + p1 -= alpha; + P[P_start + 1] = p1; + q += p1 * p1; + q = sqrt(q); + q_local[0] = q; + q_local[1] = alpha; + *q_glob = q; + } + barrier(CLK_LOCAL_MEM_FENCE); + q = q_local[0]; + alpha = q_local[1]; + if (q != 0) { + double multi = M_SQRT2 / q; + // normalize the Householder vector + for (int i = lid + 1; i < P_span; i += lsize) { + P[P_start + i] *= multi; + } + } + if (gid == 0) { + P[P_rows * (k + j + 1) + k + j] + = P[P_rows * (k + j) + k + j + 1] * q / M_SQRT2 + alpha; + } + }); // \cond // \endcond // \cond -static const char* tridiagonalization_v_step_1_kernel_code = STRINGIFY( - // \endcond - /** - * Calculates first part of constructing the vector v: Uu = Pb * u and Vu = - * Vl * u. Pb is a block of packed matrix, Vl is left part of matrix V and u - * is householder vector. Must be run with number of work groups equal to - * size of resulting vectors and 64 threads per work group. - * @param P Packed matrix being constructed. - * @param V Matrix V. - * @param[out] Uu First resulting vector. - * @param[out] Vu Second resulting vector. - * @param P_rows Number of rows of the packed matrix - * @param V_rows Number of rows of the matrix V - * @param k Index of the householder vector in the block we use as input - */ - __kernel void tridiagonalization_v_step_1( - const __global double* P, const __global double* V, __global double* Uu, - __global double* Vu, const int P_rows, const int V_rows, const int k) { - const int lid = get_local_id(0); - const int gid = get_global_id(0); - const int gsize = get_global_size(0); - const int lsize = get_local_size(0); - const int ngroups = get_num_groups(0); - const int wgid = get_group_id(0); +static constexpr const char* tridiagonalization_v_step_1_kernel_code + = STRINGIFY( + // \endcond + /** + * Calculates first part of constructing the vector v: Uu = Pb * u and + * Vu = Vl * u. Pb is a block of packed matrix, Vl is left part of + * matrix V and u is householder vector. Must be run with number of work + * groups equal to size of resulting vectors and 64 threads per work + * group. + * @param P Packed matrix being constructed. + * @param V Matrix V. + * @param[out] Uu First resulting vector. + * @param[out] Vu Second resulting vector. + * @param P_rows Number of rows of the packed matrix + * @param V_rows Number of rows of the matrix V + * @param k Index of the householder vector in the block we use as input + */ + __kernel void tridiagonalization_v_step_1( + const __global double* P, const __global double* V, + __global double* Uu, __global double* Vu, const int P_rows, + const int V_rows, const int k) { + const int lid = get_local_id(0); + const int gid = get_global_id(0); + const int gsize = get_global_size(0); + const int lsize = get_local_size(0); + const int ngroups = get_num_groups(0); + const int wgid = get_group_id(0); - __local double res_loc1[LOCAL_SIZE_]; - __local double res_loc2[LOCAL_SIZE_]; - double acc1 = 0; - double acc2 = 0; + __local double res_loc1[LOCAL_SIZE_]; + __local double res_loc2[LOCAL_SIZE_]; + double acc1 = 0; + double acc2 = 0; - const __global double* vec = P + P_rows * (k + ngroups) + k + ngroups + 1; - const __global double* M1 = P + P_rows * (k + wgid) + k + ngroups + 1; - const __global double* M2 = V + V_rows * wgid + ngroups; - for (int i = lid; i < P_rows - k - ngroups - 1; - i += LOCAL_SIZE_) { // go over column of the matrix in steps of 64 - double v = vec[i]; - acc1 += M1[i] * v; - acc2 += M2[i] * v; - } - res_loc1[lid] = acc1; - res_loc2[lid] = acc2; - barrier(CLK_LOCAL_MEM_FENCE); + const __global double* vec + = P + P_rows * (k + ngroups) + k + ngroups + 1; + const __global double* M1 = P + P_rows * (k + wgid) + k + ngroups + 1; + const __global double* M2 = V + V_rows * wgid + ngroups; + for (int i = lid; i < P_rows - k - ngroups - 1; + i + += LOCAL_SIZE_) { // go over column of the matrix in steps of 64 + double v = vec[i]; + acc1 += M1[i] * v; + acc2 += M2[i] * v; + } + res_loc1[lid] = acc1; + res_loc2[lid] = acc2; + barrier(CLK_LOCAL_MEM_FENCE); - for (int step = lsize / REDUCTION_STEP_SIZE; step > 0; - step /= REDUCTION_STEP_SIZE) { - if (lid < step) { - for (int i = 1; i < REDUCTION_STEP_SIZE; i++) { - res_loc1[lid] += res_loc1[lid + step * i]; - res_loc2[lid] += res_loc2[lid + step * i]; + for (int step = lsize / REDUCTION_STEP_SIZE; step > 0; + step /= REDUCTION_STEP_SIZE) { + if (lid < step) { + for (int i = 1; i < REDUCTION_STEP_SIZE; i++) { + res_loc1[lid] += res_loc1[lid + step * i]; + res_loc2[lid] += res_loc2[lid + step * i]; + } + } + barrier(CLK_LOCAL_MEM_FENCE); } - } - barrier(CLK_LOCAL_MEM_FENCE); - } - if (lid == 0) { - Uu[wgid] = res_loc1[0]; - Vu[wgid] = res_loc2[0]; - } - } - // \cond -); + if (lid == 0) { + Uu[wgid] = res_loc1[0]; + Vu[wgid] = res_loc2[0]; + } + }); // \cond // \endcond // \cond -static const char* tridiagonalization_v_step_2_kernel_code = STRINGIFY( - // \endcond - /** - * Second part in constructing vector v: v = Pb * u + V * Uu + U * Vu. Pb is - * a block of packed matrix and U is householder vector. Pb is symmetric - * with only lower triangle having values. That is why two columns of V are - * written that must be added to obtain the vector v. Must be run with 64 - * threads per work group and total number of threads equal or greater than - * size of result vector. - * @param P Packed matrix being constructed. - * @param V Matrix V. - * @param Uu Uu from previous kernel. - * @param Vu Vu from previous kernel. - * @param P_rows Number of rows of the packed matrix - * @param V_rows Number of rows of the matrix V - * @param k Index of the householder vector in the block we use as input - * @param j Start column of the block to work on - */ - __kernel void tridiagonalization_v_step_2( - const __global double* P, __global double* V, const __global double* Uu, - const __global double* Vu, const int P_rows, const int V_rows, - const int k, const int j) { - const int lid = get_local_id(0); - const int gid = get_global_id(0); - const int gsize = get_global_size(0); - const int lsize = get_local_size(0); - const int ngroups = get_num_groups(0); - const int wgid = get_group_id(0); +static constexpr const char* tridiagonalization_v_step_2_kernel_code + = STRINGIFY( + // \endcond + /** + * Second part in constructing vector v: v = Pb * u + V * Uu + U * Vu. + * Pb is a block of packed matrix and U is householder vector. Pb is + * symmetric with only lower triangle having values. That is why two + * columns of V are written that must be added to obtain the vector v. + * Must be run with 64 threads per work group and total number of + * threads equal or greater than size of result vector. + * @param P Packed matrix being constructed. + * @param V Matrix V. + * @param Uu Uu from previous kernel. + * @param Vu Vu from previous kernel. + * @param P_rows Number of rows of the packed matrix + * @param V_rows Number of rows of the matrix V + * @param k Index of the householder vector in the block we use as input + * @param j Start column of the block to work on + */ + __kernel void tridiagonalization_v_step_2( + const __global double* P, __global double* V, + const __global double* Uu, const __global double* Vu, + const int P_rows, const int V_rows, const int k, const int j) { + const int lid = get_local_id(0); + const int gid = get_global_id(0); + const int gsize = get_global_size(0); + const int lsize = get_local_size(0); + const int ngroups = get_num_groups(0); + const int wgid = get_group_id(0); - int work = P_rows - k - j - 1; - double acc = 0; + int work = P_rows - k - j - 1; + double acc = 0; - const __global double* vec = P + P_rows * (k + j) + k + j + 1; - const __global double* M1 = P + P_rows * (k + j + 1) + k + j + 1; - const __global double* M2 = P + P_rows * k + k + j + 1; - const __global double* M3 = V + j; - int i; - if (gid < work) { - for (i = 0; i <= gid; i++) { - acc += M1[P_rows * i + gid] * vec[i]; - } - for (int i = 0; i < j; i++) { - acc -= M2[P_rows * i + gid] * Vu[i]; - acc -= M3[V_rows * i + gid] * Uu[i]; - } - V[V_rows * j + gid + j] = acc; - } - float work_per_group - = (float)work / ngroups; // NOLINT(readability/casting) - int start = work_per_group * wgid; - int end = work_per_group * (wgid + 1); - __local double res_loc[LOCAL_SIZE_]; - for (int i = start; i < end; i += 1) { - acc = 0; - for (int l = i + 1 + lid; l < work; l += LOCAL_SIZE_) { - acc += M1[P_rows * i + l] * vec[l]; - } - res_loc[lid] = acc; - barrier(CLK_LOCAL_MEM_FENCE); - for (int step = lsize / REDUCTION_STEP_SIZE; step > 0; - step /= REDUCTION_STEP_SIZE) { - if (lid < step) { - for (int i = 1; i < REDUCTION_STEP_SIZE; i++) { - res_loc[lid] += res_loc[lid + step * i]; + const __global double* vec = P + P_rows * (k + j) + k + j + 1; + const __global double* M1 = P + P_rows * (k + j + 1) + k + j + 1; + const __global double* M2 = P + P_rows * k + k + j + 1; + const __global double* M3 = V + j; + int i; + if (gid < work) { + for (i = 0; i <= gid; i++) { + acc += M1[P_rows * i + gid] * vec[i]; + } + for (int i = 0; i < j; i++) { + acc -= M2[P_rows * i + gid] * Vu[i]; + acc -= M3[V_rows * i + gid] * Uu[i]; } + V[V_rows * j + gid + j] = acc; } - barrier(CLK_LOCAL_MEM_FENCE); - } - if (lid == 0) { - V[V_rows * (j + 1) + i + j] = res_loc[lid]; - } - barrier(CLK_LOCAL_MEM_FENCE); - } - } - // \cond -); + float work_per_group + = (float)work / ngroups; // NOLINT(readability/casting) + int start = work_per_group * wgid; + int end = work_per_group * (wgid + 1); + __local double res_loc[LOCAL_SIZE_]; + for (int i = start; i < end; i += 1) { + acc = 0; + for (int l = i + 1 + lid; l < work; l += LOCAL_SIZE_) { + acc += M1[P_rows * i + l] * vec[l]; + } + res_loc[lid] = acc; + barrier(CLK_LOCAL_MEM_FENCE); + for (int step = lsize / REDUCTION_STEP_SIZE; step > 0; + step /= REDUCTION_STEP_SIZE) { + if (lid < step) { + for (int i = 1; i < REDUCTION_STEP_SIZE; i++) { + res_loc[lid] += res_loc[lid + step * i]; + } + } + barrier(CLK_LOCAL_MEM_FENCE); + } + if (lid == 0) { + V[V_rows * (j + 1) + i + j] = res_loc[lid]; + } + barrier(CLK_LOCAL_MEM_FENCE); + } + }); // \cond // \endcond // \cond -static const char* tridiagonalization_v_step_3_kernel_code = STRINGIFY( - // \endcond - /** - * Third part in constructing vector v: v-=0.5*(v^T*u)*u, where u is the - * householder vector. - * @param[in,out] P packed matrix being constructed - * @param[in,out] V matrix V - * @param[out] q q - * @param P_rows Number of rows of the packed matrix - * @param V_rows Number of rows of the matrix V - * @param k Index of the householder vector in the block to create - * @param j Start column of the block to work on - */ - __kernel void tridiagonalization_v_step_3( - __global double* P, __global double* V, __global double* q, - const int P_rows, const int V_rows, const int k, const int j) { - const int lid = get_local_id(0); - const int gid = get_global_id(0); - const int gsize = get_global_size(0); - const int lsize = get_local_size(0); - const int ngroups = get_num_groups(0); - const int wgid = get_group_id(0); +static constexpr const char* tridiagonalization_v_step_3_kernel_code + = STRINGIFY( + // \endcond + /** + * Third part in constructing vector v: v-=0.5*(v^T*u)*u, where u is the + * householder vector. + * @param[in,out] P packed matrix being constructed + * @param[in,out] V matrix V + * @param[out] q q + * @param P_rows Number of rows of the packed matrix + * @param V_rows Number of rows of the matrix V + * @param k Index of the householder vector in the block to create + * @param j Start column of the block to work on + */ + __kernel void tridiagonalization_v_step_3( + __global double* P, __global double* V, __global double* q, + const int P_rows, const int V_rows, const int k, const int j) { + const int lid = get_local_id(0); + const int gid = get_global_id(0); + const int gsize = get_global_size(0); + const int lsize = get_local_size(0); + const int ngroups = get_num_groups(0); + const int wgid = get_group_id(0); - __global double* u = P + P_rows * (k + j) + k + j + 1; - __global double* v = V + V_rows * j + j; - double acc = 0; + __global double* u = P + P_rows * (k + j) + k + j + 1; + __global double* v = V + V_rows * j + j; + double acc = 0; - for (int i = lid; i < P_rows - k - j - 1; i += LOCAL_SIZE_) { - double vi = v[i] + v[i + V_rows]; - v[i] = vi; - acc += u[i] * vi; - } - __local double res_loc[LOCAL_SIZE_]; - res_loc[lid] = acc; - barrier(CLK_LOCAL_MEM_FENCE); - for (int step = lsize / REDUCTION_STEP_SIZE; step > 0; - step /= REDUCTION_STEP_SIZE) { - if (lid < step) { - for (int i = 1; i < REDUCTION_STEP_SIZE; i++) { - res_loc[lid] += res_loc[lid + step * i]; + for (int i = lid; i < P_rows - k - j - 1; i += LOCAL_SIZE_) { + double vi = v[i] + v[i + V_rows]; + v[i] = vi; + acc += u[i] * vi; + } + __local double res_loc[LOCAL_SIZE_]; + res_loc[lid] = acc; + barrier(CLK_LOCAL_MEM_FENCE); + for (int step = lsize / REDUCTION_STEP_SIZE; step > 0; + step /= REDUCTION_STEP_SIZE) { + if (lid < step) { + for (int i = 1; i < REDUCTION_STEP_SIZE; i++) { + res_loc[lid] += res_loc[lid + step * i]; + } + } + barrier(CLK_LOCAL_MEM_FENCE); + } + acc = res_loc[0] * 0.5; + for (int i = lid; i < P_rows - k - j - 1; i += LOCAL_SIZE_) { + v[i] -= acc * u[i]; + } + if (gid == 0) { + P[P_rows * (k + j + 1) + k + j] -= *q / M_SQRT2 * u[0]; } - } - barrier(CLK_LOCAL_MEM_FENCE); - } - acc = res_loc[0] * 0.5; - for (int i = lid; i < P_rows - k - j - 1; i += LOCAL_SIZE_) { - v[i] -= acc * u[i]; - } - if (gid == 0) { - P[P_rows * (k + j + 1) + k + j] -= *q / M_SQRT2 * u[0]; - } - } - // \cond -); + }); // \cond // \endcond const kernel_cl diff --git a/stan/math/opencl/kernels/unpack.hpp b/stan/math/opencl/kernels/unpack.hpp index f58e9471c12..cafa041d06c 100644 --- a/stan/math/opencl/kernels/unpack.hpp +++ b/stan/math/opencl/kernels/unpack.hpp @@ -10,7 +10,7 @@ namespace stan { namespace math { namespace opencl_kernels { // \cond -static const std::string unpack_kernel_code = STRINGIFY( +static constexpr const char* unpack_kernel_code = STRINGIFY( // \endcond /** \ingroup opencl_kernels * Unpacks a packed triangular matrix to a flat diff --git a/stan/math/opencl/matrix_cl_view.hpp b/stan/math/opencl/matrix_cl_view.hpp index 0b849a7c79d..ddedae38d60 100644 --- a/stan/math/opencl/matrix_cl_view.hpp +++ b/stan/math/opencl/matrix_cl_view.hpp @@ -94,7 +94,7 @@ inline matrix_cl_view from_eigen_uplo_type(Eigen::UpLoType eigen_type) { } // \cond -static const char* view_kernel_helpers = STRINGIFY( +static constexpr const char* view_kernel_helpers = STRINGIFY( // \endcond /** \ingroup opencl_kernels * Determines which parts are nonzero in any of the input views. diff --git a/stan/math/opencl/mrrr.hpp b/stan/math/opencl/mrrr.hpp index 79d5c6a1956..9f5ce9d33ec 100644 --- a/stan/math/opencl/mrrr.hpp +++ b/stan/math/opencl/mrrr.hpp @@ -21,7 +21,7 @@ namespace internal { using VectorXdd = Eigen::Matrix; using MatrixXdd = Eigen::Matrix; -const double_d perturbation_range = 1e-20; +static const double_d perturbation_range = 1e-20; /** * Generates a random number for perturbing a relatively robust representation diff --git a/stan/math/opencl/prim/bernoulli_cdf.hpp b/stan/math/opencl/prim/bernoulli_cdf.hpp index 9a3435162aa..39d4fc4826b 100644 --- a/stan/math/opencl/prim/bernoulli_cdf.hpp +++ b/stan/math/opencl/prim/bernoulli_cdf.hpp @@ -29,7 +29,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t bernoulli_cdf(const T_n_cl& n, const T_prob_cl& theta) { - static const char* function = "bernoulli_cdf(OpenCL)"; + static constexpr const char* function = "bernoulli_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isnan; constexpr bool is_n_vector = !is_stan_scalar::value; diff --git a/stan/math/opencl/prim/bernoulli_lccdf.hpp b/stan/math/opencl/prim/bernoulli_lccdf.hpp index 975d6657c2c..be76ddd64fc 100644 --- a/stan/math/opencl/prim/bernoulli_lccdf.hpp +++ b/stan/math/opencl/prim/bernoulli_lccdf.hpp @@ -30,7 +30,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t bernoulli_lccdf(const T_n_cl& n, const T_prob_cl& theta) { - static const char* function = "bernoulli_lccdf(OpenCL)"; + static constexpr const char* function = "bernoulli_lccdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isnan; constexpr bool is_n_vector = !is_stan_scalar::value; diff --git a/stan/math/opencl/prim/bernoulli_lcdf.hpp b/stan/math/opencl/prim/bernoulli_lcdf.hpp index 0e34cada8c5..694a23c8bcf 100644 --- a/stan/math/opencl/prim/bernoulli_lcdf.hpp +++ b/stan/math/opencl/prim/bernoulli_lcdf.hpp @@ -30,7 +30,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t bernoulli_lcdf(const T_n_cl& n, const T_prob_cl& theta) { - static const char* function = "bernoulli_lcdf(OpenCL)"; + static constexpr const char* function = "bernoulli_lcdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isnan; constexpr bool is_n_vector = !is_stan_scalar::value; diff --git a/stan/math/opencl/prim/bernoulli_logit_glm_lpmf.hpp b/stan/math/opencl/prim/bernoulli_logit_glm_lpmf.hpp index 4858ffa1343..809017f68ee 100644 --- a/stan/math/opencl/prim/bernoulli_logit_glm_lpmf.hpp +++ b/stan/math/opencl/prim/bernoulli_logit_glm_lpmf.hpp @@ -56,7 +56,7 @@ template bernoulli_logit_glm_lpmf( const T_y_cl& y, const T_x_cl& x, const T_alpha_cl& alpha, const T_beta_cl& beta) { - static const char* function = "bernoulli_logit_glm_lpmf(OpenCL)"; + static constexpr const char* function = "bernoulli_logit_glm_lpmf(OpenCL)"; using T_partials_return = partials_return_t; constexpr bool is_y_vector = !is_stan_scalar::value; constexpr bool is_alpha_vector = !is_stan_scalar::value; diff --git a/stan/math/opencl/prim/bernoulli_logit_lpmf.hpp b/stan/math/opencl/prim/bernoulli_logit_lpmf.hpp index f848bfd7b11..805f673d597 100644 --- a/stan/math/opencl/prim/bernoulli_logit_lpmf.hpp +++ b/stan/math/opencl/prim/bernoulli_logit_lpmf.hpp @@ -28,7 +28,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t bernoulli_logit_lpmf(const T_n_cl& n, const T_prob_cl& theta) { - static const char* function = "bernoulli_logit_lpmf(OpenCL)"; + static constexpr const char* function = "bernoulli_logit_lpmf(OpenCL)"; using T_partials_return = partials_return_t; using std::isnan; constexpr bool is_n_vector = !is_stan_scalar::value; @@ -56,7 +56,7 @@ return_type_t bernoulli_logit_lpmf(const T_n_cl& n, auto signs_expr = 2 * n - 1.0; // subtracting 1.0 converts int to double auto ntheta_expr = elt_multiply(signs_expr, theta_val); auto exp_m_ntheta_expr = exp(-ntheta_expr); - static const double cutoff = 20.0; + static constexpr double cutoff = 20.0; auto condition1_expr = ntheta_expr > cutoff; auto condition2_expr = ntheta_expr < -cutoff; auto logp_expr = colwise_sum( diff --git a/stan/math/opencl/prim/bernoulli_lpmf.hpp b/stan/math/opencl/prim/bernoulli_lpmf.hpp index a43909fd920..982a6f8c1cf 100644 --- a/stan/math/opencl/prim/bernoulli_lpmf.hpp +++ b/stan/math/opencl/prim/bernoulli_lpmf.hpp @@ -31,7 +31,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t bernoulli_lpmf(const T_n_cl& n, const T_prob_cl& theta) { - static const char* function = "bernoulli_lpmf(OpenCL)"; + static constexpr const char* function = "bernoulli_lpmf(OpenCL)"; using T_partials_return = partials_return_t; constexpr bool is_n_vector = !is_stan_scalar::value; constexpr bool is_theta_vector = !is_stan_scalar::value; diff --git a/stan/math/opencl/prim/beta_binomial_lpmf.hpp b/stan/math/opencl/prim/beta_binomial_lpmf.hpp index 0486e9d4ecb..3a1306510d4 100644 --- a/stan/math/opencl/prim/beta_binomial_lpmf.hpp +++ b/stan/math/opencl/prim/beta_binomial_lpmf.hpp @@ -44,7 +44,7 @@ return_type_t beta_binomial_lpmf( const T_n_cl& n, const T_N_cl N, const T_size1_cl& alpha, const T_size2_cl& beta) { using std::isfinite; - static const char* function = "beta_binomial_lpmf(OpenCL)"; + static constexpr const char* function = "beta_binomial_lpmf(OpenCL)"; check_consistent_sizes(function, "Successes variable", n, "Population size parameter", N, diff --git a/stan/math/opencl/prim/beta_lpdf.hpp b/stan/math/opencl/prim/beta_lpdf.hpp index 434f00c8b9a..d9414cbf820 100644 --- a/stan/math/opencl/prim/beta_lpdf.hpp +++ b/stan/math/opencl/prim/beta_lpdf.hpp @@ -44,7 +44,7 @@ return_type_t beta_lpdf( const T_y_cl& y, const T_scale_succ_cl& alpha, const T_scale_fail_cl& beta) { using std::isfinite; - static const char* function = "beta_lpdf(OpenCL)"; + static constexpr const char* function = "beta_lpdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/beta_proportion_lpdf.hpp b/stan/math/opencl/prim/beta_proportion_lpdf.hpp index 54856484661..70d461a5047 100644 --- a/stan/math/opencl/prim/beta_proportion_lpdf.hpp +++ b/stan/math/opencl/prim/beta_proportion_lpdf.hpp @@ -41,7 +41,7 @@ template * = nullptr> return_type_t beta_proportion_lpdf( const T_y_cl& y, const T_loc_cl& mu, const T_prec_cl& kappa) { - static const char* function = "beta_proportion_lpdf(OpenCL)"; + static constexpr const char* function = "beta_proportion_lpdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/binomial_logit_lpmf.hpp b/stan/math/opencl/prim/binomial_logit_lpmf.hpp index 1d1fdc3f630..a34e01a904b 100644 --- a/stan/math/opencl/prim/binomial_logit_lpmf.hpp +++ b/stan/math/opencl/prim/binomial_logit_lpmf.hpp @@ -33,7 +33,7 @@ template * = nullptr> return_type_t binomial_logit_lpmf(const T_n_cl& n, const T_N_cl N, const T_prob_cl& alpha) { - static const char* function = "binomial_logit_lpmf(OpenCL)"; + static constexpr const char* function = "binomial_logit_lpmf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/binomial_lpmf.hpp b/stan/math/opencl/prim/binomial_lpmf.hpp index d3088f004e0..2ebb680ef65 100644 --- a/stan/math/opencl/prim/binomial_lpmf.hpp +++ b/stan/math/opencl/prim/binomial_lpmf.hpp @@ -35,7 +35,7 @@ template * = nullptr> return_type_t binomial_lpmf(const T_n_cl& n, const T_N_cl N, const T_prob_cl& theta) { - static const char* function = "binomial_lpmf(OpenCL)"; + static constexpr const char* function = "binomial_lpmf(OpenCL)"; using T_partials_return = partials_return_t; using std::isnan; diff --git a/stan/math/opencl/prim/categorical_logit_glm_lpmf.hpp b/stan/math/opencl/prim/categorical_logit_glm_lpmf.hpp index e01627c3400..f6218566452 100644 --- a/stan/math/opencl/prim/categorical_logit_glm_lpmf.hpp +++ b/stan/math/opencl/prim/categorical_logit_glm_lpmf.hpp @@ -58,7 +58,7 @@ return_type_t categorical_logit_glm_lpmf( const size_t N_attributes = x.cols(); const size_t N_classes = beta.cols(); - static const char* function = "categorical_logit_glm_lpmf"; + static constexpr const char* function = "categorical_logit_glm_lpmf"; if (is_y_vector) { check_size_match(function, "Rows of ", "x", N_instances, "size of ", "y", math::size(y)); diff --git a/stan/math/opencl/prim/cauchy_cdf.hpp b/stan/math/opencl/prim/cauchy_cdf.hpp index 9e5597fddc2..816c7afa4bf 100644 --- a/stan/math/opencl/prim/cauchy_cdf.hpp +++ b/stan/math/opencl/prim/cauchy_cdf.hpp @@ -33,7 +33,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t cauchy_cdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { - static const char* function = "cauchy_cdf(OpenCL)"; + static constexpr const char* function = "cauchy_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/cauchy_lccdf.hpp b/stan/math/opencl/prim/cauchy_lccdf.hpp index d2b29e235f7..d31e3cb895c 100644 --- a/stan/math/opencl/prim/cauchy_lccdf.hpp +++ b/stan/math/opencl/prim/cauchy_lccdf.hpp @@ -33,7 +33,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t cauchy_lccdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { - static const char* function = "cauchy_lccdf(OpenCL)"; + static constexpr const char* function = "cauchy_lccdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/cauchy_lcdf.hpp b/stan/math/opencl/prim/cauchy_lcdf.hpp index a99af4b278b..2e2f779b57e 100644 --- a/stan/math/opencl/prim/cauchy_lcdf.hpp +++ b/stan/math/opencl/prim/cauchy_lcdf.hpp @@ -33,7 +33,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t cauchy_lcdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { - static const char* function = "cauchy_lcdf(OpenCL)"; + static constexpr const char* function = "cauchy_lcdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/cauchy_lpdf.hpp b/stan/math/opencl/prim/cauchy_lpdf.hpp index 627283c177e..dcd13fc2462 100644 --- a/stan/math/opencl/prim/cauchy_lpdf.hpp +++ b/stan/math/opencl/prim/cauchy_lpdf.hpp @@ -37,7 +37,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t cauchy_lpdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { - static const char* function = "cauchy_lpdf(OpenCL)"; + static constexpr const char* function = "cauchy_lpdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/chi_square_lpdf.hpp b/stan/math/opencl/prim/chi_square_lpdf.hpp index 32c4d25b6a1..ef35ac95c6f 100644 --- a/stan/math/opencl/prim/chi_square_lpdf.hpp +++ b/stan/math/opencl/prim/chi_square_lpdf.hpp @@ -37,7 +37,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t chi_square_lpdf(const T_y_cl& y, const T_dof_cl& nu) { - static const char* function = "chi_square_lpdf(OpenCL)"; + static constexpr const char* function = "chi_square_lpdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/dirichlet_lpdf.hpp b/stan/math/opencl/prim/dirichlet_lpdf.hpp index a7ab9a26169..659071debd3 100644 --- a/stan/math/opencl/prim/dirichlet_lpdf.hpp +++ b/stan/math/opencl/prim/dirichlet_lpdf.hpp @@ -60,7 +60,7 @@ template * = nullptr> inline return_type_t dirichlet_lpdf( const T_prob_cl& theta, const T_prior_size_cl& alpha) { - static const char* function = "dirichlet_lpdf(OpenCL)"; + static constexpr const char* function = "dirichlet_lpdf(OpenCL)"; check_consistent_sizes(function, "probabilities", theta, "prior sample sizes", alpha); diff --git a/stan/math/opencl/prim/double_exponential_cdf.hpp b/stan/math/opencl/prim/double_exponential_cdf.hpp index e8e4cced3d9..9e77096accd 100644 --- a/stan/math/opencl/prim/double_exponential_cdf.hpp +++ b/stan/math/opencl/prim/double_exponential_cdf.hpp @@ -32,7 +32,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t double_exponential_cdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { - static const char* function = "double_exponential_cdf(OpenCL)"; + static constexpr const char* function = "double_exponential_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/double_exponential_lccdf.hpp b/stan/math/opencl/prim/double_exponential_lccdf.hpp index f8f04db4c49..bbb39454aa1 100644 --- a/stan/math/opencl/prim/double_exponential_lccdf.hpp +++ b/stan/math/opencl/prim/double_exponential_lccdf.hpp @@ -33,7 +33,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t double_exponential_lccdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { - static const char* function = "double_exponential_lccdf(OpenCL)"; + static constexpr const char* function = "double_exponential_lccdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/double_exponential_lcdf.hpp b/stan/math/opencl/prim/double_exponential_lcdf.hpp index de8b1c35cf9..512433ca871 100644 --- a/stan/math/opencl/prim/double_exponential_lcdf.hpp +++ b/stan/math/opencl/prim/double_exponential_lcdf.hpp @@ -32,7 +32,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t double_exponential_lcdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { - static const char* function = "double_exponential_lcdf(OpenCL)"; + static constexpr const char* function = "double_exponential_lcdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/double_exponential_lpdf.hpp b/stan/math/opencl/prim/double_exponential_lpdf.hpp index 1e7b32d9a2d..303f81e9d5f 100644 --- a/stan/math/opencl/prim/double_exponential_lpdf.hpp +++ b/stan/math/opencl/prim/double_exponential_lpdf.hpp @@ -35,7 +35,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t double_exponential_lpdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { - static const char* function = "double_exponential_lpdf(OpenCL)"; + static constexpr const char* function = "double_exponential_lpdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/exp_mod_normal_cdf.hpp b/stan/math/opencl/prim/exp_mod_normal_cdf.hpp index 38a33a2399b..cca630f3f51 100644 --- a/stan/math/opencl/prim/exp_mod_normal_cdf.hpp +++ b/stan/math/opencl/prim/exp_mod_normal_cdf.hpp @@ -36,7 +36,7 @@ template exp_mod_normal_cdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma, const T_inv_scale_cl& lambda) { - static const char* function = "exp_mod_normal_cdf(OpenCL)"; + static constexpr const char* function = "exp_mod_normal_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/exp_mod_normal_lccdf.hpp b/stan/math/opencl/prim/exp_mod_normal_lccdf.hpp index 4e449445073..7c34d155689 100644 --- a/stan/math/opencl/prim/exp_mod_normal_lccdf.hpp +++ b/stan/math/opencl/prim/exp_mod_normal_lccdf.hpp @@ -37,7 +37,7 @@ template exp_mod_normal_lccdf(const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma, const T_inv_scale_cl& lambda) { - static const char* function = "exp_mod_normal_lccdf(OpenCL)"; + static constexpr const char* function = "exp_mod_normal_lccdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/exp_mod_normal_lcdf.hpp b/stan/math/opencl/prim/exp_mod_normal_lcdf.hpp index 9f9ad27f510..81ba4fbdfae 100644 --- a/stan/math/opencl/prim/exp_mod_normal_lcdf.hpp +++ b/stan/math/opencl/prim/exp_mod_normal_lcdf.hpp @@ -37,7 +37,7 @@ template exp_mod_normal_lcdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma, const T_inv_scale_cl& lambda) { - static const char* function = "exp_mod_normal_lcdf(OpenCL)"; + static constexpr const char* function = "exp_mod_normal_lcdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/exp_mod_normal_lpdf.hpp b/stan/math/opencl/prim/exp_mod_normal_lpdf.hpp index 16988cde54a..19bcf158f32 100644 --- a/stan/math/opencl/prim/exp_mod_normal_lpdf.hpp +++ b/stan/math/opencl/prim/exp_mod_normal_lpdf.hpp @@ -39,7 +39,7 @@ template exp_mod_normal_lpdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma, const T_inv_scale_cl& lambda) { - static const char* function = "exp_mod_normal_lpdf(OpenCL)"; + static constexpr const char* function = "exp_mod_normal_lpdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/exponential_cdf.hpp b/stan/math/opencl/prim/exponential_cdf.hpp index d3b1db9685f..f1682edd051 100644 --- a/stan/math/opencl/prim/exponential_cdf.hpp +++ b/stan/math/opencl/prim/exponential_cdf.hpp @@ -32,7 +32,7 @@ template * = nullptr> return_type_t exponential_cdf( const T_y_cl& y, const T_inv_scale_cl& beta) { - static const char* function = "exponential_cdf(OpenCL)"; + static constexpr const char* function = "exponential_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/exponential_lccdf.hpp b/stan/math/opencl/prim/exponential_lccdf.hpp index 475bc4d8e91..a0558a2dc99 100644 --- a/stan/math/opencl/prim/exponential_lccdf.hpp +++ b/stan/math/opencl/prim/exponential_lccdf.hpp @@ -32,7 +32,7 @@ template * = nullptr> return_type_t exponential_lccdf( const T_y_cl& y, const T_inv_scale_cl& beta) { - static const char* function = "exponential_lccdf(OpenCL)"; + static constexpr const char* function = "exponential_lccdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/exponential_lcdf.hpp b/stan/math/opencl/prim/exponential_lcdf.hpp index 2a533a1627e..58cbece5ce5 100644 --- a/stan/math/opencl/prim/exponential_lcdf.hpp +++ b/stan/math/opencl/prim/exponential_lcdf.hpp @@ -32,7 +32,7 @@ template * = nullptr> return_type_t exponential_lcdf( const T_y_cl& y, const T_inv_scale_cl& beta) { - static const char* function = "exponential_lcdf(OpenCL)"; + static constexpr const char* function = "exponential_lcdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/exponential_lpdf.hpp b/stan/math/opencl/prim/exponential_lpdf.hpp index 04ced4b51dc..541defbeb90 100644 --- a/stan/math/opencl/prim/exponential_lpdf.hpp +++ b/stan/math/opencl/prim/exponential_lpdf.hpp @@ -47,7 +47,7 @@ template exponential_lpdf( const T_y_cl& y, const T_inv_scale_cl& beta) { using std::isfinite; - static const char* function = "exponential_lpdf(OpenCL)"; + static constexpr const char* function = "exponential_lpdf(OpenCL)"; using T_partials_return = partials_return_t; check_consistent_sizes(function, "Random variable", y, diff --git a/stan/math/opencl/prim/frechet_cdf.hpp b/stan/math/opencl/prim/frechet_cdf.hpp index 431be38407e..7e4cd7bc841 100644 --- a/stan/math/opencl/prim/frechet_cdf.hpp +++ b/stan/math/opencl/prim/frechet_cdf.hpp @@ -33,7 +33,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t frechet_cdf( const T_y_cl& y, const T_shape_cl& alpha, const T_scale_cl& sigma) { - static const char* function = "frechet_cdf(OpenCL)"; + static constexpr const char* function = "frechet_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/frechet_lccdf.hpp b/stan/math/opencl/prim/frechet_lccdf.hpp index a8601917fac..95c34d69e1c 100644 --- a/stan/math/opencl/prim/frechet_lccdf.hpp +++ b/stan/math/opencl/prim/frechet_lccdf.hpp @@ -33,7 +33,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t frechet_lccdf( const T_y_cl& y, const T_shape_cl& alpha, const T_scale_cl& sigma) { - static const char* function = "frechet_lccdf(OpenCL)"; + static constexpr const char* function = "frechet_lccdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/frechet_lcdf.hpp b/stan/math/opencl/prim/frechet_lcdf.hpp index a23952421fa..e775094c861 100644 --- a/stan/math/opencl/prim/frechet_lcdf.hpp +++ b/stan/math/opencl/prim/frechet_lcdf.hpp @@ -33,7 +33,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t frechet_lcdf( const T_y_cl& y, const T_shape_cl& alpha, const T_scale_cl& sigma) { - static const char* function = "frechet_lcdf(OpenCL)"; + static constexpr const char* function = "frechet_lcdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/frechet_lpdf.hpp b/stan/math/opencl/prim/frechet_lpdf.hpp index 1670a054a57..67f1dae3290 100644 --- a/stan/math/opencl/prim/frechet_lpdf.hpp +++ b/stan/math/opencl/prim/frechet_lpdf.hpp @@ -39,7 +39,7 @@ template < return_type_t frechet_lpdf( const T_y_cl& y, const T_shape_cl& alpha, const T_scale_cl& sigma) { using std::isfinite; - static const char* function = "frechet_lpdf(OpenCL)"; + static constexpr const char* function = "frechet_lpdf(OpenCL)"; using T_partials_return = partials_return_t; check_consistent_sizes(function, "Random variable", y, "Shape parameter", diff --git a/stan/math/opencl/prim/gamma_lpdf.hpp b/stan/math/opencl/prim/gamma_lpdf.hpp index 09a4ebd0dba..ce5571f5f97 100644 --- a/stan/math/opencl/prim/gamma_lpdf.hpp +++ b/stan/math/opencl/prim/gamma_lpdf.hpp @@ -48,7 +48,7 @@ return_type_t gamma_lpdf( const T_y_cl& y, const T_shape_cl& alpha, const T_inv_scale_cl& beta) { using std::isfinite; using std::isnan; - static const char* function = "gamma_lpdf(OpenCL)"; + static constexpr const char* function = "gamma_lpdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/gumbel_cdf.hpp b/stan/math/opencl/prim/gumbel_cdf.hpp index 0f05fe51644..271ea8b601f 100644 --- a/stan/math/opencl/prim/gumbel_cdf.hpp +++ b/stan/math/opencl/prim/gumbel_cdf.hpp @@ -34,7 +34,7 @@ template < return_type_t gumbel_cdf(const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& beta) { - static const char* function = "gumbel_cdf(OpenCL)"; + static constexpr const char* function = "gumbel_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/gumbel_lccdf.hpp b/stan/math/opencl/prim/gumbel_lccdf.hpp index 427b8c9b788..a1693373f54 100644 --- a/stan/math/opencl/prim/gumbel_lccdf.hpp +++ b/stan/math/opencl/prim/gumbel_lccdf.hpp @@ -33,7 +33,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t gumbel_lccdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& beta) { - static const char* function = "gumbel_lccdf(OpenCL)"; + static constexpr const char* function = "gumbel_lccdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/gumbel_lcdf.hpp b/stan/math/opencl/prim/gumbel_lcdf.hpp index c091e251bb5..6f8d2db8d5e 100644 --- a/stan/math/opencl/prim/gumbel_lcdf.hpp +++ b/stan/math/opencl/prim/gumbel_lcdf.hpp @@ -33,7 +33,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t gumbel_lcdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& beta) { - static const char* function = "gumbel_lcdf(OpenCL)"; + static constexpr const char* function = "gumbel_lcdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/gumbel_lpdf.hpp b/stan/math/opencl/prim/gumbel_lpdf.hpp index 710d7c19820..69c8617969c 100644 --- a/stan/math/opencl/prim/gumbel_lpdf.hpp +++ b/stan/math/opencl/prim/gumbel_lpdf.hpp @@ -37,7 +37,7 @@ return_type_t gumbel_lpdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& beta) { using std::isfinite; using std::isnan; - static const char* function = "gumbel_lpdf(OpenCL)"; + static constexpr const char* function = "gumbel_lpdf(OpenCL)"; using T_partials_return = partials_return_t; check_consistent_sizes(function, "Random variable", y, "Location parameter", diff --git a/stan/math/opencl/prim/inv_chi_square_lpdf.hpp b/stan/math/opencl/prim/inv_chi_square_lpdf.hpp index 905ad6f1b28..4415e75fc59 100644 --- a/stan/math/opencl/prim/inv_chi_square_lpdf.hpp +++ b/stan/math/opencl/prim/inv_chi_square_lpdf.hpp @@ -45,7 +45,7 @@ return_type_t inv_chi_square_lpdf(const T_y_cl& y, const T_dof_cl& nu) { using std::isfinite; using std::isnan; - static const char* function = "inv_chi_square_lpdf(OpenCL)"; + static constexpr const char* function = "inv_chi_square_lpdf(OpenCL)"; using T_partials_return = partials_return_t; check_consistent_sizes(function, "Random variable", y, diff --git a/stan/math/opencl/prim/inv_gamma_lpdf.hpp b/stan/math/opencl/prim/inv_gamma_lpdf.hpp index 7738c6a002a..e287e803311 100644 --- a/stan/math/opencl/prim/inv_gamma_lpdf.hpp +++ b/stan/math/opencl/prim/inv_gamma_lpdf.hpp @@ -40,7 +40,7 @@ return_type_t inv_gamma_lpdf( const T_y_cl& y, const T_shape_cl& alpha, const T_scale_cl& beta) { using std::isfinite; using std::isnan; - static const char* function = "inv_gamma_lpdf(OpenCL)"; + static constexpr const char* function = "inv_gamma_lpdf(OpenCL)"; using T_partials_return = partials_return_t; check_consistent_sizes(function, "Random variable", y, diff --git a/stan/math/opencl/prim/log_mix.hpp b/stan/math/opencl/prim/log_mix.hpp index 1f4fef92876..3c61e846d66 100644 --- a/stan/math/opencl/prim/log_mix.hpp +++ b/stan/math/opencl/prim/log_mix.hpp @@ -37,7 +37,7 @@ template * = nullptr> inline auto log_mix(const T_theta_cl& theta, const T_lambda_cl& lambda) { - static const char* function = "log_mix(OpenCL)"; + static constexpr const char* function = "log_mix(OpenCL)"; using T_return = return_type_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/logistic_cdf.hpp b/stan/math/opencl/prim/logistic_cdf.hpp index 64a58115208..94c837a9ff8 100644 --- a/stan/math/opencl/prim/logistic_cdf.hpp +++ b/stan/math/opencl/prim/logistic_cdf.hpp @@ -33,7 +33,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t logistic_cdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { - static const char* function = "logistic_cdf(OpenCL)"; + static constexpr const char* function = "logistic_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/logistic_lccdf.hpp b/stan/math/opencl/prim/logistic_lccdf.hpp index a6829612548..3b653f8c378 100644 --- a/stan/math/opencl/prim/logistic_lccdf.hpp +++ b/stan/math/opencl/prim/logistic_lccdf.hpp @@ -33,7 +33,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t logistic_lccdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { - static const char* function = "logistic_lccdf(OpenCL)"; + static constexpr const char* function = "logistic_lccdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/logistic_lcdf.hpp b/stan/math/opencl/prim/logistic_lcdf.hpp index b151fabdf11..20026f71f67 100644 --- a/stan/math/opencl/prim/logistic_lcdf.hpp +++ b/stan/math/opencl/prim/logistic_lcdf.hpp @@ -33,7 +33,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t logistic_lcdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { - static const char* function = "logistic_lcdf(OpenCL)"; + static constexpr const char* function = "logistic_lcdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/logistic_lpdf.hpp b/stan/math/opencl/prim/logistic_lpdf.hpp index da324ac47fd..45f9e90df86 100644 --- a/stan/math/opencl/prim/logistic_lpdf.hpp +++ b/stan/math/opencl/prim/logistic_lpdf.hpp @@ -40,7 +40,7 @@ template < return_type_t logistic_lpdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { using std::isfinite; - static const char* function = "logistic_lpdf(OpenCL)"; + static constexpr const char* function = "logistic_lpdf(OpenCL)"; using T_partials_return = partials_return_t; check_consistent_sizes(function, "Random variable", y, "Location parameter", diff --git a/stan/math/opencl/prim/lognormal_cdf.hpp b/stan/math/opencl/prim/lognormal_cdf.hpp index f1909298b2b..d5e78e7a79d 100644 --- a/stan/math/opencl/prim/lognormal_cdf.hpp +++ b/stan/math/opencl/prim/lognormal_cdf.hpp @@ -33,7 +33,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t lognormal_cdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { - static const char* function = "lognormal_cdf(OpenCL)"; + static constexpr const char* function = "lognormal_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/lognormal_lccdf.hpp b/stan/math/opencl/prim/lognormal_lccdf.hpp index dde35eab19c..1a7ae21c9da 100644 --- a/stan/math/opencl/prim/lognormal_lccdf.hpp +++ b/stan/math/opencl/prim/lognormal_lccdf.hpp @@ -33,7 +33,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t lognormal_lccdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { - static const char* function = "lognormal_lccdf(OpenCL)"; + static constexpr const char* function = "lognormal_lccdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/lognormal_lcdf.hpp b/stan/math/opencl/prim/lognormal_lcdf.hpp index b83925c2945..5c917e450a7 100644 --- a/stan/math/opencl/prim/lognormal_lcdf.hpp +++ b/stan/math/opencl/prim/lognormal_lcdf.hpp @@ -33,7 +33,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t lognormal_lcdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { - static const char* function = "lognormal_lcdf(OpenCL)"; + static constexpr const char* function = "lognormal_lcdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/lognormal_lpdf.hpp b/stan/math/opencl/prim/lognormal_lpdf.hpp index b90b5615517..0c336bdfbbd 100644 --- a/stan/math/opencl/prim/lognormal_lpdf.hpp +++ b/stan/math/opencl/prim/lognormal_lpdf.hpp @@ -40,7 +40,7 @@ template < return_type_t lognormal_lpdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { using std::isfinite; - static const char* function = "lognormal_lpdf(OpenCL)"; + static constexpr const char* function = "lognormal_lpdf(OpenCL)"; using T_partials_return = partials_return_t; check_consistent_sizes(function, "Random variable", y, "Location parameter", diff --git a/stan/math/opencl/prim/multi_normal_cholesky_lpdf.hpp b/stan/math/opencl/prim/multi_normal_cholesky_lpdf.hpp index 890b1e22958..78dcd5dc291 100644 --- a/stan/math/opencl/prim/multi_normal_cholesky_lpdf.hpp +++ b/stan/math/opencl/prim/multi_normal_cholesky_lpdf.hpp @@ -41,7 +41,7 @@ template * = nullptr> inline return_type_t multi_normal_cholesky_lpdf( const T_y_cl& y, const T_loc_cl& mu, const T_covar_cl& L) { - static const char* function = "multi_normal_cholesky_lpdf(OpenCL)"; + static constexpr const char* function = "multi_normal_cholesky_lpdf(OpenCL)"; check_consistent_sizes(function, "y", y, "mu", mu); check_square(function, "covariance parameter", L); diff --git a/stan/math/opencl/prim/neg_binomial_2_log_glm_lpmf.hpp b/stan/math/opencl/prim/neg_binomial_2_log_glm_lpmf.hpp index ae8bcc55bda..3e2cca014a9 100644 --- a/stan/math/opencl/prim/neg_binomial_2_log_glm_lpmf.hpp +++ b/stan/math/opencl/prim/neg_binomial_2_log_glm_lpmf.hpp @@ -69,7 +69,7 @@ return_type_t neg_binomial_2_log_glm_lpmf(const T_y_cl& y, const T_x_cl& x, const T_alpha_cl& alpha, const T_beta_cl& beta, const T_phi_cl& phi) { - static const char* function = "neg_binomial_2_log_glm_lpmf(OpenCL)"; + static constexpr const char* function = "neg_binomial_2_log_glm_lpmf(OpenCL)"; using T_partials_return = partials_return_t; constexpr bool is_y_vector = !is_stan_scalar::value; diff --git a/stan/math/opencl/prim/neg_binomial_2_log_lpmf.hpp b/stan/math/opencl/prim/neg_binomial_2_log_lpmf.hpp index 10569ccf2f8..b856375acf1 100644 --- a/stan/math/opencl/prim/neg_binomial_2_log_lpmf.hpp +++ b/stan/math/opencl/prim/neg_binomial_2_log_lpmf.hpp @@ -42,7 +42,7 @@ template neg_binomial_2_log_lpmf(const T_n_cl& n, const T_log_location_cl& eta, const T_precision_cl& phi) { - static const char* function = "neg_binomial_2_log_lpmf(OpenCL)"; + static constexpr const char* function = "neg_binomial_2_log_lpmf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/neg_binomial_2_lpmf.hpp b/stan/math/opencl/prim/neg_binomial_2_lpmf.hpp index eb91ce037ba..4b8e19f6342 100644 --- a/stan/math/opencl/prim/neg_binomial_2_lpmf.hpp +++ b/stan/math/opencl/prim/neg_binomial_2_lpmf.hpp @@ -41,7 +41,7 @@ template * = nullptr> inline return_type_t neg_binomial_2_lpmf( const T_n_cl& n, const T_location_cl& mu, const T_precision_cl& phi) { - static const char* function = "neg_binomial_2_lpmf(OpenCL)"; + static constexpr const char* function = "neg_binomial_2_lpmf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/neg_binomial_lpmf.hpp b/stan/math/opencl/prim/neg_binomial_lpmf.hpp index 7765a5855ae..b4a82cb5aa6 100644 --- a/stan/math/opencl/prim/neg_binomial_lpmf.hpp +++ b/stan/math/opencl/prim/neg_binomial_lpmf.hpp @@ -39,7 +39,7 @@ template * = nullptr> inline return_type_t neg_binomial_lpmf( const T_n_cl& n, const T_shape_cl& alpha, const T_inv_scale_cl& beta) { - static const char* function = "neg_binomial_lpmf(OpenCL)"; + static constexpr const char* function = "neg_binomial_lpmf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/normal_cdf.hpp b/stan/math/opencl/prim/normal_cdf.hpp index 9c2b6603345..3025f0fad82 100644 --- a/stan/math/opencl/prim/normal_cdf.hpp +++ b/stan/math/opencl/prim/normal_cdf.hpp @@ -33,7 +33,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t normal_cdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { - static const char* function = "normal_cdf(OpenCL)"; + static constexpr const char* function = "normal_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/normal_id_glm_lpdf.hpp b/stan/math/opencl/prim/normal_id_glm_lpdf.hpp index 4c371cc7731..b89373c154f 100644 --- a/stan/math/opencl/prim/normal_id_glm_lpdf.hpp +++ b/stan/math/opencl/prim/normal_id_glm_lpdf.hpp @@ -68,7 +68,7 @@ normal_id_glm_lpdf(const T_y_cl& y, const T_x_cl& x, const T_alpha_cl& alpha, constexpr bool is_sigma_vector = !is_stan_scalar::value; constexpr bool is_alpha_vector = !is_stan_scalar::value; using std::isfinite; - static const char* function = "normal_id_glm_lpdf(OpenCL)"; + static constexpr const char* function = "normal_id_glm_lpdf(OpenCL)"; const size_t N = x.rows(); const size_t M = x.cols(); diff --git a/stan/math/opencl/prim/normal_lccdf.hpp b/stan/math/opencl/prim/normal_lccdf.hpp index e68008509f8..370e485c305 100644 --- a/stan/math/opencl/prim/normal_lccdf.hpp +++ b/stan/math/opencl/prim/normal_lccdf.hpp @@ -33,7 +33,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t normal_lccdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { - static const char* function = "normal_lccdf(OpenCL)"; + static constexpr const char* function = "normal_lccdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/normal_lcdf.hpp b/stan/math/opencl/prim/normal_lcdf.hpp index 15751e1345b..3509b6a2f74 100644 --- a/stan/math/opencl/prim/normal_lcdf.hpp +++ b/stan/math/opencl/prim/normal_lcdf.hpp @@ -179,7 +179,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t normal_lcdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { - static const char* function = "normal_lcdf(OpenCL)"; + static constexpr const char* function = "normal_lcdf(OpenCL)"; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/normal_lpdf.hpp b/stan/math/opencl/prim/normal_lpdf.hpp index d2b3b222c0d..d44a17c49c9 100644 --- a/stan/math/opencl/prim/normal_lpdf.hpp +++ b/stan/math/opencl/prim/normal_lpdf.hpp @@ -39,7 +39,7 @@ template < require_any_not_stan_scalar_t* = nullptr> inline return_type_t normal_lpdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { - static const char* function = "normal_lpdf(OpenCL)"; + static constexpr const char* function = "normal_lpdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/ordered_logistic_glm_lpmf.hpp b/stan/math/opencl/prim/ordered_logistic_glm_lpmf.hpp index f5c1958bf82..1ffa05b7f3f 100644 --- a/stan/math/opencl/prim/ordered_logistic_glm_lpmf.hpp +++ b/stan/math/opencl/prim/ordered_logistic_glm_lpmf.hpp @@ -59,7 +59,7 @@ return_type_t ordered_logistic_glm_lpmf( using T_partials_return = partials_return_t; constexpr bool is_y_vector = !is_stan_scalar::value; - static const char* function = "ordered_logistic_glm_lpmf"; + static constexpr const char* function = "ordered_logistic_glm_lpmf"; const size_t N_instances = x.rows(); const size_t N_attributes = x.cols(); diff --git a/stan/math/opencl/prim/ordered_logistic_lpmf.hpp b/stan/math/opencl/prim/ordered_logistic_lpmf.hpp index 2c4124b0317..ce85bb2bcba 100644 --- a/stan/math/opencl/prim/ordered_logistic_lpmf.hpp +++ b/stan/math/opencl/prim/ordered_logistic_lpmf.hpp @@ -70,7 +70,7 @@ template ordered_logistic_lpmf( const T_y_cl& y, const T_loc_cl& lambda, const T_cuts_cl& cuts) { constexpr bool is_y_vector = !is_stan_scalar::value; - static const char* function = "ordered_logistic_lpmf(OpenCL)"; + static constexpr const char* function = "ordered_logistic_lpmf(OpenCL)"; if (size(y) != 1) { check_size_match(function, "Size of ", "y", math::size(y), "Size of", diff --git a/stan/math/opencl/prim/pareto_cdf.hpp b/stan/math/opencl/prim/pareto_cdf.hpp index 47c502999f5..3a0511d9fc3 100644 --- a/stan/math/opencl/prim/pareto_cdf.hpp +++ b/stan/math/opencl/prim/pareto_cdf.hpp @@ -32,7 +32,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t pareto_cdf( const T_y_cl& y, const T_scale_cl& y_min, const T_shape_cl& alpha) { - static const char* function = "pareto_cdf(OpenCL)"; + static constexpr const char* function = "pareto_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/pareto_lccdf.hpp b/stan/math/opencl/prim/pareto_lccdf.hpp index 4b4384f440d..b7e9d97887c 100644 --- a/stan/math/opencl/prim/pareto_lccdf.hpp +++ b/stan/math/opencl/prim/pareto_lccdf.hpp @@ -32,7 +32,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t pareto_lccdf( const T_y_cl& y, const T_scale_cl& y_min, const T_shape_cl& alpha) { - static const char* function = "pareto_lccdf(OpenCL)"; + static constexpr const char* function = "pareto_lccdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isinf; diff --git a/stan/math/opencl/prim/pareto_lcdf.hpp b/stan/math/opencl/prim/pareto_lcdf.hpp index 6ecc8fe43fe..4f07fe2474f 100644 --- a/stan/math/opencl/prim/pareto_lcdf.hpp +++ b/stan/math/opencl/prim/pareto_lcdf.hpp @@ -32,7 +32,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t pareto_lcdf( const T_y_cl& y, const T_scale_cl& y_min, const T_shape_cl& alpha) { - static const char* function = "pareto_lcdf(OpenCL)"; + static constexpr const char* function = "pareto_lcdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isinf; diff --git a/stan/math/opencl/prim/pareto_lpdf.hpp b/stan/math/opencl/prim/pareto_lpdf.hpp index 5c4dbb14682..659f2ec692f 100644 --- a/stan/math/opencl/prim/pareto_lpdf.hpp +++ b/stan/math/opencl/prim/pareto_lpdf.hpp @@ -37,7 +37,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t pareto_lpdf( const T_y_cl& y, const T_scale_cl& y_min, const T_shape_cl& alpha) { - static const char* function = "pareto_lpdf(OpenCL)"; + static constexpr const char* function = "pareto_lpdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/pareto_type_2_cdf.hpp b/stan/math/opencl/prim/pareto_type_2_cdf.hpp index ac549e13783..88bbf867d22 100644 --- a/stan/math/opencl/prim/pareto_type_2_cdf.hpp +++ b/stan/math/opencl/prim/pareto_type_2_cdf.hpp @@ -36,7 +36,7 @@ template pareto_type_2_cdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& lambda, const T_shape_cl& alpha) { - static const char* function = "pareto_type_2_cdf(OpenCL)"; + static constexpr const char* function = "pareto_type_2_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/pareto_type_2_lccdf.hpp b/stan/math/opencl/prim/pareto_type_2_lccdf.hpp index 297e6547d43..e5b8735399c 100644 --- a/stan/math/opencl/prim/pareto_type_2_lccdf.hpp +++ b/stan/math/opencl/prim/pareto_type_2_lccdf.hpp @@ -36,7 +36,7 @@ template pareto_type_2_lccdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& lambda, const T_shape_cl& alpha) { - static const char* function = "pareto_type_2_lccdf(OpenCL)"; + static constexpr const char* function = "pareto_type_2_lccdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/pareto_type_2_lcdf.hpp b/stan/math/opencl/prim/pareto_type_2_lcdf.hpp index 07c33fd3141..fc163f0a732 100644 --- a/stan/math/opencl/prim/pareto_type_2_lcdf.hpp +++ b/stan/math/opencl/prim/pareto_type_2_lcdf.hpp @@ -36,7 +36,7 @@ template pareto_type_2_lcdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& lambda, const T_shape_cl& alpha) { - static const char* function = "pareto_type_2_lcdf(OpenCL)"; + static constexpr const char* function = "pareto_type_2_lcdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/pareto_type_2_lpdf.hpp b/stan/math/opencl/prim/pareto_type_2_lpdf.hpp index b15bd038da6..8e066b31b4e 100644 --- a/stan/math/opencl/prim/pareto_type_2_lpdf.hpp +++ b/stan/math/opencl/prim/pareto_type_2_lpdf.hpp @@ -39,7 +39,7 @@ template pareto_type_2_lpdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& lambda, const T_shape_cl& alpha) { - static const char* function = "pareto_type_2_lpdf(OpenCL)"; + static constexpr const char* function = "pareto_type_2_lpdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/poisson_log_glm_lpmf.hpp b/stan/math/opencl/prim/poisson_log_glm_lpmf.hpp index a5f91624ae7..986fa71cb21 100644 --- a/stan/math/opencl/prim/poisson_log_glm_lpmf.hpp +++ b/stan/math/opencl/prim/poisson_log_glm_lpmf.hpp @@ -54,7 +54,7 @@ template poisson_log_glm_lpmf( const T_y_cl& y, const T_x_cl& x, const T_alpha_cl& alpha, const T_beta_cl& beta) { - static const char* function = "poisson_log_glm_lpmf(OpenCL)"; + static constexpr const char* function = "poisson_log_glm_lpmf(OpenCL)"; using T_partials_return = partials_return_t; constexpr bool is_y_vector = !is_stan_scalar::value; constexpr bool is_alpha_vector = !is_stan_scalar::value; diff --git a/stan/math/opencl/prim/poisson_log_lpmf.hpp b/stan/math/opencl/prim/poisson_log_lpmf.hpp index a75b7379d3c..a3b786c9b45 100644 --- a/stan/math/opencl/prim/poisson_log_lpmf.hpp +++ b/stan/math/opencl/prim/poisson_log_lpmf.hpp @@ -30,7 +30,7 @@ template * = nullptr> return_type_t poisson_log_lpmf(const T_n_cl& n, const T_log_rate_cl& alpha) { - static const char* function = "poisson_log_lpmf(OpenCL)"; + static constexpr const char* function = "poisson_log_lpmf(OpenCL)"; using T_partials_return = partials_return_t; using std::isinf; using std::isnan; diff --git a/stan/math/opencl/prim/poisson_lpmf.hpp b/stan/math/opencl/prim/poisson_lpmf.hpp index 4d3d8bdbfc4..eed71b8eb84 100644 --- a/stan/math/opencl/prim/poisson_lpmf.hpp +++ b/stan/math/opencl/prim/poisson_lpmf.hpp @@ -30,7 +30,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t poisson_lpmf(const T_n_cl& n, const T_rate_cl& lambda) { - static const char* function = "poisson_lpmf(OpenCL)"; + static constexpr const char* function = "poisson_lpmf(OpenCL)"; using T_partials_return = partials_return_t; using std::isinf; constexpr bool is_n_vector = !is_stan_scalar::value; diff --git a/stan/math/opencl/prim/rayleigh_cdf.hpp b/stan/math/opencl/prim/rayleigh_cdf.hpp index 870ed9a01e0..812663affd4 100644 --- a/stan/math/opencl/prim/rayleigh_cdf.hpp +++ b/stan/math/opencl/prim/rayleigh_cdf.hpp @@ -30,7 +30,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t rayleigh_cdf(const T_y_cl& y, const T_scale_cl& sigma) { - static const char* function = "rayleigh_cdf(OpenCL)"; + static constexpr const char* function = "rayleigh_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/rayleigh_lccdf.hpp b/stan/math/opencl/prim/rayleigh_lccdf.hpp index 0a8abe1f75f..862064eb8d1 100644 --- a/stan/math/opencl/prim/rayleigh_lccdf.hpp +++ b/stan/math/opencl/prim/rayleigh_lccdf.hpp @@ -30,7 +30,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t rayleigh_lccdf(const T_y_cl& y, const T_scale_cl& sigma) { - static const char* function = "rayleigh_lccdf(OpenCL)"; + static constexpr const char* function = "rayleigh_lccdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/rayleigh_lcdf.hpp b/stan/math/opencl/prim/rayleigh_lcdf.hpp index 1d317177267..a6835c4182e 100644 --- a/stan/math/opencl/prim/rayleigh_lcdf.hpp +++ b/stan/math/opencl/prim/rayleigh_lcdf.hpp @@ -30,7 +30,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t rayleigh_lcdf(const T_y_cl& y, const T_scale_cl& sigma) { - static const char* function = "rayleigh_lcdf(OpenCL)"; + static constexpr const char* function = "rayleigh_lcdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/rayleigh_lpdf.hpp b/stan/math/opencl/prim/rayleigh_lpdf.hpp index aea5487d4b2..0a656a9875b 100644 --- a/stan/math/opencl/prim/rayleigh_lpdf.hpp +++ b/stan/math/opencl/prim/rayleigh_lpdf.hpp @@ -30,7 +30,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t rayleigh_lpdf(const T_y_cl& y, const T_scale_cl& sigma) { - static const char* function = "rayleigh_lpdf(OpenCL)"; + static constexpr const char* function = "rayleigh_lpdf(OpenCL)"; using T_partials_return = partials_return_t; check_consistent_sizes(function, "Random variable", y, "Scale parameter", diff --git a/stan/math/opencl/prim/scaled_inv_chi_square_lpdf.hpp b/stan/math/opencl/prim/scaled_inv_chi_square_lpdf.hpp index d020b444138..a1f393c6cec 100644 --- a/stan/math/opencl/prim/scaled_inv_chi_square_lpdf.hpp +++ b/stan/math/opencl/prim/scaled_inv_chi_square_lpdf.hpp @@ -42,7 +42,7 @@ template < require_any_not_stan_scalar_t* = nullptr> inline return_type_t scaled_inv_chi_square_lpdf( const T_y_cl& y, const T_dof_cl& nu, const T_scale_cl& s) { - static const char* function = "scaled_inv_chi_square_lpdf(OpenCL)"; + static constexpr const char* function = "scaled_inv_chi_square_lpdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/skew_double_exponential_cdf.hpp b/stan/math/opencl/prim/skew_double_exponential_cdf.hpp index 8871a226258..c25e0c3167c 100644 --- a/stan/math/opencl/prim/skew_double_exponential_cdf.hpp +++ b/stan/math/opencl/prim/skew_double_exponential_cdf.hpp @@ -36,7 +36,7 @@ template skew_double_exponential_cdf(const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma, const T_skewness_cl& tau) { - static const char* function = "skew_double_exponential_cdf(OpenCL)"; + static constexpr const char* function = "skew_double_exponential_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/skew_double_exponential_lccdf.hpp b/stan/math/opencl/prim/skew_double_exponential_lccdf.hpp index be5860df963..583c1479d7f 100644 --- a/stan/math/opencl/prim/skew_double_exponential_lccdf.hpp +++ b/stan/math/opencl/prim/skew_double_exponential_lccdf.hpp @@ -37,7 +37,8 @@ return_type_t skew_double_exponential_lccdf(const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma, const T_skewness_cl& tau) { - static const char* function = "skew_double_exponential_lccdf(OpenCL)"; + static constexpr const char* function + = "skew_double_exponential_lccdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/skew_double_exponential_lcdf.hpp b/stan/math/opencl/prim/skew_double_exponential_lcdf.hpp index 3a7f39205a3..44fcdb8f1c5 100644 --- a/stan/math/opencl/prim/skew_double_exponential_lcdf.hpp +++ b/stan/math/opencl/prim/skew_double_exponential_lcdf.hpp @@ -37,7 +37,8 @@ return_type_t skew_double_exponential_lcdf(const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma, const T_skewness_cl& tau) { - static const char* function = "skew_double_exponential_lcdf(OpenCL)"; + static constexpr const char* function + = "skew_double_exponential_lcdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/skew_double_exponential_lpdf.hpp b/stan/math/opencl/prim/skew_double_exponential_lpdf.hpp index 73857199cf8..b5d527d09d3 100644 --- a/stan/math/opencl/prim/skew_double_exponential_lpdf.hpp +++ b/stan/math/opencl/prim/skew_double_exponential_lpdf.hpp @@ -40,7 +40,8 @@ return_type_t skew_double_exponential_lpdf(const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma, const T_skewness_cl& tau) { - static const char* function = "skew_double_exponential_lpdf(OpenCL)"; + static constexpr const char* function + = "skew_double_exponential_lpdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/skew_normal_lpdf.hpp b/stan/math/opencl/prim/skew_normal_lpdf.hpp index d3d3534ffb9..0adf764baf0 100644 --- a/stan/math/opencl/prim/skew_normal_lpdf.hpp +++ b/stan/math/opencl/prim/skew_normal_lpdf.hpp @@ -42,7 +42,7 @@ template skew_normal_lpdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma, const T_shape_cl& alpha) { - static const char* function = "skew_normal_lpdf(OpenCL)"; + static constexpr const char* function = "skew_normal_lpdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/std_normal_cdf.hpp b/stan/math/opencl/prim/std_normal_cdf.hpp index 6039810aa74..29d538c2f48 100644 --- a/stan/math/opencl/prim/std_normal_cdf.hpp +++ b/stan/math/opencl/prim/std_normal_cdf.hpp @@ -24,7 +24,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> return_type_t std_normal_cdf(const T_y_cl& y) { - static const char* function = "std_normal_cdf(OpenCL)"; + static constexpr const char* function = "std_normal_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/std_normal_lccdf.hpp b/stan/math/opencl/prim/std_normal_lccdf.hpp index 0e4fec9050f..f792e324425 100644 --- a/stan/math/opencl/prim/std_normal_lccdf.hpp +++ b/stan/math/opencl/prim/std_normal_lccdf.hpp @@ -25,7 +25,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> return_type_t std_normal_lccdf(const T_y_cl& y) { - static const char* function = "std_normal_lccdf(OpenCL)"; + static constexpr const char* function = "std_normal_lccdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/std_normal_lcdf.hpp b/stan/math/opencl/prim/std_normal_lcdf.hpp index 55adf34e43c..e516d8e742c 100644 --- a/stan/math/opencl/prim/std_normal_lcdf.hpp +++ b/stan/math/opencl/prim/std_normal_lcdf.hpp @@ -179,7 +179,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> return_type_t std_normal_lcdf(const T_y_cl& y) { - static const char* function = "std_normal_lcdf(OpenCL)"; + static constexpr const char* function = "std_normal_lcdf(OpenCL)"; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/std_normal_lpdf.hpp b/stan/math/opencl/prim/std_normal_lpdf.hpp index 899fe2e145f..a155991b534 100644 --- a/stan/math/opencl/prim/std_normal_lpdf.hpp +++ b/stan/math/opencl/prim/std_normal_lpdf.hpp @@ -30,7 +30,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> inline return_type_t std_normal_lpdf(const T_y_cl& y) { - static const char* function = "std_normal_lpdf(OpenCL)"; + static constexpr const char* function = "std_normal_lpdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/student_t_lpdf.hpp b/stan/math/opencl/prim/student_t_lpdf.hpp index 07954ba5d48..951de38390d 100644 --- a/stan/math/opencl/prim/student_t_lpdf.hpp +++ b/stan/math/opencl/prim/student_t_lpdf.hpp @@ -51,7 +51,7 @@ template student_t_lpdf( const T_y_cl& y, const T_dof_cl& nu, const T_loc_cl& mu, const T_scale_cl& sigma) { - static const char* function = "student_t_lpdf(OpenCL)"; + static constexpr const char* function = "student_t_lpdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/uniform_cdf.hpp b/stan/math/opencl/prim/uniform_cdf.hpp index 6ecbf6277af..1836582e33a 100644 --- a/stan/math/opencl/prim/uniform_cdf.hpp +++ b/stan/math/opencl/prim/uniform_cdf.hpp @@ -33,7 +33,7 @@ template uniform_cdf(const T_y_cl& y, const T_low_cl& alpha, const T_high_cl& beta) { - static const char* function = "uniform_cdf(OpenCL)"; + static constexpr const char* function = "uniform_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/uniform_lccdf.hpp b/stan/math/opencl/prim/uniform_lccdf.hpp index 76ffbaf887a..a165459453f 100644 --- a/stan/math/opencl/prim/uniform_lccdf.hpp +++ b/stan/math/opencl/prim/uniform_lccdf.hpp @@ -32,7 +32,7 @@ template * = nullptr> return_type_t uniform_lccdf( const T_y_cl& y, const T_low_cl& alpha, const T_high_cl& beta) { - static const char* function = "uniform_lccdf(OpenCL)"; + static constexpr const char* function = "uniform_lccdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/uniform_lcdf.hpp b/stan/math/opencl/prim/uniform_lcdf.hpp index 2fc3d3fd7c1..c74e4c480ec 100644 --- a/stan/math/opencl/prim/uniform_lcdf.hpp +++ b/stan/math/opencl/prim/uniform_lcdf.hpp @@ -33,7 +33,7 @@ template uniform_lcdf(const T_y_cl& y, const T_low_cl& alpha, const T_high_cl& beta) { - static const char* function = "uniform_lcdf(OpenCL)"; + static constexpr const char* function = "uniform_lcdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/uniform_lpdf.hpp b/stan/math/opencl/prim/uniform_lpdf.hpp index 40f6a9e108a..4966b5a15f3 100644 --- a/stan/math/opencl/prim/uniform_lpdf.hpp +++ b/stan/math/opencl/prim/uniform_lpdf.hpp @@ -41,7 +41,7 @@ template * = nullptr> inline return_type_t uniform_lpdf( const T_y_cl& y, const T_low_cl& alpha, const T_high_cl& beta) { - static const char* function = "uniform_lpdf(OpenCL)"; + static constexpr const char* function = "uniform_lpdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/weibull_cdf.hpp b/stan/math/opencl/prim/weibull_cdf.hpp index 5a83b181c2e..9c7bdc67373 100644 --- a/stan/math/opencl/prim/weibull_cdf.hpp +++ b/stan/math/opencl/prim/weibull_cdf.hpp @@ -33,7 +33,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t weibull_cdf( const T_y_cl& y, const T_shape_cl& alpha, const T_scale_cl& sigma) { - static const char* function = "weibull_cdf(OpenCL)"; + static constexpr const char* function = "weibull_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/weibull_lccdf.hpp b/stan/math/opencl/prim/weibull_lccdf.hpp index 6ed1a2846b5..41199946522 100644 --- a/stan/math/opencl/prim/weibull_lccdf.hpp +++ b/stan/math/opencl/prim/weibull_lccdf.hpp @@ -33,7 +33,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t weibull_lccdf( const T_y_cl& y, const T_shape_cl& alpha, const T_scale_cl& sigma) { - static const char* function = "weibull_lccdf(OpenCL)"; + static constexpr const char* function = "weibull_lccdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/weibull_lcdf.hpp b/stan/math/opencl/prim/weibull_lcdf.hpp index cdcc2a7a621..83136dbb9b3 100644 --- a/stan/math/opencl/prim/weibull_lcdf.hpp +++ b/stan/math/opencl/prim/weibull_lcdf.hpp @@ -33,7 +33,7 @@ template < require_any_not_stan_scalar_t* = nullptr> return_type_t weibull_lcdf( const T_y_cl& y, const T_shape_cl& alpha, const T_scale_cl& sigma) { - static const char* function = "weibull_lcdf(OpenCL)"; + static constexpr const char* function = "weibull_lcdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/weibull_lpdf.hpp b/stan/math/opencl/prim/weibull_lpdf.hpp index 44c2a12e83a..7f239526076 100644 --- a/stan/math/opencl/prim/weibull_lpdf.hpp +++ b/stan/math/opencl/prim/weibull_lpdf.hpp @@ -34,7 +34,7 @@ template < require_any_not_stan_scalar_t* = nullptr> inline return_type_t weibull_lpdf( const T_y_cl& y, const T_shape_cl& alpha, const T_scale_cl& sigma) { - static const char* function = "weibull_lpdf(OpenCL)"; + static constexpr const char* function = "weibull_lpdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; using std::isnan; diff --git a/stan/math/prim/fun/binomial_coefficient_log.hpp b/stan/math/prim/fun/binomial_coefficient_log.hpp index 12b0f13de97..908ca6a753d 100644 --- a/stan/math/prim/fun/binomial_coefficient_log.hpp +++ b/stan/math/prim/fun/binomial_coefficient_log.hpp @@ -96,7 +96,7 @@ inline return_type_t binomial_coefficient_log(const T_n n, const T_partials_return n_plus_1 = n_dbl + 1; const T_partials_return n_plus_1_mk = n_plus_1 - k_dbl; - static const char* function = "binomial_coefficient_log"; + static constexpr const char* function = "binomial_coefficient_log"; check_greater_or_equal(function, "first argument", n, -1); check_greater_or_equal(function, "second argument", k, -1); check_greater_or_equal(function, "(first argument - second argument + 1)", diff --git a/stan/math/prim/fun/constants.hpp b/stan/math/prim/fun/constants.hpp index e7f483ce7f7..fa2b64a3cde 100644 --- a/stan/math/prim/fun/constants.hpp +++ b/stan/math/prim/fun/constants.hpp @@ -73,18 +73,18 @@ static constexpr double LOG_ZERO = -INFTY; */ const double LOG_EPSILON = std::log(EPSILON); -/** - * The natural logarithm of \f$ \pi \f$, - * \f$ \log \pi \f$. - */ -const double LOG_PI = std::log(pi()); - /** * The natural logarithm of 2, * \f$ \log 2 \f$. */ static constexpr double LOG_TWO = boost::math::constants::ln_two(); +/** + * The natural logarithm of \f$ \pi \f$, + * \f$ \log \pi \f$. + */ +static constexpr double LOG_PI = 1.14472988584940017414342735135; + /** * The natural logarithm of 0.5, * \f$ \log 0.5 = \log 1 - \log 2 \f$. @@ -95,19 +95,19 @@ static constexpr double LOG_HALF = -LOG_TWO; * The natural logarithm of 2 plus the natural logarithm of \f$ \pi \f$, * \f$ \log(2\pi) \f$. */ -const double LOG_TWO_PI = LOG_TWO + LOG_PI; +static constexpr double LOG_TWO_PI = LOG_TWO + LOG_PI; /** * The value of one quarter the natural logarithm of \f$ \pi \f$, * \f$ \log(\pi) / 4 \f$. */ -const double LOG_PI_OVER_FOUR = 0.25 * LOG_PI; +static constexpr double LOG_PI_OVER_FOUR = 0.25 * LOG_PI; /** * The natural logarithm of the square root of \f$ \pi \f$, * \f$ \log(sqrt{\pi}) \f$. */ -const double LOG_SQRT_PI = std::log(boost::math::constants::root_pi()); +static constexpr double LOG_SQRT_PI = LOG_PI / 2; /** * The natural logarithm of 10, @@ -178,7 +178,7 @@ static constexpr double HALF_LOG_TWO = 0.5 * LOG_TWO; * The value of half the natural logarithm \f$ 2\pi \f$, * \f$ \log(2\pi) / 2 \f$. */ -const double HALF_LOG_TWO_PI = 0.5 * LOG_TWO_PI; +static constexpr double HALF_LOG_TWO_PI = 0.5 * LOG_TWO_PI; /** * The value of minus the natural logarithm of the square root of \f$ 2\pi \f$, diff --git a/stan/math/prim/fun/hypergeometric_2F1.hpp b/stan/math/prim/fun/hypergeometric_2F1.hpp index d66f14f1ac8..2dbae6bc418 100644 --- a/stan/math/prim/fun/hypergeometric_2F1.hpp +++ b/stan/math/prim/fun/hypergeometric_2F1.hpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/stan/math/prim/fun/inv_Phi.hpp b/stan/math/prim/fun/inv_Phi.hpp index 9c9811133f1..0ec72de8062 100644 --- a/stan/math/prim/fun/inv_Phi.hpp +++ b/stan/math/prim/fun/inv_Phi.hpp @@ -38,32 +38,32 @@ inline double inv_Phi_lambda(double p) { return INFTY; } - static const double a[8] + static constexpr double a[8] = {3.3871328727963666080e+00, 1.3314166789178437745e+02, 1.9715909503065514427e+03, 1.3731693765509461125e+04, 4.5921953931549871457e+04, 6.7265770927008700853e+04, 3.3430575583588128105e+04, 2.5090809287301226727e+03}; - static const double b[7] + static constexpr double b[7] = {4.2313330701600911252e+01, 6.8718700749205790830e+02, 5.3941960214247511077e+03, 2.1213794301586595867e+04, 3.9307895800092710610e+04, 2.8729085735721942674e+04, 5.2264952788528545610e+03}; - static const double c[8] + static constexpr double c[8] = {1.42343711074968357734e+00, 4.63033784615654529590e+00, 5.76949722146069140550e+00, 3.64784832476320460504e+00, 1.27045825245236838258e+00, 2.41780725177450611770e-01, 2.27238449892691845833e-02, 7.74545014278341407640e-04}; - static const double d[7] + static constexpr double d[7] = {2.05319162663775882187e+00, 1.67638483018380384940e+00, 6.89767334985100004550e-01, 1.48103976427480074590e-01, 1.51986665636164571966e-02, 5.47593808499534494600e-04, 1.05075007164441684324e-09}; - static const double e[8] + static constexpr double e[8] = {6.65790464350110377720e+00, 5.46378491116411436990e+00, 1.78482653991729133580e+00, 2.96560571828504891230e-01, 2.65321895265761230930e-02, 1.24266094738807843860e-03, 2.71155556874348757815e-05, 2.01033439929228813265e-07}; - static const double f[7] + static constexpr double f[7] = {5.99832206555887937690e-01, 1.36929880922735805310e-01, 1.48753612908506148525e-02, 7.86869131145613259100e-04, 1.84631831751005468180e-05, 1.42151175831644588870e-07, diff --git a/stan/math/prim/fun/lbeta.hpp b/stan/math/prim/fun/lbeta.hpp index 175fd02bdce..cb5671d41a5 100644 --- a/stan/math/prim/fun/lbeta.hpp +++ b/stan/math/prim/fun/lbeta.hpp @@ -69,7 +69,7 @@ return_type_t lbeta(const T1 a, const T2 b) { return NOT_A_NUMBER; } - static const char* function = "lbeta"; + static constexpr const char* function = "lbeta"; check_nonnegative(function, "first argument", a); check_nonnegative(function, "second argument", b); T_ret x; // x is the smaller of the two diff --git a/stan/math/prim/fun/linspaced_array.hpp b/stan/math/prim/fun/linspaced_array.hpp index ff467264135..54c0e082043 100644 --- a/stan/math/prim/fun/linspaced_array.hpp +++ b/stan/math/prim/fun/linspaced_array.hpp @@ -24,7 +24,7 @@ namespace math { * if high is nan or infinite, or if high is less than low. */ inline std::vector linspaced_array(int K, double low, double high) { - static const char* function = "linspaced_array"; + static constexpr const char* function = "linspaced_array"; check_nonnegative(function, "size", K); check_finite(function, "low", low); check_finite(function, "high", high); diff --git a/stan/math/prim/fun/linspaced_int_array.hpp b/stan/math/prim/fun/linspaced_int_array.hpp index 31499ac6491..cc9346262bf 100644 --- a/stan/math/prim/fun/linspaced_int_array.hpp +++ b/stan/math/prim/fun/linspaced_int_array.hpp @@ -31,7 +31,7 @@ namespace math { * @throw std::domain_error if K is negative or high is less than low. */ inline std::vector linspaced_int_array(int K, int low, int high) { - static const char* function = "linspaced_int_array"; + static constexpr const char* function = "linspaced_int_array"; check_nonnegative(function, "size", K); check_greater_or_equal(function, "high", high, low); if (K == 0) { diff --git a/stan/math/prim/fun/linspaced_row_vector.hpp b/stan/math/prim/fun/linspaced_row_vector.hpp index 31f0d455af4..6f6f39e63fb 100644 --- a/stan/math/prim/fun/linspaced_row_vector.hpp +++ b/stan/math/prim/fun/linspaced_row_vector.hpp @@ -23,7 +23,7 @@ namespace math { * if high is nan or infinite, or if high is less than low. */ inline auto linspaced_row_vector(int K, double low, double high) { - static const char* function = "linspaced_row_vector"; + static constexpr const char* function = "linspaced_row_vector"; check_nonnegative(function, "size", K); check_finite(function, "low", low); check_finite(function, "high", high); diff --git a/stan/math/prim/fun/linspaced_vector.hpp b/stan/math/prim/fun/linspaced_vector.hpp index 807adfdac53..76051b3fa33 100644 --- a/stan/math/prim/fun/linspaced_vector.hpp +++ b/stan/math/prim/fun/linspaced_vector.hpp @@ -23,7 +23,7 @@ namespace math { * if high is nan or infinite, or if high is less than low. */ inline auto linspaced_vector(int K, double low, double high) { - static const char* function = "linspaced_vector"; + static constexpr const char* function = "linspaced_vector"; check_nonnegative(function, "size", K); check_finite(function, "low", low); check_finite(function, "high", high); diff --git a/stan/math/prim/fun/log.hpp b/stan/math/prim/fun/log.hpp index 124aab6d302..75a2dcd00b9 100644 --- a/stan/math/prim/fun/log.hpp +++ b/stan/math/prim/fun/log.hpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -76,11 +77,9 @@ namespace internal { */ template inline std::complex complex_log(const std::complex& z) { - static const double inf = std::numeric_limits::infinity(); - static const double nan = std::numeric_limits::quiet_NaN(); if ((is_nan(z.real()) && is_inf(z.imag())) || (is_inf(z.real()) && is_nan(z.imag()))) { - return {inf, nan}; + return {INFTY, NOT_A_NUMBER}; } V r = sqrt(norm(z)); V theta = arg(z); diff --git a/stan/math/prim/fun/log10.hpp b/stan/math/prim/fun/log10.hpp index 70954bbd4fc..02e60664a29 100644 --- a/stan/math/prim/fun/log10.hpp +++ b/stan/math/prim/fun/log10.hpp @@ -67,7 +67,7 @@ namespace internal { */ template inline std::complex complex_log10(const std::complex& z) { - static const double inv_log_10 = 1 / std::log(10); + static constexpr double inv_log_10 = 1.0f / LOG_TEN; return log(z) * inv_log_10; } } // namespace internal diff --git a/stan/math/prim/fun/log_falling_factorial.hpp b/stan/math/prim/fun/log_falling_factorial.hpp index bf74d9543c8..04506edc89c 100644 --- a/stan/math/prim/fun/log_falling_factorial.hpp +++ b/stan/math/prim/fun/log_falling_factorial.hpp @@ -56,7 +56,7 @@ inline return_type_t log_falling_factorial(const T1 x, const T2 n) { if (is_any_nan(x, n)) { return NOT_A_NUMBER; } - static const char* function = "log_falling_factorial"; + static constexpr const char* function = "log_falling_factorial"; check_positive(function, "first argument", x); return lgamma(x + 1) - lgamma(x - n + 1); } diff --git a/stan/math/prim/fun/log_mix.hpp b/stan/math/prim/fun/log_mix.hpp index 4b13eb7629d..4bc1107f3e2 100644 --- a/stan/math/prim/fun/log_mix.hpp +++ b/stan/math/prim/fun/log_mix.hpp @@ -76,7 +76,7 @@ template * = nullptr> return_type_t log_mix(const T_theta& theta, const T_lam& lambda) { - static const char* function = "log_mix"; + static constexpr const char* function = "log_mix"; using T_partials_return = partials_return_t; using T_partials_vec = typename Eigen::Matrix; @@ -143,7 +143,7 @@ return_type_t log_mix(const T_theta& theta, template * = nullptr> return_type_t> log_mix( const T_theta& theta, const std::vector& lambda) { - static const char* function = "log_mix"; + static constexpr const char* function = "log_mix"; using T_partials_return = partials_return_t>; using T_partials_vec = typename Eigen::Matrix; diff --git a/stan/math/prim/fun/log_modified_bessel_first_kind.hpp b/stan/math/prim/fun/log_modified_bessel_first_kind.hpp index 1d5eb2bde33..e4154e13180 100644 --- a/stan/math/prim/fun/log_modified_bessel_first_kind.hpp +++ b/stan/math/prim/fun/log_modified_bessel_first_kind.hpp @@ -91,7 +91,7 @@ inline return_type_t log_modified_bessel_first_kind( // Max error in interpolated form : 3.042e-18 // Max Error found at double precision = Poly : 5.106609e-16 // Cheb : 5.239199e-16 - static const double P[] + static constexpr double P[15] = {1.00000000000000000e+00, 2.49999999999999909e-01, 2.77777777777782257e-02, 1.73611111111023792e-03, 6.94444444453352521e-05, 1.92901234513219920e-06, @@ -107,7 +107,7 @@ inline return_type_t log_modified_bessel_first_kind( // Max error in interpolated form : 1.685e-16 // Max Error found at double precision = Poly : 2.575063e-16 // Cheb : 2.247615e+00 - static const double P[] + static constexpr double P[22] = {3.98942280401425088e-01, 4.98677850604961985e-02, 2.80506233928312623e-02, 2.92211225166047873e-02, 4.44207299493659561e-02, 1.30970574605856719e-01, @@ -123,9 +123,10 @@ inline return_type_t log_modified_bessel_first_kind( } // Max error in interpolated form : 2.437e-18 // Max Error found at double precision = Poly : 1.216719e-16 - static const double P[] = {3.98942280401432905e-01, 4.98677850491434560e-02, - 2.80506308916506102e-02, 2.92179096853915176e-02, - 4.53371208762579442e-02}; + static constexpr double P[5] + = {3.98942280401432905e-01, 4.98677850491434560e-02, + 2.80506308916506102e-02, 2.92179096853915176e-02, + 4.53371208762579442e-02}; return z + log(evaluate_polynomial(P, inv(z))) - multiply_log(0.5, z); } if (v == 1) { // WARNING: will not autodiff for v = 1 correctly @@ -136,7 +137,7 @@ inline return_type_t log_modified_bessel_first_kind( // Max error in interpolated form: 5.639e-17 // Max Error found at double precision = Poly: 1.795559e-16 - static const double P[] + static constexpr double P[13] = {8.333333333333333803e-02, 6.944444444444341983e-03, 3.472222222225921045e-04, 1.157407407354987232e-05, 2.755731926254790268e-07, 4.920949692800671435e-09, @@ -152,7 +153,7 @@ inline return_type_t log_modified_bessel_first_kind( // Max error in interpolated form: 1.796e-16 // Max Error found at double precision = Poly: 2.898731e-16 - static const double P[] + static constexpr double P[22] = {3.989422804014406054e-01, -1.496033551613111533e-01, -4.675104253598537322e-02, -4.090895951581637791e-02, -5.719036414430205390e-02, -1.528189554374492735e-01, @@ -168,7 +169,7 @@ inline return_type_t log_modified_bessel_first_kind( } // Max error in interpolated form: 1.320e-19 // Max Error found at double precision = Poly: 7.065357e-17 - static const double P[] + static constexpr double P[5] = {3.989422804014314820e-01, -1.496033551467584157e-01, -4.675105322571775911e-02, -4.090421597376992892e-02, -5.843630344778927582e-02}; diff --git a/stan/math/prim/fun/log_rising_factorial.hpp b/stan/math/prim/fun/log_rising_factorial.hpp index b71dfc971ae..8aeaedbb91f 100644 --- a/stan/math/prim/fun/log_rising_factorial.hpp +++ b/stan/math/prim/fun/log_rising_factorial.hpp @@ -54,7 +54,7 @@ inline return_type_t log_rising_factorial(const T1& x, const T2& n) { if (is_any_nan(x, n)) { return NOT_A_NUMBER; } - static const char* function = "log_rising_factorial"; + static constexpr const char* function = "log_rising_factorial"; check_positive(function, "first argument", x); return lgamma(x + n) - lgamma(x); } diff --git a/stan/math/prim/fun/mdivide_left_spd.hpp b/stan/math/prim/fun/mdivide_left_spd.hpp index f403f40f5b9..25b0f404fa0 100644 --- a/stan/math/prim/fun/mdivide_left_spd.hpp +++ b/stan/math/prim/fun/mdivide_left_spd.hpp @@ -28,7 +28,7 @@ template , EigMat1::RowsAtCompileTime, EigMat2::ColsAtCompileTime> mdivide_left_spd(const EigMat1& A, const EigMat2& b) { - static const char* function = "mdivide_left_spd"; + static constexpr const char* function = "mdivide_left_spd"; check_multiplicable(function, "A", A, "b", b); const auto& A_ref = to_ref(A); check_symmetric(function, "A", A_ref); diff --git a/stan/math/prim/fun/mdivide_right_spd.hpp b/stan/math/prim/fun/mdivide_right_spd.hpp index c874b78bbc4..c3c177dbb26 100644 --- a/stan/math/prim/fun/mdivide_right_spd.hpp +++ b/stan/math/prim/fun/mdivide_right_spd.hpp @@ -28,7 +28,7 @@ template , EigMat1::RowsAtCompileTime, EigMat2::ColsAtCompileTime> mdivide_right_spd(const EigMat1& b, const EigMat2& A) { - static const char* function = "mdivide_right_spd"; + static constexpr const char* function = "mdivide_right_spd"; check_multiplicable(function, "b", b, "A", A); const auto& A_ref = to_ref(A); check_symmetric(function, "A", A_ref); diff --git a/stan/math/prim/fun/one_hot_array.hpp b/stan/math/prim/fun/one_hot_array.hpp index 2297fe4c1bb..71dae1fa183 100644 --- a/stan/math/prim/fun/one_hot_array.hpp +++ b/stan/math/prim/fun/one_hot_array.hpp @@ -18,7 +18,7 @@ namespace math { * greater than K. */ inline std::vector one_hot_array(int K, int k) { - static const char* function = "one_hot_array"; + static constexpr const char* function = "one_hot_array"; check_positive(function, "size", K); check_bounded(function, "k", k, 1, K); diff --git a/stan/math/prim/fun/one_hot_int_array.hpp b/stan/math/prim/fun/one_hot_int_array.hpp index 261c880908d..a61c9d47e49 100644 --- a/stan/math/prim/fun/one_hot_int_array.hpp +++ b/stan/math/prim/fun/one_hot_int_array.hpp @@ -18,7 +18,7 @@ namespace math { * greater than K. */ inline std::vector one_hot_int_array(int K, int k) { - static const char* function = "one_hot_int_array"; + static constexpr const char* function = "one_hot_int_array"; check_positive(function, "size", K); check_bounded(function, "k", k, 1, K); diff --git a/stan/math/prim/fun/one_hot_row_vector.hpp b/stan/math/prim/fun/one_hot_row_vector.hpp index 52a6a98588d..f16f7a14de5 100644 --- a/stan/math/prim/fun/one_hot_row_vector.hpp +++ b/stan/math/prim/fun/one_hot_row_vector.hpp @@ -18,7 +18,7 @@ namespace math { * greater than K. */ inline Eigen::RowVectorXd one_hot_row_vector(int K, int k) { - static const char* function = "one_hot_row_vector"; + static constexpr const char* function = "one_hot_row_vector"; check_positive(function, "size", K); check_bounded(function, "k", k, 1, K); diff --git a/stan/math/prim/fun/one_hot_vector.hpp b/stan/math/prim/fun/one_hot_vector.hpp index 8cbfdf2ed23..ce2fc69d0b5 100644 --- a/stan/math/prim/fun/one_hot_vector.hpp +++ b/stan/math/prim/fun/one_hot_vector.hpp @@ -18,7 +18,7 @@ namespace math { * greater than K. */ inline Eigen::VectorXd one_hot_vector(int K, int k) { - static const char* function = "one_hot_vector"; + static constexpr const char* function = "one_hot_vector"; check_positive(function, "size", K); check_bounded(function, "k", k, 1, K); diff --git a/stan/math/prim/fun/rising_factorial.hpp b/stan/math/prim/fun/rising_factorial.hpp index 109b7c92e20..66d761e6d5e 100644 --- a/stan/math/prim/fun/rising_factorial.hpp +++ b/stan/math/prim/fun/rising_factorial.hpp @@ -61,7 +61,7 @@ namespace math { */ template * = nullptr> inline return_type_t rising_factorial(const T& x, int n) { - static const char* function = "rising_factorial"; + static constexpr const char* function = "rising_factorial"; check_not_nan(function, "first argument", x); check_nonnegative(function, "second argument", n); return boost::math::rising_factorial(x, n, boost_policy_t<>()); diff --git a/stan/math/prim/fun/to_int.hpp b/stan/math/prim/fun/to_int.hpp index 3434793e994..ea286f55925 100644 --- a/stan/math/prim/fun/to_int.hpp +++ b/stan/math/prim/fun/to_int.hpp @@ -40,7 +40,7 @@ inline T to_int(T x) { */ template * = nullptr> inline int to_int(T x) { - static const char* function = "to_int"; + static constexpr const char* function = "to_int"; check_bounded(function, "x", x, std::numeric_limits::min(), std::numeric_limits::max()); return static_cast(x); diff --git a/stan/math/prim/fun/to_matrix.hpp b/stan/math/prim/fun/to_matrix.hpp index e03c16d2b5e..876301d6e48 100644 --- a/stan/math/prim/fun/to_matrix.hpp +++ b/stan/math/prim/fun/to_matrix.hpp @@ -106,7 +106,7 @@ to_matrix(const std::vector>& x) { template * = nullptr> inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> to_matrix(EigMat&& x, int m, int n) { - static const char* function = "to_matrix(matrix)"; + static constexpr const char* function = "to_matrix(matrix)"; check_size_match(function, "rows * columns", m * n, "vector size", x.size()); Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> y = std::forward(x); @@ -128,7 +128,7 @@ to_matrix(EigMat&& x, int m, int n) { */ template inline auto to_matrix(const std::vector& x, int m, int n) { - static const char* function = "to_matrix(array)"; + static constexpr const char* function = "to_matrix(array)"; check_size_match(function, "rows * columns", m * n, "vector size", x.size()); return Eigen::Map>( &x[0], m, n); @@ -147,7 +147,7 @@ inline auto to_matrix(const std::vector& x, int m, int n) { */ inline Eigen::Matrix to_matrix( const std::vector& x, int m, int n) { - static const char* function = "to_matrix(array)"; + static constexpr const char* function = "to_matrix(array)"; int x_size = x.size(); check_size_match(function, "rows * columns", m * n, "vector size", x_size); Eigen::Matrix result(m, n); diff --git a/stan/math/prim/fun/unitspaced_array.hpp b/stan/math/prim/fun/unitspaced_array.hpp index 4985ee2a5bb..75f01faf3f4 100644 --- a/stan/math/prim/fun/unitspaced_array.hpp +++ b/stan/math/prim/fun/unitspaced_array.hpp @@ -21,7 +21,7 @@ namespace math { * @throw std::domain_error if high is less than low. */ inline std::vector unitspaced_array(int low, int high) { - static const char* function = "unitspaced_array"; + static constexpr const char* function = "unitspaced_array"; check_greater_or_equal(function, "high", high, low); int K = std::abs(high - low + 1); diff --git a/stan/math/prim/functor/map_rect.hpp b/stan/math/prim/functor/map_rect.hpp index f3952eef2e4..9fcc7ee7fde 100644 --- a/stan/math/prim/functor/map_rect.hpp +++ b/stan/math/prim/functor/map_rect.hpp @@ -130,7 +130,7 @@ map_rect(const T_shared_param& shared_params, const std::vector>& x_r, const std::vector>& x_i, std::ostream* msgs = nullptr) { - static const char* function = "map_rect"; + static constexpr const char* function = "map_rect"; using return_t = Eigen::Matrix, Eigen::Dynamic, 1>; diff --git a/stan/math/prim/prob/bernoulli_cdf.hpp b/stan/math/prim/prob/bernoulli_cdf.hpp index 4add1f9b196..a8e754fce18 100644 --- a/stan/math/prim/prob/bernoulli_cdf.hpp +++ b/stan/math/prim/prob/bernoulli_cdf.hpp @@ -30,7 +30,7 @@ template bernoulli_cdf(const T_n& n, const T_prob& theta) { using T_partials_return = partials_return_t; using T_theta_ref = ref_type_t; - static const char* function = "bernoulli_cdf"; + static constexpr const char* function = "bernoulli_cdf"; check_consistent_sizes(function, "Random variable", n, "Probability parameter", theta); T_theta_ref theta_ref = theta; diff --git a/stan/math/prim/prob/bernoulli_lccdf.hpp b/stan/math/prim/prob/bernoulli_lccdf.hpp index d3c9d035986..dcb4dd62039 100644 --- a/stan/math/prim/prob/bernoulli_lccdf.hpp +++ b/stan/math/prim/prob/bernoulli_lccdf.hpp @@ -31,7 +31,7 @@ template * = nullptr> return_type_t bernoulli_lccdf(const T_n& n, const T_prob& theta) { using T_theta_ref = ref_type_t; - static const char* function = "bernoulli_lccdf"; + static constexpr const char* function = "bernoulli_lccdf"; check_consistent_sizes(function, "Random variable", n, "Probability parameter", theta); T_theta_ref theta_ref = theta; diff --git a/stan/math/prim/prob/bernoulli_lcdf.hpp b/stan/math/prim/prob/bernoulli_lcdf.hpp index f17a51886b9..8ae643514cb 100644 --- a/stan/math/prim/prob/bernoulli_lcdf.hpp +++ b/stan/math/prim/prob/bernoulli_lcdf.hpp @@ -29,7 +29,7 @@ template * = nullptr> return_type_t bernoulli_lcdf(const T_n& n, const T_prob& theta) { using T_theta_ref = ref_type_t; - static const char* function = "bernoulli_lcdf"; + static constexpr const char* function = "bernoulli_lcdf"; check_consistent_sizes(function, "Random variable", n, "Probability parameter", theta); T_theta_ref theta_ref = theta; diff --git a/stan/math/prim/prob/bernoulli_logit_glm_lpmf.hpp b/stan/math/prim/prob/bernoulli_logit_glm_lpmf.hpp index 1c5029ca1b4..84dcffe60a8 100644 --- a/stan/math/prim/prob/bernoulli_logit_glm_lpmf.hpp +++ b/stan/math/prim/prob/bernoulli_logit_glm_lpmf.hpp @@ -72,7 +72,7 @@ return_type_t bernoulli_logit_glm_lpmf( const size_t N_instances = T_x_rows == 1 ? stan::math::size(y) : x.rows(); const size_t N_attributes = x.cols(); - static const char* function = "bernoulli_logit_glm_lpmf"; + static constexpr const char* function = "bernoulli_logit_glm_lpmf"; check_consistent_size(function, "Vector of dependent variables", y, N_instances); check_consistent_size(function, "Weight vector", beta, N_attributes); @@ -118,7 +118,7 @@ return_type_t bernoulli_logit_glm_lpmf( // Compute the log-density and handle extreme values gracefully // using Taylor approximations. // And compute the derivatives wrt theta. - static const double cutoff = 20.0; + static constexpr double cutoff = 20.0; Eigen::Array exp_m_ytheta = exp(-ytheta); T_partials_return logp = sum( (ytheta > cutoff) diff --git a/stan/math/prim/prob/bernoulli_logit_glm_rng.hpp b/stan/math/prim/prob/bernoulli_logit_glm_rng.hpp index 6d61e7b80f2..9a0da6d3d19 100644 --- a/stan/math/prim/prob/bernoulli_logit_glm_rng.hpp +++ b/stan/math/prim/prob/bernoulli_logit_glm_rng.hpp @@ -51,7 +51,7 @@ inline typename VectorBuilder::type bernoulli_logit_glm_rng( const size_t N = x.cols(); const size_t M = x.rows(); - static const char* function = "bernoulli_logit_glm_rng"; + static constexpr const char* function = "bernoulli_logit_glm_rng"; check_consistent_size(function, "Weight vector", beta, N); check_consistent_size(function, "Vector of intercepts", alpha, M); T_x_ref x_ref = x; diff --git a/stan/math/prim/prob/bernoulli_logit_lpmf.hpp b/stan/math/prim/prob/bernoulli_logit_lpmf.hpp index c63a5c45fce..deb4f1c867f 100644 --- a/stan/math/prim/prob/bernoulli_logit_lpmf.hpp +++ b/stan/math/prim/prob/bernoulli_logit_lpmf.hpp @@ -39,7 +39,7 @@ return_type_t bernoulli_logit_lpmf(const T_n& n, const T_prob& theta) { using std::exp; using T_n_ref = ref_type_if_not_constant_t; using T_theta_ref = ref_type_if_not_constant_t; - static const char* function = "bernoulli_logit_lpmf"; + static constexpr const char* function = "bernoulli_logit_lpmf"; check_consistent_sizes(function, "Random variable", n, "Probability parameter", theta); if (size_zero(n, theta)) { @@ -70,7 +70,7 @@ return_type_t bernoulli_logit_lpmf(const T_n& n, const T_prob& theta) { ntheta = T_partials_array::Constant(1, 1, ntheta_s); } T_partials_array exp_m_ntheta = exp(-ntheta); - static const double cutoff = 20.0; + static constexpr double cutoff = 20.0; T_partials_return logp = sum( (ntheta > cutoff) .select(-exp_m_ntheta, diff --git a/stan/math/prim/prob/bernoulli_lpmf.hpp b/stan/math/prim/prob/bernoulli_lpmf.hpp index 58a77a9751b..41394a09f0c 100644 --- a/stan/math/prim/prob/bernoulli_lpmf.hpp +++ b/stan/math/prim/prob/bernoulli_lpmf.hpp @@ -36,7 +36,7 @@ return_type_t bernoulli_lpmf(const T_n& n, const T_prob& theta) { using T_theta_ref = ref_type_t; using T_n_ref = ref_type_t; using std::log; - static const char* function = "bernoulli_lpmf"; + static constexpr const char* function = "bernoulli_lpmf"; check_consistent_sizes(function, "Random variable", n, "Probability parameter", theta); const T_n_ref n_ref = to_ref(n); diff --git a/stan/math/prim/prob/bernoulli_rng.hpp b/stan/math/prim/prob/bernoulli_rng.hpp index a234372acc8..49848f04ed2 100644 --- a/stan/math/prim/prob/bernoulli_rng.hpp +++ b/stan/math/prim/prob/bernoulli_rng.hpp @@ -30,7 +30,7 @@ inline typename VectorBuilder::type bernoulli_rng( const T_theta& theta, RNG& rng) { using boost::bernoulli_distribution; using boost::variate_generator; - static const char* function = "bernoulli_rng"; + static constexpr const char* function = "bernoulli_rng"; ref_type_t theta_ref = theta; check_bounded(function, "Probability parameter", value_of(theta_ref), 0.0, 1.0); diff --git a/stan/math/prim/prob/beta_binomial_cdf.hpp b/stan/math/prim/prob/beta_binomial_cdf.hpp index 3ecc48db99d..b478f2c1df8 100644 --- a/stan/math/prim/prob/beta_binomial_cdf.hpp +++ b/stan/math/prim/prob/beta_binomial_cdf.hpp @@ -48,7 +48,7 @@ return_type_t beta_binomial_cdf(const T_n& n, const T_N& N, using T_N_ref = ref_type_t; using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; - static const char* function = "beta_binomial_cdf"; + static constexpr const char* function = "beta_binomial_cdf"; check_consistent_sizes(function, "Successes variable", n, "Population size parameter", N, "First prior sample size parameter", alpha, diff --git a/stan/math/prim/prob/beta_binomial_lccdf.hpp b/stan/math/prim/prob/beta_binomial_lccdf.hpp index 4870e85d6ae..040669da858 100644 --- a/stan/math/prim/prob/beta_binomial_lccdf.hpp +++ b/stan/math/prim/prob/beta_binomial_lccdf.hpp @@ -50,7 +50,7 @@ return_type_t beta_binomial_lccdf(const T_n& n, const T_N& N, using T_N_ref = ref_type_t; using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; - static const char* function = "beta_binomial_lccdf"; + static constexpr const char* function = "beta_binomial_lccdf"; check_consistent_sizes(function, "Successes variable", n, "Population size parameter", N, "First prior sample size parameter", alpha, diff --git a/stan/math/prim/prob/beta_binomial_lcdf.hpp b/stan/math/prim/prob/beta_binomial_lcdf.hpp index b6b212b8a22..dc4e536e5bc 100644 --- a/stan/math/prim/prob/beta_binomial_lcdf.hpp +++ b/stan/math/prim/prob/beta_binomial_lcdf.hpp @@ -50,7 +50,7 @@ return_type_t beta_binomial_lcdf(const T_n& n, const T_N& N, using T_N_ref = ref_type_t; using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; - static const char* function = "beta_binomial_lcdf"; + static constexpr const char* function = "beta_binomial_lcdf"; check_consistent_sizes(function, "Successes variable", n, "Population size parameter", N, "First prior sample size parameter", alpha, diff --git a/stan/math/prim/prob/beta_binomial_lpmf.hpp b/stan/math/prim/prob/beta_binomial_lpmf.hpp index 401387b2da7..18c961940c8 100644 --- a/stan/math/prim/prob/beta_binomial_lpmf.hpp +++ b/stan/math/prim/prob/beta_binomial_lpmf.hpp @@ -47,7 +47,7 @@ return_type_t beta_binomial_lpmf(const T_n& n, const T_N& N, using T_N_ref = ref_type_t; using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; - static const char* function = "beta_binomial_lpmf"; + static constexpr const char* function = "beta_binomial_lpmf"; check_consistent_sizes(function, "Successes variable", n, "Population size parameter", N, "First prior sample size parameter", alpha, diff --git a/stan/math/prim/prob/beta_binomial_rng.hpp b/stan/math/prim/prob/beta_binomial_rng.hpp index 29375d2c2d6..a96ecfd5c3c 100644 --- a/stan/math/prim/prob/beta_binomial_rng.hpp +++ b/stan/math/prim/prob/beta_binomial_rng.hpp @@ -35,7 +35,7 @@ beta_binomial_rng(const T_N &N, const T_shape1 &alpha, const T_shape2 &beta, using T_N_ref = ref_type_t; using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; - static const char *function = "beta_binomial_rng"; + static constexpr const char *function = "beta_binomial_rng"; check_consistent_sizes(function, "First prior sample size parameter", alpha, "Second prior sample size parameter", beta); diff --git a/stan/math/prim/prob/beta_cdf.hpp b/stan/math/prim/prob/beta_cdf.hpp index cae675229d3..a74fa08a161 100644 --- a/stan/math/prim/prob/beta_cdf.hpp +++ b/stan/math/prim/prob/beta_cdf.hpp @@ -39,7 +39,7 @@ return_type_t beta_cdf( using T_y_ref = ref_type_t; using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; - static const char* function = "beta_cdf"; + static constexpr const char* function = "beta_cdf"; check_consistent_sizes(function, "Random variable", y, "First shape parameter", alpha, "Second shape parameter", beta); diff --git a/stan/math/prim/prob/beta_lccdf.hpp b/stan/math/prim/prob/beta_lccdf.hpp index ca054f705be..8509a31c69c 100644 --- a/stan/math/prim/prob/beta_lccdf.hpp +++ b/stan/math/prim/prob/beta_lccdf.hpp @@ -47,7 +47,7 @@ return_type_t beta_lccdf( using T_y_ref = ref_type_t; using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; - static const char* function = "beta_lccdf"; + static constexpr const char* function = "beta_lccdf"; check_consistent_sizes(function, "Random variable", y, "First shape parameter", alpha, "Second shape parameter", beta_param); diff --git a/stan/math/prim/prob/beta_lcdf.hpp b/stan/math/prim/prob/beta_lcdf.hpp index a455a468cbe..e78e3ebaddc 100644 --- a/stan/math/prim/prob/beta_lcdf.hpp +++ b/stan/math/prim/prob/beta_lcdf.hpp @@ -47,7 +47,7 @@ return_type_t beta_lcdf( using T_y_ref = ref_type_t; using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; - static const char* function = "beta_lcdf"; + static constexpr const char* function = "beta_lcdf"; check_consistent_sizes(function, "Random variable", y, "First shape parameter", alpha, "Second shape parameter", beta_param); diff --git a/stan/math/prim/prob/beta_lpdf.hpp b/stan/math/prim/prob/beta_lpdf.hpp index 13341cabf67..286f0b88e9e 100644 --- a/stan/math/prim/prob/beta_lpdf.hpp +++ b/stan/math/prim/prob/beta_lpdf.hpp @@ -50,7 +50,7 @@ return_type_t beta_lpdf( using T_y_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; using T_beta_ref = ref_type_if_not_constant_t; - static const char* function = "beta_lpdf"; + static constexpr const char* function = "beta_lpdf"; check_consistent_sizes(function, "Random variable", y, "First shape parameter", alpha, "Second shape parameter", beta); diff --git a/stan/math/prim/prob/beta_proportion_lccdf.hpp b/stan/math/prim/prob/beta_proportion_lccdf.hpp index 0bcbbf30232..cc9cf0fad4c 100644 --- a/stan/math/prim/prob/beta_proportion_lccdf.hpp +++ b/stan/math/prim/prob/beta_proportion_lccdf.hpp @@ -51,7 +51,7 @@ return_type_t beta_proportion_lccdf(const T_y& y, using T_y_ref = ref_type_t; using T_mu_ref = ref_type_t; using T_kappa_ref = ref_type_t; - static const char* function = "beta_proportion_lccdf"; + static constexpr const char* function = "beta_proportion_lccdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Precision parameter", kappa); if (size_zero(y, mu, kappa)) { diff --git a/stan/math/prim/prob/beta_proportion_lcdf.hpp b/stan/math/prim/prob/beta_proportion_lcdf.hpp index 5f350d8e3ca..cffa0e97c75 100644 --- a/stan/math/prim/prob/beta_proportion_lcdf.hpp +++ b/stan/math/prim/prob/beta_proportion_lcdf.hpp @@ -52,7 +52,7 @@ return_type_t beta_proportion_lcdf(const T_y& y, using T_y_ref = ref_type_t; using T_mu_ref = ref_type_t; using T_kappa_ref = ref_type_t; - static const char* function = "beta_proportion_lcdf"; + static constexpr const char* function = "beta_proportion_lcdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Precision parameter", kappa); if (size_zero(y, mu, kappa)) { diff --git a/stan/math/prim/prob/beta_proportion_lpdf.hpp b/stan/math/prim/prob/beta_proportion_lpdf.hpp index 36b3ba7f3f5..90b0efc1f04 100644 --- a/stan/math/prim/prob/beta_proportion_lpdf.hpp +++ b/stan/math/prim/prob/beta_proportion_lpdf.hpp @@ -56,7 +56,7 @@ return_type_t beta_proportion_lpdf(const T_y& y, using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; using T_kappa_ref = ref_type_if_not_constant_t; - static const char* function = "beta_proportion_lpdf"; + static constexpr const char* function = "beta_proportion_lpdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Precision parameter", kappa); if (size_zero(y, mu, kappa)) { diff --git a/stan/math/prim/prob/beta_proportion_rng.hpp b/stan/math/prim/prob/beta_proportion_rng.hpp index f5a01f68b38..61bb114f00f 100644 --- a/stan/math/prim/prob/beta_proportion_rng.hpp +++ b/stan/math/prim/prob/beta_proportion_rng.hpp @@ -36,7 +36,7 @@ inline typename VectorBuilder::type beta_proportion_rng(const T_loc &mu, const T_prec &kappa, RNG &rng) { using T_mu_ref = ref_type_t; using T_kappa_ref = ref_type_t; - static const char *function = "beta_proportion_rng"; + static constexpr const char *function = "beta_proportion_rng"; check_consistent_sizes(function, "Location parameter", mu, "Precision parameter", kappa); T_mu_ref mu_ref = mu; diff --git a/stan/math/prim/prob/beta_rng.hpp b/stan/math/prim/prob/beta_rng.hpp index d31c104dbea..9fdc839bf4e 100644 --- a/stan/math/prim/prob/beta_rng.hpp +++ b/stan/math/prim/prob/beta_rng.hpp @@ -40,7 +40,7 @@ inline typename VectorBuilder::type beta_rng( using boost::random::uniform_real_distribution; using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; - static const char *function = "beta_rng"; + static constexpr const char *function = "beta_rng"; check_consistent_sizes(function, "First shape parameter", alpha, "Second shape Parameter", beta); T_alpha_ref alpha_ref = alpha; diff --git a/stan/math/prim/prob/binomial_cdf.hpp b/stan/math/prim/prob/binomial_cdf.hpp index 135166e0807..6cba9196aa2 100644 --- a/stan/math/prim/prob/binomial_cdf.hpp +++ b/stan/math/prim/prob/binomial_cdf.hpp @@ -41,7 +41,7 @@ return_type_t binomial_cdf(const T_n& n, const T_N& N, using T_theta_ref = ref_type_t; using std::exp; using std::pow; - static const char* function = "binomial_cdf"; + static constexpr const char* function = "binomial_cdf"; check_consistent_sizes(function, "Successes variable", n, "Population size parameter", N, "Probability parameter", theta); diff --git a/stan/math/prim/prob/binomial_lccdf.hpp b/stan/math/prim/prob/binomial_lccdf.hpp index 8f0136bc628..3c55c2fe6bb 100644 --- a/stan/math/prim/prob/binomial_lccdf.hpp +++ b/stan/math/prim/prob/binomial_lccdf.hpp @@ -44,7 +44,7 @@ return_type_t binomial_lccdf(const T_n& n, const T_N& N, using std::exp; using std::log; using std::pow; - static const char* function = "binomial_lccdf"; + static constexpr const char* function = "binomial_lccdf"; check_consistent_sizes(function, "Successes variable", n, "Population size parameter", N, "Probability parameter", theta); diff --git a/stan/math/prim/prob/binomial_lcdf.hpp b/stan/math/prim/prob/binomial_lcdf.hpp index cef1f2edd35..c9e1f8ad85d 100644 --- a/stan/math/prim/prob/binomial_lcdf.hpp +++ b/stan/math/prim/prob/binomial_lcdf.hpp @@ -44,7 +44,7 @@ return_type_t binomial_lcdf(const T_n& n, const T_N& N, using std::exp; using std::log; using std::pow; - static const char* function = "binomial_lcdf"; + static constexpr const char* function = "binomial_lcdf"; check_consistent_sizes(function, "Successes variable", n, "Population size parameter", N, "Probability parameter", theta); diff --git a/stan/math/prim/prob/binomial_logit_lpmf.hpp b/stan/math/prim/prob/binomial_logit_lpmf.hpp index 48415e0a346..eb5097770da 100644 --- a/stan/math/prim/prob/binomial_logit_lpmf.hpp +++ b/stan/math/prim/prob/binomial_logit_lpmf.hpp @@ -40,7 +40,7 @@ return_type_t binomial_logit_lpmf(const T_n& n, const T_N& N, using T_n_ref = ref_type_if_not_constant_t; using T_N_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; - static const char* function = "binomial_logit_lpmf"; + static constexpr const char* function = "binomial_logit_lpmf"; check_consistent_sizes(function, "Successes variable", n, "Population size parameter", N, "Probability parameter", alpha); diff --git a/stan/math/prim/prob/binomial_lpmf.hpp b/stan/math/prim/prob/binomial_lpmf.hpp index a976f37110f..b64c172f7eb 100644 --- a/stan/math/prim/prob/binomial_lpmf.hpp +++ b/stan/math/prim/prob/binomial_lpmf.hpp @@ -42,7 +42,7 @@ return_type_t binomial_lpmf(const T_n& n, const T_N& N, using T_n_ref = ref_type_t; using T_N_ref = ref_type_t; using T_theta_ref = ref_type_t; - static const char* function = "binomial_lpmf"; + static constexpr const char* function = "binomial_lpmf"; check_consistent_sizes(function, "Successes variable", n, "Population size parameter", N, "Probability parameter", theta); diff --git a/stan/math/prim/prob/binomial_rng.hpp b/stan/math/prim/prob/binomial_rng.hpp index 588759767b5..3dab00a3649 100644 --- a/stan/math/prim/prob/binomial_rng.hpp +++ b/stan/math/prim/prob/binomial_rng.hpp @@ -35,7 +35,7 @@ inline typename VectorBuilder::type binomial_rng( using boost::variate_generator; using T_N_ref = ref_type_t; using T_theta_ref = ref_type_t; - static const char* function = "binomial_rng"; + static constexpr const char* function = "binomial_rng"; check_consistent_sizes(function, "Population size parameter", N, "Probability Parameter", theta); T_N_ref N_ref = N; diff --git a/stan/math/prim/prob/categorical_logit_glm_lpmf.hpp b/stan/math/prim/prob/categorical_logit_glm_lpmf.hpp index f13f5484cc6..4538be9bcd2 100644 --- a/stan/math/prim/prob/categorical_logit_glm_lpmf.hpp +++ b/stan/math/prim/prob/categorical_logit_glm_lpmf.hpp @@ -64,7 +64,7 @@ return_type_t categorical_logit_glm_lpmf( const size_t N_attributes = x.cols(); const size_t N_classes = beta.cols(); - static const char* function = "categorical_logit_glm_lpmf"; + static constexpr const char* function = "categorical_logit_glm_lpmf"; check_consistent_size(function, "Vector of dependent variables", y, N_instances); check_consistent_size(function, "Intercept vector", alpha, N_classes); diff --git a/stan/math/prim/prob/categorical_logit_lpmf.hpp b/stan/math/prim/prob/categorical_logit_lpmf.hpp index 521cb6e89dc..766a299e92e 100644 --- a/stan/math/prim/prob/categorical_logit_lpmf.hpp +++ b/stan/math/prim/prob/categorical_logit_lpmf.hpp @@ -15,7 +15,7 @@ namespace math { // CategoricalLog(n|theta) [0 < n <= N, theta unconstrained], no checking template * = nullptr> return_type_t categorical_logit_lpmf(int n, const T_prob& beta) { - static const char* function = "categorical_logit_lpmf"; + static constexpr const char* function = "categorical_logit_lpmf"; check_bounded(function, "categorical outcome out of support", n, 1, beta.size()); ref_type_t beta_ref = beta; @@ -33,7 +33,7 @@ return_type_t categorical_logit_lpmf(int n, const T_prob& beta) { template * = nullptr> return_type_t categorical_logit_lpmf(const std::vector& ns, const T_prob& beta) { - static const char* function = "categorical_logit_lpmf"; + static constexpr const char* function = "categorical_logit_lpmf"; check_bounded(function, "categorical outcome out of support", ns, 1, beta.size()); diff --git a/stan/math/prim/prob/categorical_logit_rng.hpp b/stan/math/prim/prob/categorical_logit_rng.hpp index 463967de7c2..155cc80684b 100644 --- a/stan/math/prim/prob/categorical_logit_rng.hpp +++ b/stan/math/prim/prob/categorical_logit_rng.hpp @@ -29,7 +29,7 @@ template inline int categorical_logit_rng(const Eigen::VectorXd& beta, RNG& rng) { using boost::uniform_01; using boost::variate_generator; - static const char* function = "categorical_logit_rng"; + static constexpr const char* function = "categorical_logit_rng"; check_finite(function, "Log odds parameter", beta); variate_generator > uniform01_rng(rng, uniform_01<>()); diff --git a/stan/math/prim/prob/categorical_lpmf.hpp b/stan/math/prim/prob/categorical_lpmf.hpp index 68f5b33f09a..158000a1604 100644 --- a/stan/math/prim/prob/categorical_lpmf.hpp +++ b/stan/math/prim/prob/categorical_lpmf.hpp @@ -15,7 +15,7 @@ namespace math { template * = nullptr> return_type_t categorical_lpmf(int n, const T_prob& theta) { - static const char* function = "categorical_lpmf"; + static constexpr const char* function = "categorical_lpmf"; using std::log; check_bounded(function, "Number of categories", n, 1, theta.size()); @@ -32,7 +32,7 @@ template * = nullptr> return_type_t categorical_lpmf(const std::vector& ns, const T_prob& theta) { - static const char* function = "categorical_lpmf"; + static constexpr const char* function = "categorical_lpmf"; check_bounded(function, "element of outcome array", ns, 1, theta.size()); ref_type_t theta_ref = theta; diff --git a/stan/math/prim/prob/categorical_rng.hpp b/stan/math/prim/prob/categorical_rng.hpp index 56096d5e01d..fac6d198aea 100644 --- a/stan/math/prim/prob/categorical_rng.hpp +++ b/stan/math/prim/prob/categorical_rng.hpp @@ -15,7 +15,7 @@ inline int categorical_rng( const Eigen::Matrix& theta, RNG& rng) { using boost::uniform_01; using boost::variate_generator; - static const char* function = "categorical_rng"; + static constexpr const char* function = "categorical_rng"; check_simplex(function, "Probabilities parameter", theta); variate_generator > uniform01_rng(rng, uniform_01<>()); diff --git a/stan/math/prim/prob/cauchy_cdf.hpp b/stan/math/prim/prob/cauchy_cdf.hpp index fc68d7f7dcc..59d4da1923f 100644 --- a/stan/math/prim/prob/cauchy_cdf.hpp +++ b/stan/math/prim/prob/cauchy_cdf.hpp @@ -39,7 +39,7 @@ return_type_t cauchy_cdf(const T_y& y, const T_loc& mu, using T_y_ref = ref_type_t; using T_mu_ref = ref_type_t; using T_sigma_ref = ref_type_t; - static const char* function = "cauchy_cdf"; + static constexpr const char* function = "cauchy_cdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale Parameter", sigma); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/cauchy_lccdf.hpp b/stan/math/prim/prob/cauchy_lccdf.hpp index b7c2aa4386d..154c24e6e0b 100644 --- a/stan/math/prim/prob/cauchy_lccdf.hpp +++ b/stan/math/prim/prob/cauchy_lccdf.hpp @@ -41,7 +41,7 @@ return_type_t cauchy_lccdf(const T_y& y, const T_loc& mu, using T_y_ref = ref_type_t; using T_mu_ref = ref_type_t; using T_sigma_ref = ref_type_t; - static const char* function = "cauchy_lccdf"; + static constexpr const char* function = "cauchy_lccdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale Parameter", sigma); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/cauchy_lcdf.hpp b/stan/math/prim/prob/cauchy_lcdf.hpp index f67662fd741..d1716f3d867 100644 --- a/stan/math/prim/prob/cauchy_lcdf.hpp +++ b/stan/math/prim/prob/cauchy_lcdf.hpp @@ -41,7 +41,7 @@ return_type_t cauchy_lcdf(const T_y& y, const T_loc& mu, using T_y_ref = ref_type_t; using T_mu_ref = ref_type_t; using T_sigma_ref = ref_type_t; - static const char* function = "cauchy_lcdf"; + static constexpr const char* function = "cauchy_lcdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale Parameter", sigma); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/cauchy_lpdf.hpp b/stan/math/prim/prob/cauchy_lpdf.hpp index c8ddfead074..251c84262fd 100644 --- a/stan/math/prim/prob/cauchy_lpdf.hpp +++ b/stan/math/prim/prob/cauchy_lpdf.hpp @@ -47,7 +47,7 @@ return_type_t cauchy_lpdf(const T_y& y, const T_loc& mu, using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; - static const char* function = "cauchy_lpdf"; + static constexpr const char* function = "cauchy_lpdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", sigma); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/cauchy_rng.hpp b/stan/math/prim/prob/cauchy_rng.hpp index 3a53abfa0d0..21ddc51d505 100644 --- a/stan/math/prim/prob/cauchy_rng.hpp +++ b/stan/math/prim/prob/cauchy_rng.hpp @@ -34,7 +34,7 @@ inline typename VectorBuilder::type cauchy_rng( const T_loc& mu, const T_scale& sigma, RNG& rng) { using boost::variate_generator; using boost::random::cauchy_distribution; - static const char* function = "cauchy_rng"; + static constexpr const char* function = "cauchy_rng"; using T_mu_ref = ref_type_t; using T_sigma_ref = ref_type_t; check_consistent_sizes(function, "Location parameter", mu, "Scale Parameter", diff --git a/stan/math/prim/prob/chi_square_cdf.hpp b/stan/math/prim/prob/chi_square_cdf.hpp index cefd6cfab04..0f684fd22fb 100644 --- a/stan/math/prim/prob/chi_square_cdf.hpp +++ b/stan/math/prim/prob/chi_square_cdf.hpp @@ -40,7 +40,7 @@ return_type_t chi_square_cdf(const T_y& y, const T_dof& nu) { using std::pow; using T_y_ref = ref_type_t; using T_nu_ref = ref_type_t; - static const char* function = "chi_square_cdf"; + static constexpr const char* function = "chi_square_cdf"; check_consistent_sizes(function, "Random variable", y, "Degrees of freedom parameter", nu); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/chi_square_lccdf.hpp b/stan/math/prim/prob/chi_square_lccdf.hpp index 4c5beda6f1f..0dd84a04730 100644 --- a/stan/math/prim/prob/chi_square_lccdf.hpp +++ b/stan/math/prim/prob/chi_square_lccdf.hpp @@ -42,7 +42,7 @@ return_type_t chi_square_lccdf(const T_y& y, const T_dof& nu) { using std::pow; using T_y_ref = ref_type_t; using T_nu_ref = ref_type_t; - static const char* function = "chi_square_lccdf"; + static constexpr const char* function = "chi_square_lccdf"; check_consistent_sizes(function, "Random variable", y, "Degrees of freedom parameter", nu); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/chi_square_lcdf.hpp b/stan/math/prim/prob/chi_square_lcdf.hpp index 266d239600e..473eb143a9d 100644 --- a/stan/math/prim/prob/chi_square_lcdf.hpp +++ b/stan/math/prim/prob/chi_square_lcdf.hpp @@ -42,7 +42,7 @@ return_type_t chi_square_lcdf(const T_y& y, const T_dof& nu) { using std::pow; using T_y_ref = ref_type_t; using T_nu_ref = ref_type_t; - static const char* function = "chi_square_lcdf"; + static constexpr const char* function = "chi_square_lcdf"; check_consistent_sizes(function, "Random variable", y, "Degrees of freedom parameter", nu); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/chi_square_lpdf.hpp b/stan/math/prim/prob/chi_square_lpdf.hpp index cfc099e497a..46c5f028a90 100644 --- a/stan/math/prim/prob/chi_square_lpdf.hpp +++ b/stan/math/prim/prob/chi_square_lpdf.hpp @@ -47,7 +47,7 @@ return_type_t chi_square_lpdf(const T_y& y, const T_dof& nu) { using T_partials_return = partials_return_t; using T_partials_array = Eigen::Array; using std::log; - static const char* function = "chi_square_lpdf"; + static constexpr const char* function = "chi_square_lpdf"; using T_y_ref = ref_type_t; using T_nu_ref = ref_type_t; check_consistent_sizes(function, "Random variable", y, diff --git a/stan/math/prim/prob/chi_square_rng.hpp b/stan/math/prim/prob/chi_square_rng.hpp index 16c3f122eb0..559b67bd88e 100644 --- a/stan/math/prim/prob/chi_square_rng.hpp +++ b/stan/math/prim/prob/chi_square_rng.hpp @@ -30,7 +30,7 @@ inline typename VectorBuilder::type chi_square_rng( using boost::variate_generator; using boost::random::chi_squared_distribution; using T_nu_ref = ref_type_t; - static const char* function = "chi_square_rng"; + static constexpr const char* function = "chi_square_rng"; T_nu_ref nu_ref = nu; check_positive_finite(function, "Degrees of freedom parameter", nu_ref); diff --git a/stan/math/prim/prob/dirichlet_lpdf.hpp b/stan/math/prim/prob/dirichlet_lpdf.hpp index dc53c7d8c73..dba3fc2b484 100644 --- a/stan/math/prim/prob/dirichlet_lpdf.hpp +++ b/stan/math/prim/prob/dirichlet_lpdf.hpp @@ -62,7 +62,7 @@ return_type_t dirichlet_lpdf(const T_prob& theta, using T_partials_array = typename Eigen::Array; using T_theta_ref = ref_type_t; using T_alpha_ref = ref_type_t; - static const char* function = "dirichlet_lpdf"; + static constexpr const char* function = "dirichlet_lpdf"; T_theta_ref theta_ref = theta; T_alpha_ref alpha_ref = alpha; diff --git a/stan/math/prim/prob/discrete_range_cdf.hpp b/stan/math/prim/prob/discrete_range_cdf.hpp index f3672237339..49c18842244 100644 --- a/stan/math/prim/prob/discrete_range_cdf.hpp +++ b/stan/math/prim/prob/discrete_range_cdf.hpp @@ -37,7 +37,7 @@ namespace math { template double discrete_range_cdf(const T_y& y, const T_lower& lower, const T_upper& upper) { - static const char* function = "discrete_range_cdf"; + static constexpr const char* function = "discrete_range_cdf"; check_consistent_sizes(function, "Lower bound parameter", lower, "Upper bound parameter", upper); check_greater_or_equal(function, "Upper bound parameter", upper, lower); diff --git a/stan/math/prim/prob/discrete_range_lccdf.hpp b/stan/math/prim/prob/discrete_range_lccdf.hpp index d58736fec1a..1c67cee0417 100644 --- a/stan/math/prim/prob/discrete_range_lccdf.hpp +++ b/stan/math/prim/prob/discrete_range_lccdf.hpp @@ -37,7 +37,7 @@ namespace math { template double discrete_range_lccdf(const T_y& y, const T_lower& lower, const T_upper& upper) { - static const char* function = "discrete_range_lccdf"; + static constexpr const char* function = "discrete_range_lccdf"; check_consistent_sizes(function, "Lower bound parameter", lower, "Upper bound parameter", upper); check_greater_or_equal(function, "Upper bound parameter", upper, lower); diff --git a/stan/math/prim/prob/discrete_range_lcdf.hpp b/stan/math/prim/prob/discrete_range_lcdf.hpp index aa7d75fb7ca..8a64df8bc29 100644 --- a/stan/math/prim/prob/discrete_range_lcdf.hpp +++ b/stan/math/prim/prob/discrete_range_lcdf.hpp @@ -37,7 +37,7 @@ namespace math { template double discrete_range_lcdf(const T_y& y, const T_lower& lower, const T_upper& upper) { - static const char* function = "discrete_range_lcdf"; + static constexpr const char* function = "discrete_range_lcdf"; check_consistent_sizes(function, "Lower bound parameter", lower, "Upper bound parameter", upper); check_greater_or_equal(function, "Upper bound parameter", upper, lower); diff --git a/stan/math/prim/prob/discrete_range_lpmf.hpp b/stan/math/prim/prob/discrete_range_lpmf.hpp index df153064672..1539a4caa71 100644 --- a/stan/math/prim/prob/discrete_range_lpmf.hpp +++ b/stan/math/prim/prob/discrete_range_lpmf.hpp @@ -46,7 +46,7 @@ template double discrete_range_lpmf(const T_y& y, const T_lower& lower, const T_upper& upper) { using std::log; - static const char* function = "discrete_range_lpmf"; + static constexpr const char* function = "discrete_range_lpmf"; check_not_nan(function, "Random variable", y); check_consistent_sizes(function, "Lower bound parameter", lower, "Upper bound parameter", upper); diff --git a/stan/math/prim/prob/discrete_range_rng.hpp b/stan/math/prim/prob/discrete_range_rng.hpp index 9f0bbb1f514..2dacf745339 100644 --- a/stan/math/prim/prob/discrete_range_rng.hpp +++ b/stan/math/prim/prob/discrete_range_rng.hpp @@ -34,7 +34,7 @@ namespace math { template inline typename VectorBuilder::type discrete_range_rng(const T_lower& lower, const T_upper& upper, RNG& rng) { - static const char* function = "discrete_range_rng"; + static constexpr const char* function = "discrete_range_rng"; using boost::variate_generator; using boost::random::uniform_int_distribution; check_consistent_sizes(function, "Lower bound parameter", lower, diff --git a/stan/math/prim/prob/double_exponential_cdf.hpp b/stan/math/prim/prob/double_exponential_cdf.hpp index 36a36ebb371..34627e394f3 100644 --- a/stan/math/prim/prob/double_exponential_cdf.hpp +++ b/stan/math/prim/prob/double_exponential_cdf.hpp @@ -48,7 +48,7 @@ return_type_t double_exponential_cdf( using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; - static const char* function = "double_exponential_cdf"; + static constexpr const char* function = "double_exponential_cdf"; T_y_ref y_ref = y; T_mu_ref mu_ref = mu; T_sigma_ref sigma_ref = sigma; diff --git a/stan/math/prim/prob/double_exponential_lccdf.hpp b/stan/math/prim/prob/double_exponential_lccdf.hpp index 23a3188fc36..5be1d09dc47 100644 --- a/stan/math/prim/prob/double_exponential_lccdf.hpp +++ b/stan/math/prim/prob/double_exponential_lccdf.hpp @@ -40,7 +40,7 @@ return_type_t double_exponential_lccdf( using T_partials_return = partials_return_t; using std::exp; using std::log; - static const char* function = "double_exponential_lccdf"; + static constexpr const char* function = "double_exponential_lccdf"; using T_y_ref = ref_type_t; using T_mu_ref = ref_type_t; using T_sigma_ref = ref_type_t; diff --git a/stan/math/prim/prob/double_exponential_lcdf.hpp b/stan/math/prim/prob/double_exponential_lcdf.hpp index ed7c5bc4b32..da46b990f04 100644 --- a/stan/math/prim/prob/double_exponential_lcdf.hpp +++ b/stan/math/prim/prob/double_exponential_lcdf.hpp @@ -42,7 +42,7 @@ return_type_t double_exponential_lcdf( using T_y_ref = ref_type_t; using T_mu_ref = ref_type_t; using T_sigma_ref = ref_type_t; - static const char* function = "double_exponential_lcdf"; + static constexpr const char* function = "double_exponential_lcdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale Parameter", sigma); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/double_exponential_lpdf.hpp b/stan/math/prim/prob/double_exponential_lpdf.hpp index d188947ed5a..059eebdeb4e 100644 --- a/stan/math/prim/prob/double_exponential_lpdf.hpp +++ b/stan/math/prim/prob/double_exponential_lpdf.hpp @@ -45,7 +45,7 @@ return_type_t double_exponential_lpdf( using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; - static const char* function = "double_exponential_lpdf"; + static constexpr const char* function = "double_exponential_lpdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Shape parameter", sigma); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/double_exponential_rng.hpp b/stan/math/prim/prob/double_exponential_rng.hpp index 856ccc946b4..a5ee59a89ac 100644 --- a/stan/math/prim/prob/double_exponential_rng.hpp +++ b/stan/math/prim/prob/double_exponential_rng.hpp @@ -38,7 +38,7 @@ double_exponential_rng(const T_loc& mu, const T_scale& sigma, RNG& rng) { using boost::random::uniform_real_distribution; using T_mu_ref = ref_type_t; using T_sigma_ref = ref_type_t; - static const char* function = "double_exponential_rng"; + static constexpr const char* function = "double_exponential_rng"; check_consistent_sizes(function, "Location parameter", mu, "Scale Parameter", sigma); T_mu_ref mu_ref = mu; diff --git a/stan/math/prim/prob/exp_mod_normal_cdf.hpp b/stan/math/prim/prob/exp_mod_normal_cdf.hpp index b1e0785c2b5..fb2e7cbc2fb 100644 --- a/stan/math/prim/prob/exp_mod_normal_cdf.hpp +++ b/stan/math/prim/prob/exp_mod_normal_cdf.hpp @@ -35,7 +35,7 @@ return_type_t exp_mod_normal_cdf( using T_mu_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; using T_lambda_ref = ref_type_if_not_constant_t; - static const char* function = "exp_mod_normal_cdf"; + static constexpr const char* function = "exp_mod_normal_cdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", sigma, "Inv_scale paramter", lambda); diff --git a/stan/math/prim/prob/exp_mod_normal_lccdf.hpp b/stan/math/prim/prob/exp_mod_normal_lccdf.hpp index 9103eaadfd8..0f2f57377ed 100644 --- a/stan/math/prim/prob/exp_mod_normal_lccdf.hpp +++ b/stan/math/prim/prob/exp_mod_normal_lccdf.hpp @@ -36,7 +36,7 @@ return_type_t exp_mod_normal_lccdf( using T_mu_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; using T_lambda_ref = ref_type_if_not_constant_t; - static const char* function = "exp_mod_normal_lccdf"; + static constexpr const char* function = "exp_mod_normal_lccdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", sigma, "Inv_scale paramter", lambda); diff --git a/stan/math/prim/prob/exp_mod_normal_lcdf.hpp b/stan/math/prim/prob/exp_mod_normal_lcdf.hpp index 441d43dd5cd..6ff79c4cd10 100644 --- a/stan/math/prim/prob/exp_mod_normal_lcdf.hpp +++ b/stan/math/prim/prob/exp_mod_normal_lcdf.hpp @@ -36,7 +36,7 @@ return_type_t exp_mod_normal_lcdf( using T_mu_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; using T_lambda_ref = ref_type_if_not_constant_t; - static const char* function = "exp_mod_normal_lcdf"; + static constexpr const char* function = "exp_mod_normal_lcdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", sigma, "Inv_scale paramter", lambda); diff --git a/stan/math/prim/prob/exp_mod_normal_lpdf.hpp b/stan/math/prim/prob/exp_mod_normal_lpdf.hpp index c1903665c10..200515292ba 100644 --- a/stan/math/prim/prob/exp_mod_normal_lpdf.hpp +++ b/stan/math/prim/prob/exp_mod_normal_lpdf.hpp @@ -34,7 +34,7 @@ return_type_t exp_mod_normal_lpdf( using T_mu_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; using T_lambda_ref = ref_type_if_not_constant_t; - static const char* function = "exp_mod_normal_lpdf"; + static constexpr const char* function = "exp_mod_normal_lpdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", sigma, "Inv_scale paramter", lambda); diff --git a/stan/math/prim/prob/exp_mod_normal_rng.hpp b/stan/math/prim/prob/exp_mod_normal_rng.hpp index 07c4cffde2b..84df8fd1733 100644 --- a/stan/math/prim/prob/exp_mod_normal_rng.hpp +++ b/stan/math/prim/prob/exp_mod_normal_rng.hpp @@ -39,7 +39,7 @@ template inline typename VectorBuilder::type exp_mod_normal_rng(const T_loc& mu, const T_scale& sigma, const T_inv_scale& lambda, RNG& rng) { - static const char* function = "exp_mod_normal_rng"; + static constexpr const char* function = "exp_mod_normal_rng"; using T_mu_ref = ref_type_t; using T_sigma_ref = ref_type_t; using T_lambda_ref = ref_type_t; diff --git a/stan/math/prim/prob/exponential_cdf.hpp b/stan/math/prim/prob/exponential_cdf.hpp index bd21c64042d..bab76c29ac6 100644 --- a/stan/math/prim/prob/exponential_cdf.hpp +++ b/stan/math/prim/prob/exponential_cdf.hpp @@ -38,7 +38,7 @@ return_type_t exponential_cdf(const T_y& y, using T_partials_array = Eigen::Array; using T_y_ref = ref_type_if_not_constant_t; using T_beta_ref = ref_type_if_not_constant_t; - static const char* function = "exponential_cdf"; + static constexpr const char* function = "exponential_cdf"; T_y_ref y_ref = y; T_beta_ref beta_ref = beta; diff --git a/stan/math/prim/prob/exponential_lccdf.hpp b/stan/math/prim/prob/exponential_lccdf.hpp index 19c32c17342..2a4eb802ac1 100644 --- a/stan/math/prim/prob/exponential_lccdf.hpp +++ b/stan/math/prim/prob/exponential_lccdf.hpp @@ -23,7 +23,7 @@ return_type_t exponential_lccdf(const T_y& y, using T_partials_array = Eigen::Array; using T_y_ref = ref_type_if_not_constant_t; using T_beta_ref = ref_type_if_not_constant_t; - static const char* function = "exponential_lccdf"; + static constexpr const char* function = "exponential_lccdf"; T_y_ref y_ref = y; T_beta_ref beta_ref = beta; diff --git a/stan/math/prim/prob/exponential_lcdf.hpp b/stan/math/prim/prob/exponential_lcdf.hpp index 0ed9d41047e..7be8631e7de 100644 --- a/stan/math/prim/prob/exponential_lcdf.hpp +++ b/stan/math/prim/prob/exponential_lcdf.hpp @@ -26,7 +26,7 @@ return_type_t exponential_lcdf(const T_y& y, using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_beta_ref = ref_type_if_not_constant_t; - static const char* function = "exponential_lcdf"; + static constexpr const char* function = "exponential_lcdf"; T_y_ref y_ref = y; T_beta_ref beta_ref = beta; diff --git a/stan/math/prim/prob/exponential_lpdf.hpp b/stan/math/prim/prob/exponential_lpdf.hpp index 26f22a0cf5e..2258ccea310 100644 --- a/stan/math/prim/prob/exponential_lpdf.hpp +++ b/stan/math/prim/prob/exponential_lpdf.hpp @@ -55,7 +55,7 @@ return_type_t exponential_lpdf(const T_y& y, using T_partials_array = Eigen::Array; using T_y_ref = ref_type_if_not_constant_t; using T_beta_ref = ref_type_if_not_constant_t; - static const char* function = "exponential_lpdf"; + static constexpr const char* function = "exponential_lpdf"; check_consistent_sizes(function, "Random variable", y, "Inverse scale parameter", beta); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/exponential_rng.hpp b/stan/math/prim/prob/exponential_rng.hpp index 981067e3d79..5d97ca02916 100644 --- a/stan/math/prim/prob/exponential_rng.hpp +++ b/stan/math/prim/prob/exponential_rng.hpp @@ -29,7 +29,7 @@ inline typename VectorBuilder::type exponential_rng( const T_inv& beta, RNG& rng) { using boost::exponential_distribution; using boost::variate_generator; - static const char* function = "exponential_rng"; + static constexpr const char* function = "exponential_rng"; using T_beta_ref = ref_type_t; T_beta_ref beta_ref = beta; check_positive_finite(function, "Inverse scale parameter", beta_ref); diff --git a/stan/math/prim/prob/frechet_cdf.hpp b/stan/math/prim/prob/frechet_cdf.hpp index a258a913e60..9a086f0acc2 100644 --- a/stan/math/prim/prob/frechet_cdf.hpp +++ b/stan/math/prim/prob/frechet_cdf.hpp @@ -33,7 +33,7 @@ return_type_t frechet_cdf(const T_y& y, using T_alpha_ref = ref_type_t; using T_sigma_ref = ref_type_t; using std::pow; - static const char* function = "frechet_cdf"; + static constexpr const char* function = "frechet_cdf"; T_y_ref y_ref = y; T_alpha_ref alpha_ref = alpha; T_sigma_ref sigma_ref = sigma; diff --git a/stan/math/prim/prob/frechet_lccdf.hpp b/stan/math/prim/prob/frechet_lccdf.hpp index 7d4432f8cff..48df3b40e05 100644 --- a/stan/math/prim/prob/frechet_lccdf.hpp +++ b/stan/math/prim/prob/frechet_lccdf.hpp @@ -32,7 +32,7 @@ return_type_t frechet_lccdf(const T_y& y, using T_y_ref = ref_type_t; using T_alpha_ref = ref_type_t; using T_sigma_ref = ref_type_t; - static const char* function = "frechet_lccdf"; + static constexpr const char* function = "frechet_lccdf"; T_y_ref y_ref = y; T_alpha_ref alpha_ref = alpha; T_sigma_ref sigma_ref = sigma; diff --git a/stan/math/prim/prob/frechet_lcdf.hpp b/stan/math/prim/prob/frechet_lcdf.hpp index 4817aa459bf..b83bec0452b 100644 --- a/stan/math/prim/prob/frechet_lcdf.hpp +++ b/stan/math/prim/prob/frechet_lcdf.hpp @@ -30,7 +30,7 @@ return_type_t frechet_lcdf(const T_y& y, using T_y_ref = ref_type_t; using T_alpha_ref = ref_type_t; using T_sigma_ref = ref_type_t; - static const char* function = "frechet_lcdf"; + static constexpr const char* function = "frechet_lcdf"; T_y_ref y_ref = y; T_alpha_ref alpha_ref = alpha; T_sigma_ref sigma_ref = sigma; diff --git a/stan/math/prim/prob/frechet_lpdf.hpp b/stan/math/prim/prob/frechet_lpdf.hpp index 14a28230a13..08cb168e462 100644 --- a/stan/math/prim/prob/frechet_lpdf.hpp +++ b/stan/math/prim/prob/frechet_lpdf.hpp @@ -35,7 +35,7 @@ return_type_t frechet_lpdf(const T_y& y, using T_y_ref = ref_type_t; using T_alpha_ref = ref_type_t; using T_sigma_ref = ref_type_t; - static const char* function = "frechet_lpdf"; + static constexpr const char* function = "frechet_lpdf"; check_consistent_sizes(function, "Random variable", y, "Shape parameter", alpha, "Scale parameter", sigma); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/frechet_rng.hpp b/stan/math/prim/prob/frechet_rng.hpp index 6cb91bc25e1..0c15df9bc35 100644 --- a/stan/math/prim/prob/frechet_rng.hpp +++ b/stan/math/prim/prob/frechet_rng.hpp @@ -35,7 +35,7 @@ inline typename VectorBuilder::type frechet_rng( using boost::random::weibull_distribution; using T_alpha_ref = ref_type_t; using T_sigma_ref = ref_type_t; - static const char* function = "frechet_rng"; + static constexpr const char* function = "frechet_rng"; check_consistent_sizes(function, "Shape parameter", alpha, "Scale Parameter", sigma); T_alpha_ref alpha_ref = alpha; diff --git a/stan/math/prim/prob/gamma_cdf.hpp b/stan/math/prim/prob/gamma_cdf.hpp index 2ef41a6f0e2..b45076cc481 100644 --- a/stan/math/prim/prob/gamma_cdf.hpp +++ b/stan/math/prim/prob/gamma_cdf.hpp @@ -46,7 +46,7 @@ return_type_t gamma_cdf(const T_y& y, using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; using std::exp; - static const char* function = "gamma_cdf"; + static constexpr const char* function = "gamma_cdf"; check_consistent_sizes(function, "Random variable", y, "Shape parameter", alpha, "Inverse scale parameter", beta); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/gamma_lccdf.hpp b/stan/math/prim/prob/gamma_lccdf.hpp index 912783d7487..6ab8f7bce4f 100644 --- a/stan/math/prim/prob/gamma_lccdf.hpp +++ b/stan/math/prim/prob/gamma_lccdf.hpp @@ -32,7 +32,7 @@ return_type_t gamma_lccdf(const T_y& y, using T_y_ref = ref_type_t; using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; - static const char* function = "gamma_lccdf"; + static constexpr const char* function = "gamma_lccdf"; check_consistent_sizes(function, "Random variable", y, "Shape parameter", alpha, "Inverse scale parameter", beta); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/gamma_lcdf.hpp b/stan/math/prim/prob/gamma_lcdf.hpp index d6a231faa56..9d4132e9975 100644 --- a/stan/math/prim/prob/gamma_lcdf.hpp +++ b/stan/math/prim/prob/gamma_lcdf.hpp @@ -32,7 +32,7 @@ return_type_t gamma_lcdf(const T_y& y, using T_y_ref = ref_type_t; using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; - static const char* function = "gamma_lcdf"; + static constexpr const char* function = "gamma_lcdf"; check_consistent_sizes(function, "Random variable", y, "Shape parameter", alpha, "Inverse scale parameter", beta); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/gamma_lpdf.hpp b/stan/math/prim/prob/gamma_lpdf.hpp index 891ccdc2283..7676570bd19 100644 --- a/stan/math/prim/prob/gamma_lpdf.hpp +++ b/stan/math/prim/prob/gamma_lpdf.hpp @@ -56,7 +56,7 @@ return_type_t gamma_lpdf(const T_y& y, using T_y_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; using T_beta_ref = ref_type_if_not_constant_t; - static const char* function = "gamma_lpdf"; + static constexpr const char* function = "gamma_lpdf"; check_consistent_sizes(function, "Random variable", y, "Shape parameter", alpha, "Inverse scale parameter", beta); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/gamma_rng.hpp b/stan/math/prim/prob/gamma_rng.hpp index 7a1ac651b18..c609e34214e 100644 --- a/stan/math/prim/prob/gamma_rng.hpp +++ b/stan/math/prim/prob/gamma_rng.hpp @@ -36,7 +36,7 @@ inline typename VectorBuilder::type gamma_rng( using boost::variate_generator; using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; - static const char* function = "gamma_rng"; + static constexpr const char* function = "gamma_rng"; check_consistent_sizes(function, "Shape parameter", alpha, "Inverse scale Parameter", beta); T_alpha_ref alpha_ref = alpha; diff --git a/stan/math/prim/prob/gaussian_dlm_obs_lpdf.hpp b/stan/math/prim/prob/gaussian_dlm_obs_lpdf.hpp index 0399cad5f81..f95db8537a3 100644 --- a/stan/math/prim/prob/gaussian_dlm_obs_lpdf.hpp +++ b/stan/math/prim/prob/gaussian_dlm_obs_lpdf.hpp @@ -72,7 +72,7 @@ inline return_type_t gaussian_dlm_obs_lpdf( const T_m0& m0, const T_C0& C0) { using T_lp = return_type_t; using std::pow; - static const char* function = "gaussian_dlm_obs_lpdf"; + static constexpr const char* function = "gaussian_dlm_obs_lpdf"; check_size_match(function, "columns of F", F.cols(), "rows of y", y.rows()); check_size_match(function, "rows of F", F.rows(), "rows of G", G.rows()); check_size_match(function, "rows of V", V.rows(), "rows of y", y.rows()); @@ -197,7 +197,7 @@ inline return_type_t gaussian_dlm_obs_lpdf( const T_m0& m0, const T_C0& C0) { using T_lp = return_type_t; using std::log; - static const char* function = "gaussian_dlm_obs_lpdf"; + static constexpr const char* function = "gaussian_dlm_obs_lpdf"; check_size_match(function, "columns of F", F.cols(), "rows of y", y.rows()); check_size_match(function, "rows of F", F.rows(), "rows of G", G.rows()); check_size_match(function, "rows of G", G.rows(), "columns of G", G.cols()); diff --git a/stan/math/prim/prob/gaussian_dlm_obs_rng.hpp b/stan/math/prim/prob/gaussian_dlm_obs_rng.hpp index f4aa29c7068..8ae0067b504 100644 --- a/stan/math/prim/prob/gaussian_dlm_obs_rng.hpp +++ b/stan/math/prim/prob/gaussian_dlm_obs_rng.hpp @@ -92,7 +92,7 @@ inline Eigen::MatrixXd gaussian_dlm_obs_rng(const Eigen::MatrixXd &F, const Eigen::VectorXd &m0, const Eigen::MatrixXd &C0, const int T, RNG &rng) { - static const char *function = "gaussian_dlm_obs_rng"; + static constexpr const char *function = "gaussian_dlm_obs_rng"; int r = F.cols(); // number of variables int n = G.rows(); // number of states diff --git a/stan/math/prim/prob/gumbel_cdf.hpp b/stan/math/prim/prob/gumbel_cdf.hpp index ade82c83b27..b56ac3af0f4 100644 --- a/stan/math/prim/prob/gumbel_cdf.hpp +++ b/stan/math/prim/prob/gumbel_cdf.hpp @@ -43,7 +43,7 @@ return_type_t gumbel_cdf(const T_y& y, const T_loc& mu, using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; using T_beta_ref = ref_type_if_not_constant_t; - static const char* function = "gumbel_cdf"; + static constexpr const char* function = "gumbel_cdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", beta); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/gumbel_lccdf.hpp b/stan/math/prim/prob/gumbel_lccdf.hpp index 13e6c2ff503..dbce33f1c80 100644 --- a/stan/math/prim/prob/gumbel_lccdf.hpp +++ b/stan/math/prim/prob/gumbel_lccdf.hpp @@ -42,7 +42,7 @@ return_type_t gumbel_lccdf(const T_y& y, const T_loc& mu, using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; using T_beta_ref = ref_type_if_not_constant_t; - static const char* function = "gumbel_lccdf"; + static constexpr const char* function = "gumbel_lccdf"; T_y_ref y_ref = y; T_mu_ref mu_ref = mu; T_beta_ref beta_ref = beta; diff --git a/stan/math/prim/prob/gumbel_lcdf.hpp b/stan/math/prim/prob/gumbel_lcdf.hpp index 8cb57ddb2f9..cbf0f279a1d 100644 --- a/stan/math/prim/prob/gumbel_lcdf.hpp +++ b/stan/math/prim/prob/gumbel_lcdf.hpp @@ -41,7 +41,7 @@ return_type_t gumbel_lcdf(const T_y& y, const T_loc& mu, using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; using T_beta_ref = ref_type_if_not_constant_t; - static const char* function = "gumbel_lcdf"; + static constexpr const char* function = "gumbel_lcdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", beta); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/gumbel_lpdf.hpp b/stan/math/prim/prob/gumbel_lpdf.hpp index 24d3f453e5e..eb5b6766250 100644 --- a/stan/math/prim/prob/gumbel_lpdf.hpp +++ b/stan/math/prim/prob/gumbel_lpdf.hpp @@ -43,7 +43,7 @@ return_type_t gumbel_lpdf(const T_y& y, const T_loc& mu, using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; using T_beta_ref = ref_type_if_not_constant_t; - static const char* function = "gumbel_lpdf"; + static constexpr const char* function = "gumbel_lpdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", beta); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/gumbel_rng.hpp b/stan/math/prim/prob/gumbel_rng.hpp index ff8b6ca4db1..b6ece64a4ec 100644 --- a/stan/math/prim/prob/gumbel_rng.hpp +++ b/stan/math/prim/prob/gumbel_rng.hpp @@ -37,7 +37,7 @@ inline typename VectorBuilder::type gumbel_rng( using boost::variate_generator; using T_mu_ref = ref_type_t; using T_beta_ref = ref_type_t; - static const char* function = "gumbel_rng"; + static constexpr const char* function = "gumbel_rng"; check_consistent_sizes(function, "Location parameter", mu, "Scale Parameter", beta); T_mu_ref mu_ref = mu; diff --git a/stan/math/prim/prob/hypergeometric_lpmf.hpp b/stan/math/prim/prob/hypergeometric_lpmf.hpp index adba7f41854..ce61d96d749 100644 --- a/stan/math/prim/prob/hypergeometric_lpmf.hpp +++ b/stan/math/prim/prob/hypergeometric_lpmf.hpp @@ -17,7 +17,7 @@ namespace math { template double hypergeometric_lpmf(const T_n& n, const T_N& N, const T_a& a, const T_b& b) { - static const char* function = "hypergeometric_lpmf"; + static constexpr const char* function = "hypergeometric_lpmf"; check_bounded(function, "Successes variable", value_of(n), 0, a); check_consistent_sizes(function, "Successes variable", n, "Draws parameter", N, "Successes in population parameter", a, diff --git a/stan/math/prim/prob/hypergeometric_rng.hpp b/stan/math/prim/prob/hypergeometric_rng.hpp index aa53734a231..b6d7e410f46 100644 --- a/stan/math/prim/prob/hypergeometric_rng.hpp +++ b/stan/math/prim/prob/hypergeometric_rng.hpp @@ -14,7 +14,7 @@ template inline int hypergeometric_rng(int N, int a, int b, RNG& rng) { using boost::variate_generator; using boost::math::hypergeometric_distribution; - static const char* function = "hypergeometric_rng"; + static constexpr const char* function = "hypergeometric_rng"; check_bounded(function, "Draws parameter", value_of(N), 0, a + b); check_positive(function, "Draws parameter", N); check_positive(function, "Successes in population parameter", a); diff --git a/stan/math/prim/prob/inv_chi_square_cdf.hpp b/stan/math/prim/prob/inv_chi_square_cdf.hpp index f5d9317e992..7d4e57e6199 100644 --- a/stan/math/prim/prob/inv_chi_square_cdf.hpp +++ b/stan/math/prim/prob/inv_chi_square_cdf.hpp @@ -40,7 +40,7 @@ return_type_t inv_chi_square_cdf(const T_y& y, const T_dof& nu) { using std::pow; using T_y_ref = ref_type_t; using T_nu_ref = ref_type_t; - static const char* function = "inv_chi_square_cdf"; + static constexpr const char* function = "inv_chi_square_cdf"; check_consistent_sizes(function, "Random variable", y, "Degrees of freedom parameter", nu); diff --git a/stan/math/prim/prob/inv_chi_square_lccdf.hpp b/stan/math/prim/prob/inv_chi_square_lccdf.hpp index 6ac2028a122..6cfa0d54c07 100644 --- a/stan/math/prim/prob/inv_chi_square_lccdf.hpp +++ b/stan/math/prim/prob/inv_chi_square_lccdf.hpp @@ -42,7 +42,7 @@ return_type_t inv_chi_square_lccdf(const T_y& y, const T_dof& nu) { using std::pow; using T_y_ref = ref_type_t; using T_nu_ref = ref_type_t; - static const char* function = "inv_chi_square_lccdf"; + static constexpr const char* function = "inv_chi_square_lccdf"; check_consistent_sizes(function, "Random variable", y, "Degrees of freedom parameter", nu); diff --git a/stan/math/prim/prob/inv_chi_square_lcdf.hpp b/stan/math/prim/prob/inv_chi_square_lcdf.hpp index 35fe706cd80..998eb0e2224 100644 --- a/stan/math/prim/prob/inv_chi_square_lcdf.hpp +++ b/stan/math/prim/prob/inv_chi_square_lcdf.hpp @@ -42,7 +42,7 @@ return_type_t inv_chi_square_lcdf(const T_y& y, const T_dof& nu) { using std::pow; using T_y_ref = ref_type_t; using T_nu_ref = ref_type_t; - static const char* function = "inv_chi_square_lcdf"; + static constexpr const char* function = "inv_chi_square_lcdf"; check_consistent_sizes(function, "Random variable", y, "Degrees of freedom parameter", nu); diff --git a/stan/math/prim/prob/inv_chi_square_lpdf.hpp b/stan/math/prim/prob/inv_chi_square_lpdf.hpp index 3b5250184fd..cb72c60aade 100644 --- a/stan/math/prim/prob/inv_chi_square_lpdf.hpp +++ b/stan/math/prim/prob/inv_chi_square_lpdf.hpp @@ -50,7 +50,7 @@ return_type_t inv_chi_square_lpdf(const T_y& y, const T_dof& nu) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_nu_ref = ref_type_if_not_constant_t; - static const char* function = "inv_chi_square_lpdf"; + static constexpr const char* function = "inv_chi_square_lpdf"; check_consistent_sizes(function, "Random variable", y, "Degrees of freedom parameter", nu); diff --git a/stan/math/prim/prob/inv_chi_square_rng.hpp b/stan/math/prim/prob/inv_chi_square_rng.hpp index b43b3c990b6..a15c23d323e 100644 --- a/stan/math/prim/prob/inv_chi_square_rng.hpp +++ b/stan/math/prim/prob/inv_chi_square_rng.hpp @@ -30,7 +30,7 @@ inline typename VectorBuilder::type inv_chi_square_rng( using boost::variate_generator; using boost::random::chi_squared_distribution; using T_nu_ref = ref_type_t; - static const char* function = "inv_chi_square_rng"; + static constexpr const char* function = "inv_chi_square_rng"; T_nu_ref nu_ref = nu; check_positive_finite(function, "Degrees of freedom parameter", nu_ref); diff --git a/stan/math/prim/prob/inv_gamma_cdf.hpp b/stan/math/prim/prob/inv_gamma_cdf.hpp index 3426c6070bb..31697f6ceb8 100644 --- a/stan/math/prim/prob/inv_gamma_cdf.hpp +++ b/stan/math/prim/prob/inv_gamma_cdf.hpp @@ -46,7 +46,7 @@ return_type_t inv_gamma_cdf(const T_y& y, using T_beta_ref = ref_type_t; using std::exp; using std::pow; - static const char* function = "inv_gamma_cdf"; + static constexpr const char* function = "inv_gamma_cdf"; check_consistent_sizes(function, "Random variable", y, "Shape parameter", alpha, "Scale Parameter", beta); diff --git a/stan/math/prim/prob/inv_gamma_lccdf.hpp b/stan/math/prim/prob/inv_gamma_lccdf.hpp index 3cf5952849e..481d2906887 100644 --- a/stan/math/prim/prob/inv_gamma_lccdf.hpp +++ b/stan/math/prim/prob/inv_gamma_lccdf.hpp @@ -32,7 +32,7 @@ return_type_t inv_gamma_lccdf(const T_y& y, using std::exp; using std::log; using std::pow; - static const char* function = "inv_gamma_lccdf"; + static constexpr const char* function = "inv_gamma_lccdf"; check_consistent_sizes(function, "Random variable", y, "Shape parameter", alpha, "Scale Parameter", beta); diff --git a/stan/math/prim/prob/inv_gamma_lcdf.hpp b/stan/math/prim/prob/inv_gamma_lcdf.hpp index 394334b7a8b..79fd78f59ca 100644 --- a/stan/math/prim/prob/inv_gamma_lcdf.hpp +++ b/stan/math/prim/prob/inv_gamma_lcdf.hpp @@ -32,7 +32,7 @@ return_type_t inv_gamma_lcdf(const T_y& y, using std::exp; using std::log; using std::pow; - static const char* function = "inv_gamma_lcdf"; + static constexpr const char* function = "inv_gamma_lcdf"; check_consistent_sizes(function, "Random variable", y, "Shape parameter", alpha, "Scale Parameter", beta); diff --git a/stan/math/prim/prob/inv_gamma_lpdf.hpp b/stan/math/prim/prob/inv_gamma_lpdf.hpp index 3be797349e1..b9b016744c9 100644 --- a/stan/math/prim/prob/inv_gamma_lpdf.hpp +++ b/stan/math/prim/prob/inv_gamma_lpdf.hpp @@ -48,7 +48,7 @@ return_type_t inv_gamma_lpdf(const T_y& y, using T_y_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; using T_beta_ref = ref_type_if_not_constant_t; - static const char* function = "inv_gamma_lpdf"; + static constexpr const char* function = "inv_gamma_lpdf"; check_consistent_sizes(function, "Random variable", y, "Shape parameter", alpha, "Scale parameter", beta); diff --git a/stan/math/prim/prob/inv_gamma_rng.hpp b/stan/math/prim/prob/inv_gamma_rng.hpp index 6923a934a00..cd7baeb7bc1 100644 --- a/stan/math/prim/prob/inv_gamma_rng.hpp +++ b/stan/math/prim/prob/inv_gamma_rng.hpp @@ -36,7 +36,7 @@ inv_gamma_rng(const T_shape& alpha, const T_scale& beta, RNG& rng) { using boost::random::gamma_distribution; using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; - static const char* function = "inv_gamma_rng"; + static constexpr const char* function = "inv_gamma_rng"; check_consistent_sizes(function, "Shape parameter", alpha, "Scale Parameter", beta); T_alpha_ref alpha_ref = alpha; diff --git a/stan/math/prim/prob/inv_wishart_cholesky_lpdf.hpp b/stan/math/prim/prob/inv_wishart_cholesky_lpdf.hpp index 2fe0f2edb5c..64ac1d969e3 100644 --- a/stan/math/prim/prob/inv_wishart_cholesky_lpdf.hpp +++ b/stan/math/prim/prob/inv_wishart_cholesky_lpdf.hpp @@ -47,7 +47,7 @@ return_type_t inv_wishart_cholesky_lpdf( using T_nu_ref = ref_type_t; using T_L_S_ref = ref_type_t; using T_return = return_type_t; - static const char* function = "inv_wishart_cholesky_lpdf"; + static constexpr const char* function = "inv_wishart_cholesky_lpdf"; Eigen::Index k = L_Y.rows(); check_greater(function, "Degrees of freedom parameter", nu, k - 1); diff --git a/stan/math/prim/prob/inv_wishart_cholesky_rng.hpp b/stan/math/prim/prob/inv_wishart_cholesky_rng.hpp index d40709a0d68..b9e2139c713 100644 --- a/stan/math/prim/prob/inv_wishart_cholesky_rng.hpp +++ b/stan/math/prim/prob/inv_wishart_cholesky_rng.hpp @@ -32,7 +32,7 @@ inline Eigen::MatrixXd inv_wishart_cholesky_rng(double nu, const Eigen::MatrixXd& L_S, RNG& rng) { using Eigen::MatrixXd; - static const char* function = "inv_wishart_cholesky_rng"; + static constexpr const char* function = "inv_wishart_cholesky_rng"; index_type_t k = L_S.rows(); check_square(function, "Cholesky Scale matrix", L_S); check_greater(function, "degrees of freedom > dims - 1", nu, k - 1); diff --git a/stan/math/prim/prob/inv_wishart_lpdf.hpp b/stan/math/prim/prob/inv_wishart_lpdf.hpp index f830cc3f2f4..9169a0f3ab1 100644 --- a/stan/math/prim/prob/inv_wishart_lpdf.hpp +++ b/stan/math/prim/prob/inv_wishart_lpdf.hpp @@ -50,7 +50,7 @@ return_type_t inv_wishart_lpdf(const T_y& W, using T_W_ref = ref_type_t; using T_nu_ref = ref_type_t; using T_S_ref = ref_type_t; - static const char* function = "inv_wishart_lpdf"; + static constexpr const char* function = "inv_wishart_lpdf"; check_size_match(function, "Rows of random variable", W.rows(), "columns of scale parameter", S.rows()); check_square(function, "random variable", W); diff --git a/stan/math/prim/prob/inv_wishart_rng.hpp b/stan/math/prim/prob/inv_wishart_rng.hpp index 56409b1359b..d4eb8f0f527 100644 --- a/stan/math/prim/prob/inv_wishart_rng.hpp +++ b/stan/math/prim/prob/inv_wishart_rng.hpp @@ -13,7 +13,7 @@ template inline Eigen::MatrixXd inv_wishart_rng(double nu, const Eigen::MatrixXd& S, RNG& rng) { using Eigen::MatrixXd; - static const char* function = "inv_wishart_rng"; + static constexpr const char* function = "inv_wishart_rng"; index_type_t k = S.rows(); check_greater(function, "degrees of freedom > dims - 1", nu, k - 1); check_square(function, "scale parameter", S); diff --git a/stan/math/prim/prob/lkj_corr_cholesky_lpdf.hpp b/stan/math/prim/prob/lkj_corr_cholesky_lpdf.hpp index d359c0eacaf..30c18c0154b 100644 --- a/stan/math/prim/prob/lkj_corr_cholesky_lpdf.hpp +++ b/stan/math/prim/prob/lkj_corr_cholesky_lpdf.hpp @@ -18,7 +18,7 @@ template return_type_t lkj_corr_cholesky_lpdf(const T_covar& L, const T_shape& eta) { using lp_ret = return_type_t; - static const char* function = "lkj_corr_cholesky_lpdf"; + static constexpr const char* function = "lkj_corr_cholesky_lpdf"; check_positive(function, "Shape parameter", eta); const auto& L_ref = to_ref(L); diff --git a/stan/math/prim/prob/lkj_corr_cholesky_rng.hpp b/stan/math/prim/prob/lkj_corr_cholesky_rng.hpp index 9cfa57c5981..170ee4314b8 100644 --- a/stan/math/prim/prob/lkj_corr_cholesky_rng.hpp +++ b/stan/math/prim/prob/lkj_corr_cholesky_rng.hpp @@ -11,7 +11,7 @@ namespace math { template inline Eigen::MatrixXd lkj_corr_cholesky_rng(size_t K, double eta, RNG& rng) { - static const char* function = "lkj_corr_cholesky_rng"; + static constexpr const char* function = "lkj_corr_cholesky_rng"; check_positive(function, "Shape parameter", eta); Eigen::ArrayXd CPCs((K * (K - 1)) / 2); diff --git a/stan/math/prim/prob/lkj_corr_lpdf.hpp b/stan/math/prim/prob/lkj_corr_lpdf.hpp index 678a6225c40..894d5030681 100644 --- a/stan/math/prim/prob/lkj_corr_lpdf.hpp +++ b/stan/math/prim/prob/lkj_corr_lpdf.hpp @@ -47,7 +47,7 @@ return_type_t do_lkj_constant(const T_shape& eta, // eta > 0; eta == 1 <-> uniform] template return_type_t lkj_corr_lpdf(const T_y& y, const T_shape& eta) { - static const char* function = "lkj_corr_lpdf"; + static constexpr const char* function = "lkj_corr_lpdf"; return_type_t lp(0.0); const auto& y_ref = to_ref(y); diff --git a/stan/math/prim/prob/lkj_corr_rng.hpp b/stan/math/prim/prob/lkj_corr_rng.hpp index 8e4717cb3f7..70a81889010 100644 --- a/stan/math/prim/prob/lkj_corr_rng.hpp +++ b/stan/math/prim/prob/lkj_corr_rng.hpp @@ -24,7 +24,7 @@ namespace math { */ template inline Eigen::MatrixXd lkj_corr_rng(size_t K, double eta, RNG& rng) { - static const char* function = "lkj_corr_rng"; + static constexpr const char* function = "lkj_corr_rng"; check_positive(function, "Shape parameter", eta); return multiply_lower_tri_self_transpose(lkj_corr_cholesky_rng(K, eta, rng)); } diff --git a/stan/math/prim/prob/lkj_cov_lpdf.hpp b/stan/math/prim/prob/lkj_cov_lpdf.hpp index fc2d8375da8..b8baceda960 100644 --- a/stan/math/prim/prob/lkj_cov_lpdf.hpp +++ b/stan/math/prim/prob/lkj_cov_lpdf.hpp @@ -22,7 +22,7 @@ return_type_t lkj_cov_lpdf(const T_y& y, const T_loc& mu, const T_scale& sigma, const T_shape& eta) { - static const char* function = "lkj_cov_lpdf"; + static constexpr const char* function = "lkj_cov_lpdf"; check_size_match(function, "Rows of location parameter", mu.rows(), "columns of scale parameter", sigma.rows()); check_square(function, "random variable", y); @@ -67,7 +67,7 @@ return_type_t lkj_cov_lpdf(const T_y& y, const T_loc& mu, const T_scale& sigma, const T_shape& eta) { - static const char* function = "lkj_cov_lpdf"; + static constexpr const char* function = "lkj_cov_lpdf"; check_positive(function, "Shape parameter", eta); check_finite(function, "Location parameter", mu); check_finite(function, "Scale parameter", sigma); diff --git a/stan/math/prim/prob/logistic_cdf.hpp b/stan/math/prim/prob/logistic_cdf.hpp index 9250b6036d3..a00359f8e2d 100644 --- a/stan/math/prim/prob/logistic_cdf.hpp +++ b/stan/math/prim/prob/logistic_cdf.hpp @@ -29,7 +29,7 @@ return_type_t logistic_cdf(const T_y& y, const T_loc& mu, using T_y_ref = ref_type_t; using T_mu_ref = ref_type_t; using T_sigma_ref = ref_type_t; - static const char* function = "logistic_cdf"; + static constexpr const char* function = "logistic_cdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", sigma); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/logistic_lccdf.hpp b/stan/math/prim/prob/logistic_lccdf.hpp index 95bb142fc39..58f797c6469 100644 --- a/stan/math/prim/prob/logistic_lccdf.hpp +++ b/stan/math/prim/prob/logistic_lccdf.hpp @@ -30,7 +30,7 @@ return_type_t logistic_lccdf(const T_y& y, const T_loc& mu, using T_y_ref = ref_type_t; using T_mu_ref = ref_type_t; using T_sigma_ref = ref_type_t; - static const char* function = "logistic_lccdf"; + static constexpr const char* function = "logistic_lccdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", sigma); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/logistic_lcdf.hpp b/stan/math/prim/prob/logistic_lcdf.hpp index 0b221124667..69a19dc0965 100644 --- a/stan/math/prim/prob/logistic_lcdf.hpp +++ b/stan/math/prim/prob/logistic_lcdf.hpp @@ -30,7 +30,7 @@ return_type_t logistic_lcdf(const T_y& y, const T_loc& mu, using T_y_ref = ref_type_t; using T_mu_ref = ref_type_t; using T_sigma_ref = ref_type_t; - static const char* function = "logistic_lcdf"; + static constexpr const char* function = "logistic_lcdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", sigma); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/logistic_lpdf.hpp b/stan/math/prim/prob/logistic_lpdf.hpp index 0c3b895fe58..52fbd18904c 100644 --- a/stan/math/prim/prob/logistic_lpdf.hpp +++ b/stan/math/prim/prob/logistic_lpdf.hpp @@ -31,7 +31,7 @@ return_type_t logistic_lpdf(const T_y& y, const T_loc& mu, using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; - static const char* function = "logistic_lpdf"; + static constexpr const char* function = "logistic_lpdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", sigma); diff --git a/stan/math/prim/prob/logistic_rng.hpp b/stan/math/prim/prob/logistic_rng.hpp index ffb3315d09d..9b7e94f1484 100644 --- a/stan/math/prim/prob/logistic_rng.hpp +++ b/stan/math/prim/prob/logistic_rng.hpp @@ -37,7 +37,7 @@ inline typename VectorBuilder::type logistic_rng( using boost::random::exponential_distribution; using T_mu_ref = ref_type_t; using T_sigma_ref = ref_type_t; - static const char* function = "logistic_rng"; + static constexpr const char* function = "logistic_rng"; check_consistent_sizes(function, "Location parameter", mu, "Scale Parameter", sigma); T_mu_ref mu_ref = mu; diff --git a/stan/math/prim/prob/loglogistic_cdf.hpp b/stan/math/prim/prob/loglogistic_cdf.hpp index 77ac17de09c..86b261cad19 100644 --- a/stan/math/prim/prob/loglogistic_cdf.hpp +++ b/stan/math/prim/prob/loglogistic_cdf.hpp @@ -51,7 +51,7 @@ return_type_t loglogistic_cdf(const T_y& y, using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; using std::pow; - static const char* function = "loglogistic_cdf"; + static constexpr const char* function = "loglogistic_cdf"; check_consistent_sizes(function, "Random variable", y, "Scale parameter", alpha, "Shape parameter", beta); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/loglogistic_lpdf.hpp b/stan/math/prim/prob/loglogistic_lpdf.hpp index 8fa49ac5976..3310d405c9c 100644 --- a/stan/math/prim/prob/loglogistic_lpdf.hpp +++ b/stan/math/prim/prob/loglogistic_lpdf.hpp @@ -50,7 +50,7 @@ return_type_t loglogistic_lpdf(const T_y& y, using T_scale_ref = ref_type_if_not_constant_t; using T_shape_ref = ref_type_if_not_constant_t; using std::pow; - static const char* function = "loglogistic_lpdf"; + static constexpr const char* function = "loglogistic_lpdf"; check_consistent_sizes(function, "Random variable", y, "Scale parameter", alpha, "Shape parameter", beta); diff --git a/stan/math/prim/prob/loglogistic_rng.hpp b/stan/math/prim/prob/loglogistic_rng.hpp index 06b43e7e3a1..fa92d93826e 100644 --- a/stan/math/prim/prob/loglogistic_rng.hpp +++ b/stan/math/prim/prob/loglogistic_rng.hpp @@ -37,7 +37,7 @@ loglogistic_rng(const T_scale& alpha, const T_shape& beta, RNG& rng) { using std::pow; using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; - static const char* function = "loglogistic_rng"; + static constexpr const char* function = "loglogistic_rng"; check_consistent_sizes(function, "Scale parameter", alpha, "Shape Parameter", beta); T_alpha_ref alpha_ref = alpha; diff --git a/stan/math/prim/prob/lognormal_cdf.hpp b/stan/math/prim/prob/lognormal_cdf.hpp index d34493ce0e4..8c26e829f5e 100644 --- a/stan/math/prim/prob/lognormal_cdf.hpp +++ b/stan/math/prim/prob/lognormal_cdf.hpp @@ -31,7 +31,7 @@ return_type_t lognormal_cdf(const T_y& y, const T_loc& mu, using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; - static const char* function = "lognormal_cdf"; + static constexpr const char* function = "lognormal_cdf"; T_y_ref y_ref = y; T_mu_ref mu_ref = mu; diff --git a/stan/math/prim/prob/lognormal_lccdf.hpp b/stan/math/prim/prob/lognormal_lccdf.hpp index 0c3fa95cae5..474d8ce2f2e 100644 --- a/stan/math/prim/prob/lognormal_lccdf.hpp +++ b/stan/math/prim/prob/lognormal_lccdf.hpp @@ -32,7 +32,7 @@ return_type_t lognormal_lccdf(const T_y& y, using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; - static const char* function = "lognormal_lccdf"; + static constexpr const char* function = "lognormal_lccdf"; T_y_ref y_ref = y; T_mu_ref mu_ref = mu; diff --git a/stan/math/prim/prob/lognormal_lcdf.hpp b/stan/math/prim/prob/lognormal_lcdf.hpp index edfb40e5ecc..2245e5cbf62 100644 --- a/stan/math/prim/prob/lognormal_lcdf.hpp +++ b/stan/math/prim/prob/lognormal_lcdf.hpp @@ -31,7 +31,7 @@ return_type_t lognormal_lcdf(const T_y& y, const T_loc& mu, using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; - static const char* function = "lognormal_lcdf"; + static constexpr const char* function = "lognormal_lcdf"; T_y_ref y_ref = y; T_mu_ref mu_ref = mu; diff --git a/stan/math/prim/prob/lognormal_lpdf.hpp b/stan/math/prim/prob/lognormal_lpdf.hpp index 08e8f700ee8..af536a0e7a8 100644 --- a/stan/math/prim/prob/lognormal_lpdf.hpp +++ b/stan/math/prim/prob/lognormal_lpdf.hpp @@ -31,7 +31,7 @@ return_type_t lognormal_lpdf(const T_y& y, const T_loc& mu, using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; - static const char* function = "lognormal_lpdf"; + static constexpr const char* function = "lognormal_lpdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", sigma); diff --git a/stan/math/prim/prob/lognormal_rng.hpp b/stan/math/prim/prob/lognormal_rng.hpp index d6e9c600bff..64adc0516c5 100644 --- a/stan/math/prim/prob/lognormal_rng.hpp +++ b/stan/math/prim/prob/lognormal_rng.hpp @@ -36,7 +36,7 @@ inline typename VectorBuilder::type lognormal_rng( using boost::random::lognormal_distribution; using T_mu_ref = ref_type_t; using T_sigma_ref = ref_type_t; - static const char* function = "lognormal_rng"; + static constexpr const char* function = "lognormal_rng"; check_consistent_sizes(function, "Location parameter", mu, "Scale Parameter", sigma); T_mu_ref mu_ref = mu; diff --git a/stan/math/prim/prob/matrix_normal_prec_lpdf.hpp b/stan/math/prim/prob/matrix_normal_prec_lpdf.hpp index 5934363c209..7641f804997 100644 --- a/stan/math/prim/prob/matrix_normal_prec_lpdf.hpp +++ b/stan/math/prim/prob/matrix_normal_prec_lpdf.hpp @@ -35,7 +35,7 @@ template * = nullptr> return_type_t matrix_normal_prec_lpdf( const T_y& y, const T_Mu& Mu, const T_Sigma& Sigma, const T_D& D) { - static const char* function = "matrix_normal_prec_lpdf"; + static constexpr const char* function = "matrix_normal_prec_lpdf"; check_positive(function, "Sigma rows", Sigma.rows()); check_finite(function, "Sigma", Sigma); check_symmetric(function, "Sigma", Sigma); diff --git a/stan/math/prim/prob/matrix_normal_prec_rng.hpp b/stan/math/prim/prob/matrix_normal_prec_rng.hpp index 8b814a33a68..e7a1d275fb2 100644 --- a/stan/math/prim/prob/matrix_normal_prec_rng.hpp +++ b/stan/math/prim/prob/matrix_normal_prec_rng.hpp @@ -35,7 +35,7 @@ inline Eigen::MatrixXd matrix_normal_prec_rng(const Eigen::MatrixXd &Mu, RNG &rng) { using boost::normal_distribution; using boost::variate_generator; - static const char *function = "matrix_normal_prec_rng"; + static constexpr const char *function = "matrix_normal_prec_rng"; check_positive(function, "Sigma rows", Sigma.rows()); check_finite(function, "Sigma", Sigma); check_symmetric(function, "Sigma", Sigma); diff --git a/stan/math/prim/prob/multi_gp_cholesky_lpdf.hpp b/stan/math/prim/prob/multi_gp_cholesky_lpdf.hpp index dcdd28d011b..e31dc1866c9 100644 --- a/stan/math/prim/prob/multi_gp_cholesky_lpdf.hpp +++ b/stan/math/prim/prob/multi_gp_cholesky_lpdf.hpp @@ -42,7 +42,7 @@ return_type_t multi_gp_cholesky_lpdf(const T_y& y, const T_covar& L, const T_w& w) { using T_lp = return_type_t; - static const char* function = "multi_gp_cholesky_lpdf"; + static constexpr const char* function = "multi_gp_cholesky_lpdf"; check_size_match(function, "Size of random variable (rows y)", y.rows(), "Size of kernel scales (w)", w.size()); check_size_match(function, "Size of random variable", y.cols(), diff --git a/stan/math/prim/prob/multi_gp_lpdf.hpp b/stan/math/prim/prob/multi_gp_lpdf.hpp index c416375873d..272aa6d1941 100644 --- a/stan/math/prim/prob/multi_gp_lpdf.hpp +++ b/stan/math/prim/prob/multi_gp_lpdf.hpp @@ -37,7 +37,7 @@ return_type_t multi_gp_lpdf(const T_y& y, const T_covar& Sigma, const T_w& w) { using T_lp = return_type_t; - static const char* function = "multi_gp_lpdf"; + static constexpr const char* function = "multi_gp_lpdf"; check_size_match(function, "Size of random variable (rows y)", y.rows(), "Size of kernel scales (w)", w.size()); check_size_match(function, "Size of random variable", y.cols(), diff --git a/stan/math/prim/prob/multi_normal_cholesky_lpdf.hpp b/stan/math/prim/prob/multi_normal_cholesky_lpdf.hpp index 299f9dbf3f5..6c1f7649704 100644 --- a/stan/math/prim/prob/multi_normal_cholesky_lpdf.hpp +++ b/stan/math/prim/prob/multi_normal_cholesky_lpdf.hpp @@ -47,7 +47,7 @@ template * = nullptr> return_type_t multi_normal_cholesky_lpdf( const T_y& y, const T_loc& mu, const T_covar& L) { - static const char* function = "multi_normal_cholesky_lpdf"; + static constexpr const char* function = "multi_normal_cholesky_lpdf"; using T_covar_elem = typename scalar_type::type; using T_return = return_type_t; using T_partials_return = partials_return_t; @@ -206,7 +206,7 @@ template * = nullptr> return_type_t multi_normal_cholesky_lpdf( const T_y& y, const T_loc& mu, const T_covar& L) { - static const char* function = "multi_normal_cholesky_lpdf"; + static constexpr const char* function = "multi_normal_cholesky_lpdf"; using T_covar_elem = typename scalar_type::type; using T_return = return_type_t; using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/multi_normal_cholesky_rng.hpp b/stan/math/prim/prob/multi_normal_cholesky_rng.hpp index 1896b6be8a0..fb1e490c683 100644 --- a/stan/math/prim/prob/multi_normal_cholesky_rng.hpp +++ b/stan/math/prim/prob/multi_normal_cholesky_rng.hpp @@ -37,7 +37,7 @@ multi_normal_cholesky_rng( using boost::normal_distribution; using boost::variate_generator; - static const char* function = "multi_normal_cholesky_rng"; + static constexpr const char* function = "multi_normal_cholesky_rng"; vector_seq_view mu_vec(mu); size_t size_mu = mu_vec[0].size(); diff --git a/stan/math/prim/prob/multi_normal_lpdf.hpp b/stan/math/prim/prob/multi_normal_lpdf.hpp index 38f3f41da82..abad728f116 100644 --- a/stan/math/prim/prob/multi_normal_lpdf.hpp +++ b/stan/math/prim/prob/multi_normal_lpdf.hpp @@ -22,7 +22,7 @@ return_type_t multi_normal_lpdf(const T_y& y, using T_covar_elem = typename scalar_type::type; using lp_type = return_type_t; using Eigen::Dynamic; - static const char* function = "multi_normal_lpdf"; + static constexpr const char* function = "multi_normal_lpdf"; check_positive(function, "Covariance matrix rows", Sigma.rows()); check_consistent_sizes_mvt(function, "y", y, "mu", mu); diff --git a/stan/math/prim/prob/multi_normal_prec_lpdf.hpp b/stan/math/prim/prob/multi_normal_prec_lpdf.hpp index 256e0160989..a12c9589a80 100644 --- a/stan/math/prim/prob/multi_normal_prec_lpdf.hpp +++ b/stan/math/prim/prob/multi_normal_prec_lpdf.hpp @@ -23,7 +23,7 @@ return_type_t multi_normal_prec_lpdf( using lp_type = return_type_t; using Eigen::Matrix; using std::vector; - static const char* function = "multi_normal_prec_lpdf"; + static constexpr const char* function = "multi_normal_prec_lpdf"; check_positive(function, "Precision matrix rows", Sigma.rows()); size_t number_of_y = size_mvt(y); diff --git a/stan/math/prim/prob/multi_normal_prec_rng.hpp b/stan/math/prim/prob/multi_normal_prec_rng.hpp index 01831d284f8..b3c7c63f518 100644 --- a/stan/math/prim/prob/multi_normal_prec_rng.hpp +++ b/stan/math/prim/prob/multi_normal_prec_rng.hpp @@ -34,7 +34,7 @@ inline typename StdVectorBuilder::type multi_normal_prec_rng(const T_loc &mu, const Eigen::MatrixXd &S, RNG &rng) { using boost::normal_distribution; using boost::variate_generator; - static const char *function = "multi_normal_prec_rng"; + static constexpr const char *function = "multi_normal_prec_rng"; check_positive(function, "Precision matrix rows", S.rows()); vector_seq_view mu_vec(mu); diff --git a/stan/math/prim/prob/multi_normal_rng.hpp b/stan/math/prim/prob/multi_normal_rng.hpp index 8f342306164..b30d5e1ae3a 100644 --- a/stan/math/prim/prob/multi_normal_rng.hpp +++ b/stan/math/prim/prob/multi_normal_rng.hpp @@ -36,7 +36,7 @@ multi_normal_rng(const T_loc& mu, RNG& rng) { using boost::normal_distribution; using boost::variate_generator; - static const char* function = "multi_normal_rng"; + static constexpr const char* function = "multi_normal_rng"; check_positive(function, "Covariance matrix rows", S.rows()); vector_seq_view mu_vec(mu); diff --git a/stan/math/prim/prob/multi_student_t_cholesky_lpdf.hpp b/stan/math/prim/prob/multi_student_t_cholesky_lpdf.hpp index 6c116c994a5..04ba2f3f610 100644 --- a/stan/math/prim/prob/multi_student_t_cholesky_lpdf.hpp +++ b/stan/math/prim/prob/multi_student_t_cholesky_lpdf.hpp @@ -55,7 +55,7 @@ return_type_t multi_student_t_cholesky_lpdf( using T_mu_ref = ref_type_t; using T_L_ref = ref_type_t; - static const char* function = "multi_student_t_cholesky"; + static constexpr const char* function = "multi_student_t_cholesky"; check_not_nan(function, "Degrees of freedom parameter", nu); check_positive(function, "Degrees of freedom parameter", nu); check_finite(function, "Degrees of freedom parameter", nu); diff --git a/stan/math/prim/prob/multi_student_t_cholesky_rng.hpp b/stan/math/prim/prob/multi_student_t_cholesky_rng.hpp index 13d8c69584e..074f14f337a 100644 --- a/stan/math/prim/prob/multi_student_t_cholesky_rng.hpp +++ b/stan/math/prim/prob/multi_student_t_cholesky_rng.hpp @@ -45,7 +45,7 @@ multi_student_t_cholesky_rng(double nu, const T_loc& mu, using boost::variate_generator; using boost::random::gamma_distribution; - static const char* function = "multi_student_t_cholesky_rng"; + static constexpr const char* function = "multi_student_t_cholesky_rng"; check_not_nan(function, "Degrees of freedom parameter", nu); check_positive(function, "Degrees of freedom parameter", nu); check_positive(function, "Scale matrix rows", L.rows()); diff --git a/stan/math/prim/prob/multi_student_t_lpdf.hpp b/stan/math/prim/prob/multi_student_t_lpdf.hpp index a5eaef677bc..ad5c2ea3414 100644 --- a/stan/math/prim/prob/multi_student_t_lpdf.hpp +++ b/stan/math/prim/prob/multi_student_t_lpdf.hpp @@ -48,7 +48,7 @@ return_type_t multi_student_t_lpdf( using Eigen::Matrix; using std::log; using std::vector; - static const char* function = "multi_student_t"; + static constexpr const char* function = "multi_student_t"; check_not_nan(function, "Degrees of freedom parameter", nu); check_positive(function, "Degrees of freedom parameter", nu); check_finite(function, "Degrees of freedom parameter", nu); diff --git a/stan/math/prim/prob/multi_student_t_rng.hpp b/stan/math/prim/prob/multi_student_t_rng.hpp index 22fe07b4cb9..cffb45338eb 100644 --- a/stan/math/prim/prob/multi_student_t_rng.hpp +++ b/stan/math/prim/prob/multi_student_t_rng.hpp @@ -46,7 +46,7 @@ multi_student_t_rng( using boost::variate_generator; using boost::random::gamma_distribution; - static const char* function = "multi_student_t_rng"; + static constexpr const char* function = "multi_student_t_rng"; check_not_nan(function, "Degrees of freedom parameter", nu); check_positive(function, "Degrees of freedom parameter", nu); check_positive(function, "Covariance matrix rows", S.rows()); diff --git a/stan/math/prim/prob/multinomial_logit_lpmf.hpp b/stan/math/prim/prob/multinomial_logit_lpmf.hpp index bda441dadf3..e72d52c2e9b 100644 --- a/stan/math/prim/prob/multinomial_logit_lpmf.hpp +++ b/stan/math/prim/prob/multinomial_logit_lpmf.hpp @@ -24,7 +24,7 @@ template , require_eigen_col_vector_t* = nullptr> return_type_t multinomial_logit_lpmf(const std::vector& ns, const T_beta& beta) { - static const char* function = "multinomial_logit_lpmf"; + static constexpr const char* function = "multinomial_logit_lpmf"; check_size_match(function, "Size of number of trials variable", ns.size(), "rows of log-probabilities parameter", beta.rows()); check_nonnegative(function, "Number of trials variable", ns); diff --git a/stan/math/prim/prob/multinomial_logit_rng.hpp b/stan/math/prim/prob/multinomial_logit_rng.hpp index 64da0645910..969c007bd1f 100644 --- a/stan/math/prim/prob/multinomial_logit_rng.hpp +++ b/stan/math/prim/prob/multinomial_logit_rng.hpp @@ -26,7 +26,7 @@ template * = nullptr> inline std::vector multinomial_logit_rng(const T_beta& beta, int N, RNG& rng) { - static const char* function = "multinomial_logit_rng"; + static constexpr const char* function = "multinomial_logit_rng"; const auto& beta_ref = to_ref(beta); check_finite(function, "Log-probabilities parameter", beta_ref); check_positive(function, "number of trials variables", N); diff --git a/stan/math/prim/prob/multinomial_lpmf.hpp b/stan/math/prim/prob/multinomial_lpmf.hpp index 3ebb42a9549..87ad024032e 100644 --- a/stan/math/prim/prob/multinomial_lpmf.hpp +++ b/stan/math/prim/prob/multinomial_lpmf.hpp @@ -16,7 +16,7 @@ template * = nullptr> return_type_t multinomial_lpmf(const std::vector& ns, const T_prob& theta) { - static const char* function = "multinomial_lpmf"; + static constexpr const char* function = "multinomial_lpmf"; check_size_match(function, "Size of number of trials variable", ns.size(), "rows of probabilities parameter", theta.rows()); check_nonnegative(function, "Number of trials variable", ns); diff --git a/stan/math/prim/prob/multinomial_rng.hpp b/stan/math/prim/prob/multinomial_rng.hpp index 0a8e2f3bdf8..86edf66beb6 100644 --- a/stan/math/prim/prob/multinomial_rng.hpp +++ b/stan/math/prim/prob/multinomial_rng.hpp @@ -13,7 +13,7 @@ namespace math { template * = nullptr> inline std::vector multinomial_rng(const T_theta& theta, int N, RNG& rng) { - static const char* function = "multinomial_rng"; + static constexpr const char* function = "multinomial_rng"; const auto& theta_ref = to_ref(theta); check_simplex(function, "Probabilities parameter", theta_ref); check_positive(function, "number of trials variables", N); diff --git a/stan/math/prim/prob/neg_binomial_2_cdf.hpp b/stan/math/prim/prob/neg_binomial_2_cdf.hpp index f3b30e2c304..9bf1a8d5577 100644 --- a/stan/math/prim/prob/neg_binomial_2_cdf.hpp +++ b/stan/math/prim/prob/neg_binomial_2_cdf.hpp @@ -27,7 +27,7 @@ return_type_t neg_binomial_2_cdf( using T_n_ref = ref_type_t; using T_mu_ref = ref_type_t; using T_phi_ref = ref_type_t; - static const char* function = "neg_binomial_2_cdf"; + static constexpr const char* function = "neg_binomial_2_cdf"; check_consistent_sizes(function, "Random variable", n, "Location parameter", mu, "Precision Parameter", phi); diff --git a/stan/math/prim/prob/neg_binomial_2_lccdf.hpp b/stan/math/prim/prob/neg_binomial_2_lccdf.hpp index d7575ba64b8..2154e96a44d 100644 --- a/stan/math/prim/prob/neg_binomial_2_lccdf.hpp +++ b/stan/math/prim/prob/neg_binomial_2_lccdf.hpp @@ -18,7 +18,7 @@ return_type_t neg_binomial_2_lccdf( const T_n& n, const T_location& mu, const T_precision& phi) { using T_mu_ref = ref_type_t; using T_phi_ref = ref_type_t; - static const char* function = "neg_binomial_2_lccdf"; + static constexpr const char* function = "neg_binomial_2_lccdf"; check_consistent_sizes(function, "Random variable", n, "Location parameter", mu, "Precision Parameter", phi); T_mu_ref mu_ref = mu; diff --git a/stan/math/prim/prob/neg_binomial_2_lcdf.hpp b/stan/math/prim/prob/neg_binomial_2_lcdf.hpp index fa0a1302994..86eee78c5de 100644 --- a/stan/math/prim/prob/neg_binomial_2_lcdf.hpp +++ b/stan/math/prim/prob/neg_binomial_2_lcdf.hpp @@ -21,7 +21,7 @@ return_type_t neg_binomial_2_lcdf( using T_n_ref = ref_type_t; using T_mu_ref = ref_type_t; using T_phi_ref = ref_type_t; - static const char* function = "neg_binomial_2_lcdf"; + static constexpr const char* function = "neg_binomial_2_lcdf"; check_consistent_sizes(function, "Random variable", n, "Location parameter", mu, "Precision Parameter", phi); diff --git a/stan/math/prim/prob/neg_binomial_2_log_glm_lpmf.hpp b/stan/math/prim/prob/neg_binomial_2_log_glm_lpmf.hpp index e8ec741a2dc..3ea192aeaee 100644 --- a/stan/math/prim/prob/neg_binomial_2_log_glm_lpmf.hpp +++ b/stan/math/prim/prob/neg_binomial_2_log_glm_lpmf.hpp @@ -98,7 +98,7 @@ return_type_t neg_binomial_2_log_glm_lpmf( const size_t N_instances = T_x_rows == 1 ? stan::math::size(y) : x.rows(); const size_t N_attributes = x.cols(); - static const char* function = "neg_binomial_2_log_glm_lpmf"; + static constexpr const char* function = "neg_binomial_2_log_glm_lpmf"; check_consistent_size(function, "Vector of dependent variables", y, N_instances); check_consistent_size(function, "Weight vector", beta, N_attributes); diff --git a/stan/math/prim/prob/neg_binomial_2_log_lpmf.hpp b/stan/math/prim/prob/neg_binomial_2_log_lpmf.hpp index 74f4d1f03bf..cf5a2b1b32f 100644 --- a/stan/math/prim/prob/neg_binomial_2_log_lpmf.hpp +++ b/stan/math/prim/prob/neg_binomial_2_log_lpmf.hpp @@ -33,7 +33,7 @@ return_type_t neg_binomial_2_log_lpmf( using T_n_ref = ref_type_t; using T_eta_ref = ref_type_t; using T_phi_ref = ref_type_t; - static const char* function = "neg_binomial_2_log_lpmf"; + static constexpr const char* function = "neg_binomial_2_log_lpmf"; check_consistent_sizes(function, "Failures variable", n, "Log location parameter", eta, "Precision parameter", phi); diff --git a/stan/math/prim/prob/neg_binomial_2_log_rng.hpp b/stan/math/prim/prob/neg_binomial_2_log_rng.hpp index 7cfa3b068cd..aefce01d132 100644 --- a/stan/math/prim/prob/neg_binomial_2_log_rng.hpp +++ b/stan/math/prim/prob/neg_binomial_2_log_rng.hpp @@ -40,7 +40,7 @@ neg_binomial_2_log_rng(const T_loc& eta, const T_inv& phi, RNG& rng) { using boost::random::poisson_distribution; using T_eta_ref = ref_type_t; using T_phi_ref = ref_type_t; - static const char* function = "neg_binomial_2_log_rng"; + static constexpr const char* function = "neg_binomial_2_log_rng"; check_consistent_sizes(function, "Log-location parameter", eta, "Inverse dispersion parameter", phi); T_eta_ref eta_ref = eta; diff --git a/stan/math/prim/prob/neg_binomial_2_lpmf.hpp b/stan/math/prim/prob/neg_binomial_2_lpmf.hpp index 8113286e2d0..8e65fbc2923 100644 --- a/stan/math/prim/prob/neg_binomial_2_lpmf.hpp +++ b/stan/math/prim/prob/neg_binomial_2_lpmf.hpp @@ -29,7 +29,7 @@ return_type_t neg_binomial_2_lpmf( using T_n_ref = ref_type_t; using T_mu_ref = ref_type_t; using T_phi_ref = ref_type_t; - static const char* function = "neg_binomial_2_lpmf"; + static constexpr const char* function = "neg_binomial_2_lpmf"; check_consistent_sizes(function, "Failures variable", n, "Location parameter", mu, "Precision parameter", phi); diff --git a/stan/math/prim/prob/neg_binomial_2_rng.hpp b/stan/math/prim/prob/neg_binomial_2_rng.hpp index 8c23c634471..67f6b69687d 100644 --- a/stan/math/prim/prob/neg_binomial_2_rng.hpp +++ b/stan/math/prim/prob/neg_binomial_2_rng.hpp @@ -39,7 +39,7 @@ neg_binomial_2_rng(const T_loc& mu, const T_prec& phi, RNG& rng) { using boost::random::poisson_distribution; using T_mu_ref = ref_type_t; using T_phi_ref = ref_type_t; - static const char* function = "neg_binomial_2_rng"; + static constexpr const char* function = "neg_binomial_2_rng"; check_consistent_sizes(function, "Location parameter", mu, "Precision parameter", phi); T_mu_ref mu_ref = mu; diff --git a/stan/math/prim/prob/neg_binomial_cdf.hpp b/stan/math/prim/prob/neg_binomial_cdf.hpp index 95a69cf3ce1..8cc650a51c2 100644 --- a/stan/math/prim/prob/neg_binomial_cdf.hpp +++ b/stan/math/prim/prob/neg_binomial_cdf.hpp @@ -29,7 +29,7 @@ return_type_t neg_binomial_cdf(const T_n& n, using T_n_ref = ref_type_t; using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; - static const char* function = "neg_binomial_cdf"; + static constexpr const char* function = "neg_binomial_cdf"; check_consistent_sizes(function, "Failures variable", n, "Shape parameter", alpha, "Inverse scale parameter", beta); T_n_ref n_ref = n; diff --git a/stan/math/prim/prob/neg_binomial_lccdf.hpp b/stan/math/prim/prob/neg_binomial_lccdf.hpp index 43e2decd40e..46ee78c1d0f 100644 --- a/stan/math/prim/prob/neg_binomial_lccdf.hpp +++ b/stan/math/prim/prob/neg_binomial_lccdf.hpp @@ -32,7 +32,7 @@ return_type_t neg_binomial_lccdf( using std::pow; using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; - static const char* function = "neg_binomial_lccdf"; + static constexpr const char* function = "neg_binomial_lccdf"; check_consistent_sizes(function, "Failures variable", n, "Shape parameter", alpha, "Inverse scale parameter", beta_param); diff --git a/stan/math/prim/prob/neg_binomial_lcdf.hpp b/stan/math/prim/prob/neg_binomial_lcdf.hpp index 462087a519d..252899de728 100644 --- a/stan/math/prim/prob/neg_binomial_lcdf.hpp +++ b/stan/math/prim/prob/neg_binomial_lcdf.hpp @@ -33,7 +33,7 @@ return_type_t neg_binomial_lcdf( using T_n_ref = ref_type_t; using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; - static const char* function = "neg_binomial_lcdf"; + static constexpr const char* function = "neg_binomial_lcdf"; check_consistent_sizes(function, "Failures variable", n, "Shape parameter", alpha, "Inverse scale parameter", beta_param); T_n_ref n_ref = n; diff --git a/stan/math/prim/prob/neg_binomial_lpmf.hpp b/stan/math/prim/prob/neg_binomial_lpmf.hpp index 3c8febf6244..cbe26b5bef9 100644 --- a/stan/math/prim/prob/neg_binomial_lpmf.hpp +++ b/stan/math/prim/prob/neg_binomial_lpmf.hpp @@ -38,7 +38,7 @@ return_type_t neg_binomial_lpmf(const T_n& n, using T_n_ref = ref_type_t; using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; - static const char* function = "neg_binomial_lpmf"; + static constexpr const char* function = "neg_binomial_lpmf"; check_consistent_sizes(function, "Failures variable", n, "Shape parameter", alpha, "Inverse scale parameter", beta); T_n_ref n_ref = n; diff --git a/stan/math/prim/prob/neg_binomial_rng.hpp b/stan/math/prim/prob/neg_binomial_rng.hpp index 0eb772092c6..0e01f6693c8 100644 --- a/stan/math/prim/prob/neg_binomial_rng.hpp +++ b/stan/math/prim/prob/neg_binomial_rng.hpp @@ -39,7 +39,7 @@ inline typename VectorBuilder::type neg_binomial_rng( using boost::random::poisson_distribution; using T_alpha_ref = ref_type_t; using T_beta_ref = ref_type_t; - static const char* function = "neg_binomial_rng"; + static constexpr const char* function = "neg_binomial_rng"; check_consistent_sizes(function, "Shape parameter", alpha, "Inverse scale Parameter", beta); T_alpha_ref alpha_ref = alpha; diff --git a/stan/math/prim/prob/normal_cdf.hpp b/stan/math/prim/prob/normal_cdf.hpp index 24c6a8468f7..1718bbc2dcd 100644 --- a/stan/math/prim/prob/normal_cdf.hpp +++ b/stan/math/prim/prob/normal_cdf.hpp @@ -43,7 +43,7 @@ inline return_type_t normal_cdf(const T_y& y, using T_y_ref = ref_type_t; using T_mu_ref = ref_type_t; using T_sigma_ref = ref_type_t; - static const char* function = "normal_cdf"; + static constexpr const char* function = "normal_cdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", sigma); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/normal_id_glm_lpdf.hpp b/stan/math/prim/prob/normal_id_glm_lpdf.hpp index fe6a1084244..71bed937955 100644 --- a/stan/math/prim/prob/normal_id_glm_lpdf.hpp +++ b/stan/math/prim/prob/normal_id_glm_lpdf.hpp @@ -80,7 +80,7 @@ return_type_t normal_id_glm_lpdf( const size_t N_instances = T_x_rows == 1 ? stan::math::size(y) : x.rows(); const size_t N_attributes = x.cols(); - static const char* function = "normal_id_glm_lpdf"; + static constexpr const char* function = "normal_id_glm_lpdf"; check_consistent_size(function, "Vector of dependent variables", y, N_instances); check_consistent_size(function, "Weight vector", beta, N_attributes); diff --git a/stan/math/prim/prob/normal_lccdf.hpp b/stan/math/prim/prob/normal_lccdf.hpp index 448c1be827c..4e016cf3498 100644 --- a/stan/math/prim/prob/normal_lccdf.hpp +++ b/stan/math/prim/prob/normal_lccdf.hpp @@ -30,7 +30,7 @@ inline return_type_t normal_lccdf(const T_y& y, using T_y_ref = ref_type_t; using T_mu_ref = ref_type_t; using T_sigma_ref = ref_type_t; - static const char* function = "normal_lccdf"; + static constexpr const char* function = "normal_lccdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", sigma); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/normal_lcdf.hpp b/stan/math/prim/prob/normal_lcdf.hpp index a97ac0bc635..1e366e44915 100644 --- a/stan/math/prim/prob/normal_lcdf.hpp +++ b/stan/math/prim/prob/normal_lcdf.hpp @@ -36,7 +36,7 @@ inline return_type_t normal_lcdf(const T_y& y, using T_y_ref = ref_type_t; using T_mu_ref = ref_type_t; using T_sigma_ref = ref_type_t; - static const char* function = "normal_lcdf"; + static constexpr const char* function = "normal_lcdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", sigma); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/normal_lpdf.hpp b/stan/math/prim/prob/normal_lpdf.hpp index a7f238dea24..069a0f80599 100644 --- a/stan/math/prim/prob/normal_lpdf.hpp +++ b/stan/math/prim/prob/normal_lpdf.hpp @@ -48,7 +48,7 @@ inline return_type_t normal_lpdf(const T_y& y, using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; - static const char* function = "normal_lpdf"; + static constexpr const char* function = "normal_lpdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", sigma); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/normal_rng.hpp b/stan/math/prim/prob/normal_rng.hpp index 65536fd93d1..73c328eb9e4 100644 --- a/stan/math/prim/prob/normal_rng.hpp +++ b/stan/math/prim/prob/normal_rng.hpp @@ -36,7 +36,7 @@ inline typename VectorBuilder::type normal_rng( using boost::variate_generator; using T_mu_ref = ref_type_t; using T_sigma_ref = ref_type_t; - static const char* function = "normal_rng"; + static constexpr const char* function = "normal_rng"; check_consistent_sizes(function, "Location parameter", mu, "Scale Parameter", sigma); T_mu_ref mu_ref = mu; diff --git a/stan/math/prim/prob/normal_sufficient_lpdf.hpp b/stan/math/prim/prob/normal_sufficient_lpdf.hpp index 27f8a75e5c9..cec75d03c2a 100644 --- a/stan/math/prim/prob/normal_sufficient_lpdf.hpp +++ b/stan/math/prim/prob/normal_sufficient_lpdf.hpp @@ -60,7 +60,7 @@ return_type_t normal_sufficient_lpdf( using T_n_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; - static const char* function = "normal_sufficient_lpdf"; + static constexpr const char* function = "normal_sufficient_lpdf"; check_consistent_sizes(function, "Location parameter sufficient statistic", y_bar, "Scale parameter sufficient statistic", s_squared, "Number of observations", n_obs, diff --git a/stan/math/prim/prob/ordered_logistic_glm_lpmf.hpp b/stan/math/prim/prob/ordered_logistic_glm_lpmf.hpp index b7124ac1e70..e690e950d92 100644 --- a/stan/math/prim/prob/ordered_logistic_glm_lpmf.hpp +++ b/stan/math/prim/prob/ordered_logistic_glm_lpmf.hpp @@ -71,7 +71,7 @@ return_type_t ordered_logistic_glm_lpmf( const size_t N_attributes = x.cols(); const size_t N_classes = stan::math::size(cuts) + 1; - static const char* function = "ordered_logistic_glm_lpmf"; + static constexpr const char* function = "ordered_logistic_glm_lpmf"; check_consistent_size(function, "Vector of dependent variables", y, N_instances); check_consistent_size(function, "Weight vector", beta, N_attributes); diff --git a/stan/math/prim/prob/ordered_logistic_lpmf.hpp b/stan/math/prim/prob/ordered_logistic_lpmf.hpp index b7b0886e220..ccb2d5ab970 100644 --- a/stan/math/prim/prob/ordered_logistic_lpmf.hpp +++ b/stan/math/prim/prob/ordered_logistic_lpmf.hpp @@ -82,7 +82,7 @@ return_type_t ordered_logistic_lpmf(const T_y& y, using T_cut_ref = ref_type_if_not_constant_t; using Eigen::Array; using Eigen::Dynamic; - static const char* function = "ordered_logistic"; + static constexpr const char* function = "ordered_logistic"; T_cut_ref c_ref = c; vector_seq_view c_vec(c_ref); diff --git a/stan/math/prim/prob/ordered_logistic_rng.hpp b/stan/math/prim/prob/ordered_logistic_rng.hpp index b8b054670fe..59921364a26 100644 --- a/stan/math/prim/prob/ordered_logistic_rng.hpp +++ b/stan/math/prim/prob/ordered_logistic_rng.hpp @@ -14,7 +14,7 @@ template inline int ordered_logistic_rng( double eta, const Eigen::Matrix& c, RNG& rng) { using boost::variate_generator; - static const char* function = "ordered_logistic"; + static constexpr const char* function = "ordered_logistic"; check_finite(function, "Location parameter", eta); check_greater(function, "Size of cut points parameter", c.size(), 0); check_ordered(function, "Cut points parameter", c); diff --git a/stan/math/prim/prob/ordered_probit_lpmf.hpp b/stan/math/prim/prob/ordered_probit_lpmf.hpp index 18bbfdd0174..0ba3dcfd71b 100644 --- a/stan/math/prim/prob/ordered_probit_lpmf.hpp +++ b/stan/math/prim/prob/ordered_probit_lpmf.hpp @@ -51,7 +51,7 @@ return_type_t ordered_probit_lpmf(const T_y& y, using std::exp; using std::log; using T_lambda_ref = ref_type_t; - static const char* function = "ordered_probit"; + static constexpr const char* function = "ordered_probit"; check_nonzero_size(function, "Cut-points", c); int N = math::size(lambda); diff --git a/stan/math/prim/prob/ordered_probit_rng.hpp b/stan/math/prim/prob/ordered_probit_rng.hpp index c46790177db..1f11cebea27 100644 --- a/stan/math/prim/prob/ordered_probit_rng.hpp +++ b/stan/math/prim/prob/ordered_probit_rng.hpp @@ -11,7 +11,7 @@ namespace math { template inline int ordered_probit_rng(double eta, const Eigen::VectorXd& c, RNG& rng) { - static const char* function = "ordered_probit"; + static constexpr const char* function = "ordered_probit"; check_finite(function, "Location parameter", eta); check_greater(function, "Size of cut points parameter", c.size(), 0); check_ordered(function, "Cut points vector", c); diff --git a/stan/math/prim/prob/pareto_cdf.hpp b/stan/math/prim/prob/pareto_cdf.hpp index d4df15b0921..9ccede79b86 100644 --- a/stan/math/prim/prob/pareto_cdf.hpp +++ b/stan/math/prim/prob/pareto_cdf.hpp @@ -29,7 +29,7 @@ return_type_t pareto_cdf(const T_y& y, using T_alpha_ref = ref_type_t; using std::exp; using std::log; - static const char* function = "pareto_cdf"; + static constexpr const char* function = "pareto_cdf"; check_consistent_sizes(function, "Random variable", y, "Scale parameter", y_min, "Shape parameter", alpha); if (size_zero(y, y_min, alpha)) { diff --git a/stan/math/prim/prob/pareto_lccdf.hpp b/stan/math/prim/prob/pareto_lccdf.hpp index f70e3cddc4b..885a028d191 100644 --- a/stan/math/prim/prob/pareto_lccdf.hpp +++ b/stan/math/prim/prob/pareto_lccdf.hpp @@ -32,7 +32,7 @@ return_type_t pareto_lccdf(const T_y& y, using T_y_min_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; using std::isinf; - static const char* function = "pareto_lccdf"; + static constexpr const char* function = "pareto_lccdf"; check_consistent_sizes(function, "Random variable", y, "Scale parameter", y_min, "Shape parameter", alpha); if (size_zero(y, y_min, alpha)) { diff --git a/stan/math/prim/prob/pareto_lcdf.hpp b/stan/math/prim/prob/pareto_lcdf.hpp index 54d6dcfeb6d..603a61e2425 100644 --- a/stan/math/prim/prob/pareto_lcdf.hpp +++ b/stan/math/prim/prob/pareto_lcdf.hpp @@ -32,7 +32,7 @@ return_type_t pareto_lcdf(const T_y& y, using T_y_min_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; using std::isinf; - static const char* function = "pareto_lcdf"; + static constexpr const char* function = "pareto_lcdf"; check_consistent_sizes(function, "Random variable", y, "Scale parameter", y_min, "Shape parameter", alpha); diff --git a/stan/math/prim/prob/pareto_lpdf.hpp b/stan/math/prim/prob/pareto_lpdf.hpp index 4a23d0e6be4..00f5dcff94f 100644 --- a/stan/math/prim/prob/pareto_lpdf.hpp +++ b/stan/math/prim/prob/pareto_lpdf.hpp @@ -31,7 +31,7 @@ return_type_t pareto_lpdf(const T_y& y, using T_y_ref = ref_type_if_not_constant_t; using T_y_min_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; - static const char* function = "pareto_lpdf"; + static constexpr const char* function = "pareto_lpdf"; check_consistent_sizes(function, "Random variable", y, "Scale parameter", y_min, "Shape parameter", alpha); if (size_zero(y, y_min, alpha)) { diff --git a/stan/math/prim/prob/pareto_rng.hpp b/stan/math/prim/prob/pareto_rng.hpp index 6cbb121d001..aac348d7c0e 100644 --- a/stan/math/prim/prob/pareto_rng.hpp +++ b/stan/math/prim/prob/pareto_rng.hpp @@ -36,7 +36,7 @@ inline typename VectorBuilder::type pareto_rng( const T_scale& y_min, const T_shape& alpha, RNG& rng) { using boost::exponential_distribution; using boost::variate_generator; - static const char* function = "pareto_rng"; + static constexpr const char* function = "pareto_rng"; check_consistent_sizes(function, "Scale Parameter", y_min, "Shape parameter", alpha); const auto& y_min_ref = to_ref(y_min); diff --git a/stan/math/prim/prob/pareto_type_2_cdf.hpp b/stan/math/prim/prob/pareto_type_2_cdf.hpp index c4aacfabe67..840ed811cdf 100644 --- a/stan/math/prim/prob/pareto_type_2_cdf.hpp +++ b/stan/math/prim/prob/pareto_type_2_cdf.hpp @@ -30,7 +30,7 @@ return_type_t pareto_type_2_cdf( using T_lambda_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; using std::pow; - static const char* function = "pareto_type_2_cdf"; + static constexpr const char* function = "pareto_type_2_cdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", lambda, "Shape parameter", alpha); diff --git a/stan/math/prim/prob/pareto_type_2_lccdf.hpp b/stan/math/prim/prob/pareto_type_2_lccdf.hpp index 6556f94e6cb..fd84a34e3c5 100644 --- a/stan/math/prim/prob/pareto_type_2_lccdf.hpp +++ b/stan/math/prim/prob/pareto_type_2_lccdf.hpp @@ -29,7 +29,7 @@ return_type_t pareto_type_2_lccdf( using T_mu_ref = ref_type_if_not_constant_t; using T_lambda_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; - static const char* function = "pareto_type_2_lccdf"; + static constexpr const char* function = "pareto_type_2_lccdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", lambda, "Shape parameter", alpha); diff --git a/stan/math/prim/prob/pareto_type_2_lcdf.hpp b/stan/math/prim/prob/pareto_type_2_lcdf.hpp index ac22927ed4b..1b13fca5a2a 100644 --- a/stan/math/prim/prob/pareto_type_2_lcdf.hpp +++ b/stan/math/prim/prob/pareto_type_2_lcdf.hpp @@ -30,7 +30,7 @@ return_type_t pareto_type_2_lcdf( using T_lambda_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; using std::pow; - static const char* function = "pareto_type_2_lcdf"; + static constexpr const char* function = "pareto_type_2_lcdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", lambda, "Shape parameter", alpha); diff --git a/stan/math/prim/prob/pareto_type_2_lpdf.hpp b/stan/math/prim/prob/pareto_type_2_lpdf.hpp index c41eee893a4..2b0b8006965 100644 --- a/stan/math/prim/prob/pareto_type_2_lpdf.hpp +++ b/stan/math/prim/prob/pareto_type_2_lpdf.hpp @@ -32,7 +32,7 @@ return_type_t pareto_type_2_lpdf( using T_mu_ref = ref_type_if_not_constant_t; using T_lambda_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; - static const char* function = "pareto_type_2_lpdf"; + static constexpr const char* function = "pareto_type_2_lpdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", lambda, "Shape parameter", alpha); diff --git a/stan/math/prim/prob/pareto_type_2_rng.hpp b/stan/math/prim/prob/pareto_type_2_rng.hpp index a1ab4af97d4..e2bcd5f0db8 100644 --- a/stan/math/prim/prob/pareto_type_2_rng.hpp +++ b/stan/math/prim/prob/pareto_type_2_rng.hpp @@ -43,7 +43,7 @@ pareto_type_2_rng(const T_loc& mu, const T_scale& lambda, const T_shape& alpha, RNG& rng) { using boost::variate_generator; using boost::random::uniform_real_distribution; - static const char* function = "pareto_type_2_rng"; + static constexpr const char* function = "pareto_type_2_rng"; check_consistent_sizes(function, "Location parameter", mu, "Scale Parameter", lambda, "Shape Parameter", alpha); const auto& mu_ref = to_ref(mu); diff --git a/stan/math/prim/prob/poisson_binomial_cdf.hpp b/stan/math/prim/prob/poisson_binomial_cdf.hpp index 47ef2eca983..0c4f647e835 100644 --- a/stan/math/prim/prob/poisson_binomial_cdf.hpp +++ b/stan/math/prim/prob/poisson_binomial_cdf.hpp @@ -35,7 +35,7 @@ namespace math { template return_type_t poisson_binomial_cdf(const T_y& y, const T_theta& theta) { - static const char* function = "poisson_binomial_cdf"; + static constexpr const char* function = "poisson_binomial_cdf"; size_t size_theta = size_mvt(theta); if (size_theta > 1) { diff --git a/stan/math/prim/prob/poisson_binomial_lccdf.hpp b/stan/math/prim/prob/poisson_binomial_lccdf.hpp index f700c4795ef..2f07bdb60e6 100644 --- a/stan/math/prim/prob/poisson_binomial_lccdf.hpp +++ b/stan/math/prim/prob/poisson_binomial_lccdf.hpp @@ -36,7 +36,7 @@ namespace math { template return_type_t poisson_binomial_lccdf(const T_y& y, const T_theta& theta) { - static const char* function = "poisson_binomial_lccdf"; + static constexpr const char* function = "poisson_binomial_lccdf"; size_t size_theta = size_mvt(theta); if (size_theta > 1) { diff --git a/stan/math/prim/prob/poisson_binomial_lcdf.hpp b/stan/math/prim/prob/poisson_binomial_lcdf.hpp index d3006865707..de5e91a32ce 100644 --- a/stan/math/prim/prob/poisson_binomial_lcdf.hpp +++ b/stan/math/prim/prob/poisson_binomial_lcdf.hpp @@ -35,7 +35,7 @@ namespace math { template return_type_t poisson_binomial_lcdf(const T_y& y, const T_theta& theta) { - static const char* function = "poisson_binomial_lcdf"; + static constexpr const char* function = "poisson_binomial_lcdf"; size_t size_theta = size_mvt(theta); if (size_theta > 1) { diff --git a/stan/math/prim/prob/poisson_binomial_lpmf.hpp b/stan/math/prim/prob/poisson_binomial_lpmf.hpp index bca1f7680de..ac8b8a80c46 100644 --- a/stan/math/prim/prob/poisson_binomial_lpmf.hpp +++ b/stan/math/prim/prob/poisson_binomial_lpmf.hpp @@ -27,7 +27,7 @@ namespace math { template return_type_t poisson_binomial_lpmf(const T_y& y, const T_theta& theta) { - static const char* function = "poisson_binomial_lpmf"; + static constexpr const char* function = "poisson_binomial_lpmf"; size_t size_theta = size_mvt(theta); if (size_theta > 1) { diff --git a/stan/math/prim/prob/poisson_binomial_rng.hpp b/stan/math/prim/prob/poisson_binomial_rng.hpp index d5d0a5b9244..768dc79dea3 100644 --- a/stan/math/prim/prob/poisson_binomial_rng.hpp +++ b/stan/math/prim/prob/poisson_binomial_rng.hpp @@ -24,7 +24,7 @@ namespace math { template * = nullptr> inline int poisson_binomial_rng(const T_theta& theta, RNG& rng) { - static const char* function = "poisson_binomial_rng"; + static constexpr const char* function = "poisson_binomial_rng"; check_finite(function, "Probability parameters", theta); check_bounded(function, "Probability parameters", value_of(theta), 0.0, 1.0); diff --git a/stan/math/prim/prob/poisson_cdf.hpp b/stan/math/prim/prob/poisson_cdf.hpp index 446487136f1..e6768c7a367 100644 --- a/stan/math/prim/prob/poisson_cdf.hpp +++ b/stan/math/prim/prob/poisson_cdf.hpp @@ -29,7 +29,7 @@ return_type_t poisson_cdf(const T_n& n, const T_rate& lambda) { using T_n_ref = ref_type_if_not_constant_t; using T_lambda_ref = ref_type_if_not_constant_t; using std::pow; - static const char* function = "poisson_cdf"; + static constexpr const char* function = "poisson_cdf"; check_consistent_sizes(function, "Random variable", n, "Rate parameter", lambda); diff --git a/stan/math/prim/prob/poisson_lccdf.hpp b/stan/math/prim/prob/poisson_lccdf.hpp index d95ecb77c02..08908b1317c 100644 --- a/stan/math/prim/prob/poisson_lccdf.hpp +++ b/stan/math/prim/prob/poisson_lccdf.hpp @@ -29,7 +29,7 @@ return_type_t poisson_lccdf(const T_n& n, const T_rate& lambda) { using T_partials_return = partials_return_t; using T_n_ref = ref_type_if_not_constant_t; using T_lambda_ref = ref_type_if_not_constant_t; - static const char* function = "poisson_lccdf"; + static constexpr const char* function = "poisson_lccdf"; check_consistent_sizes(function, "Random variable", n, "Rate parameter", lambda); diff --git a/stan/math/prim/prob/poisson_lcdf.hpp b/stan/math/prim/prob/poisson_lcdf.hpp index 24962b283f5..923a26af5eb 100644 --- a/stan/math/prim/prob/poisson_lcdf.hpp +++ b/stan/math/prim/prob/poisson_lcdf.hpp @@ -29,7 +29,7 @@ return_type_t poisson_lcdf(const T_n& n, const T_rate& lambda) { using T_partials_return = partials_return_t; using T_n_ref = ref_type_if_not_constant_t; using T_lambda_ref = ref_type_if_not_constant_t; - static const char* function = "poisson_lcdf"; + static constexpr const char* function = "poisson_lcdf"; check_consistent_sizes(function, "Random variable", n, "Rate parameter", lambda); diff --git a/stan/math/prim/prob/poisson_log_glm_lpmf.hpp b/stan/math/prim/prob/poisson_log_glm_lpmf.hpp index 9e081bfbfe6..23416b95a34 100644 --- a/stan/math/prim/prob/poisson_log_glm_lpmf.hpp +++ b/stan/math/prim/prob/poisson_log_glm_lpmf.hpp @@ -75,7 +75,7 @@ return_type_t poisson_log_glm_lpmf(const T_y& y, const size_t N_instances = T_x_rows == 1 ? stan::math::size(y) : x.rows(); const size_t N_attributes = x.cols(); - static const char* function = "poisson_log_glm_lpmf"; + static constexpr const char* function = "poisson_log_glm_lpmf"; check_consistent_size(function, "Vector of dependent variables", y, N_instances); check_consistent_size(function, "Weight vector", beta, N_attributes); diff --git a/stan/math/prim/prob/poisson_log_lpmf.hpp b/stan/math/prim/prob/poisson_log_lpmf.hpp index c1c3538f919..33b5e62a6c3 100644 --- a/stan/math/prim/prob/poisson_log_lpmf.hpp +++ b/stan/math/prim/prob/poisson_log_lpmf.hpp @@ -32,7 +32,7 @@ return_type_t poisson_log_lpmf(const T_n& n, using T_n_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; using std::isinf; - static const char* function = "poisson_log_lpmf"; + static constexpr const char* function = "poisson_log_lpmf"; check_consistent_sizes(function, "Random variable", n, "Log rate parameter", alpha); diff --git a/stan/math/prim/prob/poisson_log_rng.hpp b/stan/math/prim/prob/poisson_log_rng.hpp index 8e7a8daa7dc..262bccb25b2 100644 --- a/stan/math/prim/prob/poisson_log_rng.hpp +++ b/stan/math/prim/prob/poisson_log_rng.hpp @@ -32,8 +32,8 @@ inline typename VectorBuilder::type poisson_log_rng( const T_rate& alpha, RNG& rng) { using boost::variate_generator; using boost::random::poisson_distribution; - static const char* function = "poisson_log_rng"; - static const double POISSON_MAX_LOG_RATE = 30 * LOG_TWO; + static constexpr const char* function = "poisson_log_rng"; + static constexpr double POISSON_MAX_LOG_RATE = 30 * LOG_TWO; const auto& alpha_ref = to_ref(alpha); check_finite(function, "Log rate parameter", alpha_ref); check_less(function, "Log rate parameter", alpha_ref, POISSON_MAX_LOG_RATE); diff --git a/stan/math/prim/prob/poisson_lpmf.hpp b/stan/math/prim/prob/poisson_lpmf.hpp index 289d0c12c6f..221fc46e50a 100644 --- a/stan/math/prim/prob/poisson_lpmf.hpp +++ b/stan/math/prim/prob/poisson_lpmf.hpp @@ -31,7 +31,7 @@ return_type_t poisson_lpmf(const T_n& n, const T_rate& lambda) { using T_n_ref = ref_type_if_not_constant_t; using T_lambda_ref = ref_type_if_not_constant_t; using std::isinf; - static const char* function = "poisson_lpmf"; + static constexpr const char* function = "poisson_lpmf"; check_consistent_sizes(function, "Random variable", n, "Rate parameter", lambda); diff --git a/stan/math/prim/prob/poisson_rng.hpp b/stan/math/prim/prob/poisson_rng.hpp index 7ec96d678b1..83052699ee2 100644 --- a/stan/math/prim/prob/poisson_rng.hpp +++ b/stan/math/prim/prob/poisson_rng.hpp @@ -31,7 +31,7 @@ inline typename VectorBuilder::type poisson_rng( const T_rate& lambda, RNG& rng) { using boost::variate_generator; using boost::random::poisson_distribution; - static const char* function = "poisson_rng"; + static constexpr const char* function = "poisson_rng"; const auto& lambda_ref = to_ref(lambda); check_positive(function, "Rate parameter", lambda_ref); check_less(function, "Rate parameter", lambda_ref, POISSON_MAX_RATE); diff --git a/stan/math/prim/prob/rayleigh_cdf.hpp b/stan/math/prim/prob/rayleigh_cdf.hpp index 231256831cb..38e53b67341 100644 --- a/stan/math/prim/prob/rayleigh_cdf.hpp +++ b/stan/math/prim/prob/rayleigh_cdf.hpp @@ -26,7 +26,7 @@ return_type_t rayleigh_cdf(const T_y& y, const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; - static const char* function = "rayleigh_cdf"; + static constexpr const char* function = "rayleigh_cdf"; check_consistent_sizes(function, "Random variable", y, "Scale parameter", sigma); diff --git a/stan/math/prim/prob/rayleigh_lccdf.hpp b/stan/math/prim/prob/rayleigh_lccdf.hpp index c72090b8c09..abbd8c6072e 100644 --- a/stan/math/prim/prob/rayleigh_lccdf.hpp +++ b/stan/math/prim/prob/rayleigh_lccdf.hpp @@ -24,7 +24,7 @@ return_type_t rayleigh_lccdf(const T_y& y, const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; - static const char* function = "rayleigh_lccdf"; + static constexpr const char* function = "rayleigh_lccdf"; check_consistent_sizes(function, "Random variable", y, "Scale parameter", sigma); diff --git a/stan/math/prim/prob/rayleigh_lcdf.hpp b/stan/math/prim/prob/rayleigh_lcdf.hpp index cb07f4707e0..9be1416df57 100644 --- a/stan/math/prim/prob/rayleigh_lcdf.hpp +++ b/stan/math/prim/prob/rayleigh_lcdf.hpp @@ -26,7 +26,7 @@ return_type_t rayleigh_lcdf(const T_y& y, const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; - static const char* function = "rayleigh_lcdf"; + static constexpr const char* function = "rayleigh_lcdf"; check_consistent_sizes(function, "Random variable", y, "Scale parameter", sigma); diff --git a/stan/math/prim/prob/rayleigh_lpdf.hpp b/stan/math/prim/prob/rayleigh_lpdf.hpp index a00d34d1259..adb24a55b2c 100644 --- a/stan/math/prim/prob/rayleigh_lpdf.hpp +++ b/stan/math/prim/prob/rayleigh_lpdf.hpp @@ -26,7 +26,7 @@ return_type_t rayleigh_lpdf(const T_y& y, const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; - static const char* function = "rayleigh_lpdf"; + static constexpr const char* function = "rayleigh_lpdf"; check_consistent_sizes(function, "Random variable", y, "Scale parameter", sigma); diff --git a/stan/math/prim/prob/rayleigh_rng.hpp b/stan/math/prim/prob/rayleigh_rng.hpp index 58868567273..55b382be7fc 100644 --- a/stan/math/prim/prob/rayleigh_rng.hpp +++ b/stan/math/prim/prob/rayleigh_rng.hpp @@ -31,7 +31,7 @@ inline typename VectorBuilder::type rayleigh_rng( const T_scale& sigma, RNG& rng) { using boost::variate_generator; using boost::random::uniform_real_distribution; - static const char* function = "rayleigh_rng"; + static constexpr const char* function = "rayleigh_rng"; const auto& sigma_ref = to_ref(sigma); check_positive_finite(function, "Scale parameter", sigma_ref); diff --git a/stan/math/prim/prob/scaled_inv_chi_square_cdf.hpp b/stan/math/prim/prob/scaled_inv_chi_square_cdf.hpp index 979636a1e60..de234529393 100644 --- a/stan/math/prim/prob/scaled_inv_chi_square_cdf.hpp +++ b/stan/math/prim/prob/scaled_inv_chi_square_cdf.hpp @@ -44,7 +44,7 @@ return_type_t scaled_inv_chi_square_cdf(const T_y& y, using T_y_ref = ref_type_t; using T_nu_ref = ref_type_t; using T_s_ref = ref_type_t; - static const char* function = "scaled_inv_chi_square_cdf"; + static constexpr const char* function = "scaled_inv_chi_square_cdf"; check_consistent_sizes(function, "Random variable", y, "Degrees of freedom parameter", nu, "Scale parameter", s); diff --git a/stan/math/prim/prob/scaled_inv_chi_square_lccdf.hpp b/stan/math/prim/prob/scaled_inv_chi_square_lccdf.hpp index 829678057c9..a3a9bb4fddb 100644 --- a/stan/math/prim/prob/scaled_inv_chi_square_lccdf.hpp +++ b/stan/math/prim/prob/scaled_inv_chi_square_lccdf.hpp @@ -31,7 +31,7 @@ return_type_t scaled_inv_chi_square_lccdf( using T_y_ref = ref_type_t; using T_nu_ref = ref_type_t; using T_s_ref = ref_type_t; - static const char* function = "scaled_inv_chi_square_lccdf"; + static constexpr const char* function = "scaled_inv_chi_square_lccdf"; check_consistent_sizes(function, "Random variable", y, "Degrees of freedom parameter", nu, "Scale parameter", s); diff --git a/stan/math/prim/prob/scaled_inv_chi_square_lcdf.hpp b/stan/math/prim/prob/scaled_inv_chi_square_lcdf.hpp index 16534c2b9dc..4017821d569 100644 --- a/stan/math/prim/prob/scaled_inv_chi_square_lcdf.hpp +++ b/stan/math/prim/prob/scaled_inv_chi_square_lcdf.hpp @@ -31,7 +31,7 @@ return_type_t scaled_inv_chi_square_lcdf( using T_y_ref = ref_type_t; using T_nu_ref = ref_type_t; using T_s_ref = ref_type_t; - static const char* function = "scaled_inv_chi_square_lcdf"; + static constexpr const char* function = "scaled_inv_chi_square_lcdf"; check_consistent_sizes(function, "Random variable", y, "Degrees of freedom parameter", nu, "Scale parameter", s); diff --git a/stan/math/prim/prob/scaled_inv_chi_square_lpdf.hpp b/stan/math/prim/prob/scaled_inv_chi_square_lpdf.hpp index 30dbc5d8053..f9890bf55fd 100644 --- a/stan/math/prim/prob/scaled_inv_chi_square_lpdf.hpp +++ b/stan/math/prim/prob/scaled_inv_chi_square_lpdf.hpp @@ -51,7 +51,7 @@ return_type_t scaled_inv_chi_square_lpdf( using T_y_ref = ref_type_t; using T_nu_ref = ref_type_t; using T_s_ref = ref_type_t; - static const char* function = "scaled_inv_chi_square_lpdf"; + static constexpr const char* function = "scaled_inv_chi_square_lpdf"; check_consistent_sizes(function, "Random variable", y, "Degrees of freedom parameter", nu, "Scale parameter", s); diff --git a/stan/math/prim/prob/scaled_inv_chi_square_rng.hpp b/stan/math/prim/prob/scaled_inv_chi_square_rng.hpp index 1b3abcb9776..819255a94a1 100644 --- a/stan/math/prim/prob/scaled_inv_chi_square_rng.hpp +++ b/stan/math/prim/prob/scaled_inv_chi_square_rng.hpp @@ -36,7 +36,7 @@ inline typename VectorBuilder::type scaled_inv_chi_square_rng(const T_deg& nu, const T_scale& s, RNG& rng) { using boost::variate_generator; using boost::random::chi_squared_distribution; - static const char* function = "scaled_inv_chi_square_rng"; + static constexpr const char* function = "scaled_inv_chi_square_rng"; check_consistent_sizes(function, "Location parameter", nu, "Scale Parameter", s); const auto& nu_ref = to_ref(nu); diff --git a/stan/math/prim/prob/skew_double_exponential_cdf.hpp b/stan/math/prim/prob/skew_double_exponential_cdf.hpp index a8942d7049a..f45f499414a 100644 --- a/stan/math/prim/prob/skew_double_exponential_cdf.hpp +++ b/stan/math/prim/prob/skew_double_exponential_cdf.hpp @@ -42,7 +42,7 @@ return_type_t skew_double_exponential_cdf( const T_y& y, const T_loc& mu, const T_scale& sigma, const T_skewness& tau) { using T_partials_return = partials_return_t; - static const char* function = "skew_double_exponential_lcdf"; + static constexpr const char* function = "skew_double_exponential_lcdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Shape parameter", sigma, "Skewness parameter", tau); diff --git a/stan/math/prim/prob/skew_double_exponential_lccdf.hpp b/stan/math/prim/prob/skew_double_exponential_lccdf.hpp index fdff7dd6796..69a51ed2121 100644 --- a/stan/math/prim/prob/skew_double_exponential_lccdf.hpp +++ b/stan/math/prim/prob/skew_double_exponential_lccdf.hpp @@ -40,7 +40,7 @@ template skew_double_exponential_lccdf( const T_y& y, const T_loc& mu, const T_scale& sigma, const T_skewness& tau) { - static const char* function = "skew_double_exponential_lccdf"; + static constexpr const char* function = "skew_double_exponential_lccdf"; using T_partials_return = partials_return_t; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Shape parameter", sigma, "Skewness parameter", diff --git a/stan/math/prim/prob/skew_double_exponential_lcdf.hpp b/stan/math/prim/prob/skew_double_exponential_lcdf.hpp index b1f8a6bd726..82fdc373abe 100644 --- a/stan/math/prim/prob/skew_double_exponential_lcdf.hpp +++ b/stan/math/prim/prob/skew_double_exponential_lcdf.hpp @@ -44,7 +44,7 @@ return_type_t skew_double_exponential_lcdf( using std::exp; using std::log; using T_partials_return = partials_return_t; - static const char* function = "skew_double_exponential_lcdf"; + static constexpr const char* function = "skew_double_exponential_lcdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Shape parameter", sigma, "Skewness parameter", tau); diff --git a/stan/math/prim/prob/skew_double_exponential_lpdf.hpp b/stan/math/prim/prob/skew_double_exponential_lpdf.hpp index 53bc9c5b718..fe73b1b972a 100644 --- a/stan/math/prim/prob/skew_double_exponential_lpdf.hpp +++ b/stan/math/prim/prob/skew_double_exponential_lpdf.hpp @@ -48,7 +48,7 @@ return_type_t skew_double_exponential_lpdf( using T_mu_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; using T_tau_ref = ref_type_if_not_constant_t; - static const char* function = "skew_double_exponential_lpdf"; + static constexpr const char* function = "skew_double_exponential_lpdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Shape parameter", sigma, "Skewness parameter", tau); diff --git a/stan/math/prim/prob/skew_double_exponential_rng.hpp b/stan/math/prim/prob/skew_double_exponential_rng.hpp index 0b3f2fd1e5d..7b238d71189 100644 --- a/stan/math/prim/prob/skew_double_exponential_rng.hpp +++ b/stan/math/prim/prob/skew_double_exponential_rng.hpp @@ -42,7 +42,7 @@ skew_double_exponential_rng(const T_loc& mu, const T_scale& sigma, using T_mu_ref = ref_type_t; using T_sigma_ref = ref_type_t; using T_tau_ref = ref_type_t; - static const char* function = "skew_double_exponential_rng"; + static constexpr const char* function = "skew_double_exponential_rng"; check_consistent_sizes(function, "Location parameter", mu, "Scale Parameter", sigma, "Skewness Parameter", tau); T_mu_ref mu_ref = mu; diff --git a/stan/math/prim/prob/skew_normal_cdf.hpp b/stan/math/prim/prob/skew_normal_cdf.hpp index ee6745cf409..c78f50ab1be 100644 --- a/stan/math/prim/prob/skew_normal_cdf.hpp +++ b/stan/math/prim/prob/skew_normal_cdf.hpp @@ -32,7 +32,7 @@ return_type_t skew_normal_cdf( using T_mu_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; - static const char* function = "skew_normal_cdf"; + static constexpr const char* function = "skew_normal_cdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", sigma, "Shape paramter", alpha); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/skew_normal_lccdf.hpp b/stan/math/prim/prob/skew_normal_lccdf.hpp index 500e962a95e..0536fa7d317 100644 --- a/stan/math/prim/prob/skew_normal_lccdf.hpp +++ b/stan/math/prim/prob/skew_normal_lccdf.hpp @@ -30,7 +30,7 @@ return_type_t skew_normal_lccdf( using T_mu_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; - static const char* function = "skew_normal_lccdf"; + static constexpr const char* function = "skew_normal_lccdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", sigma, "Shape paramter", alpha); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/skew_normal_lcdf.hpp b/stan/math/prim/prob/skew_normal_lcdf.hpp index 64d2077d7ef..e5ad7c4d49e 100644 --- a/stan/math/prim/prob/skew_normal_lcdf.hpp +++ b/stan/math/prim/prob/skew_normal_lcdf.hpp @@ -32,7 +32,7 @@ return_type_t skew_normal_lcdf( using T_mu_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; - static const char* function = "skew_normal_lcdf"; + static constexpr const char* function = "skew_normal_lcdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", sigma, "Shape parameter", alpha); diff --git a/stan/math/prim/prob/skew_normal_lpdf.hpp b/stan/math/prim/prob/skew_normal_lpdf.hpp index a1a9fb41991..78dabb09cf5 100644 --- a/stan/math/prim/prob/skew_normal_lpdf.hpp +++ b/stan/math/prim/prob/skew_normal_lpdf.hpp @@ -33,7 +33,7 @@ return_type_t skew_normal_lpdf( using T_mu_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; - static const char* function = "skew_normal_lpdf"; + static constexpr const char* function = "skew_normal_lpdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", mu, "Scale parameter", sigma, "Shape paramter", alpha); T_y_ref y_ref = y; diff --git a/stan/math/prim/prob/skew_normal_rng.hpp b/stan/math/prim/prob/skew_normal_rng.hpp index 6758a6bcd69..d4cc8590de7 100644 --- a/stan/math/prim/prob/skew_normal_rng.hpp +++ b/stan/math/prim/prob/skew_normal_rng.hpp @@ -41,7 +41,7 @@ skew_normal_rng(const T_loc& mu, const T_scale& sigma, const T_shape& alpha, RNG& rng) { using boost::variate_generator; using boost::random::normal_distribution; - static const char* function = "skew_normal_rng"; + static constexpr const char* function = "skew_normal_rng"; check_consistent_sizes(function, "Location parameter", mu, "Scale Parameter", sigma, "Shape Parameter", alpha); const auto& mu_ref = to_ref(mu); diff --git a/stan/math/prim/prob/std_normal_cdf.hpp b/stan/math/prim/prob/std_normal_cdf.hpp index 70abaf33acc..123fc7cc302 100644 --- a/stan/math/prim/prob/std_normal_cdf.hpp +++ b/stan/math/prim/prob/std_normal_cdf.hpp @@ -34,7 +34,7 @@ inline return_type_t std_normal_cdf(const T_y& y) { using T_partials_return = partials_return_t; using std::exp; using T_y_ref = ref_type_t; - static const char* function = "std_normal_cdf"; + static constexpr const char* function = "std_normal_cdf"; T_y_ref y_ref = y; check_not_nan(function, "Random variable", y_ref); diff --git a/stan/math/prim/prob/std_normal_lccdf.hpp b/stan/math/prim/prob/std_normal_lccdf.hpp index ee6637ca555..83cc3a6d33f 100644 --- a/stan/math/prim/prob/std_normal_lccdf.hpp +++ b/stan/math/prim/prob/std_normal_lccdf.hpp @@ -26,7 +26,7 @@ inline return_type_t std_normal_lccdf(const T_y& y) { using std::exp; using std::log; using T_y_ref = ref_type_t; - static const char* function = "std_normal_lccdf"; + static constexpr const char* function = "std_normal_lccdf"; T_y_ref y_ref = y; check_not_nan(function, "Random variable", y_ref); diff --git a/stan/math/prim/prob/std_normal_lcdf.hpp b/stan/math/prim/prob/std_normal_lcdf.hpp index 7b1d269d2e4..be712ddf375 100644 --- a/stan/math/prim/prob/std_normal_lcdf.hpp +++ b/stan/math/prim/prob/std_normal_lcdf.hpp @@ -31,7 +31,7 @@ inline return_type_t std_normal_lcdf(const T_y& y) { using std::log; using std::pow; using T_y_ref = ref_type_t; - static const char* function = "std_normal_lcdf"; + static constexpr const char* function = "std_normal_lcdf"; T_y_ref y_ref = y; check_not_nan(function, "Random variable", y_ref); diff --git a/stan/math/prim/prob/std_normal_log_qf.hpp b/stan/math/prim/prob/std_normal_log_qf.hpp index e229099b71c..b69ab23026c 100644 --- a/stan/math/prim/prob/std_normal_log_qf.hpp +++ b/stan/math/prim/prob/std_normal_log_qf.hpp @@ -34,42 +34,42 @@ inline double std_normal_log_qf(double log_p) { return INFTY; } - static const double log_a[8] + static constexpr double log_a[8] = {1.2199838032983212, 4.8914137334471356, 7.5865960847956080, 9.5274618535358388, 10.734698580862359, 11.116406781896242, 10.417226196842595, 7.8276718012189362}; - static const double log_b[8] = {0., - 3.7451021830139207, - 6.5326064640478618, - 8.5930788436817044, - 9.9624069236663077, - 10.579180688621286, - 10.265665328832871, - 8.5614962136628454}; - static const double log_c[8] + static constexpr double log_b[8] = {0., + 3.7451021830139207, + 6.5326064640478618, + 8.5930788436817044, + 9.9624069236663077, + 10.579180688621286, + 10.265665328832871, + 8.5614962136628454}; + static constexpr double log_c[8] = {0.3530744474482423, 1.5326298343683388, 1.7525849400614634, 1.2941374937060454, 0.2393776640901312, -1.419724057885092, -3.784340465764968, -7.163234779359426}; - static const double log_d[8] = {0., - 0.7193954734947205, - 0.5166395879845317, - -0.371400933927844, - -1.909840708457214, - -4.186547581055928, - -7.509976771225415, - -20.67376157385924}; - static const double log_e[8] + static constexpr double log_d[8] = {0., + 0.7193954734947205, + 0.5166395879845317, + -0.371400933927844, + -1.909840708457214, + -4.186547581055928, + -7.509976771225415, + -20.67376157385924}; + static constexpr double log_e[8] = {1.8958048169567149, 1.6981417567726154, 0.5793212339927351, -1.215503791936417, -3.629396584023968, -6.690500273261249, -10.51540298415323, -15.41979457491781}; - static const double log_f[8] = {0., - -0.511105318617135, - -1.988286302259815, - -4.208049039384857, - -7.147448611626374, - -10.89973190740069, - -15.76637472711685, - -33.82373901099482}; + static constexpr double log_f[8] = {0., + -0.511105318617135, + -1.988286302259815, + -4.208049039384857, + -7.147448611626374, + -10.89973190740069, + -15.76637472711685, + -33.82373901099482}; double val; double log_q = log_p <= LOG_HALF ? log_diff_exp(LOG_HALF, log_p) diff --git a/stan/math/prim/prob/std_normal_lpdf.hpp b/stan/math/prim/prob/std_normal_lpdf.hpp index a47bd94ea4a..de1e4c15698 100644 --- a/stan/math/prim/prob/std_normal_lpdf.hpp +++ b/stan/math/prim/prob/std_normal_lpdf.hpp @@ -32,7 +32,7 @@ template < return_type_t std_normal_lpdf(const T_y& y) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_t; - static const char* function = "std_normal_lpdf"; + static constexpr const char* function = "std_normal_lpdf"; T_y_ref y_ref = y; check_not_nan(function, "Random variable", y_ref); diff --git a/stan/math/prim/prob/student_t_cdf.hpp b/stan/math/prim/prob/student_t_cdf.hpp index eb47ed17bc8..b784a1a994e 100644 --- a/stan/math/prim/prob/student_t_cdf.hpp +++ b/stan/math/prim/prob/student_t_cdf.hpp @@ -31,7 +31,7 @@ return_type_t student_t_cdf(const T_y& y, using T_sigma_ref = ref_type_t; using std::exp; using std::pow; - static const char* function = "student_t_cdf"; + static constexpr const char* function = "student_t_cdf"; T_y_ref y_ref = y; T_nu_ref nu_ref = nu; T_mu_ref mu_ref = mu; diff --git a/stan/math/prim/prob/student_t_lccdf.hpp b/stan/math/prim/prob/student_t_lccdf.hpp index 9aabaa435c1..2e7c5f45af0 100644 --- a/stan/math/prim/prob/student_t_lccdf.hpp +++ b/stan/math/prim/prob/student_t_lccdf.hpp @@ -31,7 +31,7 @@ return_type_t student_t_lccdf( using std::exp; using std::log; using std::pow; - static const char* function = "student_t_lccdf"; + static constexpr const char* function = "student_t_lccdf"; T_y_ref y_ref = y; T_nu_ref nu_ref = nu; T_mu_ref mu_ref = mu; diff --git a/stan/math/prim/prob/student_t_lcdf.hpp b/stan/math/prim/prob/student_t_lcdf.hpp index 2595ba3becd..df505758bb8 100644 --- a/stan/math/prim/prob/student_t_lcdf.hpp +++ b/stan/math/prim/prob/student_t_lcdf.hpp @@ -33,7 +33,7 @@ return_type_t student_t_lcdf(const T_y& y, using std::exp; using std::log; using std::pow; - static const char* function = "student_t_lcdf"; + static constexpr const char* function = "student_t_lcdf"; T_y_ref y_ref = y; T_nu_ref nu_ref = nu; T_mu_ref mu_ref = mu; diff --git a/stan/math/prim/prob/student_t_lpdf.hpp b/stan/math/prim/prob/student_t_lpdf.hpp index cc593ae2985..20aeedad9d6 100644 --- a/stan/math/prim/prob/student_t_lpdf.hpp +++ b/stan/math/prim/prob/student_t_lpdf.hpp @@ -65,7 +65,7 @@ return_type_t student_t_lpdf(const T_y& y, using T_nu_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; - static const char* function = "student_t_lpdf"; + static constexpr const char* function = "student_t_lpdf"; check_consistent_sizes(function, "Random variable", y, "Degrees of freedom parameter", nu, "Location parameter", mu, "Scale parameter", sigma); diff --git a/stan/math/prim/prob/student_t_rng.hpp b/stan/math/prim/prob/student_t_rng.hpp index c47c8d2672e..ce7d271ef30 100644 --- a/stan/math/prim/prob/student_t_rng.hpp +++ b/stan/math/prim/prob/student_t_rng.hpp @@ -42,7 +42,7 @@ student_t_rng(const T_deg& nu, const T_loc& mu, const T_scale& sigma, using T_sigma_ref = ref_type_t; using boost::variate_generator; using boost::random::student_t_distribution; - static const char* function = "student_t_rng"; + static constexpr const char* function = "student_t_rng"; check_consistent_sizes(function, "Degrees of freedom parameter", nu, "Location parameter", mu, "Scale Parameter", sigma); T_nu_ref nu_ref = nu; diff --git a/stan/math/prim/prob/uniform_cdf.hpp b/stan/math/prim/prob/uniform_cdf.hpp index 1be99363bf7..120dacb08aa 100644 --- a/stan/math/prim/prob/uniform_cdf.hpp +++ b/stan/math/prim/prob/uniform_cdf.hpp @@ -26,7 +26,7 @@ return_type_t uniform_cdf(const T_y& y, const T_low& alpha, using T_y_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; using T_beta_ref = ref_type_if_not_constant_t; - static const char* function = "uniform_cdf"; + static constexpr const char* function = "uniform_cdf"; check_consistent_sizes(function, "Random variable", y, "Lower bound parameter", alpha, "Upper bound parameter", beta); diff --git a/stan/math/prim/prob/uniform_lccdf.hpp b/stan/math/prim/prob/uniform_lccdf.hpp index 37f5a5b45f9..9480fc4b2f6 100644 --- a/stan/math/prim/prob/uniform_lccdf.hpp +++ b/stan/math/prim/prob/uniform_lccdf.hpp @@ -29,7 +29,7 @@ return_type_t uniform_lccdf(const T_y& y, using T_y_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; using T_beta_ref = ref_type_if_not_constant_t; - static const char* function = "uniform_lccdf"; + static constexpr const char* function = "uniform_lccdf"; check_consistent_sizes(function, "Random variable", y, "Lower bound parameter", alpha, "Upper bound parameter", beta); diff --git a/stan/math/prim/prob/uniform_lcdf.hpp b/stan/math/prim/prob/uniform_lcdf.hpp index c35b4e9a20b..3026b66e331 100644 --- a/stan/math/prim/prob/uniform_lcdf.hpp +++ b/stan/math/prim/prob/uniform_lcdf.hpp @@ -28,7 +28,7 @@ return_type_t uniform_lcdf(const T_y& y, const T_low& alpha, using T_y_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; using T_beta_ref = ref_type_if_not_constant_t; - static const char* function = "uniform_lcdf"; + static constexpr const char* function = "uniform_lcdf"; check_consistent_sizes(function, "Random variable", y, "Lower bound parameter", alpha, "Upper bound parameter", beta); diff --git a/stan/math/prim/prob/uniform_lpdf.hpp b/stan/math/prim/prob/uniform_lpdf.hpp index 252a1584308..0ea4a1fee6e 100644 --- a/stan/math/prim/prob/uniform_lpdf.hpp +++ b/stan/math/prim/prob/uniform_lpdf.hpp @@ -50,7 +50,7 @@ return_type_t uniform_lpdf(const T_y& y, const T_low& alpha, using T_y_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; using T_beta_ref = ref_type_if_not_constant_t; - static const char* function = "uniform_lpdf"; + static constexpr const char* function = "uniform_lpdf"; check_consistent_sizes(function, "Random variable", y, "Lower bound parameter", alpha, "Upper bound parameter", beta); diff --git a/stan/math/prim/prob/uniform_rng.hpp b/stan/math/prim/prob/uniform_rng.hpp index b2591c1245b..ad18cf1add3 100644 --- a/stan/math/prim/prob/uniform_rng.hpp +++ b/stan/math/prim/prob/uniform_rng.hpp @@ -38,7 +38,7 @@ inline typename VectorBuilder::type uniform_rng( using T_beta_ref = ref_type_t; using boost::variate_generator; using boost::random::uniform_real_distribution; - static const char* function = "uniform_rng"; + static constexpr const char* function = "uniform_rng"; check_consistent_sizes(function, "Lower bound parameter", alpha, "Upper bound parameter", beta); T_alpha_ref alpha_ref = alpha; diff --git a/stan/math/prim/prob/von_mises_rng.hpp b/stan/math/prim/prob/von_mises_rng.hpp index da51770c18f..c68a6227f74 100644 --- a/stan/math/prim/prob/von_mises_rng.hpp +++ b/stan/math/prim/prob/von_mises_rng.hpp @@ -49,7 +49,7 @@ inline typename VectorBuilder::type von_mises_rng( using boost::random::uniform_real_distribution; using T_mu_ref = ref_type_t; using T_kappa_ref = ref_type_t; - static const char* function = "von_mises_rng"; + static constexpr const char* function = "von_mises_rng"; check_consistent_sizes(function, "Location parameter", mu, "Scale parameter", kappa); T_mu_ref mu_ref = mu; diff --git a/stan/math/prim/prob/weibull_cdf.hpp b/stan/math/prim/prob/weibull_cdf.hpp index abf6c71a33d..11bd26ec3b1 100644 --- a/stan/math/prim/prob/weibull_cdf.hpp +++ b/stan/math/prim/prob/weibull_cdf.hpp @@ -44,7 +44,7 @@ return_type_t weibull_cdf(const T_y& y, using T_alpha_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; using std::pow; - static const char* function = "weibull_cdf"; + static constexpr const char* function = "weibull_cdf"; T_y_ref y_ref = y; T_alpha_ref alpha_ref = alpha; diff --git a/stan/math/prim/prob/weibull_lccdf.hpp b/stan/math/prim/prob/weibull_lccdf.hpp index 031051f486a..0a3a0f916e9 100644 --- a/stan/math/prim/prob/weibull_lccdf.hpp +++ b/stan/math/prim/prob/weibull_lccdf.hpp @@ -42,7 +42,7 @@ return_type_t weibull_lccdf(const T_y& y, using T_alpha_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; using std::pow; - static const char* function = "weibull_lccdf"; + static constexpr const char* function = "weibull_lccdf"; T_y_ref y_ref = y; T_alpha_ref alpha_ref = alpha; diff --git a/stan/math/prim/prob/weibull_lcdf.hpp b/stan/math/prim/prob/weibull_lcdf.hpp index 34e2b65d1f3..98d927f602e 100644 --- a/stan/math/prim/prob/weibull_lcdf.hpp +++ b/stan/math/prim/prob/weibull_lcdf.hpp @@ -44,7 +44,7 @@ return_type_t weibull_lcdf(const T_y& y, using T_alpha_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; using std::pow; - static const char* function = "weibull_lcdf"; + static constexpr const char* function = "weibull_lcdf"; T_y_ref y_ref = y; T_alpha_ref alpha_ref = alpha; diff --git a/stan/math/prim/prob/weibull_lpdf.hpp b/stan/math/prim/prob/weibull_lpdf.hpp index 66df5a21303..c4800de78cc 100644 --- a/stan/math/prim/prob/weibull_lpdf.hpp +++ b/stan/math/prim/prob/weibull_lpdf.hpp @@ -45,7 +45,7 @@ return_type_t weibull_lpdf(const T_y& y, using T_alpha_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; using std::pow; - static const char* function = "weibull_lpdf"; + static constexpr const char* function = "weibull_lpdf"; check_consistent_sizes(function, "Random variable", y, "Shape parameter", alpha, "Scale parameter", sigma); diff --git a/stan/math/prim/prob/weibull_rng.hpp b/stan/math/prim/prob/weibull_rng.hpp index 3ae4dc64a6a..0626add9fd8 100644 --- a/stan/math/prim/prob/weibull_rng.hpp +++ b/stan/math/prim/prob/weibull_rng.hpp @@ -36,7 +36,7 @@ inline typename VectorBuilder::type weibull_rng( using boost::random::weibull_distribution; using T_alpha_ref = ref_type_t; using T_sigma_ref = ref_type_t; - static const char* function = "weibull_rng"; + static constexpr const char* function = "weibull_rng"; check_consistent_sizes(function, "Shape parameter", alpha, "Scale Parameter", sigma); T_alpha_ref alpha_ref = alpha; diff --git a/stan/math/prim/prob/wiener_lpdf.hpp b/stan/math/prim/prob/wiener_lpdf.hpp index e274254637b..a61d0959deb 100644 --- a/stan/math/prim/prob/wiener_lpdf.hpp +++ b/stan/math/prim/prob/wiener_lpdf.hpp @@ -89,7 +89,7 @@ return_type_t wiener_lpdf( using std::log; using std::sin; using std::sqrt; - static const char* function = "wiener_lpdf"; + static constexpr const char* function = "wiener_lpdf"; check_consistent_sizes(function, "Random variable", y, "Boundary separation", alpha, "A-priori bias", beta, "Nondecision time", tau, "Drift rate", delta); @@ -138,15 +138,16 @@ return_type_t wiener_lpdf( return 0; } - static const double WIENER_ERR = 0.000001; - static const double PI_TIMES_WIENER_ERR = pi() * WIENER_ERR; - static const double LOG_PI_LOG_WIENER_ERR = LOG_PI + log(WIENER_ERR); - static const double TWO_TIMES_SQRT_TWO_PI_TIMES_WIENER_ERR + static constexpr double WIENER_ERR = 0.000001; + static constexpr double PI_TIMES_WIENER_ERR = pi() * WIENER_ERR; + static constexpr double LOG_PI_LOG_WIENER_ERR = LOG_PI - 6 * LOG_TEN; + static constexpr double TWO_TIMES_SQRT_TWO_PI_TIMES_WIENER_ERR = 2.0 * SQRT_TWO_PI * WIENER_ERR; - static const double LOG_TWO_OVER_TWO_PLUS_LOG_SQRT_PI + static constexpr double LOG_TWO_OVER_TWO_PLUS_LOG_SQRT_PI = LOG_TWO / 2 + LOG_SQRT_PI; - static const double SQUARE_PI_OVER_TWO = square(pi()) * 0.5; - static const double TWO_TIMES_LOG_SQRT_PI = 2.0 * LOG_SQRT_PI; + // square(pi()) * 0.5 + static constexpr double SQUARE_PI_OVER_TWO = (pi() * pi()) / 2; + static constexpr double TWO_TIMES_LOG_SQRT_PI = 2.0 * LOG_SQRT_PI; for (size_t i = 0; i < N; i++) { typename scalar_type::type one_minus_beta = 1.0 - beta_vec[i]; diff --git a/stan/math/prim/prob/wishart_cholesky_lpdf.hpp b/stan/math/prim/prob/wishart_cholesky_lpdf.hpp index dc83974479b..82014461bd4 100644 --- a/stan/math/prim/prob/wishart_cholesky_lpdf.hpp +++ b/stan/math/prim/prob/wishart_cholesky_lpdf.hpp @@ -47,7 +47,7 @@ return_type_t wishart_cholesky_lpdf(const T_y& L_Y, using T_nu_ref = ref_type_t; using T_L_S_ref = ref_type_t; using T_return = return_type_t; - static const char* function = "wishart_cholesky_lpdf"; + static constexpr const char* function = "wishart_cholesky_lpdf"; Eigen::Index k = L_Y.rows(); check_greater(function, "Degrees of freedom parameter", nu, k - 1); diff --git a/stan/math/prim/prob/wishart_cholesky_rng.hpp b/stan/math/prim/prob/wishart_cholesky_rng.hpp index 0f910ee5adb..ab6cc671a1e 100644 --- a/stan/math/prim/prob/wishart_cholesky_rng.hpp +++ b/stan/math/prim/prob/wishart_cholesky_rng.hpp @@ -32,7 +32,7 @@ inline Eigen::MatrixXd wishart_cholesky_rng(double nu, const Eigen::MatrixXd& L_S, RNG& rng) { using Eigen::MatrixXd; - static const char* function = "wishart_cholesky_rng"; + static constexpr const char* function = "wishart_cholesky_rng"; index_type_t k = L_S.rows(); check_greater(function, "degrees of freedom > dims - 1", nu, k - 1); check_square(function, "Cholesky Scale matrix", L_S); diff --git a/stan/math/prim/prob/wishart_lpdf.hpp b/stan/math/prim/prob/wishart_lpdf.hpp index 2e89001ce8a..89c0c9e8bcd 100644 --- a/stan/math/prim/prob/wishart_lpdf.hpp +++ b/stan/math/prim/prob/wishart_lpdf.hpp @@ -54,7 +54,7 @@ return_type_t wishart_lpdf(const T_y& W, const T_dof& nu, using T_W_ref = ref_type_t; using T_nu_ref = ref_type_t; using T_S_ref = ref_type_t; - static const char* function = "wishart_lpdf"; + static constexpr const char* function = "wishart_lpdf"; Eigen::Index k = W.rows(); check_size_match(function, "Rows of random variable", W.rows(), "columns of scale parameter", S.rows()); diff --git a/stan/math/prim/prob/wishart_rng.hpp b/stan/math/prim/prob/wishart_rng.hpp index 509b3f8ddde..b039a6ed633 100644 --- a/stan/math/prim/prob/wishart_rng.hpp +++ b/stan/math/prim/prob/wishart_rng.hpp @@ -15,7 +15,7 @@ template inline Eigen::MatrixXd wishart_rng(double nu, const Eigen::MatrixXd& S, RNG& rng) { using Eigen::MatrixXd; - static const char* function = "wishart_rng"; + static constexpr const char* function = "wishart_rng"; index_type_t k = S.rows(); check_square(function, "scale parameter", S); check_symmetric(function, "scale parameter", S); diff --git a/stan/math/rev/fun/accumulator.hpp b/stan/math/rev/fun/accumulator.hpp index 0819afa35a3..9fc264c4db5 100644 --- a/stan/math/rev/fun/accumulator.hpp +++ b/stan/math/rev/fun/accumulator.hpp @@ -24,7 +24,7 @@ namespace math { template class accumulator> { private: - static const int max_size_ = 128; + static constexpr int max_size_ = 128; std::vector> buf_; /** diff --git a/stan/math/rev/fun/mdivide_left_spd.hpp b/stan/math/rev/fun/mdivide_left_spd.hpp index 754415ec337..58a4486235c 100644 --- a/stan/math/rev/fun/mdivide_left_spd.hpp +++ b/stan/math/rev/fun/mdivide_left_spd.hpp @@ -154,7 +154,7 @@ mdivide_left_spd(const EigMat1 &A, const EigMat2 &b) { constexpr int C1 = EigMat1::ColsAtCompileTime; constexpr int R2 = EigMat2::RowsAtCompileTime; constexpr int C2 = EigMat2::ColsAtCompileTime; - static const char *function = "mdivide_left_spd"; + static constexpr const char *function = "mdivide_left_spd"; check_multiplicable(function, "A", A, "b", b); const auto &A_ref = to_ref(A); check_symmetric(function, "A", A_ref); @@ -185,7 +185,7 @@ mdivide_left_spd(const EigMat1 &A, const EigMat2 &b) { constexpr int C1 = EigMat1::ColsAtCompileTime; constexpr int R2 = EigMat2::RowsAtCompileTime; constexpr int C2 = EigMat2::ColsAtCompileTime; - static const char *function = "mdivide_left_spd"; + static constexpr const char *function = "mdivide_left_spd"; check_multiplicable(function, "A", A, "b", b); const auto &A_ref = to_ref(A); check_symmetric(function, "A", A_ref); @@ -216,7 +216,7 @@ mdivide_left_spd(const EigMat1 &A, const EigMat2 &b) { constexpr int C1 = EigMat1::ColsAtCompileTime; constexpr int R2 = EigMat2::RowsAtCompileTime; constexpr int C2 = EigMat2::ColsAtCompileTime; - static const char *function = "mdivide_left_spd"; + static constexpr const char *function = "mdivide_left_spd"; check_multiplicable(function, "A", A, "b", b); const auto &A_ref = to_ref(A); check_symmetric(function, "A", A_ref);