From c5c4eb1d0d8fa05b48587387d625839ec8fa59c1 Mon Sep 17 00:00:00 2001 From: Steve Bronder Date: Fri, 3 Oct 2025 16:46:03 -0400 Subject: [PATCH 1/5] add inline to all functions so that the definition of functions is used only in on translation unit --- stan/math/fwd/fun/hypergeometric_1F0.hpp | 2 +- stan/math/fwd/fun/polar.hpp | 2 +- stan/math/fwd/functor/gradient.hpp | 2 +- stan/math/fwd/functor/hessian.hpp | 2 +- stan/math/fwd/functor/jacobian.hpp | 2 +- stan/math/memory/stack_alloc.hpp | 2 +- .../math/mix/functor/hessian_times_vector.hpp | 2 +- stan/math/mix/functor/partial_derivative.hpp | 2 +- stan/math/opencl/copy.hpp | 2 +- stan/math/opencl/indexing_rev.hpp | 2 +- .../opencl/kernel_generator/evaluate_into.hpp | 2 +- .../opencl/kernel_generator/holder_cl.hpp | 8 +- .../kernel_generator/multi_result_kernel.hpp | 2 +- stan/math/opencl/prim/bernoulli_cdf.hpp | 2 +- stan/math/opencl/prim/bernoulli_lccdf.hpp | 2 +- stan/math/opencl/prim/bernoulli_lcdf.hpp | 2 +- .../opencl/prim/bernoulli_logit_glm_lpmf.hpp | 2 +- .../math/opencl/prim/bernoulli_logit_lpmf.hpp | 2 +- stan/math/opencl/prim/bernoulli_lpmf.hpp | 2 +- stan/math/opencl/prim/beta_binomial_lpmf.hpp | 2 +- stan/math/opencl/prim/beta_lpdf.hpp | 2 +- .../math/opencl/prim/beta_proportion_lpdf.hpp | 2 +- .../opencl/prim/binomial_logit_glm_lpmf.hpp | 2 +- stan/math/opencl/prim/binomial_logit_lpmf.hpp | 2 +- stan/math/opencl/prim/binomial_lpmf.hpp | 2 +- .../prim/categorical_logit_glm_lpmf.hpp | 2 +- stan/math/opencl/prim/cauchy_cdf.hpp | 2 +- stan/math/opencl/prim/cauchy_lccdf.hpp | 2 +- stan/math/opencl/prim/cauchy_lcdf.hpp | 2 +- stan/math/opencl/prim/cauchy_lpdf.hpp | 2 +- stan/math/opencl/prim/chi_square_lpdf.hpp | 2 +- .../opencl/prim/double_exponential_cdf.hpp | 2 +- .../opencl/prim/double_exponential_lccdf.hpp | 2 +- .../opencl/prim/double_exponential_lcdf.hpp | 2 +- .../opencl/prim/double_exponential_lpdf.hpp | 2 +- stan/math/opencl/prim/exp_mod_normal_cdf.hpp | 2 +- .../math/opencl/prim/exp_mod_normal_lccdf.hpp | 2 +- stan/math/opencl/prim/exp_mod_normal_lcdf.hpp | 2 +- stan/math/opencl/prim/exp_mod_normal_lpdf.hpp | 2 +- stan/math/opencl/prim/exponential_cdf.hpp | 2 +- stan/math/opencl/prim/exponential_lccdf.hpp | 2 +- stan/math/opencl/prim/exponential_lcdf.hpp | 2 +- stan/math/opencl/prim/exponential_lpdf.hpp | 2 +- stan/math/opencl/prim/frechet_cdf.hpp | 2 +- stan/math/opencl/prim/frechet_lccdf.hpp | 2 +- stan/math/opencl/prim/frechet_lcdf.hpp | 2 +- stan/math/opencl/prim/frechet_lpdf.hpp | 2 +- stan/math/opencl/prim/gamma_lpdf.hpp | 2 +- stan/math/opencl/prim/gumbel_cdf.hpp | 2 +- stan/math/opencl/prim/gumbel_lccdf.hpp | 2 +- stan/math/opencl/prim/gumbel_lcdf.hpp | 2 +- stan/math/opencl/prim/gumbel_lpdf.hpp | 2 +- stan/math/opencl/prim/inv_chi_square_lpdf.hpp | 2 +- stan/math/opencl/prim/inv_gamma_lpdf.hpp | 2 +- stan/math/opencl/prim/logistic_cdf.hpp | 2 +- stan/math/opencl/prim/logistic_lccdf.hpp | 2 +- stan/math/opencl/prim/logistic_lcdf.hpp | 2 +- stan/math/opencl/prim/logistic_lpdf.hpp | 2 +- stan/math/opencl/prim/lognormal_cdf.hpp | 2 +- stan/math/opencl/prim/lognormal_lccdf.hpp | 2 +- stan/math/opencl/prim/lognormal_lcdf.hpp | 2 +- stan/math/opencl/prim/lognormal_lpdf.hpp | 2 +- .../prim/neg_binomial_2_log_glm_lpmf.hpp | 2 +- stan/math/opencl/prim/normal_cdf.hpp | 2 +- stan/math/opencl/prim/normal_id_glm_lpdf.hpp | 2 +- stan/math/opencl/prim/normal_lccdf.hpp | 2 +- stan/math/opencl/prim/normal_lcdf.hpp | 2 +- .../opencl/prim/ordered_logistic_glm_lpmf.hpp | 2 +- stan/math/opencl/prim/pareto_cdf.hpp | 2 +- stan/math/opencl/prim/pareto_lccdf.hpp | 2 +- stan/math/opencl/prim/pareto_lcdf.hpp | 2 +- stan/math/opencl/prim/pareto_lpdf.hpp | 2 +- stan/math/opencl/prim/pareto_type_2_cdf.hpp | 2 +- stan/math/opencl/prim/pareto_type_2_lccdf.hpp | 2 +- stan/math/opencl/prim/pareto_type_2_lcdf.hpp | 2 +- stan/math/opencl/prim/pareto_type_2_lpdf.hpp | 2 +- .../math/opencl/prim/poisson_log_glm_lpmf.hpp | 2 +- stan/math/opencl/prim/poisson_log_lpmf.hpp | 2 +- stan/math/opencl/prim/poisson_lpmf.hpp | 2 +- stan/math/opencl/prim/prod.hpp | 2 +- stan/math/opencl/prim/rayleigh_cdf.hpp | 2 +- stan/math/opencl/prim/rayleigh_lccdf.hpp | 2 +- stan/math/opencl/prim/rayleigh_lcdf.hpp | 2 +- stan/math/opencl/prim/rayleigh_lpdf.hpp | 2 +- stan/math/opencl/prim/rep_array.hpp | 2 +- stan/math/opencl/prim/rep_row_vector.hpp | 2 +- stan/math/opencl/prim/rep_vector.hpp | 2 +- stan/math/opencl/prim/sign.hpp | 2 +- .../prim/skew_double_exponential_cdf.hpp | 2 +- .../prim/skew_double_exponential_lccdf.hpp | 2 +- .../prim/skew_double_exponential_lcdf.hpp | 2 +- .../prim/skew_double_exponential_lpdf.hpp | 2 +- stan/math/opencl/prim/std_normal_cdf.hpp | 2 +- stan/math/opencl/prim/std_normal_lccdf.hpp | 2 +- stan/math/opencl/prim/std_normal_lcdf.hpp | 2 +- stan/math/opencl/prim/sum.hpp | 2 +- stan/math/opencl/prim/trace.hpp | 2 +- stan/math/opencl/prim/uniform_cdf.hpp | 2 +- stan/math/opencl/prim/uniform_lccdf.hpp | 2 +- stan/math/opencl/prim/uniform_lcdf.hpp | 2 +- stan/math/opencl/prim/weibull_cdf.hpp | 2 +- stan/math/opencl/prim/weibull_lccdf.hpp | 2 +- stan/math/opencl/prim/weibull_lcdf.hpp | 2 +- stan/math/opencl/qr_decomposition.hpp | 2 +- stan/math/opencl/rev/adjoint_results.hpp | 2 +- stan/math/opencl/rev/arena_matrix_cl.hpp | 2 +- stan/math/opencl/rev/copy.hpp | 2 +- stan/math/opencl/rev/to_arena.hpp | 2 +- stan/math/opencl/symmetric_eigensolver.hpp | 2 +- .../prim/constraint/cholesky_factor_free.hpp | 2 +- .../math/prim/constraint/corr_matrix_free.hpp | 2 +- stan/math/prim/constraint/cov_matrix_free.hpp | 2 +- .../prim/constraint/cov_matrix_free_lkj.hpp | 4 +- stan/math/prim/constraint/ordered_free.hpp | 2 +- stan/math/prim/err/check_cholesky_factor.hpp | 2 +- .../prim/err/check_cholesky_factor_corr.hpp | 4 +- stan/math/prim/err/check_corr_matrix.hpp | 2 +- stan/math/prim/err/check_cov_matrix.hpp | 2 +- stan/math/prim/err/check_ordered.hpp | 6 +- stan/math/prim/err/check_positive_ordered.hpp | 4 +- stan/math/prim/err/check_simplex.hpp | 4 +- stan/math/prim/err/check_sorted.hpp | 4 +- .../math/prim/err/check_stochastic_column.hpp | 4 +- stan/math/prim/err/check_stochastic_row.hpp | 4 +- stan/math/prim/err/check_sum_to_zero.hpp | 4 +- stan/math/prim/err/check_unit_vector.hpp | 4 +- stan/math/prim/err/elementwise_check.hpp | 2 +- stan/math/prim/fun/autocorrelation.hpp | 8 +- stan/math/prim/fun/autocovariance.hpp | 8 +- stan/math/prim/fun/chol2inv.hpp | 2 +- stan/math/prim/fun/diag_post_multiply.hpp | 2 +- stan/math/prim/fun/diag_pre_multiply.hpp | 2 +- stan/math/prim/fun/eigenvalues_sym.hpp | 2 +- stan/math/prim/fun/eigenvectors_sym.hpp | 2 +- stan/math/prim/fun/elt_divide.hpp | 8 +- stan/math/prim/fun/elt_multiply.hpp | 4 +- stan/math/prim/fun/factor_U.hpp | 2 +- stan/math/prim/fun/factor_cov_matrix.hpp | 2 +- stan/math/prim/fun/gp_dot_prod_cov.hpp | 8 +- stan/math/prim/fun/grad_2F1.hpp | 10 +- stan/math/prim/fun/grad_F32.hpp | 2 +- stan/math/prim/fun/grad_reg_inc_beta.hpp | 2 +- stan/math/prim/fun/grad_reg_inc_gamma.hpp | 2 +- .../prim/fun/grad_reg_lower_inc_gamma.hpp | 2 +- stan/math/prim/fun/hypergeometric_1F0.hpp | 2 +- stan/math/prim/fun/hypergeometric_2F2.hpp | 2 +- stan/math/prim/fun/hypergeometric_pFq.hpp | 2 +- stan/math/prim/fun/imag.hpp | 2 +- stan/math/prim/fun/inc_beta_dda.hpp | 2 +- stan/math/prim/fun/inc_beta_ddb.hpp | 4 +- stan/math/prim/fun/inc_beta_ddz.hpp | 2 +- stan/math/prim/fun/inverse_softmax.hpp | 2 +- stan/math/prim/fun/lbeta.hpp | 2 +- stan/math/prim/fun/lgamma_stirling.hpp | 2 +- stan/math/prim/fun/lgamma_stirling_diff.hpp | 2 +- stan/math/prim/fun/log_mix.hpp | 4 +- stan/math/prim/fun/logb.hpp | 2 +- stan/math/prim/fun/make_nu.hpp | 2 +- stan/math/prim/fun/matrix_exp_2x2.hpp | 2 +- stan/math/prim/fun/matrix_exp_pade.hpp | 2 +- stan/math/prim/fun/max.hpp | 2 +- stan/math/prim/fun/min.hpp | 2 +- .../prim/fun/poisson_binomial_log_probs.hpp | 4 +- stan/math/prim/fun/prod.hpp | 2 +- stan/math/prim/fun/pseudo_eigenvalues.hpp | 2 +- stan/math/prim/fun/pseudo_eigenvectors.hpp | 2 +- stan/math/prim/fun/qr.hpp | 2 +- stan/math/prim/fun/qr_Q.hpp | 2 +- stan/math/prim/fun/qr_R.hpp | 2 +- stan/math/prim/fun/qr_thin.hpp | 2 +- stan/math/prim/fun/qr_thin_Q.hpp | 2 +- stan/math/prim/fun/qr_thin_R.hpp | 2 +- stan/math/prim/fun/read_corr_L.hpp | 4 +- stan/math/prim/fun/read_corr_matrix.hpp | 4 +- stan/math/prim/fun/read_cov_L.hpp | 2 +- stan/math/prim/fun/read_cov_matrix.hpp | 4 +- stan/math/prim/fun/real.hpp | 2 +- stan/math/prim/fun/resize.hpp | 6 +- stan/math/prim/fun/scalbn.hpp | 2 +- stan/math/prim/fun/serializer.hpp | 12 +- stan/math/prim/fun/singular_values.hpp | 2 +- stan/math/prim/fun/stan_print.hpp | 12 +- stan/math/prim/fun/svd_U.hpp | 2 +- stan/math/prim/fun/svd_V.hpp | 2 +- stan/math/prim/fun/transpose.hpp | 2 +- .../prim/functor/finite_diff_gradient.hpp | 2 +- .../functor/finite_diff_gradient_auto.hpp | 2 +- stan/math/prim/functor/map_rect.hpp | 2 +- .../math/prim/functor/map_rect_concurrent.hpp | 2 +- stan/math/prim/functor/map_rect_mpi.hpp | 2 +- stan/math/prim/functor/ode_ckrk.hpp | 6 +- stan/math/prim/functor/ode_rk45.hpp | 6 +- .../prim/functor/ode_store_sensitivities.hpp | 2 +- stan/math/prim/functor/reduce_sum_static.hpp | 2 +- stan/math/prim/meta/static_select.hpp | 4 +- stan/math/prim/prob/bernoulli_ccdf_log.hpp | 2 +- stan/math/prim/prob/bernoulli_cdf.hpp | 2 +- stan/math/prim/prob/bernoulli_cdf_log.hpp | 2 +- stan/math/prim/prob/bernoulli_lccdf.hpp | 2 +- stan/math/prim/prob/bernoulli_lcdf.hpp | 2 +- .../prim/prob/bernoulli_logit_glm_lpmf.hpp | 2 +- stan/math/prim/prob/bernoulli_logit_lpmf.hpp | 2 +- stan/math/prim/prob/bernoulli_lpmf.hpp | 2 +- .../math/prim/prob/beta_binomial_ccdf_log.hpp | 2 +- stan/math/prim/prob/beta_binomial_cdf.hpp | 2 +- stan/math/prim/prob/beta_binomial_cdf_log.hpp | 2 +- stan/math/prim/prob/beta_binomial_lccdf.hpp | 2 +- stan/math/prim/prob/beta_binomial_lcdf.hpp | 2 +- stan/math/prim/prob/beta_binomial_lpmf.hpp | 4 +- stan/math/prim/prob/beta_ccdf_log.hpp | 2 +- stan/math/prim/prob/beta_cdf.hpp | 2 +- stan/math/prim/prob/beta_cdf_log.hpp | 2 +- stan/math/prim/prob/beta_lccdf.hpp | 2 +- stan/math/prim/prob/beta_lcdf.hpp | 2 +- stan/math/prim/prob/beta_lpdf.hpp | 2 +- .../prim/prob/beta_proportion_ccdf_log.hpp | 2 +- .../prim/prob/beta_proportion_cdf_log.hpp | 2 +- stan/math/prim/prob/beta_proportion_lccdf.hpp | 2 +- stan/math/prim/prob/beta_proportion_lcdf.hpp | 2 +- stan/math/prim/prob/beta_proportion_lpdf.hpp | 2 +- stan/math/prim/prob/binomial_ccdf_log.hpp | 2 +- stan/math/prim/prob/binomial_cdf.hpp | 2 +- stan/math/prim/prob/binomial_cdf_log.hpp | 2 +- stan/math/prim/prob/binomial_lccdf.hpp | 2 +- stan/math/prim/prob/binomial_lcdf.hpp | 2 +- .../prim/prob/binomial_logit_glm_lpmf.hpp | 2 +- stan/math/prim/prob/binomial_logit_lpmf.hpp | 2 +- stan/math/prim/prob/binomial_lpmf.hpp | 2 +- .../prim/prob/categorical_logit_glm_lpmf.hpp | 4 +- .../math/prim/prob/categorical_logit_lpmf.hpp | 4 +- stan/math/prim/prob/categorical_lpmf.hpp | 4 +- stan/math/prim/prob/cauchy_ccdf_log.hpp | 2 +- stan/math/prim/prob/cauchy_cdf.hpp | 2 +- stan/math/prim/prob/cauchy_cdf_log.hpp | 2 +- stan/math/prim/prob/cauchy_lccdf.hpp | 2 +- stan/math/prim/prob/cauchy_lcdf.hpp | 2 +- stan/math/prim/prob/cauchy_lpdf.hpp | 2 +- stan/math/prim/prob/chi_square_ccdf_log.hpp | 2 +- stan/math/prim/prob/chi_square_cdf.hpp | 2 +- stan/math/prim/prob/chi_square_cdf_log.hpp | 2 +- stan/math/prim/prob/chi_square_lccdf.hpp | 2 +- stan/math/prim/prob/chi_square_lcdf.hpp | 2 +- stan/math/prim/prob/chi_square_lpdf.hpp | 2 +- stan/math/prim/prob/dirichlet_lpdf.hpp | 4 +- .../prim/prob/dirichlet_multinomial_lpmf.hpp | 4 +- .../prim/prob/discrete_range_ccdf_log.hpp | 2 +- stan/math/prim/prob/discrete_range_cdf.hpp | 2 +- .../math/prim/prob/discrete_range_cdf_log.hpp | 2 +- stan/math/prim/prob/discrete_range_lccdf.hpp | 2 +- stan/math/prim/prob/discrete_range_lcdf.hpp | 2 +- stan/math/prim/prob/discrete_range_lpmf.hpp | 2 +- .../prim/prob/double_exponential_ccdf_log.hpp | 2 +- .../math/prim/prob/double_exponential_cdf.hpp | 2 +- .../prim/prob/double_exponential_cdf_log.hpp | 2 +- .../prim/prob/double_exponential_lccdf.hpp | 2 +- .../prim/prob/double_exponential_lcdf.hpp | 2 +- .../prim/prob/double_exponential_lpdf.hpp | 4 +- .../prim/prob/exp_mod_normal_ccdf_log.hpp | 2 +- stan/math/prim/prob/exp_mod_normal_cdf.hpp | 2 +- .../math/prim/prob/exp_mod_normal_cdf_log.hpp | 2 +- stan/math/prim/prob/exp_mod_normal_lccdf.hpp | 2 +- stan/math/prim/prob/exp_mod_normal_lcdf.hpp | 2 +- stan/math/prim/prob/exp_mod_normal_lpdf.hpp | 2 +- stan/math/prim/prob/exponential_ccdf_log.hpp | 2 +- stan/math/prim/prob/exponential_cdf.hpp | 2 +- stan/math/prim/prob/exponential_cdf_log.hpp | 2 +- stan/math/prim/prob/exponential_lccdf.hpp | 2 +- stan/math/prim/prob/exponential_lcdf.hpp | 2 +- stan/math/prim/prob/exponential_lpdf.hpp | 2 +- stan/math/prim/prob/frechet_ccdf_log.hpp | 2 +- stan/math/prim/prob/frechet_cdf.hpp | 2 +- stan/math/prim/prob/frechet_cdf_log.hpp | 2 +- stan/math/prim/prob/frechet_lccdf.hpp | 2 +- stan/math/prim/prob/frechet_lcdf.hpp | 2 +- stan/math/prim/prob/frechet_lpdf.hpp | 2 +- stan/math/prim/prob/gamma_ccdf_log.hpp | 2 +- stan/math/prim/prob/gamma_cdf.hpp | 2 +- stan/math/prim/prob/gamma_cdf_log.hpp | 2 +- stan/math/prim/prob/gamma_lccdf.hpp | 2 +- stan/math/prim/prob/gamma_lcdf.hpp | 2 +- stan/math/prim/prob/gamma_lpdf.hpp | 2 +- stan/math/prim/prob/gumbel_ccdf_log.hpp | 2 +- stan/math/prim/prob/gumbel_cdf.hpp | 2 +- stan/math/prim/prob/gumbel_cdf_log.hpp | 2 +- stan/math/prim/prob/gumbel_lccdf.hpp | 2 +- stan/math/prim/prob/gumbel_lcdf.hpp | 2 +- stan/math/prim/prob/gumbel_lpdf.hpp | 2 +- stan/math/prim/prob/hypergeometric_lpmf.hpp | 2 +- .../prim/prob/inv_chi_square_ccdf_log.hpp | 2 +- stan/math/prim/prob/inv_chi_square_cdf.hpp | 2 +- .../math/prim/prob/inv_chi_square_cdf_log.hpp | 2 +- stan/math/prim/prob/inv_chi_square_lccdf.hpp | 2 +- stan/math/prim/prob/inv_chi_square_lcdf.hpp | 2 +- stan/math/prim/prob/inv_chi_square_lpdf.hpp | 2 +- stan/math/prim/prob/inv_gamma_ccdf_log.hpp | 2 +- stan/math/prim/prob/inv_gamma_cdf.hpp | 2 +- stan/math/prim/prob/inv_gamma_cdf_log.hpp | 2 +- stan/math/prim/prob/inv_gamma_lccdf.hpp | 2 +- stan/math/prim/prob/inv_gamma_lcdf.hpp | 2 +- stan/math/prim/prob/inv_gamma_lpdf.hpp | 2 +- .../prim/prob/inv_wishart_cholesky_lpdf.hpp | 2 +- stan/math/prim/prob/inv_wishart_lpdf.hpp | 2 +- .../math/prim/prob/lkj_corr_cholesky_lpdf.hpp | 2 +- stan/math/prim/prob/lkj_corr_lpdf.hpp | 4 +- stan/math/prim/prob/lkj_cov_lpdf.hpp | 4 +- stan/math/prim/prob/logistic_ccdf_log.hpp | 2 +- stan/math/prim/prob/logistic_cdf.hpp | 2 +- stan/math/prim/prob/logistic_cdf_log.hpp | 2 +- stan/math/prim/prob/logistic_lccdf.hpp | 2 +- stan/math/prim/prob/logistic_lcdf.hpp | 2 +- stan/math/prim/prob/logistic_lpdf.hpp | 2 +- stan/math/prim/prob/loglogistic_cdf.hpp | 2 +- stan/math/prim/prob/loglogistic_lpdf.hpp | 2 +- stan/math/prim/prob/lognormal_ccdf_log.hpp | 2 +- stan/math/prim/prob/lognormal_cdf.hpp | 2 +- stan/math/prim/prob/lognormal_cdf_log.hpp | 2 +- stan/math/prim/prob/lognormal_lccdf.hpp | 2 +- stan/math/prim/prob/lognormal_lcdf.hpp | 2 +- stan/math/prim/prob/lognormal_lpdf.hpp | 2 +- .../prim/prob/matrix_normal_prec_lpdf.hpp | 4 +- .../math/prim/prob/multi_gp_cholesky_lpdf.hpp | 2 +- stan/math/prim/prob/multi_gp_lpdf.hpp | 2 +- .../prim/prob/multi_normal_cholesky_lpdf.hpp | 4 +- stan/math/prim/prob/multi_normal_lpdf.hpp | 4 +- .../math/prim/prob/multi_normal_prec_lpdf.hpp | 2 +- .../prob/multi_student_t_cholesky_lpdf.hpp | 4 +- stan/math/prim/prob/multi_student_t_lpdf.hpp | 2 +- .../math/prim/prob/multinomial_logit_lpmf.hpp | 4 +- stan/math/prim/prob/multinomial_lpmf.hpp | 4 +- .../prim/prob/neg_binomial_2_ccdf_log.hpp | 2 +- stan/math/prim/prob/neg_binomial_2_cdf.hpp | 2 +- .../math/prim/prob/neg_binomial_2_cdf_log.hpp | 2 +- stan/math/prim/prob/neg_binomial_2_lccdf.hpp | 2 +- stan/math/prim/prob/neg_binomial_2_lcdf.hpp | 2 +- .../prim/prob/neg_binomial_2_log_glm_lpmf.hpp | 2 +- .../prim/prob/neg_binomial_2_log_lpmf.hpp | 2 +- stan/math/prim/prob/neg_binomial_2_lpmf.hpp | 2 +- stan/math/prim/prob/neg_binomial_ccdf_log.hpp | 2 +- stan/math/prim/prob/neg_binomial_cdf.hpp | 2 +- stan/math/prim/prob/neg_binomial_cdf_log.hpp | 2 +- stan/math/prim/prob/neg_binomial_lccdf.hpp | 2 +- stan/math/prim/prob/neg_binomial_lcdf.hpp | 2 +- stan/math/prim/prob/neg_binomial_lpmf.hpp | 2 +- stan/math/prim/prob/normal_id_glm_lpdf.hpp | 2 +- .../math/prim/prob/normal_sufficient_lpdf.hpp | 2 +- .../prim/prob/ordered_logistic_glm_lpmf.hpp | 4 +- stan/math/prim/prob/ordered_logistic_lpmf.hpp | 4 +- stan/math/prim/prob/ordered_probit_lpmf.hpp | 4 +- stan/math/prim/prob/pareto_ccdf_log.hpp | 2 +- stan/math/prim/prob/pareto_cdf.hpp | 2 +- stan/math/prim/prob/pareto_cdf_log.hpp | 2 +- stan/math/prim/prob/pareto_lccdf.hpp | 2 +- stan/math/prim/prob/pareto_lcdf.hpp | 2 +- stan/math/prim/prob/pareto_lpdf.hpp | 2 +- .../math/prim/prob/pareto_type_2_ccdf_log.hpp | 2 +- stan/math/prim/prob/pareto_type_2_cdf.hpp | 2 +- stan/math/prim/prob/pareto_type_2_cdf_log.hpp | 2 +- stan/math/prim/prob/pareto_type_2_lccdf.hpp | 2 +- stan/math/prim/prob/pareto_type_2_lcdf.hpp | 2 +- stan/math/prim/prob/pareto_type_2_lpdf.hpp | 2 +- .../prim/prob/poisson_binomial_ccdf_log.hpp | 2 +- stan/math/prim/prob/poisson_binomial_cdf.hpp | 4 +- .../prim/prob/poisson_binomial_cdf_log.hpp | 2 +- .../math/prim/prob/poisson_binomial_lccdf.hpp | 4 +- stan/math/prim/prob/poisson_binomial_lcdf.hpp | 4 +- stan/math/prim/prob/poisson_binomial_lpmf.hpp | 4 +- stan/math/prim/prob/poisson_ccdf_log.hpp | 2 +- stan/math/prim/prob/poisson_cdf.hpp | 2 +- stan/math/prim/prob/poisson_cdf_log.hpp | 2 +- stan/math/prim/prob/poisson_lccdf.hpp | 2 +- stan/math/prim/prob/poisson_lcdf.hpp | 2 +- stan/math/prim/prob/poisson_log_glm_lpmf.hpp | 2 +- stan/math/prim/prob/poisson_log_lpmf.hpp | 2 +- stan/math/prim/prob/poisson_lpmf.hpp | 2 +- stan/math/prim/prob/rayleigh_ccdf_log.hpp | 2 +- stan/math/prim/prob/rayleigh_cdf.hpp | 2 +- stan/math/prim/prob/rayleigh_cdf_log.hpp | 2 +- stan/math/prim/prob/rayleigh_lccdf.hpp | 2 +- stan/math/prim/prob/rayleigh_lcdf.hpp | 2 +- stan/math/prim/prob/rayleigh_lpdf.hpp | 2 +- .../prob/scaled_inv_chi_square_ccdf_log.hpp | 2 +- .../prim/prob/scaled_inv_chi_square_cdf.hpp | 2 +- .../prob/scaled_inv_chi_square_cdf_log.hpp | 2 +- .../prim/prob/scaled_inv_chi_square_lccdf.hpp | 2 +- .../prim/prob/scaled_inv_chi_square_lcdf.hpp | 2 +- .../prim/prob/scaled_inv_chi_square_lpdf.hpp | 2 +- .../prim/prob/skew_double_exponential_cdf.hpp | 2 +- .../prob/skew_double_exponential_lccdf.hpp | 2 +- .../prob/skew_double_exponential_lcdf.hpp | 2 +- .../prob/skew_double_exponential_lpdf.hpp | 4 +- stan/math/prim/prob/skew_normal_ccdf_log.hpp | 2 +- stan/math/prim/prob/skew_normal_cdf.hpp | 2 +- stan/math/prim/prob/skew_normal_cdf_log.hpp | 2 +- stan/math/prim/prob/skew_normal_lccdf.hpp | 2 +- stan/math/prim/prob/skew_normal_lcdf.hpp | 2 +- stan/math/prim/prob/skew_normal_lpdf.hpp | 2 +- stan/math/prim/prob/std_normal_lpdf.hpp | 2 +- stan/math/prim/prob/student_t_ccdf_log.hpp | 2 +- stan/math/prim/prob/student_t_cdf.hpp | 2 +- stan/math/prim/prob/student_t_cdf_log.hpp | 2 +- stan/math/prim/prob/student_t_lccdf.hpp | 2 +- stan/math/prim/prob/student_t_lcdf.hpp | 2 +- stan/math/prim/prob/student_t_lpdf.hpp | 2 +- stan/math/prim/prob/uniform_ccdf_log.hpp | 2 +- stan/math/prim/prob/uniform_cdf.hpp | 2 +- stan/math/prim/prob/uniform_cdf_log.hpp | 2 +- stan/math/prim/prob/uniform_lccdf.hpp | 2 +- stan/math/prim/prob/uniform_lcdf.hpp | 2 +- stan/math/prim/prob/uniform_lpdf.hpp | 2 +- stan/math/prim/prob/von_mises_cdf.hpp | 6 +- stan/math/prim/prob/von_mises_lpdf.hpp | 2 +- stan/math/prim/prob/weibull_ccdf_log.hpp | 2 +- stan/math/prim/prob/weibull_cdf.hpp | 2 +- stan/math/prim/prob/weibull_cdf_log.hpp | 2 +- stan/math/prim/prob/weibull_lccdf.hpp | 2 +- stan/math/prim/prob/weibull_lcdf.hpp | 2 +- stan/math/prim/prob/weibull_lpdf.hpp | 2 +- stan/math/prim/prob/wiener_lpdf.hpp | 2 +- stan/math/prim/prob/wishart_cholesky_lpdf.hpp | 2 +- stan/math/prim/prob/wishart_lpdf.hpp | 2 +- .../constraint/cholesky_corr_constrain.hpp | 4 +- .../constraint/cholesky_factor_constrain.hpp | 4 +- .../rev/constraint/corr_matrix_constrain.hpp | 4 +- .../rev/constraint/cov_matrix_constrain.hpp | 4 +- .../constraint/cov_matrix_constrain_lkj.hpp | 4 +- .../math/rev/constraint/ordered_constrain.hpp | 2 +- .../rev/constraint/sum_to_zero_constrain.hpp | 2 +- stan/math/rev/core/build_vari_array.hpp | 2 +- stan/math/rev/core/callback_vari.hpp | 4 +- stan/math/rev/core/chainable_object.hpp | 4 +- stan/math/rev/fun/diag_post_multiply.hpp | 2 +- stan/math/rev/fun/diag_pre_multiply.hpp | 2 +- stan/math/rev/fun/elt_divide.hpp | 4 +- stan/math/rev/fun/elt_multiply.hpp | 2 +- stan/math/rev/fun/from_var_value.hpp | 6 +- stan/math/rev/fun/hypergeometric_1F0.hpp | 2 +- stan/math/rev/fun/log_determinant_ldlt.hpp | 2 +- stan/math/rev/fun/log_softmax.hpp | 2 +- stan/math/rev/fun/read_corr_L.hpp | 4 +- stan/math/rev/fun/read_cov_matrix.hpp | 2 +- stan/math/rev/fun/sd.hpp | 6 +- stan/math/rev/fun/variance.hpp | 2 +- stan/math/rev/functor/algebra_solver_fp.hpp | 2 +- stan/math/rev/functor/algebra_system.hpp | 2 +- stan/math/rev/functor/dae.hpp | 6 +- .../rev/functor/finite_diff_hessian_auto.hpp | 2 +- .../finite_diff_hessian_times_vector_auto.hpp | 2 +- stan/math/rev/functor/gradient.hpp | 4 +- stan/math/rev/functor/jacobian.hpp | 2 +- stan/math/rev/functor/kinsol_solve.hpp | 2 +- stan/math/rev/functor/map_rect_concurrent.hpp | 2 +- stan/math/rev/functor/ode_adams.hpp | 6 +- stan/math/rev/functor/ode_adjoint.hpp | 6 +- stan/math/rev/functor/ode_bdf.hpp | 6 +- .../rev/functor/ode_store_sensitivities.hpp | 2 +- stan/math/rev/functor/solve_newton.hpp | 8 +- stan/math/rev/functor/solve_powell.hpp | 10 +- test/expressions/expression_test_helpers.hpp | 32 ++-- test/prob/generate_tests.cpp | 18 +- test/prob/utility.hpp | 82 ++++----- test/unit/math/expect_near_rel.hpp | 18 +- .../fwd/core/std_iterator_traits_test.cpp | 2 +- test/unit/math/fwd/fun/accumulator_test.cpp | 2 +- test/unit/math/fwd/fun/rank_test.cpp | 4 +- test/unit/math/fwd/fun/sort_indices_test.cpp | 16 +- .../math/fwd/meta/is_constant_all_test.cpp | 2 +- test/unit/math/laplace/laplace_utility.hpp | 2 +- .../cholesky_corr_constrain_test.cpp | 2 +- .../constraint/corr_matrix_constrain_test.cpp | 2 +- .../constraint/cov_matrix_constrain_test.cpp | 2 +- .../constraint/identity_constrain_test.cpp | 8 +- .../constraint/lb_constrain_matvar_test.cpp | 4 +- .../math/mix/constraint/lb_constrain_test.cpp | 4 +- .../mix/constraint/lub_constrain_helpers.hpp | 4 +- .../constraint/lub_constrain_matvar_test.cpp | 2 +- .../offset_multiplier_constrain_helpers.hpp | 4 +- ...et_multiplier_constrain_matvar_helpers.hpp | 4 +- .../mix/constraint/ordered_constrain_test.cpp | 8 +- .../positive_ordered_constrain_test.cpp | 8 +- .../mix/constraint/simplex_constrain_test.cpp | 6 +- .../stochastic_column_constrain_test.cpp | 6 +- .../stochastic_row_constrain_test.cpp | 6 +- .../constraint/sum_to_zero_constrain_test.cpp | 6 +- .../constraint/unit_vector_constrain_test.cpp | 2 +- .../mix/core/operator_logical_and_test.cpp | 2 +- .../mix/core/operator_logical_or_test.cpp | 2 +- .../math/mix/core/operator_unary_not_test.cpp | 2 +- test/unit/math/mix/core/std_complex_test.cpp | 14 +- test/unit/math/mix/fun/accumulator_test.cpp | 2 +- test/unit/math/mix/fun/append_array_test.cpp | 34 ++-- .../math/mix/fun/cholesky_decompose_test.cpp | 2 +- .../mix/fun/complex_schur_decompose_test.cpp | 4 +- test/unit/math/mix/fun/conj_test.cpp | 2 +- test/unit/math/mix/fun/copysign_test.cpp | 4 +- .../unit/math/mix/fun/cumulative_sum_test.cpp | 2 +- .../math/mix/fun/diag_post_multiply_test.cpp | 2 +- .../math/mix/fun/diag_pre_multiply_test.cpp | 2 +- .../math/mix/fun/eigen_comparisons_test.cpp | 8 +- .../eigendecompose_identity_complex_test.cpp | 4 +- .../mix/fun/eigendecompose_identity_test.cpp | 4 +- test/unit/math/mix/fun/fft_test.cpp | 8 +- test/unit/math/mix/fun/get_imag_test.cpp | 2 +- test/unit/math/mix/fun/get_real_test.cpp | 2 +- test/unit/math/mix/fun/head_test.cpp | 2 +- test/unit/math/mix/fun/isfinite_test.cpp | 2 +- test/unit/math/mix/fun/isinf_test.cpp | 2 +- test/unit/math/mix/fun/isnan_test.cpp | 2 +- test/unit/math/mix/fun/isnormal_test.cpp | 2 +- test/unit/math/mix/fun/log_mix_part2_test.cpp | 8 +- test/unit/math/mix/fun/logb_test.cpp | 4 +- .../math/mix/fun/matrix_exp_multiply_test.cpp | 2 +- test/unit/math/mix/fun/max_test.cpp | 2 +- test/unit/math/mix/fun/mean_test.cpp | 2 +- test/unit/math/mix/fun/min_test.cpp | 2 +- test/unit/math/mix/fun/multiply_util.hpp | 2 +- test/unit/math/mix/fun/pow_part1_test.cpp | 2 +- test/unit/math/mix/fun/prod_test.cpp | 2 +- .../unit/math/mix/fun/promote_scalar_test.cpp | 14 +- .../math/mix/fun/pseudo_eigenvectors_test.cpp | 4 +- test/unit/math/mix/fun/rank_test.cpp | 4 +- test/unit/math/mix/fun/scalbn_test.cpp | 4 +- test/unit/math/mix/fun/sd_test.cpp | 2 +- test/unit/math/mix/fun/signbit_test.cpp | 2 +- test/unit/math/mix/fun/sort_indices_test.cpp | 16 +- test/unit/math/mix/fun/sort_test.cpp | 2 +- .../math/mix/fun/squared_distance_test.cpp | 2 +- test/unit/math/mix/fun/sum_test.cpp | 2 +- test/unit/math/mix/fun/tail_test.cpp | 2 +- test/unit/math/mix/fun/transpose_test.cpp | 2 +- .../math/mix/fun/ub_constrain_matvar_test.cpp | 4 +- test/unit/math/mix/fun/ub_constrain_test.cpp | 4 +- test/unit/math/mix/fun/variance_test.cpp | 2 +- .../finite_diff_grad_hessian_auto_test.cpp | 2 +- .../finite_diff_gradient_auto_test.cpp | 2 +- .../unit/math/mix/functor/reduce_sum_util.hpp | 2 +- test/unit/math/mix/meta/base_type_test.cpp | 4 +- test/unit/math/mix/meta/eigen_utils.hpp | 18 +- test/unit/math/mix/meta/is_complex_test.cpp | 12 +- .../math/mix/meta/is_constant_all_test.cpp | 2 +- test/unit/math/mix/meta/return_type_test.cpp | 4 +- test/unit/math/mix/meta/scalar_type_test.cpp | 4 +- test/unit/math/mix/prob/dirichlet_test.cpp | 4 +- .../unit/math/mix/prob/higher_order_utils.hpp | 4 +- .../math/opencl/cholesky_decompose_test.cpp | 2 +- .../kernel_generator/elt_function_cl_test.cpp | 2 +- .../kernel_generator/reference_kernel.hpp | 4 +- test/unit/math/opencl/prim/crossprod_test.cpp | 2 +- .../opencl/prim/mdivide_left_tri_low_test.cpp | 4 +- .../prim/mdivide_right_tri_low_test.cpp | 2 +- .../unit/math/opencl/prim/tcrossprod_test.cpp | 2 +- test/unit/math/opencl/tri_inverse_test.cpp | 4 +- test/unit/math/opencl/util.hpp | 46 ++--- .../cholesky_corr_transform_test.cpp | 2 +- .../math/prim/err/elementwise_check_test.cpp | 8 +- test/unit/math/prim/fun/accumulator_test.cpp | 2 +- test/unit/math/prim/fun/assign_test.cpp | 2 +- .../math/prim/fun/binary_scalar_tester.hpp | 18 +- .../fun/binomial_coefficient_log_test.cpp | 2 +- test/unit/math/prim/fun/choose_test.cpp | 2 +- test/unit/math/prim/fun/crossprod_test.cpp | 2 +- .../math/prim/fun/cumulative_sum_test.cpp | 2 +- test/unit/math/prim/fun/divide_test.cpp | 2 +- .../prim/fun/linspaced_row_vector_test.cpp | 2 +- .../math/prim/fun/linspaced_vector_test.cpp | 2 +- test/unit/math/prim/fun/log_diff_exp_test.cpp | 2 +- test/unit/math/prim/fun/log_mix_test.cpp | 4 +- test/unit/math/prim/fun/log_softmax_test.cpp | 2 +- test/unit/math/prim/fun/log_sum_exp_test.cpp | 6 +- ...multiply_lower_tri_self_transpose_test.cpp | 4 +- .../math/prim/fun/promote_type_test_util.hpp | 2 +- test/unit/math/prim/fun/quantile_test.cpp | 4 +- test/unit/math/prim/fun/rank_test.cpp | 4 +- .../math/prim/fun/scalar_seq_view_test.cpp | 2 +- test/unit/math/prim/fun/sort_indices_test.cpp | 4 +- test/unit/math/prim/fun/sort_test.cpp | 4 +- test/unit/math/prim/fun/sort_test_util.hpp | 4 +- test/unit/math/prim/fun/tcrossprod_test.cpp | 2 +- .../math/prim/fun/ternary_scalar_tester.hpp | 6 +- test/unit/math/prim/fun/to_complex_test.cpp | 2 +- test/unit/math/prim/fun/to_matrix_test.cpp | 12 +- .../unit/math/prim/functor/hcubature_test.cpp | 2 +- .../prim/functor/integrate_1d_impl_test.cpp | 10 +- .../math/prim/functor/integrate_1d_test.cpp | 10 +- .../math/prim/functor/reduce_sum_util.hpp | 4 +- test/unit/math/prim/functor/utils_threads.hpp | 4 +- .../prim/meta/apply_template_permutations.hpp | 2 +- .../math/prim/meta/is_constant_all_test.cpp | 2 +- test/unit/math/prim/prob/VectorRNGTestRig.hpp | 12 +- test/unit/math/prim/prob/dirichlet_test.cpp | 6 +- test/unit/math/prim/prob/hmm_util.hpp | 2 +- test/unit/math/prim/prob/loglogistic_test.cpp | 2 +- .../prim/prob/matrix_normal_prec_rng_test.cpp | 6 +- .../unit/math/prim/prob/neg_binomial_test.cpp | 2 +- .../math/prim/prob/ordered_logistic_test.cpp | 2 +- .../math/prim/prob/ordered_probit_test.cpp | 2 +- .../prob/skew_double_exponential_test.cpp | 2 +- test/unit/math/prim/prob/util.hpp | 6 +- .../math/prim/prob/vector_rng_test_helper.hpp | 48 ++--- test/unit/math/prim/util.hpp | 2 +- .../math/rev/core/arena_allocator_test.cpp | 2 +- .../rev/core/operator_logical_and_test.cpp | 2 +- .../rev/core/operator_logical_or_test.cpp | 2 +- .../math/rev/core/operator_unary_not_test.cpp | 2 +- test/unit/math/rev/core/var_test.cpp | 12 +- test/unit/math/rev/fun/accumulator_test.cpp | 2 +- .../math/rev/fun/cholesky_decompose_test.cpp | 14 +- test/unit/math/rev/fun/lbeta_test.cpp | 2 +- .../math/rev/fun/scalar_seq_view_test.cpp | 4 +- test/unit/math/rev/fun/sort_indices_test.cpp | 8 +- test/unit/math/rev/fun/util.hpp | 2 +- .../math/rev/fun/vector_seq_view_test.cpp | 2 +- .../functor/finite_diff_hessian_auto_test.cpp | 2 +- test/unit/math/rev/functor/gradient_test.cpp | 2 +- .../rev/functor/integrate_1d_impl_test.cpp | 6 +- .../math/rev/functor/integrate_1d_test.cpp | 6 +- .../map_rect_concurrent_threads_test.cpp | 2 +- .../math/rev/functor/util_algebra_solver.hpp | 4 +- .../math/rev/meta/is_constant_all_test.cpp | 2 +- test/unit/math/rev/prob/categorical2_test.cpp | 2 +- .../prob/categorical_logit_glm_lpmf_test.cpp | 2 +- test/unit/math/rev/prob/dirichlet2_test.cpp | 2 +- test/unit/math/rev/prob/expect_eq_diffs.hpp | 4 +- test/unit/math/rev/prob/inv_wishart2_test.cpp | 2 +- .../rev/prob/inv_wishart_cholesky_test.cpp | 2 +- .../prob/lkj_corr_cholesky_test_functors.hpp | 2 +- test/unit/math/rev/prob/multi_gp2_test.cpp | 2 +- .../math/rev/prob/multi_gp_cholesky2_test.cpp | 2 +- .../unit/math/rev/prob/multi_normal2_test.cpp | 4 +- .../rev/prob/multi_normal_cholesky2_test.cpp | 2 +- .../math/rev/prob/multi_normal_prec2_test.cpp | 4 +- .../math/rev/prob/multi_student_t2_test.cpp | 4 +- .../prob/multi_student_t_cholesky_test.cpp | 4 +- .../math/rev/prob/multinomial_logit_test.cpp | 2 +- test/unit/math/rev/prob/multinomial_test.cpp | 2 +- .../prob/ordered_logistic_glm_lpmf_test.cpp | 2 +- test/unit/math/rev/prob/test_gradients.hpp | 8 +- .../rev/prob/test_gradients_multi_normal.hpp | 6 +- .../prob/test_gradients_multi_student_t.hpp | 6 +- ...est_gradients_multi_student_t_cholesky.hpp | 6 +- test/unit/math/rev/prob/wiener_full_test.cpp | 4 +- .../math/rev/prob/wishart_cholesky_test.cpp | 2 +- test/unit/math/rev/prob/wishart_test.cpp | 2 +- test/unit/math/test_ad.hpp | 170 +++++++++--------- test/unit/math/test_ad_matvar.hpp | 44 ++--- test/unit/math/test_ad_test.cpp | 26 +-- test/unit/multiple_translation_units1.cpp | 2 +- test/unit/multiple_translation_units2.cpp | 2 +- 647 files changed, 1176 insertions(+), 1176 deletions(-) diff --git a/stan/math/fwd/fun/hypergeometric_1F0.hpp b/stan/math/fwd/fun/hypergeometric_1F0.hpp index 21ae6764487..527ce87e134 100644 --- a/stan/math/fwd/fun/hypergeometric_1F0.hpp +++ b/stan/math/fwd/fun/hypergeometric_1F0.hpp @@ -31,7 +31,7 @@ namespace math { template , require_all_stan_scalar_t* = nullptr, require_any_fvar_t* = nullptr> -FvarT hypergeometric_1F0(const Ta& a, const Tz& z) { +inline FvarT hypergeometric_1F0(const Ta& a, const Tz& z) { partials_type_t a_val = value_of(a); partials_type_t z_val = value_of(z); FvarT rtn = FvarT(hypergeometric_1F0(a_val, z_val), 0.0); diff --git a/stan/math/fwd/fun/polar.hpp b/stan/math/fwd/fun/polar.hpp index 2728e6ded8d..118479d0730 100644 --- a/stan/math/fwd/fun/polar.hpp +++ b/stan/math/fwd/fun/polar.hpp @@ -44,7 +44,7 @@ inline std::complex> polar(const fvar& r, U theta) { * Returns complex number with specified magnitude and phase angle. * * @tparam T autodiff value type for phase angle -+* * @tparam U arithmetic type for magnitude + * * @tparam U arithmetic type for magnitude * @param[in] r magnitude * @param[in] theta phase angle * @return complex number with magnitude and phase angle diff --git a/stan/math/fwd/functor/gradient.hpp b/stan/math/fwd/functor/gradient.hpp index e31e542e874..b9756c4dce0 100644 --- a/stan/math/fwd/functor/gradient.hpp +++ b/stan/math/fwd/functor/gradient.hpp @@ -37,7 +37,7 @@ namespace math { * @param[out] grad_fx Gradient of function at argument */ template -void gradient(const F& f, const Eigen::Matrix& x, T& fx, +inline void gradient(const F& f, const Eigen::Matrix& x, T& fx, Eigen::Matrix& grad_fx) { Eigen::Matrix, Eigen::Dynamic, 1> x_fvar(x.size()); grad_fx.resize(x.size()); diff --git a/stan/math/fwd/functor/hessian.hpp b/stan/math/fwd/functor/hessian.hpp index ba75e8007f2..2cc4cec5ba5 100644 --- a/stan/math/fwd/functor/hessian.hpp +++ b/stan/math/fwd/functor/hessian.hpp @@ -38,7 +38,7 @@ namespace math { * @param[out] H Hessian of function at argument */ template -void hessian(const F& f, const Eigen::Matrix& x, T& fx, +inline void hessian(const F& f, const Eigen::Matrix& x, T& fx, Eigen::Matrix& grad, Eigen::Matrix& H) { H.resize(x.size(), x.size()); diff --git a/stan/math/fwd/functor/jacobian.hpp b/stan/math/fwd/functor/jacobian.hpp index 283a2f71e5c..18dfdba33a0 100644 --- a/stan/math/fwd/functor/jacobian.hpp +++ b/stan/math/fwd/functor/jacobian.hpp @@ -8,7 +8,7 @@ namespace stan { namespace math { template -void jacobian(const F& f, const Eigen::Matrix& x, +inline void jacobian(const F& f, const Eigen::Matrix& x, Eigen::Matrix& fx, Eigen::Matrix& J) { using Eigen::Dynamic; diff --git a/stan/math/memory/stack_alloc.hpp b/stan/math/memory/stack_alloc.hpp index 8a8ef2cc7c1..3d73c7d6b52 100644 --- a/stan/math/memory/stack_alloc.hpp +++ b/stan/math/memory/stack_alloc.hpp @@ -26,7 +26,7 @@ namespace math { * @tparam Type of object to which pointer points. */ template -bool is_aligned(T* ptr, unsigned int bytes_aligned) { +inline bool is_aligned(T* ptr, unsigned int bytes_aligned) { return (reinterpret_cast(ptr) % bytes_aligned) == 0U; } diff --git a/stan/math/mix/functor/hessian_times_vector.hpp b/stan/math/mix/functor/hessian_times_vector.hpp index dbd1c62c347..b90fa2bd17a 100644 --- a/stan/math/mix/functor/hessian_times_vector.hpp +++ b/stan/math/mix/functor/hessian_times_vector.hpp @@ -38,7 +38,7 @@ inline void hessian_times_vector( template * = nullptr, require_stan_scalar_t* = nullptr> -void hessian_times_vector(const F& f, +inline void hessian_times_vector(const F& f, const Eigen::Matrix& x, const EigVec& v, T& fx, Eigen::Matrix& Hv) { diff --git a/stan/math/mix/functor/partial_derivative.hpp b/stan/math/mix/functor/partial_derivative.hpp index dfa428c2185..488f7525cc1 100644 --- a/stan/math/mix/functor/partial_derivative.hpp +++ b/stan/math/mix/functor/partial_derivative.hpp @@ -22,7 +22,7 @@ namespace math { * @param[out] dfx_dxn Value of partial derivative */ template -void partial_derivative(const F& f, +inline void partial_derivative(const F& f, const Eigen::Matrix& x, int n, T& fx, T& dfx_dxn) { Eigen::Matrix, Eigen::Dynamic, 1> x_fvar(x.size()); diff --git a/stan/math/opencl/copy.hpp b/stan/math/opencl/copy.hpp index e3599e5c933..9a06ea7cc26 100644 --- a/stan/math/opencl/copy.hpp +++ b/stan/math/opencl/copy.hpp @@ -232,7 +232,7 @@ inline T_dst from_matrix_cl(const matrix_cl& src) { * @return Eigen matrix with a copy of the data in the source matrix */ template * = nullptr> -auto from_matrix_cl(const T& src) { +inline auto from_matrix_cl(const T& src) { return from_matrix_cl< Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>>(src); } diff --git a/stan/math/opencl/indexing_rev.hpp b/stan/math/opencl/indexing_rev.hpp index 94be70c2c68..854aa6d85c4 100644 --- a/stan/math/opencl/indexing_rev.hpp +++ b/stan/math/opencl/indexing_rev.hpp @@ -19,7 +19,7 @@ namespace math { * @param idx indices * @param res adjoint of the result of the indexing operation */ -void indexing_rev(matrix_cl& adj, const matrix_cl& idx, +inline void indexing_rev(matrix_cl& adj, const matrix_cl& idx, const matrix_cl& res) { int local_mem_size = opencl_context.device()[0].getInfo(); diff --git a/stan/math/opencl/kernel_generator/evaluate_into.hpp b/stan/math/opencl/kernel_generator/evaluate_into.hpp index c171f62e1e4..e224ddac9af 100644 --- a/stan/math/opencl/kernel_generator/evaluate_into.hpp +++ b/stan/math/opencl/kernel_generator/evaluate_into.hpp @@ -18,7 +18,7 @@ namespace math { */ template template -void operation_cl::evaluate_into(T_lhs& lhs) const { +inline void operation_cl::evaluate_into(T_lhs& lhs) const { static_assert( is_kernel_expression::value, "operation_cl::evaluate_into: left hand side is not a valid expression!"); diff --git a/stan/math/opencl/kernel_generator/holder_cl.hpp b/stan/math/opencl/kernel_generator/holder_cl.hpp index 175ef1689d6..5a74895fe2f 100644 --- a/stan/math/opencl/kernel_generator/holder_cl.hpp +++ b/stan/math/opencl/kernel_generator/holder_cl.hpp @@ -64,7 +64,7 @@ class holder_cl_ */ template * = nullptr> -auto holder_cl(T&& a, Ptrs*... ptrs) { +inline auto holder_cl(T&& a, Ptrs*... ptrs) { return holder_cl_, Ptrs...>( as_operation_cl(std::forward(a)), ptrs...); } @@ -81,7 +81,7 @@ namespace internal { * @return `holder_cl` referencing given expression */ template -auto make_holder_cl_impl_step2(T&& expr, std::index_sequence, +inline auto make_holder_cl_impl_step2(T&& expr, std::index_sequence, const std::tuple& ptrs) { return holder_cl(std::forward(expr), std::get(ptrs)...); } @@ -96,7 +96,7 @@ auto make_holder_cl_impl_step2(T&& expr, std::index_sequence, * @return `holder_cl` referencing given expression */ template -auto make_holder_cl_impl_step1(const T& func, std::index_sequence, +inline auto make_holder_cl_impl_step1(const T& func, std::index_sequence, Args&&... args) { std::tuple*...> res; auto ptrs = std::tuple_cat( @@ -122,7 +122,7 @@ template ()(std::declval()...)), Args...>* = nullptr> -auto make_holder_cl(const T& func, Args&&... args) { +inline auto make_holder_cl(const T& func, Args&&... args) { return internal::make_holder_cl_impl_step1( func, std::make_index_sequence(), std::forward(args)...); diff --git a/stan/math/opencl/kernel_generator/multi_result_kernel.hpp b/stan/math/opencl/kernel_generator/multi_result_kernel.hpp index 2cf0bcb2676..0b0cbadec57 100644 --- a/stan/math/opencl/kernel_generator/multi_result_kernel.hpp +++ b/stan/math/opencl/kernel_generator/multi_result_kernel.hpp @@ -665,7 +665,7 @@ class results_cl { * @param results results that will be calculated in same kernel. */ template -results_cl results(T_results&&... results) { +inline results_cl results(T_results&&... results) { return results_cl(std::forward(results)...); } diff --git a/stan/math/opencl/prim/bernoulli_cdf.hpp b/stan/math/opencl/prim/bernoulli_cdf.hpp index 32bd3479d59..8dc84b67198 100644 --- a/stan/math/opencl/prim/bernoulli_cdf.hpp +++ b/stan/math/opencl/prim/bernoulli_cdf.hpp @@ -27,7 +27,7 @@ template < typename T_n_cl, typename T_prob_cl, require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t bernoulli_cdf(const T_n_cl& n, +inline return_type_t bernoulli_cdf(const T_n_cl& n, const T_prob_cl& theta) { static constexpr const char* function = "bernoulli_cdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/bernoulli_lccdf.hpp b/stan/math/opencl/prim/bernoulli_lccdf.hpp index 7de8edb66e6..c17134517c6 100644 --- a/stan/math/opencl/prim/bernoulli_lccdf.hpp +++ b/stan/math/opencl/prim/bernoulli_lccdf.hpp @@ -28,7 +28,7 @@ template < typename T_n_cl, typename T_prob_cl, require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t bernoulli_lccdf(const T_n_cl& n, +inline return_type_t bernoulli_lccdf(const T_n_cl& n, const T_prob_cl& theta) { static constexpr const char* function = "bernoulli_lccdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/bernoulli_lcdf.hpp b/stan/math/opencl/prim/bernoulli_lcdf.hpp index aad36c9651e..a1e081c80f6 100644 --- a/stan/math/opencl/prim/bernoulli_lcdf.hpp +++ b/stan/math/opencl/prim/bernoulli_lcdf.hpp @@ -28,7 +28,7 @@ template < typename T_n_cl, typename T_prob_cl, require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t bernoulli_lcdf(const T_n_cl& n, +inline return_type_t bernoulli_lcdf(const T_n_cl& n, const T_prob_cl& theta) { static constexpr const char* function = "bernoulli_lcdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/bernoulli_logit_glm_lpmf.hpp b/stan/math/opencl/prim/bernoulli_logit_glm_lpmf.hpp index ba535db8aee..c48356464dc 100644 --- a/stan/math/opencl/prim/bernoulli_logit_glm_lpmf.hpp +++ b/stan/math/opencl/prim/bernoulli_logit_glm_lpmf.hpp @@ -53,7 +53,7 @@ template * = nullptr> -return_type_t bernoulli_logit_glm_lpmf( +inline return_type_t 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 constexpr const char* function = "bernoulli_logit_glm_lpmf(OpenCL)"; diff --git a/stan/math/opencl/prim/bernoulli_logit_lpmf.hpp b/stan/math/opencl/prim/bernoulli_logit_lpmf.hpp index af6635b3441..394bbc830fb 100644 --- a/stan/math/opencl/prim/bernoulli_logit_lpmf.hpp +++ b/stan/math/opencl/prim/bernoulli_logit_lpmf.hpp @@ -26,7 +26,7 @@ template < bool propto, typename T_n_cl, typename T_prob_cl, require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t bernoulli_logit_lpmf(const T_n_cl& n, +inline return_type_t bernoulli_logit_lpmf(const T_n_cl& n, const T_prob_cl& theta) { static constexpr const char* function = "bernoulli_logit_lpmf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/bernoulli_lpmf.hpp b/stan/math/opencl/prim/bernoulli_lpmf.hpp index 344bdf5e084..940404d50dd 100644 --- a/stan/math/opencl/prim/bernoulli_lpmf.hpp +++ b/stan/math/opencl/prim/bernoulli_lpmf.hpp @@ -29,7 +29,7 @@ template < bool propto, typename T_n_cl, typename T_prob_cl, require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t bernoulli_lpmf(const T_n_cl& n, +inline return_type_t bernoulli_lpmf(const T_n_cl& n, const T_prob_cl& theta) { static constexpr const char* function = "bernoulli_lpmf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/beta_binomial_lpmf.hpp b/stan/math/opencl/prim/beta_binomial_lpmf.hpp index a0c23dc8840..39406d1b38e 100644 --- a/stan/math/opencl/prim/beta_binomial_lpmf.hpp +++ b/stan/math/opencl/prim/beta_binomial_lpmf.hpp @@ -40,7 +40,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t beta_binomial_lpmf( +inline 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; diff --git a/stan/math/opencl/prim/beta_lpdf.hpp b/stan/math/opencl/prim/beta_lpdf.hpp index 1756c768a6a..59de46f585c 100644 --- a/stan/math/opencl/prim/beta_lpdf.hpp +++ b/stan/math/opencl/prim/beta_lpdf.hpp @@ -40,7 +40,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t beta_lpdf( +inline 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; diff --git a/stan/math/opencl/prim/beta_proportion_lpdf.hpp b/stan/math/opencl/prim/beta_proportion_lpdf.hpp index 47efd47861a..0c0cbacc632 100644 --- a/stan/math/opencl/prim/beta_proportion_lpdf.hpp +++ b/stan/math/opencl/prim/beta_proportion_lpdf.hpp @@ -39,7 +39,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t beta_proportion_lpdf( +inline return_type_t beta_proportion_lpdf( const T_y_cl& y, const T_loc_cl& mu, const T_prec_cl& kappa) { static constexpr const char* function = "beta_proportion_lpdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/binomial_logit_glm_lpmf.hpp b/stan/math/opencl/prim/binomial_logit_glm_lpmf.hpp index ac726b2e153..ebc06ce035f 100644 --- a/stan/math/opencl/prim/binomial_logit_glm_lpmf.hpp +++ b/stan/math/opencl/prim/binomial_logit_glm_lpmf.hpp @@ -29,7 +29,7 @@ template * = nullptr> -return_type_t binomial_logit_glm_lpmf( +inline return_type_t binomial_logit_glm_lpmf( const T_n_cl& n, const T_N_cl& N, const T_x_cl& x, const T_alpha_cl& alpha, const T_beta_cl& beta) { static const char* function = "binomial_logit_glm_lpmf(OpenCL)"; diff --git a/stan/math/opencl/prim/binomial_logit_lpmf.hpp b/stan/math/opencl/prim/binomial_logit_lpmf.hpp index 286addfc82a..1fd43c9c4f7 100644 --- a/stan/math/opencl/prim/binomial_logit_lpmf.hpp +++ b/stan/math/opencl/prim/binomial_logit_lpmf.hpp @@ -31,7 +31,7 @@ template * = nullptr, require_any_nonscalar_prim_or_rev_kernel_expression_t< T_n_cl, T_N_cl, T_prob_cl>* = nullptr> -return_type_t binomial_logit_lpmf(const T_n_cl& n, const T_N_cl N, +inline return_type_t binomial_logit_lpmf(const T_n_cl& n, const T_N_cl N, const T_prob_cl& alpha) { static constexpr const char* function = "binomial_logit_lpmf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/binomial_lpmf.hpp b/stan/math/opencl/prim/binomial_lpmf.hpp index 8bed274f468..757d2349a32 100644 --- a/stan/math/opencl/prim/binomial_lpmf.hpp +++ b/stan/math/opencl/prim/binomial_lpmf.hpp @@ -33,7 +33,7 @@ template * = nullptr, require_any_nonscalar_prim_or_rev_kernel_expression_t< T_n_cl, T_N_cl, T_prob_cl>* = nullptr> -return_type_t binomial_lpmf(const T_n_cl& n, const T_N_cl N, +inline return_type_t binomial_lpmf(const T_n_cl& n, const T_N_cl N, const T_prob_cl& theta) { static constexpr const char* function = "binomial_lpmf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/categorical_logit_glm_lpmf.hpp b/stan/math/opencl/prim/categorical_logit_glm_lpmf.hpp index aaae3438f1f..2d280b6c7e3 100644 --- a/stan/math/opencl/prim/categorical_logit_glm_lpmf.hpp +++ b/stan/math/opencl/prim/categorical_logit_glm_lpmf.hpp @@ -46,7 +46,7 @@ template * = nullptr> -return_type_t categorical_logit_glm_lpmf( +inline return_type_t categorical_logit_glm_lpmf( const T_y& y, const T_x& x, const T_alpha& alpha, const T_beta& beta) { using T_partials_return = partials_return_t; constexpr bool is_y_vector = !is_stan_scalar::value; diff --git a/stan/math/opencl/prim/cauchy_cdf.hpp b/stan/math/opencl/prim/cauchy_cdf.hpp index 84d1e19a1c5..795eb6b2beb 100644 --- a/stan/math/opencl/prim/cauchy_cdf.hpp +++ b/stan/math/opencl/prim/cauchy_cdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t cauchy_cdf( +inline return_type_t cauchy_cdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { static constexpr const char* function = "cauchy_cdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/cauchy_lccdf.hpp b/stan/math/opencl/prim/cauchy_lccdf.hpp index 6d9cb8d79be..cb20f5349b5 100644 --- a/stan/math/opencl/prim/cauchy_lccdf.hpp +++ b/stan/math/opencl/prim/cauchy_lccdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t cauchy_lccdf( +inline return_type_t cauchy_lccdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { static constexpr const char* function = "cauchy_lccdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/cauchy_lcdf.hpp b/stan/math/opencl/prim/cauchy_lcdf.hpp index c19665e5773..0fc66720f3d 100644 --- a/stan/math/opencl/prim/cauchy_lcdf.hpp +++ b/stan/math/opencl/prim/cauchy_lcdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t cauchy_lcdf( +inline return_type_t cauchy_lcdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { static constexpr const char* function = "cauchy_lcdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/cauchy_lpdf.hpp b/stan/math/opencl/prim/cauchy_lpdf.hpp index 9ec186bd224..faaa477c9a2 100644 --- a/stan/math/opencl/prim/cauchy_lpdf.hpp +++ b/stan/math/opencl/prim/cauchy_lpdf.hpp @@ -35,7 +35,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t cauchy_lpdf( +inline return_type_t cauchy_lpdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { static constexpr const char* function = "cauchy_lpdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/chi_square_lpdf.hpp b/stan/math/opencl/prim/chi_square_lpdf.hpp index 553ad80a0b0..caa8d838e2e 100644 --- a/stan/math/opencl/prim/chi_square_lpdf.hpp +++ b/stan/math/opencl/prim/chi_square_lpdf.hpp @@ -35,7 +35,7 @@ template < bool propto, typename T_y_cl, typename T_dof_cl, require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t chi_square_lpdf(const T_y_cl& y, +inline return_type_t chi_square_lpdf(const T_y_cl& y, const T_dof_cl& nu) { static constexpr const char* function = "chi_square_lpdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/double_exponential_cdf.hpp b/stan/math/opencl/prim/double_exponential_cdf.hpp index 8b09791c96a..7428963c418 100644 --- a/stan/math/opencl/prim/double_exponential_cdf.hpp +++ b/stan/math/opencl/prim/double_exponential_cdf.hpp @@ -30,7 +30,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t double_exponential_cdf( +inline return_type_t double_exponential_cdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { static constexpr const char* function = "double_exponential_cdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/double_exponential_lccdf.hpp b/stan/math/opencl/prim/double_exponential_lccdf.hpp index 5baafc72bfa..d1ace573441 100644 --- a/stan/math/opencl/prim/double_exponential_lccdf.hpp +++ b/stan/math/opencl/prim/double_exponential_lccdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t double_exponential_lccdf( +inline return_type_t double_exponential_lccdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { static constexpr const char* function = "double_exponential_lccdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/double_exponential_lcdf.hpp b/stan/math/opencl/prim/double_exponential_lcdf.hpp index 31592578699..6b898e35d94 100644 --- a/stan/math/opencl/prim/double_exponential_lcdf.hpp +++ b/stan/math/opencl/prim/double_exponential_lcdf.hpp @@ -30,7 +30,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t double_exponential_lcdf( +inline return_type_t double_exponential_lcdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { static constexpr const char* function = "double_exponential_lcdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/double_exponential_lpdf.hpp b/stan/math/opencl/prim/double_exponential_lpdf.hpp index cdc68587faa..6046467b7b2 100644 --- a/stan/math/opencl/prim/double_exponential_lpdf.hpp +++ b/stan/math/opencl/prim/double_exponential_lpdf.hpp @@ -33,7 +33,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t double_exponential_lpdf( +inline return_type_t double_exponential_lpdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { static constexpr const char* function = "double_exponential_lpdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/exp_mod_normal_cdf.hpp b/stan/math/opencl/prim/exp_mod_normal_cdf.hpp index d45519fe9cd..523de6055b4 100644 --- a/stan/math/opencl/prim/exp_mod_normal_cdf.hpp +++ b/stan/math/opencl/prim/exp_mod_normal_cdf.hpp @@ -33,7 +33,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t exp_mod_normal_cdf( +inline return_type_t 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 constexpr const char* function = "exp_mod_normal_cdf(OpenCL)"; diff --git a/stan/math/opencl/prim/exp_mod_normal_lccdf.hpp b/stan/math/opencl/prim/exp_mod_normal_lccdf.hpp index a3aa1514459..8f250a0d40f 100644 --- a/stan/math/opencl/prim/exp_mod_normal_lccdf.hpp +++ b/stan/math/opencl/prim/exp_mod_normal_lccdf.hpp @@ -34,7 +34,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t +inline return_type_t 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 constexpr const char* function = "exp_mod_normal_lccdf(OpenCL)"; diff --git a/stan/math/opencl/prim/exp_mod_normal_lcdf.hpp b/stan/math/opencl/prim/exp_mod_normal_lcdf.hpp index 57508e3f221..6e6d94231a7 100644 --- a/stan/math/opencl/prim/exp_mod_normal_lcdf.hpp +++ b/stan/math/opencl/prim/exp_mod_normal_lcdf.hpp @@ -34,7 +34,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t exp_mod_normal_lcdf( +inline return_type_t 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 constexpr const char* function = "exp_mod_normal_lcdf(OpenCL)"; diff --git a/stan/math/opencl/prim/exp_mod_normal_lpdf.hpp b/stan/math/opencl/prim/exp_mod_normal_lpdf.hpp index 091ba28a0ae..044b2a47090 100644 --- a/stan/math/opencl/prim/exp_mod_normal_lpdf.hpp +++ b/stan/math/opencl/prim/exp_mod_normal_lpdf.hpp @@ -36,7 +36,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t exp_mod_normal_lpdf( +inline return_type_t 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 constexpr const char* function = "exp_mod_normal_lpdf(OpenCL)"; diff --git a/stan/math/opencl/prim/exponential_cdf.hpp b/stan/math/opencl/prim/exponential_cdf.hpp index 0cc9510ce79..aa150618fde 100644 --- a/stan/math/opencl/prim/exponential_cdf.hpp +++ b/stan/math/opencl/prim/exponential_cdf.hpp @@ -30,7 +30,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t exponential_cdf( +inline return_type_t exponential_cdf( const T_y_cl& y, const T_inv_scale_cl& beta) { static constexpr const char* function = "exponential_cdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/exponential_lccdf.hpp b/stan/math/opencl/prim/exponential_lccdf.hpp index b43f08ed35e..fe612a2792d 100644 --- a/stan/math/opencl/prim/exponential_lccdf.hpp +++ b/stan/math/opencl/prim/exponential_lccdf.hpp @@ -30,7 +30,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t exponential_lccdf( +inline return_type_t exponential_lccdf( const T_y_cl& y, const T_inv_scale_cl& beta) { static constexpr const char* function = "exponential_lccdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/exponential_lcdf.hpp b/stan/math/opencl/prim/exponential_lcdf.hpp index 641ce3354c1..b598b78276e 100644 --- a/stan/math/opencl/prim/exponential_lcdf.hpp +++ b/stan/math/opencl/prim/exponential_lcdf.hpp @@ -30,7 +30,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t exponential_lcdf( +inline return_type_t exponential_lcdf( const T_y_cl& y, const T_inv_scale_cl& beta) { static constexpr const char* function = "exponential_lcdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/exponential_lpdf.hpp b/stan/math/opencl/prim/exponential_lpdf.hpp index bfe07601bc0..f20517ee955 100644 --- a/stan/math/opencl/prim/exponential_lpdf.hpp +++ b/stan/math/opencl/prim/exponential_lpdf.hpp @@ -44,7 +44,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t exponential_lpdf( +inline return_type_t exponential_lpdf( const T_y_cl& y, const T_inv_scale_cl& beta) { using std::isfinite; static constexpr const char* function = "exponential_lpdf(OpenCL)"; diff --git a/stan/math/opencl/prim/frechet_cdf.hpp b/stan/math/opencl/prim/frechet_cdf.hpp index b06c716c92d..8c422aebb3e 100644 --- a/stan/math/opencl/prim/frechet_cdf.hpp +++ b/stan/math/opencl/prim/frechet_cdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t frechet_cdf( +inline return_type_t frechet_cdf( const T_y_cl& y, const T_shape_cl& alpha, const T_scale_cl& sigma) { static constexpr const char* function = "frechet_cdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/frechet_lccdf.hpp b/stan/math/opencl/prim/frechet_lccdf.hpp index 8dec08db992..7942d421675 100644 --- a/stan/math/opencl/prim/frechet_lccdf.hpp +++ b/stan/math/opencl/prim/frechet_lccdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t frechet_lccdf( +inline return_type_t frechet_lccdf( const T_y_cl& y, const T_shape_cl& alpha, const T_scale_cl& sigma) { static constexpr const char* function = "frechet_lccdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/frechet_lcdf.hpp b/stan/math/opencl/prim/frechet_lcdf.hpp index ec248254f91..b162e27f864 100644 --- a/stan/math/opencl/prim/frechet_lcdf.hpp +++ b/stan/math/opencl/prim/frechet_lcdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t frechet_lcdf( +inline return_type_t frechet_lcdf( const T_y_cl& y, const T_shape_cl& alpha, const T_scale_cl& sigma) { static constexpr const char* function = "frechet_lcdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/frechet_lpdf.hpp b/stan/math/opencl/prim/frechet_lpdf.hpp index b2c9d678a34..608882cbd60 100644 --- a/stan/math/opencl/prim/frechet_lpdf.hpp +++ b/stan/math/opencl/prim/frechet_lpdf.hpp @@ -36,7 +36,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t frechet_lpdf( +inline return_type_t frechet_lpdf( const T_y_cl& y, const T_shape_cl& alpha, const T_scale_cl& sigma) { using std::isfinite; static constexpr const char* function = "frechet_lpdf(OpenCL)"; diff --git a/stan/math/opencl/prim/gamma_lpdf.hpp b/stan/math/opencl/prim/gamma_lpdf.hpp index 46e4c00b478..35af358c658 100644 --- a/stan/math/opencl/prim/gamma_lpdf.hpp +++ b/stan/math/opencl/prim/gamma_lpdf.hpp @@ -44,7 +44,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t gamma_lpdf( +inline 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; diff --git a/stan/math/opencl/prim/gumbel_cdf.hpp b/stan/math/opencl/prim/gumbel_cdf.hpp index 289ccabc376..cd66776b9ab 100644 --- a/stan/math/opencl/prim/gumbel_cdf.hpp +++ b/stan/math/opencl/prim/gumbel_cdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t gumbel_cdf(const T_y_cl& y, +inline return_type_t gumbel_cdf(const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& beta) { static constexpr const char* function = "gumbel_cdf(OpenCL)"; diff --git a/stan/math/opencl/prim/gumbel_lccdf.hpp b/stan/math/opencl/prim/gumbel_lccdf.hpp index 87c6aa7cdaf..002805c6037 100644 --- a/stan/math/opencl/prim/gumbel_lccdf.hpp +++ b/stan/math/opencl/prim/gumbel_lccdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t gumbel_lccdf( +inline return_type_t gumbel_lccdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& beta) { static constexpr const char* function = "gumbel_lccdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/gumbel_lcdf.hpp b/stan/math/opencl/prim/gumbel_lcdf.hpp index 116a3f25119..0d7418f252f 100644 --- a/stan/math/opencl/prim/gumbel_lcdf.hpp +++ b/stan/math/opencl/prim/gumbel_lcdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t gumbel_lcdf( +inline return_type_t gumbel_lcdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& beta) { static constexpr const char* function = "gumbel_lcdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/gumbel_lpdf.hpp b/stan/math/opencl/prim/gumbel_lpdf.hpp index d0d90a7c1bf..abf6e5cf87b 100644 --- a/stan/math/opencl/prim/gumbel_lpdf.hpp +++ b/stan/math/opencl/prim/gumbel_lpdf.hpp @@ -33,7 +33,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t gumbel_lpdf( +inline 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; diff --git a/stan/math/opencl/prim/inv_chi_square_lpdf.hpp b/stan/math/opencl/prim/inv_chi_square_lpdf.hpp index a6ad295c9c2..8afd9292a54 100644 --- a/stan/math/opencl/prim/inv_chi_square_lpdf.hpp +++ b/stan/math/opencl/prim/inv_chi_square_lpdf.hpp @@ -41,7 +41,7 @@ template < bool propto, typename T_y_cl, typename T_dof_cl, require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t inv_chi_square_lpdf(const T_y_cl& y, +inline return_type_t inv_chi_square_lpdf(const T_y_cl& y, const T_dof_cl& nu) { using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/inv_gamma_lpdf.hpp b/stan/math/opencl/prim/inv_gamma_lpdf.hpp index 940199ceea8..d678c8dba58 100644 --- a/stan/math/opencl/prim/inv_gamma_lpdf.hpp +++ b/stan/math/opencl/prim/inv_gamma_lpdf.hpp @@ -36,7 +36,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t inv_gamma_lpdf( +inline 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; diff --git a/stan/math/opencl/prim/logistic_cdf.hpp b/stan/math/opencl/prim/logistic_cdf.hpp index 3546c79e591..7d02536baa3 100644 --- a/stan/math/opencl/prim/logistic_cdf.hpp +++ b/stan/math/opencl/prim/logistic_cdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t logistic_cdf( +inline return_type_t logistic_cdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { static constexpr const char* function = "logistic_cdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/logistic_lccdf.hpp b/stan/math/opencl/prim/logistic_lccdf.hpp index a6b7be3197f..2c9155969cf 100644 --- a/stan/math/opencl/prim/logistic_lccdf.hpp +++ b/stan/math/opencl/prim/logistic_lccdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t logistic_lccdf( +inline return_type_t logistic_lccdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { static constexpr const char* function = "logistic_lccdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/logistic_lcdf.hpp b/stan/math/opencl/prim/logistic_lcdf.hpp index 133de304534..f16c9518bd1 100644 --- a/stan/math/opencl/prim/logistic_lcdf.hpp +++ b/stan/math/opencl/prim/logistic_lcdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t logistic_lcdf( +inline return_type_t logistic_lcdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { static constexpr const char* function = "logistic_lcdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/logistic_lpdf.hpp b/stan/math/opencl/prim/logistic_lpdf.hpp index 82de4eb5efb..cfcfb2b5ba7 100644 --- a/stan/math/opencl/prim/logistic_lpdf.hpp +++ b/stan/math/opencl/prim/logistic_lpdf.hpp @@ -37,7 +37,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t logistic_lpdf( +inline return_type_t logistic_lpdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { using std::isfinite; static constexpr const char* function = "logistic_lpdf(OpenCL)"; diff --git a/stan/math/opencl/prim/lognormal_cdf.hpp b/stan/math/opencl/prim/lognormal_cdf.hpp index c7341cd52db..19781c96639 100644 --- a/stan/math/opencl/prim/lognormal_cdf.hpp +++ b/stan/math/opencl/prim/lognormal_cdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t lognormal_cdf( +inline return_type_t lognormal_cdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { static constexpr const char* function = "lognormal_cdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/lognormal_lccdf.hpp b/stan/math/opencl/prim/lognormal_lccdf.hpp index e9eb8f688f8..af407a42967 100644 --- a/stan/math/opencl/prim/lognormal_lccdf.hpp +++ b/stan/math/opencl/prim/lognormal_lccdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t lognormal_lccdf( +inline return_type_t lognormal_lccdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { static constexpr const char* function = "lognormal_lccdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/lognormal_lcdf.hpp b/stan/math/opencl/prim/lognormal_lcdf.hpp index f7542866189..3f977a24e0a 100644 --- a/stan/math/opencl/prim/lognormal_lcdf.hpp +++ b/stan/math/opencl/prim/lognormal_lcdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t lognormal_lcdf( +inline return_type_t lognormal_lcdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { static constexpr const char* function = "lognormal_lcdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/lognormal_lpdf.hpp b/stan/math/opencl/prim/lognormal_lpdf.hpp index d96b60eb34f..4b06ed80871 100644 --- a/stan/math/opencl/prim/lognormal_lpdf.hpp +++ b/stan/math/opencl/prim/lognormal_lpdf.hpp @@ -37,7 +37,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t lognormal_lpdf( +inline return_type_t lognormal_lpdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { using std::isfinite; static constexpr const char* function = "lognormal_lpdf(OpenCL)"; 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 61743dc3fab..0d752b21b01 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 @@ -65,7 +65,7 @@ template * = nullptr> -return_type_t +inline 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) { diff --git a/stan/math/opencl/prim/normal_cdf.hpp b/stan/math/opencl/prim/normal_cdf.hpp index 3cda89b0a39..2e764e8eb81 100644 --- a/stan/math/opencl/prim/normal_cdf.hpp +++ b/stan/math/opencl/prim/normal_cdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t normal_cdf( +inline return_type_t normal_cdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { static constexpr const char* function = "normal_cdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/normal_id_glm_lpdf.hpp b/stan/math/opencl/prim/normal_id_glm_lpdf.hpp index cf05ff2457b..18ffff1a407 100644 --- a/stan/math/opencl/prim/normal_id_glm_lpdf.hpp +++ b/stan/math/opencl/prim/normal_id_glm_lpdf.hpp @@ -59,7 +59,7 @@ template * = nullptr> -return_type_t +inline return_type_t normal_id_glm_lpdf(const T_y_cl& y, const T_x_cl& x, const T_alpha_cl& alpha, const T_beta_cl& beta, const T_sigma_cl& sigma) { using T_partials_return diff --git a/stan/math/opencl/prim/normal_lccdf.hpp b/stan/math/opencl/prim/normal_lccdf.hpp index a5d6473e71a..775b9a9238b 100644 --- a/stan/math/opencl/prim/normal_lccdf.hpp +++ b/stan/math/opencl/prim/normal_lccdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t normal_lccdf( +inline return_type_t normal_lccdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { static constexpr const char* function = "normal_lccdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/normal_lcdf.hpp b/stan/math/opencl/prim/normal_lcdf.hpp index adca8c171f4..40459eaf384 100644 --- a/stan/math/opencl/prim/normal_lcdf.hpp +++ b/stan/math/opencl/prim/normal_lcdf.hpp @@ -177,7 +177,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t normal_lcdf( +inline return_type_t normal_lcdf( const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& sigma) { static constexpr const char* function = "normal_lcdf(OpenCL)"; using std::isfinite; diff --git a/stan/math/opencl/prim/ordered_logistic_glm_lpmf.hpp b/stan/math/opencl/prim/ordered_logistic_glm_lpmf.hpp index 26d980b4b88..e53124a4e1b 100644 --- a/stan/math/opencl/prim/ordered_logistic_glm_lpmf.hpp +++ b/stan/math/opencl/prim/ordered_logistic_glm_lpmf.hpp @@ -49,7 +49,7 @@ template * = nullptr> -return_type_t ordered_logistic_glm_lpmf( +inline return_type_t ordered_logistic_glm_lpmf( const T_y& y, const T_x& x, const T_beta& beta, const T_cuts& cuts) { using Eigen::Array; using Eigen::Dynamic; diff --git a/stan/math/opencl/prim/pareto_cdf.hpp b/stan/math/opencl/prim/pareto_cdf.hpp index ad996da8a9b..d047ce2847a 100644 --- a/stan/math/opencl/prim/pareto_cdf.hpp +++ b/stan/math/opencl/prim/pareto_cdf.hpp @@ -30,7 +30,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t pareto_cdf( +inline return_type_t pareto_cdf( const T_y_cl& y, const T_scale_cl& y_min, const T_shape_cl& alpha) { static constexpr const char* function = "pareto_cdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/pareto_lccdf.hpp b/stan/math/opencl/prim/pareto_lccdf.hpp index 2cb018ce0a3..72815b94f9d 100644 --- a/stan/math/opencl/prim/pareto_lccdf.hpp +++ b/stan/math/opencl/prim/pareto_lccdf.hpp @@ -30,7 +30,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t pareto_lccdf( +inline return_type_t pareto_lccdf( const T_y_cl& y, const T_scale_cl& y_min, const T_shape_cl& alpha) { static constexpr const char* function = "pareto_lccdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/pareto_lcdf.hpp b/stan/math/opencl/prim/pareto_lcdf.hpp index dd4042ef845..118d6d9a51b 100644 --- a/stan/math/opencl/prim/pareto_lcdf.hpp +++ b/stan/math/opencl/prim/pareto_lcdf.hpp @@ -30,7 +30,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t pareto_lcdf( +inline return_type_t pareto_lcdf( const T_y_cl& y, const T_scale_cl& y_min, const T_shape_cl& alpha) { static constexpr const char* function = "pareto_lcdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/pareto_lpdf.hpp b/stan/math/opencl/prim/pareto_lpdf.hpp index 24248901ab5..fccd07c67e1 100644 --- a/stan/math/opencl/prim/pareto_lpdf.hpp +++ b/stan/math/opencl/prim/pareto_lpdf.hpp @@ -35,7 +35,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t pareto_lpdf( +inline return_type_t pareto_lpdf( const T_y_cl& y, const T_scale_cl& y_min, const T_shape_cl& alpha) { static constexpr const char* function = "pareto_lpdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/pareto_type_2_cdf.hpp b/stan/math/opencl/prim/pareto_type_2_cdf.hpp index f61bc4fec49..20a6e61ce35 100644 --- a/stan/math/opencl/prim/pareto_type_2_cdf.hpp +++ b/stan/math/opencl/prim/pareto_type_2_cdf.hpp @@ -33,7 +33,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t pareto_type_2_cdf( +inline return_type_t 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 constexpr const char* function = "pareto_type_2_cdf(OpenCL)"; diff --git a/stan/math/opencl/prim/pareto_type_2_lccdf.hpp b/stan/math/opencl/prim/pareto_type_2_lccdf.hpp index 5ec0e2f89ce..f0412db84f4 100644 --- a/stan/math/opencl/prim/pareto_type_2_lccdf.hpp +++ b/stan/math/opencl/prim/pareto_type_2_lccdf.hpp @@ -33,7 +33,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t pareto_type_2_lccdf( +inline return_type_t 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 constexpr const char* function = "pareto_type_2_lccdf(OpenCL)"; diff --git a/stan/math/opencl/prim/pareto_type_2_lcdf.hpp b/stan/math/opencl/prim/pareto_type_2_lcdf.hpp index a5ad8e7cf3a..b3205933ab1 100644 --- a/stan/math/opencl/prim/pareto_type_2_lcdf.hpp +++ b/stan/math/opencl/prim/pareto_type_2_lcdf.hpp @@ -33,7 +33,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t pareto_type_2_lcdf( +inline return_type_t 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 constexpr const char* function = "pareto_type_2_lcdf(OpenCL)"; diff --git a/stan/math/opencl/prim/pareto_type_2_lpdf.hpp b/stan/math/opencl/prim/pareto_type_2_lpdf.hpp index 61d63d41333..9f15409181a 100644 --- a/stan/math/opencl/prim/pareto_type_2_lpdf.hpp +++ b/stan/math/opencl/prim/pareto_type_2_lpdf.hpp @@ -36,7 +36,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t pareto_type_2_lpdf( +inline return_type_t 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 constexpr const char* function = "pareto_type_2_lpdf(OpenCL)"; diff --git a/stan/math/opencl/prim/poisson_log_glm_lpmf.hpp b/stan/math/opencl/prim/poisson_log_glm_lpmf.hpp index 2011deeaf7a..fbded9eb7d4 100644 --- a/stan/math/opencl/prim/poisson_log_glm_lpmf.hpp +++ b/stan/math/opencl/prim/poisson_log_glm_lpmf.hpp @@ -51,7 +51,7 @@ template * = nullptr> -return_type_t poisson_log_glm_lpmf( +inline return_type_t 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 constexpr const char* function = "poisson_log_glm_lpmf(OpenCL)"; diff --git a/stan/math/opencl/prim/poisson_log_lpmf.hpp b/stan/math/opencl/prim/poisson_log_lpmf.hpp index 9fe2e19a8ef..42713f5e6b2 100644 --- a/stan/math/opencl/prim/poisson_log_lpmf.hpp +++ b/stan/math/opencl/prim/poisson_log_lpmf.hpp @@ -28,7 +28,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t poisson_log_lpmf(const T_n_cl& n, +inline return_type_t poisson_log_lpmf(const T_n_cl& n, const T_log_rate_cl& alpha) { static constexpr const char* function = "poisson_log_lpmf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/poisson_lpmf.hpp b/stan/math/opencl/prim/poisson_lpmf.hpp index 69a5ababdce..2f7953a794a 100644 --- a/stan/math/opencl/prim/poisson_lpmf.hpp +++ b/stan/math/opencl/prim/poisson_lpmf.hpp @@ -28,7 +28,7 @@ template < bool propto, typename T_n_cl, typename T_rate_cl, require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t poisson_lpmf(const T_n_cl& n, +inline return_type_t poisson_lpmf(const T_n_cl& n, const T_rate_cl& lambda) { static constexpr const char* function = "poisson_lpmf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/prod.hpp b/stan/math/opencl/prim/prod.hpp index dc8b22d5d6e..8ca63878155 100644 --- a/stan/math/opencl/prim/prod.hpp +++ b/stan/math/opencl/prim/prod.hpp @@ -18,7 +18,7 @@ namespace math { */ template * = nullptr> -value_type_t prod(const T& m) { +inline value_type_t prod(const T& m) { if constexpr (is_matrix_cl::value) { if (m.size() < 1000) { // for small matrices running another kernel is not worth it diff --git a/stan/math/opencl/prim/rayleigh_cdf.hpp b/stan/math/opencl/prim/rayleigh_cdf.hpp index e8abefe60fa..7e9895176b0 100644 --- a/stan/math/opencl/prim/rayleigh_cdf.hpp +++ b/stan/math/opencl/prim/rayleigh_cdf.hpp @@ -28,7 +28,7 @@ template < typename T_y_cl, typename T_scale_cl, require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t rayleigh_cdf(const T_y_cl& y, +inline return_type_t rayleigh_cdf(const T_y_cl& y, const T_scale_cl& sigma) { static constexpr const char* function = "rayleigh_cdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/rayleigh_lccdf.hpp b/stan/math/opencl/prim/rayleigh_lccdf.hpp index ab6fb33877c..77fd46da4d1 100644 --- a/stan/math/opencl/prim/rayleigh_lccdf.hpp +++ b/stan/math/opencl/prim/rayleigh_lccdf.hpp @@ -28,7 +28,7 @@ template < typename T_y_cl, typename T_scale_cl, require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t rayleigh_lccdf(const T_y_cl& y, +inline return_type_t rayleigh_lccdf(const T_y_cl& y, const T_scale_cl& sigma) { static constexpr const char* function = "rayleigh_lccdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/rayleigh_lcdf.hpp b/stan/math/opencl/prim/rayleigh_lcdf.hpp index 5a8187063ee..78bf253f51e 100644 --- a/stan/math/opencl/prim/rayleigh_lcdf.hpp +++ b/stan/math/opencl/prim/rayleigh_lcdf.hpp @@ -28,7 +28,7 @@ template < typename T_y_cl, typename T_scale_cl, require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t rayleigh_lcdf(const T_y_cl& y, +inline return_type_t rayleigh_lcdf(const T_y_cl& y, const T_scale_cl& sigma) { static constexpr const char* function = "rayleigh_lcdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/rayleigh_lpdf.hpp b/stan/math/opencl/prim/rayleigh_lpdf.hpp index 478c92b7daf..370a07079f9 100644 --- a/stan/math/opencl/prim/rayleigh_lpdf.hpp +++ b/stan/math/opencl/prim/rayleigh_lpdf.hpp @@ -28,7 +28,7 @@ template < bool propto, typename T_y_cl, typename T_scale_cl, require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t rayleigh_lpdf(const T_y_cl& y, +inline return_type_t rayleigh_lpdf(const T_y_cl& y, const T_scale_cl& sigma) { static constexpr const char* function = "rayleigh_lpdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/rep_array.hpp b/stan/math/opencl/prim/rep_array.hpp index f170d6f5739..a7b9db7fc90 100644 --- a/stan/math/opencl/prim/rep_array.hpp +++ b/stan/math/opencl/prim/rep_array.hpp @@ -29,7 +29,7 @@ template < require_any_t< is_matrix_cl, math::conjunction, is_matrix_cl>>>* = nullptr> -auto rep_array(const scalar_type_t& x, int n) { +inline auto rep_array(const scalar_type_t& x, int n) { return rep_matrix(x, n, 1); } diff --git a/stan/math/opencl/prim/rep_row_vector.hpp b/stan/math/opencl/prim/rep_row_vector.hpp index c210ef3a642..118eebf7371 100644 --- a/stan/math/opencl/prim/rep_row_vector.hpp +++ b/stan/math/opencl/prim/rep_row_vector.hpp @@ -28,7 +28,7 @@ template < require_any_t< is_matrix_cl, math::conjunction, is_matrix_cl>>>* = nullptr> -auto rep_row_vector(const scalar_type_t& x, int n) { +inline auto rep_row_vector(const scalar_type_t& x, int n) { return rep_matrix(x, 1, n); } diff --git a/stan/math/opencl/prim/rep_vector.hpp b/stan/math/opencl/prim/rep_vector.hpp index efafc90db44..bd62290e6ee 100644 --- a/stan/math/opencl/prim/rep_vector.hpp +++ b/stan/math/opencl/prim/rep_vector.hpp @@ -28,7 +28,7 @@ template < require_any_t< is_matrix_cl, math::conjunction, is_matrix_cl>>>* = nullptr> -auto rep_vector(const scalar_type_t& x, int n) { +inline auto rep_vector(const scalar_type_t& x, int n) { return rep_matrix(x, n, 1); } diff --git a/stan/math/opencl/prim/sign.hpp b/stan/math/opencl/prim/sign.hpp index 39bf4398071..53c1bab9419 100644 --- a/stan/math/opencl/prim/sign.hpp +++ b/stan/math/opencl/prim/sign.hpp @@ -15,7 +15,7 @@ namespace math { */ template * = nullptr> -auto sign(const T& x) { +inline auto sign(const T& x) { return select(x == 0, 0, select(x < 0, -1, 1)); } diff --git a/stan/math/opencl/prim/skew_double_exponential_cdf.hpp b/stan/math/opencl/prim/skew_double_exponential_cdf.hpp index 54ca316d072..f7dc0489b80 100644 --- a/stan/math/opencl/prim/skew_double_exponential_cdf.hpp +++ b/stan/math/opencl/prim/skew_double_exponential_cdf.hpp @@ -33,7 +33,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t +inline return_type_t 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 constexpr const char* function = "skew_double_exponential_cdf(OpenCL)"; diff --git a/stan/math/opencl/prim/skew_double_exponential_lccdf.hpp b/stan/math/opencl/prim/skew_double_exponential_lccdf.hpp index bc25f1fbc58..e4c7452a2cf 100644 --- a/stan/math/opencl/prim/skew_double_exponential_lccdf.hpp +++ b/stan/math/opencl/prim/skew_double_exponential_lccdf.hpp @@ -33,7 +33,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t +inline 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) { diff --git a/stan/math/opencl/prim/skew_double_exponential_lcdf.hpp b/stan/math/opencl/prim/skew_double_exponential_lcdf.hpp index 74210cd4ecb..54b316657a6 100644 --- a/stan/math/opencl/prim/skew_double_exponential_lcdf.hpp +++ b/stan/math/opencl/prim/skew_double_exponential_lcdf.hpp @@ -33,7 +33,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t +inline 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) { diff --git a/stan/math/opencl/prim/skew_double_exponential_lpdf.hpp b/stan/math/opencl/prim/skew_double_exponential_lpdf.hpp index 8ac28ce67ee..e6c46abc558 100644 --- a/stan/math/opencl/prim/skew_double_exponential_lpdf.hpp +++ b/stan/math/opencl/prim/skew_double_exponential_lpdf.hpp @@ -36,7 +36,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t +inline 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) { diff --git a/stan/math/opencl/prim/std_normal_cdf.hpp b/stan/math/opencl/prim/std_normal_cdf.hpp index 2161094d25f..5a0cd0c1316 100644 --- a/stan/math/opencl/prim/std_normal_cdf.hpp +++ b/stan/math/opencl/prim/std_normal_cdf.hpp @@ -23,7 +23,7 @@ namespace math { template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t std_normal_cdf(const T_y_cl& y) { +inline return_type_t std_normal_cdf(const T_y_cl& y) { static constexpr const char* function = "std_normal_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/std_normal_lccdf.hpp b/stan/math/opencl/prim/std_normal_lccdf.hpp index 59f42b33f9b..7a3c90c7089 100644 --- a/stan/math/opencl/prim/std_normal_lccdf.hpp +++ b/stan/math/opencl/prim/std_normal_lccdf.hpp @@ -24,7 +24,7 @@ namespace math { template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t std_normal_lccdf(const T_y_cl& y) { +inline return_type_t std_normal_lccdf(const T_y_cl& y) { static constexpr const char* function = "std_normal_lccdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/std_normal_lcdf.hpp b/stan/math/opencl/prim/std_normal_lcdf.hpp index 2a6c0efbfdb..1f9f50d08c0 100644 --- a/stan/math/opencl/prim/std_normal_lcdf.hpp +++ b/stan/math/opencl/prim/std_normal_lcdf.hpp @@ -178,7 +178,7 @@ const char opencl_std_normal_lcdf_dnlcdf[] = STRINGIFY( template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t std_normal_lcdf(const T_y_cl& y) { +inline return_type_t std_normal_lcdf(const T_y_cl& y) { static constexpr const char* function = "std_normal_lcdf(OpenCL)"; using std::isfinite; using std::isnan; diff --git a/stan/math/opencl/prim/sum.hpp b/stan/math/opencl/prim/sum.hpp index 8d65436c8d1..d9175d45516 100644 --- a/stan/math/opencl/prim/sum.hpp +++ b/stan/math/opencl/prim/sum.hpp @@ -18,7 +18,7 @@ namespace math { */ template * = nullptr> -value_type_t sum(const T& m) { +inline value_type_t sum(const T& m) { if constexpr (is_matrix_cl::value) { if (m.size() < 1000) { // for small matrices running another kernel is not worth it diff --git a/stan/math/opencl/prim/trace.hpp b/stan/math/opencl/prim/trace.hpp index 0693b2c3a9a..fede30166f3 100644 --- a/stan/math/opencl/prim/trace.hpp +++ b/stan/math/opencl/prim/trace.hpp @@ -19,7 +19,7 @@ namespace math { */ template * = nullptr> -value_type_t trace(const T& m) { +inline value_type_t trace(const T& m) { return sum(diagonal(m)); } diff --git a/stan/math/opencl/prim/uniform_cdf.hpp b/stan/math/opencl/prim/uniform_cdf.hpp index 3f940ae62c2..b6e24075807 100644 --- a/stan/math/opencl/prim/uniform_cdf.hpp +++ b/stan/math/opencl/prim/uniform_cdf.hpp @@ -30,7 +30,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t uniform_cdf(const T_y_cl& y, +inline return_type_t uniform_cdf(const T_y_cl& y, const T_low_cl& alpha, const T_high_cl& beta) { static constexpr const char* function = "uniform_cdf(OpenCL)"; diff --git a/stan/math/opencl/prim/uniform_lccdf.hpp b/stan/math/opencl/prim/uniform_lccdf.hpp index 99c0e886437..19a62e4e90e 100644 --- a/stan/math/opencl/prim/uniform_lccdf.hpp +++ b/stan/math/opencl/prim/uniform_lccdf.hpp @@ -30,7 +30,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t uniform_lccdf( +inline return_type_t uniform_lccdf( const T_y_cl& y, const T_low_cl& alpha, const T_high_cl& beta) { static constexpr const char* function = "uniform_lccdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/uniform_lcdf.hpp b/stan/math/opencl/prim/uniform_lcdf.hpp index 305d575b6c7..f3787e1e7ed 100644 --- a/stan/math/opencl/prim/uniform_lcdf.hpp +++ b/stan/math/opencl/prim/uniform_lcdf.hpp @@ -30,7 +30,7 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t uniform_lcdf(const T_y_cl& y, +inline return_type_t uniform_lcdf(const T_y_cl& y, const T_low_cl& alpha, const T_high_cl& beta) { static constexpr const char* function = "uniform_lcdf(OpenCL)"; diff --git a/stan/math/opencl/prim/weibull_cdf.hpp b/stan/math/opencl/prim/weibull_cdf.hpp index 69c96b624f6..2788ed8842e 100644 --- a/stan/math/opencl/prim/weibull_cdf.hpp +++ b/stan/math/opencl/prim/weibull_cdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t weibull_cdf( +inline return_type_t weibull_cdf( const T_y_cl& y, const T_shape_cl& alpha, const T_scale_cl& sigma) { static constexpr const char* function = "weibull_cdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/weibull_lccdf.hpp b/stan/math/opencl/prim/weibull_lccdf.hpp index 7cc45b759e1..8a0563490f7 100644 --- a/stan/math/opencl/prim/weibull_lccdf.hpp +++ b/stan/math/opencl/prim/weibull_lccdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t weibull_lccdf( +inline return_type_t weibull_lccdf( const T_y_cl& y, const T_shape_cl& alpha, const T_scale_cl& sigma) { static constexpr const char* function = "weibull_lccdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/weibull_lcdf.hpp b/stan/math/opencl/prim/weibull_lcdf.hpp index 5b0dfb0425a..f805f7579ed 100644 --- a/stan/math/opencl/prim/weibull_lcdf.hpp +++ b/stan/math/opencl/prim/weibull_lcdf.hpp @@ -31,7 +31,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -return_type_t weibull_lcdf( +inline return_type_t weibull_lcdf( const T_y_cl& y, const T_shape_cl& alpha, const T_scale_cl& sigma) { static constexpr const char* function = "weibull_lcdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/qr_decomposition.hpp b/stan/math/opencl/qr_decomposition.hpp index 6392b43a342..2a32ef99e2e 100644 --- a/stan/math/opencl/qr_decomposition.hpp +++ b/stan/math/opencl/qr_decomposition.hpp @@ -31,7 +31,7 @@ namespace math { * @param r Block size. Optimal value depends on the hardware. */ template -void qr_decomposition_cl(const matrix_cl& A, matrix_cl& Q, +inline void qr_decomposition_cl(const matrix_cl& A, matrix_cl& Q, matrix_cl& R, int r = 100) { using std::copysign; using std::sqrt; diff --git a/stan/math/opencl/rev/adjoint_results.hpp b/stan/math/opencl/rev/adjoint_results.hpp index 4a2dede57d0..89b34ae6db4 100644 --- a/stan/math/opencl/rev/adjoint_results.hpp +++ b/stan/math/opencl/rev/adjoint_results.hpp @@ -148,7 +148,7 @@ class adjoint_results_cl : protected results_cl { * @param results results that will be calculated. */ template -adjoint_results_cl adjoint_results(T_results&&... results) { +inline adjoint_results_cl adjoint_results(T_results&&... results) { return adjoint_results_cl(std::forward(results)...); } diff --git a/stan/math/opencl/rev/arena_matrix_cl.hpp b/stan/math/opencl/rev/arena_matrix_cl.hpp index 6b5026822ba..37ab828c880 100644 --- a/stan/math/opencl/rev/arena_matrix_cl.hpp +++ b/stan/math/opencl/rev/arena_matrix_cl.hpp @@ -145,7 +145,7 @@ class arena_matrix_cl : public matrix_cl_base { #undef ARENA_MATRIX_CL_CONST_FUNCTION_WRAPPER }; template -matrix_cl::matrix_cl(const arena_matrix_cl& A) +inline matrix_cl::matrix_cl(const arena_matrix_cl& A) // works like a move constructor, except it does not modify `a` : buffer_cl_(A.impl_->buffer_cl_), rows_(A.impl_->rows_), diff --git a/stan/math/opencl/rev/copy.hpp b/stan/math/opencl/rev/copy.hpp index dbd2994c262..50201e3e565 100644 --- a/stan/math/opencl/rev/copy.hpp +++ b/stan/math/opencl/rev/copy.hpp @@ -206,7 +206,7 @@ inline T_dst from_matrix_cl(const var_value& a) { * @return var with a copy of the data on the host */ template * = nullptr> -auto from_matrix_cl(const var_value& src) { +inline auto from_matrix_cl(const var_value& src) { return from_matrix_cl>(src); } diff --git a/stan/math/opencl/rev/to_arena.hpp b/stan/math/opencl/rev/to_arena.hpp index ce4fdbdca9f..6fc0c9bc475 100644 --- a/stan/math/opencl/rev/to_arena.hpp +++ b/stan/math/opencl/rev/to_arena.hpp @@ -22,7 +22,7 @@ namespace math { * @return argument */ template * = nullptr> -arena_t to_arena(const T& a) { +inline arena_t to_arena(const T& a) { arena_t res(a.buffer(), a.rows(), a.cols(), a.view()); for (cl::Event e : a.read_events()) { res.add_read_event(e); diff --git a/stan/math/opencl/symmetric_eigensolver.hpp b/stan/math/opencl/symmetric_eigensolver.hpp index d1878fe43c8..a13d6ce8df4 100644 --- a/stan/math/opencl/symmetric_eigensolver.hpp +++ b/stan/math/opencl/symmetric_eigensolver.hpp @@ -10,7 +10,7 @@ namespace stan { namespace math { template -void symmetric_eigensolver(const matrix_cl& A, +inline void symmetric_eigensolver(const matrix_cl& A, matrix_cl& eigenvalues, matrix_cl& eigenvectors) { matrix_cl packed; diff --git a/stan/math/prim/constraint/cholesky_factor_free.hpp b/stan/math/prim/constraint/cholesky_factor_free.hpp index 7bd879033f6..1ef81d0bfff 100644 --- a/stan/math/prim/constraint/cholesky_factor_free.hpp +++ b/stan/math/prim/constraint/cholesky_factor_free.hpp @@ -23,7 +23,7 @@ namespace math { * @throw std::domain_error If the matrix is not a Cholesky factor. */ template * = nullptr> -Eigen::Matrix, Eigen::Dynamic, 1> cholesky_factor_free( +inline Eigen::Matrix, Eigen::Dynamic, 1> cholesky_factor_free( const T& y) { using std::log; diff --git a/stan/math/prim/constraint/corr_matrix_free.hpp b/stan/math/prim/constraint/corr_matrix_free.hpp index 87479eb9e34..bf3ac24a6ff 100644 --- a/stan/math/prim/constraint/corr_matrix_free.hpp +++ b/stan/math/prim/constraint/corr_matrix_free.hpp @@ -31,7 +31,7 @@ namespace math { * factor_cov_matrix() on log scale are unconstrained. */ template * = nullptr> -Eigen::Matrix, Eigen::Dynamic, 1> corr_matrix_free(const T& y) { +inline Eigen::Matrix, Eigen::Dynamic, 1> corr_matrix_free(const T& y) { using Eigen::Array; using Eigen::Dynamic; diff --git a/stan/math/prim/constraint/cov_matrix_free.hpp b/stan/math/prim/constraint/cov_matrix_free.hpp index 6324d2c61e9..153681a9494 100644 --- a/stan/math/prim/constraint/cov_matrix_free.hpp +++ b/stan/math/prim/constraint/cov_matrix_free.hpp @@ -35,7 +35,7 @@ namespace math { * has zero dimensionality, or has a non-positive diagonal element. */ template * = nullptr> -Eigen::Matrix, Eigen::Dynamic, 1> cov_matrix_free(const T& y) { +inline Eigen::Matrix, Eigen::Dynamic, 1> cov_matrix_free(const T& y) { const auto& y_ref = to_ref(y); check_square("cov_matrix_free", "y", y_ref); check_nonzero_size("cov_matrix_free", "y", y_ref); diff --git a/stan/math/prim/constraint/cov_matrix_free_lkj.hpp b/stan/math/prim/constraint/cov_matrix_free_lkj.hpp index a2fa9764a19..ba2486fd3bf 100644 --- a/stan/math/prim/constraint/cov_matrix_free_lkj.hpp +++ b/stan/math/prim/constraint/cov_matrix_free_lkj.hpp @@ -28,7 +28,7 @@ namespace math { * factorized by factor_cov_matrix() */ template * = nullptr> -Eigen::Matrix, Eigen::Dynamic, 1> cov_matrix_free_lkj( +inline Eigen::Matrix, Eigen::Dynamic, 1> cov_matrix_free_lkj( const T& y) { using Eigen::Array; using Eigen::Dynamic; @@ -57,7 +57,7 @@ Eigen::Matrix, Eigen::Dynamic, 1> cov_matrix_free_lkj( * @param x The standard vector to untransform. */ template * = nullptr> -auto cov_matrix_free_lkj(T&& x) { +inline auto cov_matrix_free_lkj(T&& x) { return apply_vector_unary::apply(std::forward(x), [](auto&& v) { return cov_matrix_free_lkj(std::forward(v)); }); diff --git a/stan/math/prim/constraint/ordered_free.hpp b/stan/math/prim/constraint/ordered_free.hpp index 03058fb57cf..dabf83aed84 100644 --- a/stan/math/prim/constraint/ordered_free.hpp +++ b/stan/math/prim/constraint/ordered_free.hpp @@ -25,7 +25,7 @@ namespace math { * ordered scalars. */ template * = nullptr> -plain_type_t ordered_free(const EigVec& y) { +inline plain_type_t ordered_free(const EigVec& y) { const auto& y_ref = to_ref(y); check_ordered("stan::math::ordered_free", "Ordered variable", y_ref); using std::log; diff --git a/stan/math/prim/err/check_cholesky_factor.hpp b/stan/math/prim/err/check_cholesky_factor.hpp index 8213b4304ca..a845e745748 100644 --- a/stan/math/prim/err/check_cholesky_factor.hpp +++ b/stan/math/prim/err/check_cholesky_factor.hpp @@ -58,7 +58,7 @@ inline void check_cholesky_factor(const char* function, const char* name, * element in matrix is `NaN` */ template * = nullptr> -void check_cholesky_factor(const char* function, const char* name, +inline void check_cholesky_factor(const char* function, const char* name, const StdVec& y) { for (size_t i = 0; i < y.size(); ++i) { check_cholesky_factor(function, internal::make_iter_name(name, i).c_str(), diff --git a/stan/math/prim/err/check_cholesky_factor_corr.hpp b/stan/math/prim/err/check_cholesky_factor_corr.hpp index 1c7ff949485..28d59a00eed 100644 --- a/stan/math/prim/err/check_cholesky_factor_corr.hpp +++ b/stan/math/prim/err/check_cholesky_factor_corr.hpp @@ -34,7 +34,7 @@ namespace math { * element in matrix is NaN */ template * = nullptr> -void check_cholesky_factor_corr(const char* function, const char* name, +inline void check_cholesky_factor_corr(const char* function, const char* name, const Mat& y) { const auto& y_ref = to_ref(value_of_rec(y)); check_square(function, name, y_ref); @@ -66,7 +66,7 @@ void check_cholesky_factor_corr(const char* function, const char* name, * element in matrix is NaN */ template * = nullptr> -void check_cholesky_factor_corr(const char* function, const char* name, +inline void check_cholesky_factor_corr(const char* function, const char* name, const StdVec& y) { for (size_t i = 0; i < y.size(); ++i) { check_cholesky_factor_corr(function, diff --git a/stan/math/prim/err/check_corr_matrix.hpp b/stan/math/prim/err/check_corr_matrix.hpp index 08e026ff944..7be67bad471 100644 --- a/stan/math/prim/err/check_corr_matrix.hpp +++ b/stan/math/prim/err/check_corr_matrix.hpp @@ -73,7 +73,7 @@ inline void check_corr_matrix(const char* function, const char* name, * 1, not positive definite, or any of the elements are `NaN` */ template * = nullptr> -void check_corr_matrix(const char* function, const char* name, +inline void check_corr_matrix(const char* function, const char* name, const StdVec& y) { for (auto&& y_i : y) { check_corr_matrix(function, name, y_i); diff --git a/stan/math/prim/err/check_cov_matrix.hpp b/stan/math/prim/err/check_cov_matrix.hpp index 4e4c402cb2c..17611949acf 100644 --- a/stan/math/prim/err/check_cov_matrix.hpp +++ b/stan/math/prim/err/check_cov_matrix.hpp @@ -49,7 +49,7 @@ inline void check_cov_matrix(const char* function, const char* name, * not positive definite, or if any element of the matrix is `NaN` */ template * = nullptr> -void check_cov_matrix(const char* function, const char* name, const StdVec& y) { +inline void check_cov_matrix(const char* function, const char* name, const StdVec& y) { for (auto&& y_i : y) { check_cov_matrix(function, name, y_i); } diff --git a/stan/math/prim/err/check_ordered.hpp b/stan/math/prim/err/check_ordered.hpp index 88d5baa5316..9ec4119a5c2 100644 --- a/stan/math/prim/err/check_ordered.hpp +++ b/stan/math/prim/err/check_ordered.hpp @@ -27,7 +27,7 @@ namespace math { */ template * = nullptr, require_not_std_vector_t* = nullptr> -void check_ordered(const char* function, const char* name, const T_y& y) { +inline void check_ordered(const char* function, const char* name, const T_y& y) { const auto& y_ref = to_ref(value_of_rec(y)); for (Eigen::Index n = 1; n < y_ref.size(); n++) { if (!(y_ref[n] > y_ref[n - 1])) { @@ -58,7 +58,7 @@ void check_ordered(const char* function, const char* name, const T_y& y) { * are duplicated values, or if any element is `NaN` */ template * = nullptr> -void check_ordered(const char* function, const char* name, const T_y& y) { +inline void check_ordered(const char* function, const char* name, const T_y& y) { for (size_t n = 1; n < y.size(); n++) { if (!(y[n] > y[n - 1])) { [&]() STAN_COLD_PATH { @@ -89,7 +89,7 @@ void check_ordered(const char* function, const char* name, const T_y& y) { */ template * = nullptr, require_not_vt_stan_scalar* = nullptr> -void check_ordered(const char* function, const char* name, const T_y& y) { +inline void check_ordered(const char* function, const char* name, const T_y& y) { for (size_t i = 0; i < y.size(); ++i) { check_ordered(function, internal::make_iter_name(name, i).c_str(), y[i]); } diff --git a/stan/math/prim/err/check_positive_ordered.hpp b/stan/math/prim/err/check_positive_ordered.hpp index cc36790af5f..deef6f63cd5 100644 --- a/stan/math/prim/err/check_positive_ordered.hpp +++ b/stan/math/prim/err/check_positive_ordered.hpp @@ -28,7 +28,7 @@ namespace math { */ template * = nullptr, require_not_std_vector_t* = nullptr> -void check_positive_ordered(const char* function, const char* name, +inline void check_positive_ordered(const char* function, const char* name, const Vec& y) { if (y.size() == 0) { return; @@ -60,7 +60,7 @@ void check_positive_ordered(const char* function, const char* name, * `NaN` */ template * = nullptr> -void check_positive_ordered(const char* function, const char* name, +inline void check_positive_ordered(const char* function, const char* name, const StdVec& y) { for (size_t i = 0; i < y.size(); ++i) { check_positive_ordered(function, internal::make_iter_name(name, i).c_str(), diff --git a/stan/math/prim/err/check_simplex.hpp b/stan/math/prim/err/check_simplex.hpp index 67b6bb831c1..ace9b1590eb 100644 --- a/stan/math/prim/err/check_simplex.hpp +++ b/stan/math/prim/err/check_simplex.hpp @@ -31,7 +31,7 @@ namespace math { * is `NaN` */ template * = nullptr> -void check_simplex(const char* function, const char* name, const T& theta) { +inline void check_simplex(const char* function, const char* name, const T& theta) { using std::fabs; check_nonzero_size(function, name, theta); auto&& theta_ref = to_ref(value_of_rec(theta)); @@ -78,7 +78,7 @@ void check_simplex(const char* function, const char* name, const T& theta) { * is `NaN` */ template * = nullptr> -void check_simplex(const char* function, const char* name, const T& theta) { +inline void check_simplex(const char* function, const char* name, const T& theta) { for (size_t i = 0; i < theta.size(); ++i) { check_simplex(function, internal::make_iter_name(name, i).c_str(), theta[i]); diff --git a/stan/math/prim/err/check_sorted.hpp b/stan/math/prim/err/check_sorted.hpp index 9a345fb2fec..63731827f18 100644 --- a/stan/math/prim/err/check_sorted.hpp +++ b/stan/math/prim/err/check_sorted.hpp @@ -23,7 +23,7 @@ namespace math { * not sorted, or if any element is NaN. */ template * = nullptr> -void check_sorted(const char* function, const char* name, const EigVec& y) { +inline void check_sorted(const char* function, const char* name, const EigVec& y) { const auto& y_ref = to_ref(y); for (Eigen::Index n = 1; n < y_ref.size(); n++) { if (!(y_ref[n] >= y_ref[n - 1])) { @@ -53,7 +53,7 @@ void check_sorted(const char* function, const char* name, const EigVec& y) { * is NaN. */ template -void check_sorted(const char* function, const char* name, +inline void check_sorted(const char* function, const char* name, const std::vector& y) { for (size_t n = 1; n < y.size(); n++) { if (!(y[n] >= y[n - 1])) { diff --git a/stan/math/prim/err/check_stochastic_column.hpp b/stan/math/prim/err/check_stochastic_column.hpp index c410fef398a..e2116621f2f 100644 --- a/stan/math/prim/err/check_stochastic_column.hpp +++ b/stan/math/prim/err/check_stochastic_column.hpp @@ -32,7 +32,7 @@ namespace math { * if any element is `NaN` */ template * = nullptr> -void check_stochastic_column(const char* function, const char* name, +inline void check_stochastic_column(const char* function, const char* name, const T& theta) { using std::fabs; check_nonzero_size(function, name, theta); @@ -86,7 +86,7 @@ void check_stochastic_column(const char* function, const char* name, * matrices or if any element is `NaN` */ template * = nullptr> -void check_stochastic_column(const char* function, const char* name, +inline void check_stochastic_column(const char* function, const char* name, const T& theta) { for (size_t i = 0; i < theta.size(); ++i) { check_stochastic_column(function, internal::make_iter_name(name, i).c_str(), diff --git a/stan/math/prim/err/check_stochastic_row.hpp b/stan/math/prim/err/check_stochastic_row.hpp index fa917ae2a63..6d705a1d3f2 100644 --- a/stan/math/prim/err/check_stochastic_row.hpp +++ b/stan/math/prim/err/check_stochastic_row.hpp @@ -32,7 +32,7 @@ namespace math { * any element is `NaN` */ template * = nullptr> -void check_stochastic_row(const char* function, const char* name, +inline void check_stochastic_row(const char* function, const char* name, const T& theta) { using std::fabs; check_nonzero_size(function, name, theta); @@ -86,7 +86,7 @@ void check_stochastic_row(const char* function, const char* name, * stochastic matrix or if any element is `NaN` */ template * = nullptr> -void check_stochastic_row(const char* function, const char* name, +inline void check_stochastic_row(const char* function, const char* name, const T& theta) { for (size_t i = 0; i < theta.size(); ++i) { check_stochastic_row(function, internal::make_iter_name(name, i).c_str(), diff --git a/stan/math/prim/err/check_sum_to_zero.hpp b/stan/math/prim/err/check_sum_to_zero.hpp index b384f5cc778..0097fc4429f 100644 --- a/stan/math/prim/err/check_sum_to_zero.hpp +++ b/stan/math/prim/err/check_sum_to_zero.hpp @@ -28,7 +28,7 @@ namespace math { * @throw `std::domain_error` if the vector does not sum to zero */ template * = nullptr> -void check_sum_to_zero(const char* function, const char* name, const T& theta) { +inline void check_sum_to_zero(const char* function, const char* name, const T& theta) { using std::fabs; // the size-zero case is technically a valid sum-to-zero vector, // but it cannot be unconstrained to anything @@ -60,7 +60,7 @@ void check_sum_to_zero(const char* function, const char* name, const T& theta) { * @throw `std::domain_error` if the vector does not sum to zero */ template * = nullptr> -void check_sum_to_zero(const char* function, const char* name, const T& theta) { +inline void check_sum_to_zero(const char* function, const char* name, const T& theta) { for (size_t i = 0; i < theta.size(); ++i) { check_sum_to_zero(function, internal::make_iter_name(name, i).c_str(), theta[i]); diff --git a/stan/math/prim/err/check_unit_vector.hpp b/stan/math/prim/err/check_unit_vector.hpp index fd165bf3dbe..7781379e486 100644 --- a/stan/math/prim/err/check_unit_vector.hpp +++ b/stan/math/prim/err/check_unit_vector.hpp @@ -34,7 +34,7 @@ namespace math { */ template * = nullptr, require_not_std_vector_t* = nullptr> -void check_unit_vector(const char* function, const char* name, +inline void check_unit_vector(const char* function, const char* name, const Vec& theta) { check_nonzero_size(function, name, theta); using std::fabs; @@ -64,7 +64,7 @@ void check_unit_vector(const char* function, const char* name, * element is `NaN` */ template * = nullptr> -void check_unit_vector(const char* function, const char* name, +inline void check_unit_vector(const char* function, const char* name, const StdVec& theta) { for (size_t i = 0; i < theta.size(); ++i) { check_unit_vector(function, internal::make_iter_name(name, i).c_str(), diff --git a/stan/math/prim/err/elementwise_check.hpp b/stan/math/prim/err/elementwise_check.hpp index bd9f4a7aa74..c88364f64d5 100644 --- a/stan/math/prim/err/elementwise_check.hpp +++ b/stan/math/prim/err/elementwise_check.hpp @@ -85,7 +85,7 @@ inline void pipe_in(std::stringstream& ss, Arg0 arg0, const Args... args) { * @param args arguments */ template -void elementwise_throw_domain_error(const Args... args) { +inline void elementwise_throw_domain_error(const Args... args) { std::stringstream ss; pipe_in(ss, args...); throw std::domain_error(ss.str()); diff --git a/stan/math/prim/fun/autocorrelation.hpp b/stan/math/prim/fun/autocorrelation.hpp index e9b7c4a4e67..5647d61de72 100644 --- a/stan/math/prim/fun/autocorrelation.hpp +++ b/stan/math/prim/fun/autocorrelation.hpp @@ -59,7 +59,7 @@ inline size_t fft_next_good_size(size_t N) { * @param fft FFT engine instance. */ template -void autocorrelation(const std::vector& y, std::vector& ac, +inline void autocorrelation(const std::vector& y, std::vector& ac, Eigen::FFT& fft) { using std::complex; using std::vector; @@ -116,7 +116,7 @@ void autocorrelation(const std::vector& y, std::vector& ac, * @param fft FFT engine instance. */ template -void autocorrelation(const Eigen::MatrixBase& y, +inline void autocorrelation(const Eigen::MatrixBase& y, Eigen::MatrixBase& ac, Eigen::FFT& fft) { size_t N = y.size(); size_t M = internal::fft_next_good_size(N); @@ -161,7 +161,7 @@ void autocorrelation(const Eigen::MatrixBase& y, * @param ac Autocorrelations. */ template -void autocorrelation(const std::vector& y, std::vector& ac) { +inline void autocorrelation(const std::vector& y, std::vector& ac) { Eigen::FFT fft; size_t N = y.size(); ac.resize(N); @@ -188,7 +188,7 @@ void autocorrelation(const std::vector& y, std::vector& ac) { * @param ac Autocorrelations. */ template -void autocorrelation(const Eigen::MatrixBase& y, +inline void autocorrelation(const Eigen::MatrixBase& y, Eigen::MatrixBase& ac) { Eigen::FFT fft; autocorrelation(y, ac, fft); diff --git a/stan/math/prim/fun/autocovariance.hpp b/stan/math/prim/fun/autocovariance.hpp index e9c9b564e42..e4516c286ed 100644 --- a/stan/math/prim/fun/autocovariance.hpp +++ b/stan/math/prim/fun/autocovariance.hpp @@ -30,7 +30,7 @@ namespace math { * @param fft FFT engine instance. */ template -void autocovariance(const std::vector& y, std::vector& acov, +inline void autocovariance(const std::vector& y, std::vector& acov, Eigen::FFT& fft) { autocorrelation(y, acov, fft); @@ -63,7 +63,7 @@ void autocovariance(const std::vector& y, std::vector& acov, * @param fft FFT engine instance. */ template -void autocovariance(const Eigen::MatrixBase& y, +inline void autocovariance(const Eigen::MatrixBase& y, Eigen::MatrixBase& acov, Eigen::FFT& fft) { autocorrelation(y, acov, fft); acov = acov.array() * (y.array() - y.mean()).square().sum() / y.size(); @@ -86,7 +86,7 @@ void autocovariance(const Eigen::MatrixBase& y, * @param acov Autocovariances. */ template -void autocovariance(const std::vector& y, std::vector& acov) { +inline void autocovariance(const std::vector& y, std::vector& acov) { Eigen::FFT fft; size_t N = y.size(); acov.resize(N); @@ -115,7 +115,7 @@ void autocovariance(const std::vector& y, std::vector& acov) { * @param acov Autocovariances. */ template -void autocovariance(const Eigen::MatrixBase& y, +inline void autocovariance(const Eigen::MatrixBase& y, Eigen::MatrixBase& acov) { Eigen::FFT fft; autocovariance(y, acov, fft); diff --git a/stan/math/prim/fun/chol2inv.hpp b/stan/math/prim/fun/chol2inv.hpp index 8f2f3c3d866..26bdece0f33 100644 --- a/stan/math/prim/fun/chol2inv.hpp +++ b/stan/math/prim/fun/chol2inv.hpp @@ -20,7 +20,7 @@ namespace math { * lower triangular */ template * = nullptr> -plain_type_t chol2inv(const T& L) { +inline plain_type_t chol2inv(const T& L) { const Eigen::Ref>& L_ref = L; check_square("chol2inv", "L", L_ref); check_lower_triangular("chol2inv", "L", L_ref); diff --git a/stan/math/prim/fun/diag_post_multiply.hpp b/stan/math/prim/fun/diag_post_multiply.hpp index 5564618660d..35a3946a8f6 100644 --- a/stan/math/prim/fun/diag_post_multiply.hpp +++ b/stan/math/prim/fun/diag_post_multiply.hpp @@ -22,7 +22,7 @@ namespace math { template * = nullptr, require_eigen_vector_t* = nullptr, require_all_not_st_var* = nullptr> -auto diag_post_multiply(const T1& m1, const T2& m2) { +inline auto diag_post_multiply(const T1& m1, const T2& m2) { check_size_match("diag_post_multiply", "m2.size()", m2.size(), "m1.cols()", m1.cols()); return m1 * m2.asDiagonal(); diff --git a/stan/math/prim/fun/diag_pre_multiply.hpp b/stan/math/prim/fun/diag_pre_multiply.hpp index a3ed197b6e2..d4de767cb00 100644 --- a/stan/math/prim/fun/diag_pre_multiply.hpp +++ b/stan/math/prim/fun/diag_pre_multiply.hpp @@ -22,7 +22,7 @@ namespace math { template * = nullptr, require_eigen_t* = nullptr, require_all_not_st_var* = nullptr> -auto diag_pre_multiply(const T1& m1, const T2& m2) { +inline auto diag_pre_multiply(const T1& m1, const T2& m2) { check_size_match("diag_pre_multiply", "m1.size()", m1.size(), "m2.rows()", m2.rows()); diff --git a/stan/math/prim/fun/eigenvalues_sym.hpp b/stan/math/prim/fun/eigenvalues_sym.hpp index bc6df83f8ac..05edf91f282 100644 --- a/stan/math/prim/fun/eigenvalues_sym.hpp +++ b/stan/math/prim/fun/eigenvalues_sym.hpp @@ -20,7 +20,7 @@ namespace math { */ template * = nullptr, require_not_st_var* = nullptr> -Eigen::Matrix, -1, 1> eigenvalues_sym(const EigMat& m) { +inline Eigen::Matrix, -1, 1> eigenvalues_sym(const EigMat& m) { if (unlikely(m.size() == 0)) { return Eigen::Matrix, -1, 1>(0, 1); } diff --git a/stan/math/prim/fun/eigenvectors_sym.hpp b/stan/math/prim/fun/eigenvectors_sym.hpp index 88da84d3983..e763f20044b 100644 --- a/stan/math/prim/fun/eigenvectors_sym.hpp +++ b/stan/math/prim/fun/eigenvectors_sym.hpp @@ -10,7 +10,7 @@ namespace math { template * = nullptr, require_not_st_var* = nullptr> -Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> eigenvectors_sym(const EigMat& m) { if (unlikely(m.size() == 0)) { return Eigen::Matrix, -1, -1>(0, 0); diff --git a/stan/math/prim/fun/elt_divide.hpp b/stan/math/prim/fun/elt_divide.hpp index d0fedb64bdc..4bc628c31be 100644 --- a/stan/math/prim/fun/elt_divide.hpp +++ b/stan/math/prim/fun/elt_divide.hpp @@ -22,7 +22,7 @@ namespace math { template * = nullptr, require_all_not_st_var* = nullptr> -auto elt_divide(const Mat1& m1, const Mat2& m2) { +inline auto elt_divide(const Mat1& m1, const Mat2& m2) { check_matching_dims("elt_divide", "m1", m1, "m2", m2); return (m1.array() / m2.array()).matrix(); } @@ -40,7 +40,7 @@ auto elt_divide(const Mat1& m1, const Mat2& m2) { */ template * = nullptr, require_stan_scalar_t* = nullptr> -auto elt_divide(const Mat& m, Scal s) { +inline auto elt_divide(const Mat& m, Scal s) { return divide(m, s); } @@ -57,13 +57,13 @@ auto elt_divide(const Mat& m, Scal s) { */ template * = nullptr, require_eigen_t* = nullptr> -auto elt_divide(Scal s, const Mat& m) { +inline auto elt_divide(Scal s, const Mat& m) { return (s / m.array()).matrix(); } template * = nullptr> -auto elt_divide(Scal1 s1, Scal2 s2) { +inline auto elt_divide(Scal1 s1, Scal2 s2) { return s1 / s2; } diff --git a/stan/math/prim/fun/elt_multiply.hpp b/stan/math/prim/fun/elt_multiply.hpp index bad90c7a26d..3ddbe9e0427 100644 --- a/stan/math/prim/fun/elt_multiply.hpp +++ b/stan/math/prim/fun/elt_multiply.hpp @@ -23,7 +23,7 @@ namespace math { template * = nullptr, require_all_not_st_var* = nullptr> -auto elt_multiply(const Mat1& m1, const Mat2& m2) { +inline auto elt_multiply(const Mat1& m1, const Mat2& m2) { check_matching_dims("elt_multiply", "m1", m1, "m2", m2); return m1.cwiseProduct(m2); } @@ -41,7 +41,7 @@ auto elt_multiply(const Mat1& m1, const Mat2& m2) { */ template * = nullptr> -auto elt_multiply(const Scalar1& a, const Scalar2& b) { +inline auto elt_multiply(const Scalar1& a, const Scalar2& b) { return a * b; } diff --git a/stan/math/prim/fun/factor_U.hpp b/stan/math/prim/fun/factor_U.hpp index 6e9c600f4e0..9dc03b97887 100644 --- a/stan/math/prim/fun/factor_U.hpp +++ b/stan/math/prim/fun/factor_U.hpp @@ -22,7 +22,7 @@ namespace math { template * = nullptr, require_eigen_vector_t* = nullptr, require_vt_same* = nullptr> -void factor_U(const T_U& U, T_CPCs&& CPCs) { +inline void factor_U(const T_U& U, T_CPCs&& CPCs) { size_t K = U.rows(); size_t position = 0; size_t pull = K - 1; diff --git a/stan/math/prim/fun/factor_cov_matrix.hpp b/stan/math/prim/fun/factor_cov_matrix.hpp index c123a08aecc..68a4756cfb0 100644 --- a/stan/math/prim/fun/factor_cov_matrix.hpp +++ b/stan/math/prim/fun/factor_cov_matrix.hpp @@ -25,7 +25,7 @@ template * = nullptr, require_all_eigen_vector_t* = nullptr, require_all_vt_same* = nullptr> -bool factor_cov_matrix(const T_Sigma& Sigma, T_CPCs&& CPCs, T_sds&& sds) { +inline bool factor_cov_matrix(const T_Sigma& Sigma, T_CPCs&& CPCs, T_sds&& sds) { using T_scalar = value_type_t; size_t K = sds.rows(); const Eigen::Ref>& Sigma_ref = Sigma; diff --git a/stan/math/prim/fun/gp_dot_prod_cov.hpp b/stan/math/prim/fun/gp_dot_prod_cov.hpp index caa1d5291e0..fdcf43bf4bf 100644 --- a/stan/math/prim/fun/gp_dot_prod_cov.hpp +++ b/stan/math/prim/fun/gp_dot_prod_cov.hpp @@ -34,7 +34,7 @@ namespace math { * x is nan or infinite */ template -Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> gp_dot_prod_cov(const std::vector> &x, const T_sigma &sigma) { check_not_nan("gp_dot_prod_cov", "sigma", sigma); @@ -96,7 +96,7 @@ gp_dot_prod_cov(const std::vector> &x, * x is nan or infinite */ template -Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> gp_dot_prod_cov(const std::vector &x, const T_sigma &sigma) { check_nonnegative("gp_dot_prod_cov", "sigma", sigma); check_finite("gp_dot_prod_cov", "sigma", sigma); @@ -152,7 +152,7 @@ gp_dot_prod_cov(const std::vector &x, const T_sigma &sigma) { * or if x1 or x2 are nan or inf */ template -Eigen::Matrix, Eigen::Dynamic, +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> gp_dot_prod_cov(const std::vector> &x1, const std::vector> &x2, @@ -216,7 +216,7 @@ gp_dot_prod_cov(const std::vector> &x1, * or if x1 or x2 are nan or inf */ template -Eigen::Matrix, Eigen::Dynamic, +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> gp_dot_prod_cov(const std::vector &x1, const std::vector &x2, const T_sigma &sigma) { diff --git a/stan/math/prim/fun/grad_2F1.hpp b/stan/math/prim/fun/grad_2F1.hpp index 6399dec7c5f..401e6a835c7 100644 --- a/stan/math/prim/fun/grad_2F1.hpp +++ b/stan/math/prim/fun/grad_2F1.hpp @@ -49,7 +49,7 @@ template , typename TupleT = std::tuple> -TupleT grad_2F1_impl_ab(const T1& a1, const T2& a2, const T3& b1, const T_z& z, +inline TupleT grad_2F1_impl_ab(const T1& a1, const T2& a2, const T3& b1, const T_z& z, double precision = 1e-14, int max_steps = 1e6) { TupleT grad_tuple = TupleT(0, 0, 0); @@ -167,7 +167,7 @@ template , typename TupleT = std::tuple> -TupleT grad_2F1_impl(const T1& a1, const T2& a2, const T3& b1, const T_z& z, +inline TupleT grad_2F1_impl(const T1& a1, const T2& a2, const T3& b1, const T_z& z, double precision = 1e-14, int max_steps = 1e6) { bool euler_transform = false; try { @@ -268,7 +268,7 @@ TupleT grad_2F1_impl(const T1& a1, const T2& a2, const T3& b1, const T_z& z, */ template >* = nullptr> -auto grad_2F1(const T1& a1, const T2& a2, const T3& b1, const T_z& z, +inline auto grad_2F1(const T1& a1, const T2& a2, const T3& b1, const T_z& z, double precision = 1e-14, int max_steps = 1e6) { return internal::grad_2F1_impl, is_autodiff_v, is_autodiff_v, is_autodiff_v>( @@ -301,7 +301,7 @@ auto grad_2F1(const T1& a1, const T2& a2, const T3& b1, const T_z& z, */ template >* = nullptr> -auto grad_2F1(const T1& a1, const T2& a2, const T3& b1, const T_z& z, +inline auto grad_2F1(const T1& a1, const T2& a2, const T3& b1, const T_z& z, double precision = 1e-14, int max_steps = 1e6) { return internal::grad_2F1_impl(a1, a2, b1, z, precision, max_steps); @@ -326,7 +326,7 @@ auto grad_2F1(const T1& a1, const T2& a2, const T3& b1, const T_z& z, * @param[in] max_steps number of steps to take */ template -auto grad_2F1(const T1& a1, const T2& a2, const T3& b1, const T_z& z, +inline auto grad_2F1(const T1& a1, const T2& a2, const T3& b1, const T_z& z, double precision = 1e-14, int max_steps = 1e6) { return grad_2F1(a1, a2, b1, z, precision, max_steps); } diff --git a/stan/math/prim/fun/grad_F32.hpp b/stan/math/prim/fun/grad_F32.hpp index a9ab44f3d09..1df597f8636 100644 --- a/stan/math/prim/fun/grad_F32.hpp +++ b/stan/math/prim/fun/grad_F32.hpp @@ -52,7 +52,7 @@ template -void grad_F32(T1* g, const T2& a1, const T3& a2, const T4& a3, const T5& b1, +inline void grad_F32(T1* g, const T2& a1, const T3& a2, const T4& a3, const T5& b1, const T6& b2, const T7& z, const T8& precision = 1e-6, int max_steps = 1e5) { check_3F2_converges("grad_F32", a1, a2, a3, b1, b2, z); diff --git a/stan/math/prim/fun/grad_reg_inc_beta.hpp b/stan/math/prim/fun/grad_reg_inc_beta.hpp index 07159b9f9ce..ad1f911e9a0 100644 --- a/stan/math/prim/fun/grad_reg_inc_beta.hpp +++ b/stan/math/prim/fun/grad_reg_inc_beta.hpp @@ -32,7 +32,7 @@ namespace math { * @param[in] betaAB the value of beta(a, b) */ template -void grad_reg_inc_beta(T& g1, T& g2, const T& a, const T& b, const T& z, +inline void grad_reg_inc_beta(T& g1, T& g2, const T& a, const T& b, const T& z, const T& digammaA, const T& digammaB, const T& digammaSum, const T& betaAB) { using std::exp; diff --git a/stan/math/prim/fun/grad_reg_inc_gamma.hpp b/stan/math/prim/fun/grad_reg_inc_gamma.hpp index 34f9122adbe..51a7c3da90d 100644 --- a/stan/math/prim/fun/grad_reg_inc_gamma.hpp +++ b/stan/math/prim/fun/grad_reg_inc_gamma.hpp @@ -49,7 +49,7 @@ namespace math { (a-1)_k\right) \frac{1}{z^k} \end{array} \f] */ template -return_type_t grad_reg_inc_gamma(T1 a, T2 z, T1 g, T1 dig, +inline return_type_t grad_reg_inc_gamma(T1 a, T2 z, T1 g, T1 dig, double precision = 1e-6, int max_steps = 1e5) { using std::exp; diff --git a/stan/math/prim/fun/grad_reg_lower_inc_gamma.hpp b/stan/math/prim/fun/grad_reg_lower_inc_gamma.hpp index b93e37f9637..8dba893f44c 100644 --- a/stan/math/prim/fun/grad_reg_lower_inc_gamma.hpp +++ b/stan/math/prim/fun/grad_reg_lower_inc_gamma.hpp @@ -107,7 +107,7 @@ namespace math { * */ template -return_type_t grad_reg_lower_inc_gamma(const T1& a, const T2& z, +inline return_type_t grad_reg_lower_inc_gamma(const T1& a, const T2& z, double precision = 1e-10, int max_steps = 1e5) { using std::exp; diff --git a/stan/math/prim/fun/hypergeometric_1F0.hpp b/stan/math/prim/fun/hypergeometric_1F0.hpp index 2833e503887..dfe9905f74d 100644 --- a/stan/math/prim/fun/hypergeometric_1F0.hpp +++ b/stan/math/prim/fun/hypergeometric_1F0.hpp @@ -28,7 +28,7 @@ namespace math { * @return Hypergeometric 1F0 function */ template * = nullptr> -return_type_t hypergeometric_1F0(const Ta& a, const Tz& z) { +inline return_type_t hypergeometric_1F0(const Ta& a, const Tz& z) { check_less("hypergeometric_1F0", "abs(z)", std::fabs(z), 1.0); return boost::math::hypergeometric_1F0(a, z, boost_policy_t<>()); diff --git a/stan/math/prim/fun/hypergeometric_2F2.hpp b/stan/math/prim/fun/hypergeometric_2F2.hpp index 1c4afd06afd..321e55ebc91 100644 --- a/stan/math/prim/fun/hypergeometric_2F2.hpp +++ b/stan/math/prim/fun/hypergeometric_2F2.hpp @@ -22,7 +22,7 @@ namespace math { template * = nullptr, require_stan_scalar_t* = nullptr> -return_type_t hypergeometric_2F2(const Ta& a, const Tb& b, +inline return_type_t hypergeometric_2F2(const Ta& a, const Tb& b, const Tz& z) { if (a.size() != 2 || b.size() != 2) { std::stringstream msg; diff --git a/stan/math/prim/fun/hypergeometric_pFq.hpp b/stan/math/prim/fun/hypergeometric_pFq.hpp index c2b30610314..2085306e55d 100644 --- a/stan/math/prim/fun/hypergeometric_pFq.hpp +++ b/stan/math/prim/fun/hypergeometric_pFq.hpp @@ -25,7 +25,7 @@ namespace math { template * = nullptr, require_arithmetic_t* = nullptr> -return_type_t hypergeometric_pFq(const Ta& a, const Tb& b, +inline return_type_t hypergeometric_pFq(const Ta& a, const Tb& b, const Tz& z) { plain_type_t a_ref = a; plain_type_t b_ref = b; diff --git a/stan/math/prim/fun/imag.hpp b/stan/math/prim/fun/imag.hpp index 49ecbf5499c..af9d45ecc82 100644 --- a/stan/math/prim/fun/imag.hpp +++ b/stan/math/prim/fun/imag.hpp @@ -15,7 +15,7 @@ namespace math { * @return imaginary component of argument */ template > -T imag(const std::complex& z) { +inline T imag(const std::complex& z) { return z.imag(); } diff --git a/stan/math/prim/fun/inc_beta_dda.hpp b/stan/math/prim/fun/inc_beta_dda.hpp index b913f0c5801..4ed2c0e4758 100644 --- a/stan/math/prim/fun/inc_beta_dda.hpp +++ b/stan/math/prim/fun/inc_beta_dda.hpp @@ -36,7 +36,7 @@ namespace math { * @pre 0 <= z <= 1 */ template -T inc_beta_dda(T a, T b, T z, T digamma_a, T digamma_ab) { +inline T inc_beta_dda(T a, T b, T z, T digamma_a, T digamma_ab) { using std::fabs; using std::log; using std::pow; diff --git a/stan/math/prim/fun/inc_beta_ddb.hpp b/stan/math/prim/fun/inc_beta_ddb.hpp index 4d980824b80..5514743f3e9 100644 --- a/stan/math/prim/fun/inc_beta_ddb.hpp +++ b/stan/math/prim/fun/inc_beta_ddb.hpp @@ -14,7 +14,7 @@ namespace stan { namespace math { template -T inc_beta_dda(T a, T b, T z, T digamma_a, T digamma_ab); +inline T inc_beta_dda(T a, T b, T z, T digamma_a, T digamma_ab); /** * Returns the partial derivative of the regularized @@ -39,7 +39,7 @@ T inc_beta_dda(T a, T b, T z, T digamma_a, T digamma_ab); * @pre 0 <= z <= 1 */ template -T inc_beta_ddb(T a, T b, T z, T digamma_b, T digamma_ab) { +inline T inc_beta_ddb(T a, T b, T z, T digamma_b, T digamma_ab) { using std::fabs; using std::log; using std::pow; diff --git a/stan/math/prim/fun/inc_beta_ddz.hpp b/stan/math/prim/fun/inc_beta_ddz.hpp index 455c80b82d5..4543df47880 100644 --- a/stan/math/prim/fun/inc_beta_ddz.hpp +++ b/stan/math/prim/fun/inc_beta_ddz.hpp @@ -27,7 +27,7 @@ namespace math { * @pre 0 < z <= 1 */ template -T inc_beta_ddz(T a, T b, T z) { +inline T inc_beta_ddz(T a, T b, T z) { using std::exp; using std::log; return exp((b - 1) * log1m(z) + (a - 1) * log(z) + lgamma(a + b) - lgamma(a) diff --git a/stan/math/prim/fun/inverse_softmax.hpp b/stan/math/prim/fun/inverse_softmax.hpp index 9e276f9ec2e..7b07b65a6b8 100644 --- a/stan/math/prim/fun/inverse_softmax.hpp +++ b/stan/math/prim/fun/inverse_softmax.hpp @@ -34,7 +34,7 @@ namespace math { * output vectors differ. */ template * = nullptr> -void inverse_softmax(const Vector& simplex, Vector& y) { +inline void inverse_softmax(const Vector& simplex, Vector& y) { check_matching_sizes("inverse_softmax", "simplex", simplex, "y", y); y = log(simplex); } diff --git a/stan/math/prim/fun/lbeta.hpp b/stan/math/prim/fun/lbeta.hpp index 5716c290b8c..5dfb7687677 100644 --- a/stan/math/prim/fun/lbeta.hpp +++ b/stan/math/prim/fun/lbeta.hpp @@ -62,7 +62,7 @@ namespace math { * @return Log of the beta function applied to the two values. */ template * = nullptr> -return_type_t lbeta(const T1 a, const T2 b) { +inline return_type_t lbeta(const T1 a, const T2 b) { using T_ret = return_type_t; if (is_any_nan(a, b)) { diff --git a/stan/math/prim/fun/lgamma_stirling.hpp b/stan/math/prim/fun/lgamma_stirling.hpp index e96c2fcdae3..99505c3ff50 100644 --- a/stan/math/prim/fun/lgamma_stirling.hpp +++ b/stan/math/prim/fun/lgamma_stirling.hpp @@ -23,7 +23,7 @@ namespace math { * @return Stirling's approximation to lgamma(x). */ template -return_type_t lgamma_stirling(const T x) { +inline return_type_t lgamma_stirling(const T x) { return HALF_LOG_TWO_PI + (x - 0.5) * log(x) - x; } diff --git a/stan/math/prim/fun/lgamma_stirling_diff.hpp b/stan/math/prim/fun/lgamma_stirling_diff.hpp index 26bd33b58de..4d248f22a83 100644 --- a/stan/math/prim/fun/lgamma_stirling_diff.hpp +++ b/stan/math/prim/fun/lgamma_stirling_diff.hpp @@ -40,7 +40,7 @@ constexpr double lgamma_stirling_diff_useful = 10; * @return Difference between lgamma(x) and its Stirling approximation. */ template -return_type_t lgamma_stirling_diff(const T x) { +inline return_type_t lgamma_stirling_diff(const T x) { using T_ret = return_type_t; if (is_nan(value_of_rec(x))) { diff --git a/stan/math/prim/fun/log_mix.hpp b/stan/math/prim/fun/log_mix.hpp index 0cb1038fc3b..d9a2e783a36 100644 --- a/stan/math/prim/fun/log_mix.hpp +++ b/stan/math/prim/fun/log_mix.hpp @@ -74,7 +74,7 @@ inline double log_mix(T_theta theta, T_lambda1 lambda1, T_lambda2 lambda2) { */ template * = nullptr> -return_type_t log_mix(const T_theta& theta, +inline return_type_t log_mix(const T_theta& theta, const T_lam& lambda) { static constexpr const char* function = "log_mix"; using T_partials_return = partials_return_t; @@ -141,7 +141,7 @@ return_type_t log_mix(const T_theta& theta, * @return log mixture of densities in specified proportion */ template * = nullptr> -return_type_t> log_mix( +inline return_type_t> log_mix( const T_theta& theta, const std::vector& lambda) { static constexpr const char* function = "log_mix"; using T_partials_return = partials_return_t>; diff --git a/stan/math/prim/fun/logb.hpp b/stan/math/prim/fun/logb.hpp index 491c01c3766..24249d78ee9 100644 --- a/stan/math/prim/fun/logb.hpp +++ b/stan/math/prim/fun/logb.hpp @@ -21,7 +21,7 @@ namespace math { * @return unbiased radix-independent exponent of the argument */ template > -double logb(const T& x) { +inline double logb(const T& x) { return std::logb(value_of_rec(x)); } diff --git a/stan/math/prim/fun/make_nu.hpp b/stan/math/prim/fun/make_nu.hpp index 10e9a8a8415..aec8781a38c 100644 --- a/stan/math/prim/fun/make_nu.hpp +++ b/stan/math/prim/fun/make_nu.hpp @@ -16,7 +16,7 @@ namespace math { * @param K number of variables in correlation matrix */ template -Eigen::Array make_nu(const T& eta, size_t K) { +inline Eigen::Array make_nu(const T& eta, size_t K) { using size_type = index_type_t>; // Best (1978) implies nu = 2 * alpha for the dof in a t diff --git a/stan/math/prim/fun/matrix_exp_2x2.hpp b/stan/math/prim/fun/matrix_exp_2x2.hpp index 8f020bf71c3..4f29bd5ecaa 100644 --- a/stan/math/prim/fun/matrix_exp_2x2.hpp +++ b/stan/math/prim/fun/matrix_exp_2x2.hpp @@ -22,7 +22,7 @@ namespace math { * @return Matrix exponential of A. */ template * = nullptr> -Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> matrix_exp_2x2(const EigMat& A) { using T = value_type_t; T a = A(0, 0), b = A(0, 1), c = A(1, 0), d = A(1, 1), delta; diff --git a/stan/math/prim/fun/matrix_exp_pade.hpp b/stan/math/prim/fun/matrix_exp_pade.hpp index 3a6e494c126..d0ecb7ea2c2 100644 --- a/stan/math/prim/fun/matrix_exp_pade.hpp +++ b/stan/math/prim/fun/matrix_exp_pade.hpp @@ -18,7 +18,7 @@ namespace math { * @return Matrix exponential of input matrix. */ template * = nullptr> -Eigen::Matrix, EigMat::RowsAtCompileTime, +inline Eigen::Matrix, EigMat::RowsAtCompileTime, EigMat::ColsAtCompileTime> matrix_exp_pade(const EigMat& arg) { using MatrixType diff --git a/stan/math/prim/fun/max.hpp b/stan/math/prim/fun/max.hpp index 7c236e60c9a..2f0af8187fc 100644 --- a/stan/math/prim/fun/max.hpp +++ b/stan/math/prim/fun/max.hpp @@ -22,7 +22,7 @@ namespace math { * @return maximum value of the two arguments */ template * = nullptr> -auto max(T1 x, T2 y) { +inline auto max(T1 x, T2 y) { return std::max(x, y); } diff --git a/stan/math/prim/fun/min.hpp b/stan/math/prim/fun/min.hpp index 3ff2c6d0970..a6e006f4c74 100644 --- a/stan/math/prim/fun/min.hpp +++ b/stan/math/prim/fun/min.hpp @@ -21,7 +21,7 @@ namespace math { * @return minimum value of the two arguments */ template * = nullptr> -auto min(T1 x, T2 y) { +inline auto min(T1 x, T2 y) { return std::min(x, y); } diff --git a/stan/math/prim/fun/poisson_binomial_log_probs.hpp b/stan/math/prim/fun/poisson_binomial_log_probs.hpp index 312ae7efdfd..2e4cc9c79c9 100644 --- a/stan/math/prim/fun/poisson_binomial_log_probs.hpp +++ b/stan/math/prim/fun/poisson_binomial_log_probs.hpp @@ -24,7 +24,7 @@ namespace math { */ template , require_vector_t* = nullptr> -Eigen::Matrix poisson_binomial_log_probs( +inline Eigen::Matrix poisson_binomial_log_probs( int y, const T_theta& theta) { int size_theta = theta.size(); plain_type_t log_theta = log(theta); @@ -54,7 +54,7 @@ Eigen::Matrix poisson_binomial_log_probs( } template * = nullptr> -auto poisson_binomial_log_probs(const T_y& y, const T_theta& theta) { +inline auto poisson_binomial_log_probs(const T_y& y, const T_theta& theta) { using T_scalar = scalar_type_t; size_t max_sizes = std::max(stan::math::size(y), size_mvt(theta)); std::vector> result(max_sizes); diff --git a/stan/math/prim/fun/prod.hpp b/stan/math/prim/fun/prod.hpp index 12e02bd149b..0dce5d0a780 100644 --- a/stan/math/prim/fun/prod.hpp +++ b/stan/math/prim/fun/prod.hpp @@ -16,7 +16,7 @@ namespace math { * @return the scalar */ template * = nullptr> -T prod(const T& v) { +inline T prod(const T& v) { return v; } diff --git a/stan/math/prim/fun/pseudo_eigenvalues.hpp b/stan/math/prim/fun/pseudo_eigenvalues.hpp index fd51f25f46e..7fe9eae25bc 100644 --- a/stan/math/prim/fun/pseudo_eigenvalues.hpp +++ b/stan/math/prim/fun/pseudo_eigenvalues.hpp @@ -8,7 +8,7 @@ namespace stan { namespace math { template -Eigen::Matrix pseudo_eigenvalues(const Eigen::Matrix& m) { +inline Eigen::Matrix pseudo_eigenvalues(const Eigen::Matrix& m) { check_nonzero_size("pseudo_eigenvalues", "m", m); check_square("pseudo_eigenvalues", "m", m); diff --git a/stan/math/prim/fun/pseudo_eigenvectors.hpp b/stan/math/prim/fun/pseudo_eigenvectors.hpp index 6b75f33691b..3379c03c417 100644 --- a/stan/math/prim/fun/pseudo_eigenvectors.hpp +++ b/stan/math/prim/fun/pseudo_eigenvectors.hpp @@ -8,7 +8,7 @@ namespace stan { namespace math { template -Eigen::Matrix pseudo_eigenvectors( +inline Eigen::Matrix pseudo_eigenvectors( const Eigen::Matrix& m) { check_nonzero_size("pseudo_eigenvectors", "m", m); check_square("pseudo_eigenvectors", "m", m); diff --git a/stan/math/prim/fun/qr.hpp b/stan/math/prim/fun/qr.hpp index 8b71e5ce02a..0e3a9906605 100644 --- a/stan/math/prim/fun/qr.hpp +++ b/stan/math/prim/fun/qr.hpp @@ -20,7 +20,7 @@ namespace math { * 2. Upper triangular matrix with maximal rows */ template * = nullptr> -std::tuple, Eigen::Dynamic, Eigen::Dynamic>, +inline std::tuple, Eigen::Dynamic, Eigen::Dynamic>, Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>> qr(const EigMat& m) { using matrix_t diff --git a/stan/math/prim/fun/qr_Q.hpp b/stan/math/prim/fun/qr_Q.hpp index 2ba2ba747bc..fe8b505aa09 100644 --- a/stan/math/prim/fun/qr_Q.hpp +++ b/stan/math/prim/fun/qr_Q.hpp @@ -17,7 +17,7 @@ namespace math { * @return Orthogonal matrix with maximal columns */ template * = nullptr> -Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> qr_Q( +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> qr_Q( const EigMat& m) { using matrix_t = Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>; diff --git a/stan/math/prim/fun/qr_R.hpp b/stan/math/prim/fun/qr_R.hpp index 240e1346875..ffc2fcdd0ca 100644 --- a/stan/math/prim/fun/qr_R.hpp +++ b/stan/math/prim/fun/qr_R.hpp @@ -16,7 +16,7 @@ namespace math { * @return Upper triangular matrix with maximal rows */ template * = nullptr> -Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> qr_R( +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> qr_R( const EigMat& m) { using matrix_t = Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>; diff --git a/stan/math/prim/fun/qr_thin.hpp b/stan/math/prim/fun/qr_thin.hpp index dabdc69f8c8..98db68d5d37 100644 --- a/stan/math/prim/fun/qr_thin.hpp +++ b/stan/math/prim/fun/qr_thin.hpp @@ -20,7 +20,7 @@ namespace math { * 2. Upper triangular matrix with minimal rows */ template * = nullptr> -std::tuple, Eigen::Dynamic, Eigen::Dynamic>, +inline std::tuple, Eigen::Dynamic, Eigen::Dynamic>, Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>> qr_thin(const EigMat& m) { using matrix_t diff --git a/stan/math/prim/fun/qr_thin_Q.hpp b/stan/math/prim/fun/qr_thin_Q.hpp index f7287fe0524..7eba6df5bb3 100644 --- a/stan/math/prim/fun/qr_thin_Q.hpp +++ b/stan/math/prim/fun/qr_thin_Q.hpp @@ -16,7 +16,7 @@ namespace math { * @return Orthogonal matrix with minimal columns */ template * = nullptr> -Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> qr_thin_Q( +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> qr_thin_Q( const EigMat& m) { using matrix_t = Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>; diff --git a/stan/math/prim/fun/qr_thin_R.hpp b/stan/math/prim/fun/qr_thin_R.hpp index 3f431b72597..e19dbdca8ca 100644 --- a/stan/math/prim/fun/qr_thin_R.hpp +++ b/stan/math/prim/fun/qr_thin_R.hpp @@ -16,7 +16,7 @@ namespace math { * @return Upper triangular matrix with minimal rows */ template * = nullptr> -Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> qr_thin_R( +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> qr_thin_R( const EigMat& m) { using matrix_t = Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>; diff --git a/stan/math/prim/fun/read_corr_L.hpp b/stan/math/prim/fun/read_corr_L.hpp index 5e646ef82ae..b9531e11f72 100644 --- a/stan/math/prim/fun/read_corr_L.hpp +++ b/stan/math/prim/fun/read_corr_L.hpp @@ -34,7 +34,7 @@ namespace math { * canonical partial correlations. */ template * = nullptr> -Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> read_corr_L( +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> read_corr_L( const T& CPCs, // on (-1, 1) size_t K) { using T_scalar = value_type_t; @@ -101,7 +101,7 @@ Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> read_corr_L( */ template * = nullptr, require_convertible_t, Lp>* = nullptr> -Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> read_corr_L( +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> read_corr_L( const T& CPCs, size_t K, Lp& log_prob) { using T_scalar = value_type_t; if (K == 0) { diff --git a/stan/math/prim/fun/read_corr_matrix.hpp b/stan/math/prim/fun/read_corr_matrix.hpp index 53b6e2cdff8..cae9ee1303e 100644 --- a/stan/math/prim/fun/read_corr_matrix.hpp +++ b/stan/math/prim/fun/read_corr_matrix.hpp @@ -23,7 +23,7 @@ namespace math { * canonical partial correlations. */ template * = nullptr> -Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> read_corr_matrix(const T_CPCs& CPCs, size_t K) { if (K == 0) { return {}; @@ -56,7 +56,7 @@ read_corr_matrix(const T_CPCs& CPCs, size_t K) { template * = nullptr, require_convertible_t, Lp>* = nullptr> -Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> read_corr_matrix(const T_CPCs& CPCs, size_t K, Lp& log_prob) { if (K == 0) { return {}; diff --git a/stan/math/prim/fun/read_cov_L.hpp b/stan/math/prim/fun/read_cov_L.hpp index f2421a7bc22..dc876213569 100644 --- a/stan/math/prim/fun/read_cov_L.hpp +++ b/stan/math/prim/fun/read_cov_L.hpp @@ -27,7 +27,7 @@ namespace math { template * = nullptr, require_vt_same* = nullptr> -Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> read_cov_L( +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> read_cov_L( const T_CPCs& CPCs, const T_sds& sds, value_type_t& log_prob) { size_t K = sds.rows(); // adjust due to transformation from correlations to covariances diff --git a/stan/math/prim/fun/read_cov_matrix.hpp b/stan/math/prim/fun/read_cov_matrix.hpp index 0e7e629845d..5b86531043d 100644 --- a/stan/math/prim/fun/read_cov_matrix.hpp +++ b/stan/math/prim/fun/read_cov_matrix.hpp @@ -25,7 +25,7 @@ namespace math { template * = nullptr, require_vt_same* = nullptr> -Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> read_cov_matrix(const T_CPCs& CPCs, const T_sds& sds, value_type_t& log_prob) { Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> L @@ -46,7 +46,7 @@ read_cov_matrix(const T_CPCs& CPCs, const T_sds& sds, template * = nullptr, require_vt_same* = nullptr> -Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> read_cov_matrix(const T_CPCs& CPCs, const T_sds& sds) { size_t K = sds.rows(); Eigen::DiagonalMatrix, Eigen::Dynamic> D(K); diff --git a/stan/math/prim/fun/real.hpp b/stan/math/prim/fun/real.hpp index 9905d734a5c..f0a94ec6e87 100644 --- a/stan/math/prim/fun/real.hpp +++ b/stan/math/prim/fun/real.hpp @@ -15,7 +15,7 @@ namespace math { * @return real component of argument */ template > -T real(const std::complex& z) { +inline T real(const std::complex& z) { return z.real(); } diff --git a/stan/math/prim/fun/resize.hpp b/stan/math/prim/fun/resize.hpp index ccd9214a3ec..7a9b34eff66 100644 --- a/stan/math/prim/fun/resize.hpp +++ b/stan/math/prim/fun/resize.hpp @@ -8,17 +8,17 @@ namespace stan { namespace math { namespace internal { template -void resize(Eigen::Matrix& x, const std::vector& dims, int pos) { +inline void resize(Eigen::Matrix& x, const std::vector& dims, int pos) { x.resize(dims[pos], dims[pos + 1]); } template -void resize(T /*x*/, const std::vector& /*dims*/, int /*pos*/) { +inline void resize(T /*x*/, const std::vector& /*dims*/, int /*pos*/) { // no-op } template -void resize(std::vector& x, const std::vector& dims, int pos) { +inline void resize(std::vector& x, const std::vector& dims, int pos) { x.resize(dims[pos]); ++pos; if (pos >= static_cast(dims.size())) { diff --git a/stan/math/prim/fun/scalbn.hpp b/stan/math/prim/fun/scalbn.hpp index e953e388cf5..ab56729a308 100644 --- a/stan/math/prim/fun/scalbn.hpp +++ b/stan/math/prim/fun/scalbn.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { template > -double scalbn(const T& x, int n) { +inline double scalbn(const T& x, int n) { return std::scalbn(value_of_rec(x), n); } diff --git a/stan/math/prim/fun/serializer.hpp b/stan/math/prim/fun/serializer.hpp index 68388b90f4d..62fcc866f4e 100644 --- a/stan/math/prim/fun/serializer.hpp +++ b/stan/math/prim/fun/serializer.hpp @@ -269,7 +269,7 @@ struct serializer { * @return deserializer based on specified values */ template -deserializer to_deserializer(const std::vector& vals) { +inline deserializer to_deserializer(const std::vector& vals) { return deserializer(vals); } @@ -281,20 +281,20 @@ deserializer to_deserializer(const std::vector& vals) { * @return deserializer based on specified values */ template * = nullptr> -deserializer> to_deserializer(const T& vals) { +inline deserializer> to_deserializer(const T& vals) { return deserializer>(vals); } template -deserializer to_deserializer(const std::complex& vals) { +inline deserializer to_deserializer(const std::complex& vals) { return to_deserializer(std::vector{vals.real(), vals.imag()}); } template -void serialize_helper(serializer& s) {} +inline void serialize_helper(serializer& s) {} template -void serialize_helper(serializer& s, const T& x, const Ts... xs) { +inline void serialize_helper(serializer& s, const T& x, const Ts... xs) { s.write(x); serialize_helper(s, xs...); } @@ -336,7 +336,7 @@ std::vector> serialize_return(const T& x) { * @return serialized form of arguments */ template -Eigen::VectorXd serialize_args(const Ts... xs) { +inline Eigen::VectorXd serialize_args(const Ts... xs) { return to_vector(serialize(xs...)); } diff --git a/stan/math/prim/fun/singular_values.hpp b/stan/math/prim/fun/singular_values.hpp index 7ade631048f..a65722fad64 100644 --- a/stan/math/prim/fun/singular_values.hpp +++ b/stan/math/prim/fun/singular_values.hpp @@ -20,7 +20,7 @@ namespace math { */ template * = nullptr, require_not_st_var* = nullptr> -auto singular_values(const EigMat& m) { +inline auto singular_values(const EigMat& m) { if (unlikely(m.size() == 0)) { return Eigen::Matrix, Eigen::Dynamic, 1>(0, 1); } diff --git a/stan/math/prim/fun/stan_print.hpp b/stan/math/prim/fun/stan_print.hpp index 14deeec3779..4c5b5f8f3cb 100644 --- a/stan/math/prim/fun/stan_print.hpp +++ b/stan/math/prim/fun/stan_print.hpp @@ -12,12 +12,12 @@ namespace math { template * = nullptr, require_not_tuple_t* = nullptr> -void stan_print(std::ostream* o, const T& x) { +inline void stan_print(std::ostream* o, const T& x) { *o << x; } template * = nullptr> -void stan_print(std::ostream* o, const EigVec& x) { +inline void stan_print(std::ostream* o, const EigVec& x) { const auto& x_ref = to_ref(x); *o << '['; @@ -32,7 +32,7 @@ void stan_print(std::ostream* o, const EigVec& x) { template * = nullptr, require_not_eigen_vector_t* = nullptr> -void stan_print(std::ostream* o, const EigMat& x) { +inline void stan_print(std::ostream* o, const EigMat& x) { const auto& x_ref = to_ref(x); *o << '['; @@ -54,10 +54,10 @@ void stan_print(std::ostream* o, const EigMat& x) { // forward decl to allow the next two overloads to call each other template * = nullptr> -void stan_print(std::ostream* o, const T& x); +inline void stan_print(std::ostream* o, const T& x); template * = nullptr> -void stan_print(std::ostream* o, const T& x) { +inline void stan_print(std::ostream* o, const T& x) { *o << '['; for (size_t i = 0; i < x.size(); ++i) { if (i > 0) { @@ -69,7 +69,7 @@ void stan_print(std::ostream* o, const T& x) { } template *> -void stan_print(std::ostream* o, const T& x) { +inline void stan_print(std::ostream* o, const T& x) { *o << '('; size_t i = 0; stan::math::for_each( diff --git a/stan/math/prim/fun/svd_U.hpp b/stan/math/prim/fun/svd_U.hpp index ae4688bbb20..32f082a136a 100644 --- a/stan/math/prim/fun/svd_U.hpp +++ b/stan/math/prim/fun/svd_U.hpp @@ -16,7 +16,7 @@ namespace math { */ template * = nullptr, require_not_st_var* = nullptr> -Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> svd_U( +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> svd_U( const EigMat& m) { using MatType = Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>; diff --git a/stan/math/prim/fun/svd_V.hpp b/stan/math/prim/fun/svd_V.hpp index 147390ed837..36f3c836d40 100644 --- a/stan/math/prim/fun/svd_V.hpp +++ b/stan/math/prim/fun/svd_V.hpp @@ -16,7 +16,7 @@ namespace math { */ template * = nullptr, require_not_st_var* = nullptr> -Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> svd_V( +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> svd_V( const EigMat& m) { using MatType = Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>; diff --git a/stan/math/prim/fun/transpose.hpp b/stan/math/prim/fun/transpose.hpp index 39cb2dcaf73..fd2aa698146 100644 --- a/stan/math/prim/fun/transpose.hpp +++ b/stan/math/prim/fun/transpose.hpp @@ -14,7 +14,7 @@ namespace math { * @return transposed matrix */ template * = nullptr> -auto inline transpose(const T& m) { +inline auto transpose(const T& m) { return m.transpose(); } diff --git a/stan/math/prim/functor/finite_diff_gradient.hpp b/stan/math/prim/functor/finite_diff_gradient.hpp index 47a794e4b46..a40d2ed1ed5 100644 --- a/stan/math/prim/functor/finite_diff_gradient.hpp +++ b/stan/math/prim/functor/finite_diff_gradient.hpp @@ -40,7 +40,7 @@ namespace math { * @param[in] epsilon perturbation size */ template -void finite_diff_gradient(const F& f, const Eigen::VectorXd& x, double& fx, +inline void finite_diff_gradient(const F& f, const Eigen::VectorXd& x, double& fx, Eigen::VectorXd& grad_fx, double epsilon = 1e-03) { Eigen::VectorXd x_temp(x); int d = x.size(); diff --git a/stan/math/prim/functor/finite_diff_gradient_auto.hpp b/stan/math/prim/functor/finite_diff_gradient_auto.hpp index 11f68bf350c..5d6a33da0cc 100644 --- a/stan/math/prim/functor/finite_diff_gradient_auto.hpp +++ b/stan/math/prim/functor/finite_diff_gradient_auto.hpp @@ -48,7 +48,7 @@ namespace math { */ template > -void finite_diff_gradient_auto(const F& f, VectorT&& x, ScalarT& fx, +inline void finite_diff_gradient_auto(const F& f, VectorT&& x, ScalarT& fx, GradVectorT& grad_fx) { using EigT = Eigen::Matrix; static constexpr int h_scale[6] = {3, 2, 1, -3, -2, -1}; diff --git a/stan/math/prim/functor/map_rect.hpp b/stan/math/prim/functor/map_rect.hpp index 9fcc7ee7fde..c394264f7e2 100644 --- a/stan/math/prim/functor/map_rect.hpp +++ b/stan/math/prim/functor/map_rect.hpp @@ -123,7 +123,7 @@ namespace math { template * = nullptr> -Eigen::Matrix, Eigen::Dynamic, 1> +inline Eigen::Matrix, Eigen::Dynamic, 1> map_rect(const T_shared_param& shared_params, const std::vector>& job_params, diff --git a/stan/math/prim/functor/map_rect_concurrent.hpp b/stan/math/prim/functor/map_rect_concurrent.hpp index 06138845345..c2996444ac0 100644 --- a/stan/math/prim/functor/map_rect_concurrent.hpp +++ b/stan/math/prim/functor/map_rect_concurrent.hpp @@ -12,7 +12,7 @@ namespace internal { template * = nullptr> -Eigen::Matrix, Eigen::Dynamic, 1> +inline Eigen::Matrix, Eigen::Dynamic, 1> map_rect_concurrent( const T_shared_param& shared_params, const std::vector>& diff --git a/stan/math/prim/functor/map_rect_mpi.hpp b/stan/math/prim/functor/map_rect_mpi.hpp index b208a55c9b6..6d2866d231c 100644 --- a/stan/math/prim/functor/map_rect_mpi.hpp +++ b/stan/math/prim/functor/map_rect_mpi.hpp @@ -17,7 +17,7 @@ namespace internal { template -Eigen::Matrix, Eigen::Dynamic, 1> +inline Eigen::Matrix, Eigen::Dynamic, 1> map_rect_mpi(const T_shared_param& shared_params, const std::vector>& job_params, diff --git a/stan/math/prim/functor/ode_ckrk.hpp b/stan/math/prim/functor/ode_ckrk.hpp index 10c7f901aa7..f3ff1f55508 100644 --- a/stan/math/prim/functor/ode_ckrk.hpp +++ b/stan/math/prim/functor/ode_ckrk.hpp @@ -53,7 +53,7 @@ namespace math { */ template * = nullptr> -std::vector, +inline std::vector, Eigen::Dynamic, 1>> ode_ckrk_tol_impl(const char* function_name, const F& f, const T_y0& y0_arg, T_t0 t0, const std::vector& ts, @@ -194,7 +194,7 @@ ode_ckrk_tol_impl(const char* function_name, const F& f, const T_y0& y0_arg, */ template * = nullptr> -std::vector, +inline std::vector, Eigen::Dynamic, 1>> ode_ckrk_tol(const F& f, const T_y0& y0_arg, T_t0 t0, const std::vector& ts, double relative_tolerance, @@ -240,7 +240,7 @@ ode_ckrk_tol(const F& f, const T_y0& y0_arg, T_t0 t0, */ template * = nullptr> -std::vector, +inline std::vector, Eigen::Dynamic, 1>> ode_ckrk(const F& f, const T_y0& y0, T_t0 t0, const std::vector& ts, std::ostream* msgs, const Args&... args) { diff --git a/stan/math/prim/functor/ode_rk45.hpp b/stan/math/prim/functor/ode_rk45.hpp index 4850b1169c6..4066d0d9420 100644 --- a/stan/math/prim/functor/ode_rk45.hpp +++ b/stan/math/prim/functor/ode_rk45.hpp @@ -54,7 +54,7 @@ namespace math { */ template * = nullptr> -std::vector, +inline std::vector, Eigen::Dynamic, 1>> ode_rk45_tol_impl(const char* function_name, const F& f, const T_y0& y0_arg, T_t0 t0, const std::vector& ts, @@ -196,7 +196,7 @@ ode_rk45_tol_impl(const char* function_name, const F& f, const T_y0& y0_arg, */ template * = nullptr> -std::vector, +inline std::vector, Eigen::Dynamic, 1>> ode_rk45_tol(const F& f, const T_y0& y0_arg, T_t0 t0, const std::vector& ts, double relative_tolerance, @@ -242,7 +242,7 @@ ode_rk45_tol(const F& f, const T_y0& y0_arg, T_t0 t0, */ template * = nullptr> -std::vector, +inline std::vector, Eigen::Dynamic, 1>> ode_rk45(const F& f, const T_y0& y0, T_t0 t0, const std::vector& ts, std::ostream* msgs, const Args&... args) { diff --git a/stan/math/prim/functor/ode_store_sensitivities.hpp b/stan/math/prim/functor/ode_store_sensitivities.hpp index ec42a5506e4..52851cd00db 100644 --- a/stan/math/prim/functor/ode_store_sensitivities.hpp +++ b/stan/math/prim/functor/ode_store_sensitivities.hpp @@ -32,7 +32,7 @@ template < typename F, typename T_y0_t0, typename T_t0, typename T_t, typename... Args, typename = require_all_arithmetic_t...>> -Eigen::VectorXd ode_store_sensitivities( +inline Eigen::VectorXd ode_store_sensitivities( const F& f, const std::vector& coupled_state, const Eigen::Matrix& y0, T_t0 t0, T_t t, std::ostream* msgs, const Args&... args) { diff --git a/stan/math/prim/functor/reduce_sum_static.hpp b/stan/math/prim/functor/reduce_sum_static.hpp index 235a6d8c1b6..e1c8f1f9d42 100644 --- a/stan/math/prim/functor/reduce_sum_static.hpp +++ b/stan/math/prim/functor/reduce_sum_static.hpp @@ -42,7 +42,7 @@ namespace math { */ template , typename... Args> -auto reduce_sum_static(Vec&& vmapped, int grainsize, std::ostream* msgs, +inline auto reduce_sum_static(Vec&& vmapped, int grainsize, std::ostream* msgs, Args&&... args) { using return_type = return_type_t; diff --git a/stan/math/prim/meta/static_select.hpp b/stan/math/prim/meta/static_select.hpp index a594b41c1e9..f7cafc5aa4d 100644 --- a/stan/math/prim/meta/static_select.hpp +++ b/stan/math/prim/meta/static_select.hpp @@ -21,13 +21,13 @@ namespace math { */ template * = nullptr> -T1 static_select(T1&& a, T2&& b) { +inline T1 static_select(T1&& a, T2&& b) { return std::forward(a); } template * = nullptr> -T2 static_select(T1&& a, T2&& b) { +inline T2 static_select(T1&& a, T2&& b) { return std::forward(b); } diff --git a/stan/math/prim/prob/bernoulli_ccdf_log.hpp b/stan/math/prim/prob/bernoulli_ccdf_log.hpp index 187c76cedbb..62a20a853a6 100644 --- a/stan/math/prim/prob/bernoulli_ccdf_log.hpp +++ b/stan/math/prim/prob/bernoulli_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use bernoulli_lccdf */ template -return_type_t bernoulli_ccdf_log(const T_n& n, const T_prob& theta) { +inline return_type_t bernoulli_ccdf_log(const T_n& n, const T_prob& theta) { return bernoulli_lccdf(n, theta); } } // namespace math diff --git a/stan/math/prim/prob/bernoulli_cdf.hpp b/stan/math/prim/prob/bernoulli_cdf.hpp index 0250c3e7983..649adcf674b 100644 --- a/stan/math/prim/prob/bernoulli_cdf.hpp +++ b/stan/math/prim/prob/bernoulli_cdf.hpp @@ -27,7 +27,7 @@ namespace math { template * = nullptr> -return_type_t bernoulli_cdf(const T_n& n, const T_prob& theta) { +inline return_type_t 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 constexpr const char* function = "bernoulli_cdf"; diff --git a/stan/math/prim/prob/bernoulli_cdf_log.hpp b/stan/math/prim/prob/bernoulli_cdf_log.hpp index 3f3cf21a433..41798f3fc51 100644 --- a/stan/math/prim/prob/bernoulli_cdf_log.hpp +++ b/stan/math/prim/prob/bernoulli_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use bernoulli_lcdf */ template -return_type_t bernoulli_cdf_log(const T_n& n, const T_prob& theta) { +inline return_type_t bernoulli_cdf_log(const T_n& n, const T_prob& theta) { return bernoulli_lcdf(n, theta); } diff --git a/stan/math/prim/prob/bernoulli_lccdf.hpp b/stan/math/prim/prob/bernoulli_lccdf.hpp index 23566158e36..9e556398d4c 100644 --- a/stan/math/prim/prob/bernoulli_lccdf.hpp +++ b/stan/math/prim/prob/bernoulli_lccdf.hpp @@ -29,7 +29,7 @@ namespace math { template * = nullptr> -return_type_t bernoulli_lccdf(const T_n& n, const T_prob& theta) { +inline return_type_t bernoulli_lccdf(const T_n& n, const T_prob& theta) { using T_theta_ref = ref_type_t; static constexpr const char* function = "bernoulli_lccdf"; check_consistent_sizes(function, "Random variable", n, diff --git a/stan/math/prim/prob/bernoulli_lcdf.hpp b/stan/math/prim/prob/bernoulli_lcdf.hpp index 3e370df9af1..a336a22aba6 100644 --- a/stan/math/prim/prob/bernoulli_lcdf.hpp +++ b/stan/math/prim/prob/bernoulli_lcdf.hpp @@ -27,7 +27,7 @@ namespace math { template * = nullptr> -return_type_t bernoulli_lcdf(const T_n& n, const T_prob& theta) { +inline return_type_t bernoulli_lcdf(const T_n& n, const T_prob& theta) { using T_theta_ref = ref_type_t; static constexpr const char* function = "bernoulli_lcdf"; check_consistent_sizes(function, "Random variable", n, diff --git a/stan/math/prim/prob/bernoulli_logit_glm_lpmf.hpp b/stan/math/prim/prob/bernoulli_logit_glm_lpmf.hpp index a476ba81262..481663718f0 100644 --- a/stan/math/prim/prob/bernoulli_logit_glm_lpmf.hpp +++ b/stan/math/prim/prob/bernoulli_logit_glm_lpmf.hpp @@ -48,7 +48,7 @@ namespace math { */ template * = nullptr> -return_type_t bernoulli_logit_glm_lpmf( +inline return_type_t bernoulli_logit_glm_lpmf( const T_y& y, const T_x& x, const T_alpha& alpha, const T_beta& beta) { using Eigen::Array; using Eigen::Dynamic; diff --git a/stan/math/prim/prob/bernoulli_logit_lpmf.hpp b/stan/math/prim/prob/bernoulli_logit_lpmf.hpp index 54eeba26068..5714f94d359 100644 --- a/stan/math/prim/prob/bernoulli_logit_lpmf.hpp +++ b/stan/math/prim/prob/bernoulli_logit_lpmf.hpp @@ -33,7 +33,7 @@ namespace math { template * = nullptr> -return_type_t bernoulli_logit_lpmf(const T_n& n, const T_prob& theta) { +inline return_type_t bernoulli_logit_lpmf(const T_n& n, const T_prob& theta) { using T_partials_return = partials_return_t; using T_partials_array = Eigen::Array; using std::exp; diff --git a/stan/math/prim/prob/bernoulli_lpmf.hpp b/stan/math/prim/prob/bernoulli_lpmf.hpp index e0d3f166d10..c13e4dee1ee 100644 --- a/stan/math/prim/prob/bernoulli_lpmf.hpp +++ b/stan/math/prim/prob/bernoulli_lpmf.hpp @@ -31,7 +31,7 @@ namespace math { template * = nullptr> -return_type_t bernoulli_lpmf(const T_n& n, const T_prob& theta) { +inline return_type_t bernoulli_lpmf(const T_n& n, const T_prob& theta) { using T_partials_return = partials_return_t; using T_theta_ref = ref_type_t; using T_n_ref = ref_type_t; diff --git a/stan/math/prim/prob/beta_binomial_ccdf_log.hpp b/stan/math/prim/prob/beta_binomial_ccdf_log.hpp index 5422a3d00a6..99b32ee1c63 100644 --- a/stan/math/prim/prob/beta_binomial_ccdf_log.hpp +++ b/stan/math/prim/prob/beta_binomial_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use beta_binomial_lccdf */ template -return_type_t beta_binomial_ccdf_log(const T_n& n, +inline return_type_t beta_binomial_ccdf_log(const T_n& n, const T_N& N, const T_size1& alpha, const T_size2& beta) { diff --git a/stan/math/prim/prob/beta_binomial_cdf.hpp b/stan/math/prim/prob/beta_binomial_cdf.hpp index 244e750d6c1..f68a7ad9742 100644 --- a/stan/math/prim/prob/beta_binomial_cdf.hpp +++ b/stan/math/prim/prob/beta_binomial_cdf.hpp @@ -40,7 +40,7 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -return_type_t beta_binomial_cdf(const T_n& n, const T_N& N, +inline return_type_t beta_binomial_cdf(const T_n& n, const T_N& N, const T_size1& alpha, const T_size2& beta) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/beta_binomial_cdf_log.hpp b/stan/math/prim/prob/beta_binomial_cdf_log.hpp index d881f4978f8..117fdd9188c 100644 --- a/stan/math/prim/prob/beta_binomial_cdf_log.hpp +++ b/stan/math/prim/prob/beta_binomial_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use beta_binomial_lcdf */ template -return_type_t beta_binomial_cdf_log(const T_n& n, +inline return_type_t beta_binomial_cdf_log(const T_n& n, const T_N& N, const T_size1& alpha, const T_size2& beta) { diff --git a/stan/math/prim/prob/beta_binomial_lccdf.hpp b/stan/math/prim/prob/beta_binomial_lccdf.hpp index ea49d864b83..4fe81ecdc09 100644 --- a/stan/math/prim/prob/beta_binomial_lccdf.hpp +++ b/stan/math/prim/prob/beta_binomial_lccdf.hpp @@ -41,7 +41,7 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -return_type_t beta_binomial_lccdf(const T_n& n, const T_N& N, +inline return_type_t beta_binomial_lccdf(const T_n& n, const T_N& N, const T_size1& alpha, const T_size2& beta) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/beta_binomial_lcdf.hpp b/stan/math/prim/prob/beta_binomial_lcdf.hpp index 44b6048a0b0..db7d91127b7 100644 --- a/stan/math/prim/prob/beta_binomial_lcdf.hpp +++ b/stan/math/prim/prob/beta_binomial_lcdf.hpp @@ -41,7 +41,7 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -return_type_t beta_binomial_lcdf(const T_n& n, const T_N& N, +inline return_type_t beta_binomial_lcdf(const T_n& n, const T_N& N, const T_size1& alpha, const T_size2& beta) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/beta_binomial_lpmf.hpp b/stan/math/prim/prob/beta_binomial_lpmf.hpp index 18e98ed59bd..f538657f603 100644 --- a/stan/math/prim/prob/beta_binomial_lpmf.hpp +++ b/stan/math/prim/prob/beta_binomial_lpmf.hpp @@ -40,7 +40,7 @@ template * = nullptr> -return_type_t beta_binomial_lpmf(const T_n& n, const T_N& N, +inline return_type_t beta_binomial_lpmf(const T_n& n, const T_N& N, const T_size1& alpha, const T_size2& beta) { using T_partials_return = partials_return_t; @@ -165,7 +165,7 @@ return_type_t beta_binomial_lpmf(const T_n& n, const T_N& N, } template -return_type_t beta_binomial_lpmf(const T_n& n, const T_N& N, +inline return_type_t beta_binomial_lpmf(const T_n& n, const T_N& N, const T_size1& alpha, const T_size2& beta) { return beta_binomial_lpmf(n, N, alpha, beta); diff --git a/stan/math/prim/prob/beta_ccdf_log.hpp b/stan/math/prim/prob/beta_ccdf_log.hpp index ed5f3098192..36707a6cb16 100644 --- a/stan/math/prim/prob/beta_ccdf_log.hpp +++ b/stan/math/prim/prob/beta_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use beta_lccdf */ template -return_type_t beta_ccdf_log( +inline return_type_t beta_ccdf_log( const T_y& y, const T_scale_succ& alpha, const T_scale_fail& beta) { return beta_lccdf(y, alpha, beta); } diff --git a/stan/math/prim/prob/beta_cdf.hpp b/stan/math/prim/prob/beta_cdf.hpp index 3d7d6672dc2..b099c8df6ab 100644 --- a/stan/math/prim/prob/beta_cdf.hpp +++ b/stan/math/prim/prob/beta_cdf.hpp @@ -33,7 +33,7 @@ namespace math { * @tparam T_scale_fail Type of beta. */ template -return_type_t beta_cdf( +inline return_type_t beta_cdf( const T_y& y, const T_scale_succ& alpha, const T_scale_fail& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_t; diff --git a/stan/math/prim/prob/beta_cdf_log.hpp b/stan/math/prim/prob/beta_cdf_log.hpp index b7568ece3a0..71c74676a33 100644 --- a/stan/math/prim/prob/beta_cdf_log.hpp +++ b/stan/math/prim/prob/beta_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use beta_lcdf */ template -return_type_t beta_cdf_log( +inline return_type_t beta_cdf_log( const T_y& y, const T_scale_succ& alpha, const T_scale_fail& beta) { return beta_lcdf(y, alpha, beta); } diff --git a/stan/math/prim/prob/beta_lccdf.hpp b/stan/math/prim/prob/beta_lccdf.hpp index 009b2b5d906..66232243893 100644 --- a/stan/math/prim/prob/beta_lccdf.hpp +++ b/stan/math/prim/prob/beta_lccdf.hpp @@ -38,7 +38,7 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -return_type_t beta_lccdf( +inline return_type_t beta_lccdf( const T_y& y, const T_scale_succ& alpha, const T_scale_fail& beta_param) { using T_partials_return = partials_return_t; using std::exp; diff --git a/stan/math/prim/prob/beta_lcdf.hpp b/stan/math/prim/prob/beta_lcdf.hpp index 051ed367116..c2a514a766c 100644 --- a/stan/math/prim/prob/beta_lcdf.hpp +++ b/stan/math/prim/prob/beta_lcdf.hpp @@ -29,7 +29,7 @@ namespace math { * @tparam T_scale_fail type of failure parameter */ template -return_type_t beta_lcdf( +inline return_type_t beta_lcdf( const T_y& y, const T_scale_succ& alpha, const T_scale_fail& beta_param) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_t; diff --git a/stan/math/prim/prob/beta_lpdf.hpp b/stan/math/prim/prob/beta_lpdf.hpp index e2211c0685b..1424d7f5703 100644 --- a/stan/math/prim/prob/beta_lpdf.hpp +++ b/stan/math/prim/prob/beta_lpdf.hpp @@ -44,7 +44,7 @@ template * = nullptr> -return_type_t beta_lpdf( +inline return_type_t beta_lpdf( const T_y& y, const T_scale_succ& alpha, const T_scale_fail& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/beta_proportion_ccdf_log.hpp b/stan/math/prim/prob/beta_proportion_ccdf_log.hpp index 922b3f3fc57..48cbac8605f 100644 --- a/stan/math/prim/prob/beta_proportion_ccdf_log.hpp +++ b/stan/math/prim/prob/beta_proportion_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use beta_proportion_lccdf */ template -return_type_t beta_proportion_ccdf_log( +inline return_type_t beta_proportion_ccdf_log( const T_y& y, const T_loc& mu, const T_prec& kappa) { return beta_proportion_lccdf(y, mu, kappa); } diff --git a/stan/math/prim/prob/beta_proportion_cdf_log.hpp b/stan/math/prim/prob/beta_proportion_cdf_log.hpp index 1db4a6aa55f..7c702d8b060 100644 --- a/stan/math/prim/prob/beta_proportion_cdf_log.hpp +++ b/stan/math/prim/prob/beta_proportion_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use beta_proportion_lcdf */ template -return_type_t beta_proportion_cdf_log(const T_y& y, +inline return_type_t beta_proportion_cdf_log(const T_y& y, const T_loc& mu, const T_prec& kappa) { return beta_proportion_lcdf(y, mu, kappa); diff --git a/stan/math/prim/prob/beta_proportion_lccdf.hpp b/stan/math/prim/prob/beta_proportion_lccdf.hpp index 34299986203..833fa0f9645 100644 --- a/stan/math/prim/prob/beta_proportion_lccdf.hpp +++ b/stan/math/prim/prob/beta_proportion_lccdf.hpp @@ -41,7 +41,7 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -return_type_t beta_proportion_lccdf(const T_y& y, +inline return_type_t beta_proportion_lccdf(const T_y& y, const T_loc& mu, const T_prec& kappa) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/beta_proportion_lcdf.hpp b/stan/math/prim/prob/beta_proportion_lcdf.hpp index 1e177df8e32..0d11249e447 100644 --- a/stan/math/prim/prob/beta_proportion_lcdf.hpp +++ b/stan/math/prim/prob/beta_proportion_lcdf.hpp @@ -42,7 +42,7 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -return_type_t beta_proportion_lcdf(const T_y& y, +inline return_type_t beta_proportion_lcdf(const T_y& y, const T_loc& mu, const T_prec& kappa) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/beta_proportion_lpdf.hpp b/stan/math/prim/prob/beta_proportion_lpdf.hpp index 37325ce0b32..9c9a3713745 100644 --- a/stan/math/prim/prob/beta_proportion_lpdf.hpp +++ b/stan/math/prim/prob/beta_proportion_lpdf.hpp @@ -48,7 +48,7 @@ namespace math { template * = nullptr> -return_type_t beta_proportion_lpdf(const T_y& y, +inline return_type_t beta_proportion_lpdf(const T_y& y, const T_loc& mu, const T_prec& kappa) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/binomial_ccdf_log.hpp b/stan/math/prim/prob/binomial_ccdf_log.hpp index ab032100a25..b67ca850337 100644 --- a/stan/math/prim/prob/binomial_ccdf_log.hpp +++ b/stan/math/prim/prob/binomial_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use binomial_lccdf */ template -return_type_t binomial_ccdf_log(const T_n& n, const T_N& N, +inline return_type_t binomial_ccdf_log(const T_n& n, const T_N& N, const T_prob& theta) { return binomial_lccdf(n, N, theta); } diff --git a/stan/math/prim/prob/binomial_cdf.hpp b/stan/math/prim/prob/binomial_cdf.hpp index bacbfab8863..0672494b0d4 100644 --- a/stan/math/prim/prob/binomial_cdf.hpp +++ b/stan/math/prim/prob/binomial_cdf.hpp @@ -33,7 +33,7 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -return_type_t binomial_cdf(const T_n& n, const T_N& N, +inline return_type_t binomial_cdf(const T_n& n, const T_N& N, const T_prob& theta) { using T_partials_return = partials_return_t; using T_n_ref = ref_type_t; diff --git a/stan/math/prim/prob/binomial_cdf_log.hpp b/stan/math/prim/prob/binomial_cdf_log.hpp index 11446688958..3961cbfca63 100644 --- a/stan/math/prim/prob/binomial_cdf_log.hpp +++ b/stan/math/prim/prob/binomial_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use binomial_lcdf */ template -return_type_t binomial_cdf_log(const T_n& n, const T_N& N, +inline return_type_t binomial_cdf_log(const T_n& n, const T_N& N, const T_prob& theta) { return binomial_lcdf(n, N, theta); } diff --git a/stan/math/prim/prob/binomial_lccdf.hpp b/stan/math/prim/prob/binomial_lccdf.hpp index 4ac755f762e..9cb13f0cec6 100644 --- a/stan/math/prim/prob/binomial_lccdf.hpp +++ b/stan/math/prim/prob/binomial_lccdf.hpp @@ -35,7 +35,7 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -return_type_t binomial_lccdf(const T_n& n, const T_N& N, +inline return_type_t binomial_lccdf(const T_n& n, const T_N& N, const T_prob& theta) { using T_partials_return = partials_return_t; using T_n_ref = ref_type_t; diff --git a/stan/math/prim/prob/binomial_lcdf.hpp b/stan/math/prim/prob/binomial_lcdf.hpp index ddd59d10717..518338debb9 100644 --- a/stan/math/prim/prob/binomial_lcdf.hpp +++ b/stan/math/prim/prob/binomial_lcdf.hpp @@ -35,7 +35,7 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -return_type_t binomial_lcdf(const T_n& n, const T_N& N, +inline return_type_t binomial_lcdf(const T_n& n, const T_N& N, const T_prob& theta) { using T_partials_return = partials_return_t; using T_n_ref = ref_type_t; diff --git a/stan/math/prim/prob/binomial_logit_glm_lpmf.hpp b/stan/math/prim/prob/binomial_logit_glm_lpmf.hpp index 95ee260f0bd..0e47c80fd2c 100644 --- a/stan/math/prim/prob/binomial_logit_glm_lpmf.hpp +++ b/stan/math/prim/prob/binomial_logit_glm_lpmf.hpp @@ -53,7 +53,7 @@ namespace math { */ template * = nullptr> -return_type_t binomial_logit_glm_lpmf( +inline return_type_t binomial_logit_glm_lpmf( const T_n& n, const T_N& N, const T_x& x, const T_alpha& alpha, const T_beta& beta) { constexpr int T_x_rows = T_x::RowsAtCompileTime; diff --git a/stan/math/prim/prob/binomial_logit_lpmf.hpp b/stan/math/prim/prob/binomial_logit_lpmf.hpp index 57725d05a3f..2f6c49f8209 100644 --- a/stan/math/prim/prob/binomial_logit_lpmf.hpp +++ b/stan/math/prim/prob/binomial_logit_lpmf.hpp @@ -34,7 +34,7 @@ namespace math { template * = nullptr> -return_type_t binomial_logit_lpmf(const T_n& n, const T_N& N, +inline return_type_t binomial_logit_lpmf(const T_n& n, const T_N& N, const T_prob& alpha) { using T_partials_return = partials_return_t; using T_n_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/binomial_lpmf.hpp b/stan/math/prim/prob/binomial_lpmf.hpp index 06b96882cf9..4e612d66ed2 100644 --- a/stan/math/prim/prob/binomial_lpmf.hpp +++ b/stan/math/prim/prob/binomial_lpmf.hpp @@ -36,7 +36,7 @@ namespace math { template * = nullptr> -return_type_t binomial_lpmf(const T_n& n, const T_N& N, +inline return_type_t binomial_lpmf(const T_n& n, const T_N& N, const T_prob& theta) { using T_partials_return = partials_return_t; using T_n_ref = ref_type_t; diff --git a/stan/math/prim/prob/categorical_logit_glm_lpmf.hpp b/stan/math/prim/prob/categorical_logit_glm_lpmf.hpp index 246a624e461..3e0ffbed3fc 100644 --- a/stan/math/prim/prob/categorical_logit_glm_lpmf.hpp +++ b/stan/math/prim/prob/categorical_logit_glm_lpmf.hpp @@ -44,7 +44,7 @@ template * = nullptr, require_col_vector_t* = nullptr, require_matrix_t* = nullptr> -return_type_t categorical_logit_glm_lpmf( +inline return_type_t categorical_logit_glm_lpmf( const T_y& y, const T_x& x, const T_alpha& alpha, const T_beta& beta) { using T_partials_return = partials_return_t; using Eigen::Array; @@ -194,7 +194,7 @@ return_type_t categorical_logit_glm_lpmf( } template -return_type_t categorical_logit_glm_lpmf( +inline return_type_t categorical_logit_glm_lpmf( const T_y& y, const T_x& x, const T_alpha& alpha, const T_beta& beta) { return categorical_logit_glm_lpmf(y, x, alpha, beta); } diff --git a/stan/math/prim/prob/categorical_logit_lpmf.hpp b/stan/math/prim/prob/categorical_logit_lpmf.hpp index 3483d0080e9..425d0091a97 100644 --- a/stan/math/prim/prob/categorical_logit_lpmf.hpp +++ b/stan/math/prim/prob/categorical_logit_lpmf.hpp @@ -14,7 +14,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) { +inline return_type_t categorical_logit_lpmf(int n, const T_prob& beta) { static constexpr const char* function = "categorical_logit_lpmf"; check_bounded(function, "categorical outcome out of support", n, 1, beta.size()); @@ -31,7 +31,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, +inline return_type_t categorical_logit_lpmf(const std::vector& ns, const T_prob& beta) { static constexpr const char* function = "categorical_logit_lpmf"; diff --git a/stan/math/prim/prob/categorical_lpmf.hpp b/stan/math/prim/prob/categorical_lpmf.hpp index 3c1e57d3990..d99661e4a14 100644 --- a/stan/math/prim/prob/categorical_lpmf.hpp +++ b/stan/math/prim/prob/categorical_lpmf.hpp @@ -14,7 +14,7 @@ namespace math { // Categorical(n|theta) [0 < n <= N; 0 <= theta[n] <= 1; SUM theta = 1] template * = nullptr> -return_type_t categorical_lpmf(int n, const T_prob& theta) { +inline return_type_t categorical_lpmf(int n, const T_prob& theta) { static constexpr const char* function = "categorical_lpmf"; using std::log; @@ -30,7 +30,7 @@ return_type_t categorical_lpmf(int n, const T_prob& theta) { template * = nullptr> -return_type_t categorical_lpmf(const std::vector& ns, +inline return_type_t categorical_lpmf(const std::vector& ns, const T_prob& theta) { static constexpr const char* function = "categorical_lpmf"; diff --git a/stan/math/prim/prob/cauchy_ccdf_log.hpp b/stan/math/prim/prob/cauchy_ccdf_log.hpp index 03b6ca23cd7..0af495fde9a 100644 --- a/stan/math/prim/prob/cauchy_ccdf_log.hpp +++ b/stan/math/prim/prob/cauchy_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use cauchy_lccdf */ template -return_type_t cauchy_ccdf_log(const T_y& y, +inline return_type_t cauchy_ccdf_log(const T_y& y, const T_loc& mu, const T_scale& sigma) { return cauchy_lccdf(y, mu, sigma); diff --git a/stan/math/prim/prob/cauchy_cdf.hpp b/stan/math/prim/prob/cauchy_cdf.hpp index 59f8c79a033..2b24afb8d58 100644 --- a/stan/math/prim/prob/cauchy_cdf.hpp +++ b/stan/math/prim/prob/cauchy_cdf.hpp @@ -32,7 +32,7 @@ namespace math { template * = nullptr> -return_type_t cauchy_cdf(const T_y& y, const T_loc& mu, +inline return_type_t cauchy_cdf(const T_y& y, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; using std::atan; diff --git a/stan/math/prim/prob/cauchy_cdf_log.hpp b/stan/math/prim/prob/cauchy_cdf_log.hpp index bdcb2b0dfc8..6f441c98d04 100644 --- a/stan/math/prim/prob/cauchy_cdf_log.hpp +++ b/stan/math/prim/prob/cauchy_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use cauchy_lcdf */ template -return_type_t cauchy_cdf_log(const T_y& y, const T_loc& mu, +inline return_type_t cauchy_cdf_log(const T_y& y, const T_loc& mu, const T_scale& sigma) { return cauchy_lcdf(y, mu, sigma); } diff --git a/stan/math/prim/prob/cauchy_lccdf.hpp b/stan/math/prim/prob/cauchy_lccdf.hpp index cb4fa9b16aa..0d3af6c91de 100644 --- a/stan/math/prim/prob/cauchy_lccdf.hpp +++ b/stan/math/prim/prob/cauchy_lccdf.hpp @@ -34,7 +34,7 @@ namespace math { template * = nullptr> -return_type_t cauchy_lccdf(const T_y& y, const T_loc& mu, +inline return_type_t cauchy_lccdf(const T_y& y, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_t; diff --git a/stan/math/prim/prob/cauchy_lcdf.hpp b/stan/math/prim/prob/cauchy_lcdf.hpp index 84f0bac8618..44f42758cd3 100644 --- a/stan/math/prim/prob/cauchy_lcdf.hpp +++ b/stan/math/prim/prob/cauchy_lcdf.hpp @@ -34,7 +34,7 @@ namespace math { template * = nullptr> -return_type_t cauchy_lcdf(const T_y& y, const T_loc& mu, +inline return_type_t cauchy_lcdf(const T_y& y, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_t; diff --git a/stan/math/prim/prob/cauchy_lpdf.hpp b/stan/math/prim/prob/cauchy_lpdf.hpp index cffc8db8dec..25b4a377462 100644 --- a/stan/math/prim/prob/cauchy_lpdf.hpp +++ b/stan/math/prim/prob/cauchy_lpdf.hpp @@ -40,7 +40,7 @@ namespace math { template * = nullptr> -return_type_t cauchy_lpdf(const T_y& y, const T_loc& mu, +inline return_type_t cauchy_lpdf(const T_y& y, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; using std::log; diff --git a/stan/math/prim/prob/chi_square_ccdf_log.hpp b/stan/math/prim/prob/chi_square_ccdf_log.hpp index 845b8ce261e..c148700cfdf 100644 --- a/stan/math/prim/prob/chi_square_ccdf_log.hpp +++ b/stan/math/prim/prob/chi_square_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use chi_square_lccdf */ template -return_type_t chi_square_ccdf_log(const T_y& y, const T_dof& nu) { +inline return_type_t chi_square_ccdf_log(const T_y& y, const T_dof& nu) { return chi_square_lccdf(y, nu); } diff --git a/stan/math/prim/prob/chi_square_cdf.hpp b/stan/math/prim/prob/chi_square_cdf.hpp index 02313f673f2..46e0ea4e623 100644 --- a/stan/math/prim/prob/chi_square_cdf.hpp +++ b/stan/math/prim/prob/chi_square_cdf.hpp @@ -34,7 +34,7 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -return_type_t chi_square_cdf(const T_y& y, const T_dof& nu) { +inline return_type_t chi_square_cdf(const T_y& y, const T_dof& nu) { using T_partials_return = partials_return_t; using std::exp; using std::pow; diff --git a/stan/math/prim/prob/chi_square_cdf_log.hpp b/stan/math/prim/prob/chi_square_cdf_log.hpp index 2eabcd2af8b..15b44b45c1b 100644 --- a/stan/math/prim/prob/chi_square_cdf_log.hpp +++ b/stan/math/prim/prob/chi_square_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use chi_square_lcdf */ template -return_type_t chi_square_cdf_log(const T_y& y, const T_dof& nu) { +inline return_type_t chi_square_cdf_log(const T_y& y, const T_dof& nu) { return chi_square_lcdf(y, nu); } diff --git a/stan/math/prim/prob/chi_square_lccdf.hpp b/stan/math/prim/prob/chi_square_lccdf.hpp index 7c7ae4c47b6..8851b28fd4e 100644 --- a/stan/math/prim/prob/chi_square_lccdf.hpp +++ b/stan/math/prim/prob/chi_square_lccdf.hpp @@ -35,7 +35,7 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -return_type_t chi_square_lccdf(const T_y& y, const T_dof& nu) { +inline return_type_t chi_square_lccdf(const T_y& y, const T_dof& nu) { using T_partials_return = partials_return_t; using std::exp; using std::log; diff --git a/stan/math/prim/prob/chi_square_lcdf.hpp b/stan/math/prim/prob/chi_square_lcdf.hpp index 3e0a6d363f5..3f8841110d2 100644 --- a/stan/math/prim/prob/chi_square_lcdf.hpp +++ b/stan/math/prim/prob/chi_square_lcdf.hpp @@ -35,7 +35,7 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -return_type_t chi_square_lcdf(const T_y& y, const T_dof& nu) { +inline return_type_t chi_square_lcdf(const T_y& y, const T_dof& nu) { using T_partials_return = partials_return_t; using std::exp; using std::log; diff --git a/stan/math/prim/prob/chi_square_lpdf.hpp b/stan/math/prim/prob/chi_square_lpdf.hpp index 8642f1f91ca..eff88df21e0 100644 --- a/stan/math/prim/prob/chi_square_lpdf.hpp +++ b/stan/math/prim/prob/chi_square_lpdf.hpp @@ -43,7 +43,7 @@ namespace math { template * = nullptr> -return_type_t chi_square_lpdf(const T_y& y, const T_dof& nu) { +inline 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; diff --git a/stan/math/prim/prob/dirichlet_lpdf.hpp b/stan/math/prim/prob/dirichlet_lpdf.hpp index 8339f532724..7765a864663 100644 --- a/stan/math/prim/prob/dirichlet_lpdf.hpp +++ b/stan/math/prim/prob/dirichlet_lpdf.hpp @@ -56,7 +56,7 @@ namespace math { template * = nullptr> -return_type_t dirichlet_lpdf(const T_prob& theta, +inline return_type_t dirichlet_lpdf(const T_prob& theta, const T_prior_size& alpha) { using T_partials_return = partials_return_t; using T_partials_array = typename Eigen::Array; @@ -125,7 +125,7 @@ return_type_t dirichlet_lpdf(const T_prob& theta, } template -return_type_t dirichlet_lpdf(const T_prob& theta, +inline return_type_t dirichlet_lpdf(const T_prob& theta, const T_prior_size& alpha) { return dirichlet_lpdf(theta, alpha); } diff --git a/stan/math/prim/prob/dirichlet_multinomial_lpmf.hpp b/stan/math/prim/prob/dirichlet_multinomial_lpmf.hpp index 3bebbb0bab0..b371cfb340d 100644 --- a/stan/math/prim/prob/dirichlet_multinomial_lpmf.hpp +++ b/stan/math/prim/prob/dirichlet_multinomial_lpmf.hpp @@ -57,7 +57,7 @@ namespace math { template * = nullptr> -return_type_t dirichlet_multinomial_lpmf( +inline return_type_t dirichlet_multinomial_lpmf( const std::vector& ns, const T_prior_size& alpha) { static const char* function = "dirichlet_multinomial_lpmf"; check_size_match(function, "Size of number of trials variable", ns.size(), @@ -98,7 +98,7 @@ return_type_t dirichlet_multinomial_lpmf( } template -return_type_t dirichlet_multinomial_lpmf( +inline return_type_t dirichlet_multinomial_lpmf( const std::vector& ns, const T_prior_size& alpha) { return dirichlet_multinomial_lpmf(ns, alpha); } diff --git a/stan/math/prim/prob/discrete_range_ccdf_log.hpp b/stan/math/prim/prob/discrete_range_ccdf_log.hpp index 324192e8c72..767befb1c8a 100644 --- a/stan/math/prim/prob/discrete_range_ccdf_log.hpp +++ b/stan/math/prim/prob/discrete_range_ccdf_log.hpp @@ -10,7 +10,7 @@ namespace math { * @deprecated use discrete_range_lccdf */ template -double discrete_range_ccdf_log(const T_y& y, const T_lower& lower, +inline double discrete_range_ccdf_log(const T_y& y, const T_lower& lower, const T_upper& upper) { return discrete_range_lccdf(y, lower, upper); } diff --git a/stan/math/prim/prob/discrete_range_cdf.hpp b/stan/math/prim/prob/discrete_range_cdf.hpp index 49c18842244..f9a07d90adc 100644 --- a/stan/math/prim/prob/discrete_range_cdf.hpp +++ b/stan/math/prim/prob/discrete_range_cdf.hpp @@ -35,7 +35,7 @@ namespace math { * sizes. */ template -double discrete_range_cdf(const T_y& y, const T_lower& lower, +inline double discrete_range_cdf(const T_y& y, const T_lower& lower, const T_upper& upper) { static constexpr const char* function = "discrete_range_cdf"; check_consistent_sizes(function, "Lower bound parameter", lower, diff --git a/stan/math/prim/prob/discrete_range_cdf_log.hpp b/stan/math/prim/prob/discrete_range_cdf_log.hpp index c21d7e17014..d75ed1318b7 100644 --- a/stan/math/prim/prob/discrete_range_cdf_log.hpp +++ b/stan/math/prim/prob/discrete_range_cdf_log.hpp @@ -10,7 +10,7 @@ namespace math { * @deprecated use discrete_range_lcdf */ template -double discrete_range_cdf_log(const T_y& y, const T_lower& lower, +inline double discrete_range_cdf_log(const T_y& y, const T_lower& lower, const T_upper& upper) { return discrete_range_lcdf(y, lower, upper); } diff --git a/stan/math/prim/prob/discrete_range_lccdf.hpp b/stan/math/prim/prob/discrete_range_lccdf.hpp index 1c67cee0417..ea27506f8b2 100644 --- a/stan/math/prim/prob/discrete_range_lccdf.hpp +++ b/stan/math/prim/prob/discrete_range_lccdf.hpp @@ -35,7 +35,7 @@ namespace math { * sizes. */ template -double discrete_range_lccdf(const T_y& y, const T_lower& lower, +inline double discrete_range_lccdf(const T_y& y, const T_lower& lower, const T_upper& upper) { static constexpr const char* function = "discrete_range_lccdf"; check_consistent_sizes(function, "Lower bound parameter", lower, diff --git a/stan/math/prim/prob/discrete_range_lcdf.hpp b/stan/math/prim/prob/discrete_range_lcdf.hpp index 8a64df8bc29..ca45637b808 100644 --- a/stan/math/prim/prob/discrete_range_lcdf.hpp +++ b/stan/math/prim/prob/discrete_range_lcdf.hpp @@ -35,7 +35,7 @@ namespace math { * sizes. */ template -double discrete_range_lcdf(const T_y& y, const T_lower& lower, +inline double discrete_range_lcdf(const T_y& y, const T_lower& lower, const T_upper& upper) { static constexpr const char* function = "discrete_range_lcdf"; check_consistent_sizes(function, "Lower bound parameter", lower, diff --git a/stan/math/prim/prob/discrete_range_lpmf.hpp b/stan/math/prim/prob/discrete_range_lpmf.hpp index 87cfd110f2f..f5c100404a2 100644 --- a/stan/math/prim/prob/discrete_range_lpmf.hpp +++ b/stan/math/prim/prob/discrete_range_lpmf.hpp @@ -43,7 +43,7 @@ namespace math { * sizes. */ template -double discrete_range_lpmf(const T_y& y, const T_lower& lower, +inline double discrete_range_lpmf(const T_y& y, const T_lower& lower, const T_upper& upper) { using std::log; static constexpr const char* function = "discrete_range_lpmf"; diff --git a/stan/math/prim/prob/double_exponential_ccdf_log.hpp b/stan/math/prim/prob/double_exponential_ccdf_log.hpp index a66dfab81c6..c40404c7809 100644 --- a/stan/math/prim/prob/double_exponential_ccdf_log.hpp +++ b/stan/math/prim/prob/double_exponential_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use double_exponential_lccdf */ template -return_type_t double_exponential_ccdf_log( +inline return_type_t double_exponential_ccdf_log( const T_y& y, const T_loc& mu, const T_scale& sigma) { return double_exponential_lccdf(y, mu, sigma); } diff --git a/stan/math/prim/prob/double_exponential_cdf.hpp b/stan/math/prim/prob/double_exponential_cdf.hpp index 7b2ee5ff6fa..eaefeacec57 100644 --- a/stan/math/prim/prob/double_exponential_cdf.hpp +++ b/stan/math/prim/prob/double_exponential_cdf.hpp @@ -36,7 +36,7 @@ namespace math { template * = nullptr> -return_type_t double_exponential_cdf( +inline return_type_t double_exponential_cdf( const T_y& y, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; using T_partials_array = Eigen::Array; diff --git a/stan/math/prim/prob/double_exponential_cdf_log.hpp b/stan/math/prim/prob/double_exponential_cdf_log.hpp index ee209635f12..f4447ae0a08 100644 --- a/stan/math/prim/prob/double_exponential_cdf_log.hpp +++ b/stan/math/prim/prob/double_exponential_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use double_exponential_lcdf */ template -return_type_t double_exponential_cdf_log( +inline return_type_t double_exponential_cdf_log( const T_y& y, const T_loc& mu, const T_scale& sigma) { return double_exponential_lcdf(y, mu, sigma); } diff --git a/stan/math/prim/prob/double_exponential_lccdf.hpp b/stan/math/prim/prob/double_exponential_lccdf.hpp index b39e7d66503..0c24a32825f 100644 --- a/stan/math/prim/prob/double_exponential_lccdf.hpp +++ b/stan/math/prim/prob/double_exponential_lccdf.hpp @@ -35,7 +35,7 @@ namespace math { template * = nullptr> -return_type_t double_exponential_lccdf( +inline return_type_t double_exponential_lccdf( const T_y& y, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; using std::exp; diff --git a/stan/math/prim/prob/double_exponential_lcdf.hpp b/stan/math/prim/prob/double_exponential_lcdf.hpp index 5ea11d1d25c..db264576c57 100644 --- a/stan/math/prim/prob/double_exponential_lcdf.hpp +++ b/stan/math/prim/prob/double_exponential_lcdf.hpp @@ -34,7 +34,7 @@ namespace math { template * = nullptr> -return_type_t double_exponential_lcdf( +inline return_type_t double_exponential_lcdf( const T_y& y, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; using std::exp; diff --git a/stan/math/prim/prob/double_exponential_lpdf.hpp b/stan/math/prim/prob/double_exponential_lpdf.hpp index fd88aa9e338..6181e7853bf 100644 --- a/stan/math/prim/prob/double_exponential_lpdf.hpp +++ b/stan/math/prim/prob/double_exponential_lpdf.hpp @@ -39,7 +39,7 @@ namespace math { template * = nullptr> -return_type_t double_exponential_lpdf( +inline return_type_t double_exponential_lpdf( const T_y& y, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; @@ -105,7 +105,7 @@ return_type_t double_exponential_lpdf( } template -return_type_t double_exponential_lpdf( +inline return_type_t double_exponential_lpdf( const T_y& y, const T_loc& mu, const T_scale& sigma) { return double_exponential_lpdf(y, mu, sigma); } diff --git a/stan/math/prim/prob/exp_mod_normal_ccdf_log.hpp b/stan/math/prim/prob/exp_mod_normal_ccdf_log.hpp index 97be1160140..c5a84309029 100644 --- a/stan/math/prim/prob/exp_mod_normal_ccdf_log.hpp +++ b/stan/math/prim/prob/exp_mod_normal_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use exp_mod_normal_lccdf */ template -return_type_t exp_mod_normal_ccdf_log( +inline return_type_t exp_mod_normal_ccdf_log( const T_y& y, const T_loc& mu, const T_scale& sigma, const T_inv_scale& lambda) { return exp_mod_normal_lccdf(y, mu, sigma, diff --git a/stan/math/prim/prob/exp_mod_normal_cdf.hpp b/stan/math/prim/prob/exp_mod_normal_cdf.hpp index ae7eb72ed8b..de61b14ecf5 100644 --- a/stan/math/prim/prob/exp_mod_normal_cdf.hpp +++ b/stan/math/prim/prob/exp_mod_normal_cdf.hpp @@ -26,7 +26,7 @@ namespace math { template * = nullptr> -return_type_t exp_mod_normal_cdf( +inline return_type_t exp_mod_normal_cdf( const T_y& y, const T_loc& mu, const T_scale& sigma, const T_inv_scale& lambda) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/exp_mod_normal_cdf_log.hpp b/stan/math/prim/prob/exp_mod_normal_cdf_log.hpp index e04f04f77c9..4908971ad37 100644 --- a/stan/math/prim/prob/exp_mod_normal_cdf_log.hpp +++ b/stan/math/prim/prob/exp_mod_normal_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use exp_mod_normal_lcdf */ template -return_type_t exp_mod_normal_cdf_log( +inline return_type_t exp_mod_normal_cdf_log( const T_y& y, const T_loc& mu, const T_scale& sigma, const T_inv_scale& lambda) { return exp_mod_normal_lcdf(y, mu, sigma, diff --git a/stan/math/prim/prob/exp_mod_normal_lccdf.hpp b/stan/math/prim/prob/exp_mod_normal_lccdf.hpp index 4681e7ffef6..44d29b3cb67 100644 --- a/stan/math/prim/prob/exp_mod_normal_lccdf.hpp +++ b/stan/math/prim/prob/exp_mod_normal_lccdf.hpp @@ -28,7 +28,7 @@ namespace math { template * = nullptr> -return_type_t exp_mod_normal_lccdf( +inline return_type_t exp_mod_normal_lccdf( const T_y& y, const T_loc& mu, const T_scale& sigma, const T_inv_scale& lambda) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/exp_mod_normal_lcdf.hpp b/stan/math/prim/prob/exp_mod_normal_lcdf.hpp index 4e212fded85..fce9deae953 100644 --- a/stan/math/prim/prob/exp_mod_normal_lcdf.hpp +++ b/stan/math/prim/prob/exp_mod_normal_lcdf.hpp @@ -28,7 +28,7 @@ namespace math { template * = nullptr> -return_type_t exp_mod_normal_lcdf( +inline return_type_t exp_mod_normal_lcdf( const T_y& y, const T_loc& mu, const T_scale& sigma, const T_inv_scale& lambda) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/exp_mod_normal_lpdf.hpp b/stan/math/prim/prob/exp_mod_normal_lpdf.hpp index f2b8b5f2867..d0a59719072 100644 --- a/stan/math/prim/prob/exp_mod_normal_lpdf.hpp +++ b/stan/math/prim/prob/exp_mod_normal_lpdf.hpp @@ -26,7 +26,7 @@ template * = nullptr> -return_type_t exp_mod_normal_lpdf( +inline return_type_t exp_mod_normal_lpdf( const T_y& y, const T_loc& mu, const T_scale& sigma, const T_inv_scale& lambda) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/exponential_ccdf_log.hpp b/stan/math/prim/prob/exponential_ccdf_log.hpp index dec72eff28d..53d0378eb0a 100644 --- a/stan/math/prim/prob/exponential_ccdf_log.hpp +++ b/stan/math/prim/prob/exponential_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use exponential_lccdf */ template -return_type_t exponential_ccdf_log(const T_y& y, +inline return_type_t exponential_ccdf_log(const T_y& y, const T_inv_scale& beta) { return exponential_lccdf(y, beta); } diff --git a/stan/math/prim/prob/exponential_cdf.hpp b/stan/math/prim/prob/exponential_cdf.hpp index 26915bbffe5..48545c73645 100644 --- a/stan/math/prim/prob/exponential_cdf.hpp +++ b/stan/math/prim/prob/exponential_cdf.hpp @@ -32,7 +32,7 @@ namespace math { template * = nullptr> -return_type_t exponential_cdf(const T_y& y, +inline return_type_t exponential_cdf(const T_y& y, const T_inv_scale& beta) { using T_partials_return = partials_return_t; using T_partials_array = Eigen::Array; diff --git a/stan/math/prim/prob/exponential_cdf_log.hpp b/stan/math/prim/prob/exponential_cdf_log.hpp index fd7d58ddad0..eab8bd60849 100644 --- a/stan/math/prim/prob/exponential_cdf_log.hpp +++ b/stan/math/prim/prob/exponential_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use exponential_lcdf */ template -return_type_t exponential_cdf_log(const T_y& y, +inline return_type_t exponential_cdf_log(const T_y& y, const T_inv_scale& beta) { return exponential_lcdf(y, beta); } diff --git a/stan/math/prim/prob/exponential_lccdf.hpp b/stan/math/prim/prob/exponential_lccdf.hpp index e6d4cdfc803..3af821a39f2 100644 --- a/stan/math/prim/prob/exponential_lccdf.hpp +++ b/stan/math/prim/prob/exponential_lccdf.hpp @@ -17,7 +17,7 @@ namespace math { template * = nullptr> -return_type_t exponential_lccdf(const T_y& y, +inline return_type_t exponential_lccdf(const T_y& y, const T_inv_scale& beta) { using T_partials_return = partials_return_t; using T_partials_array = Eigen::Array; diff --git a/stan/math/prim/prob/exponential_lcdf.hpp b/stan/math/prim/prob/exponential_lcdf.hpp index c0fc2243385..b20bbaa2122 100644 --- a/stan/math/prim/prob/exponential_lcdf.hpp +++ b/stan/math/prim/prob/exponential_lcdf.hpp @@ -21,7 +21,7 @@ namespace math { template * = nullptr> -return_type_t exponential_lcdf(const T_y& y, +inline return_type_t exponential_lcdf(const T_y& y, const T_inv_scale& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/exponential_lpdf.hpp b/stan/math/prim/prob/exponential_lpdf.hpp index 1157b6397b4..60daefc37cf 100644 --- a/stan/math/prim/prob/exponential_lpdf.hpp +++ b/stan/math/prim/prob/exponential_lpdf.hpp @@ -49,7 +49,7 @@ namespace math { template * = nullptr> -return_type_t exponential_lpdf(const T_y& y, +inline return_type_t exponential_lpdf(const T_y& y, const T_inv_scale& beta) { using T_partials_return = partials_return_t; using T_partials_array = Eigen::Array; diff --git a/stan/math/prim/prob/frechet_ccdf_log.hpp b/stan/math/prim/prob/frechet_ccdf_log.hpp index 16888cdf6cf..c05449de3c3 100644 --- a/stan/math/prim/prob/frechet_ccdf_log.hpp +++ b/stan/math/prim/prob/frechet_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use frechet_lccdf */ template -return_type_t frechet_ccdf_log(const T_y& y, +inline return_type_t frechet_ccdf_log(const T_y& y, const T_shape& alpha, const T_scale& sigma) { return frechet_lccdf(y, alpha, sigma); diff --git a/stan/math/prim/prob/frechet_cdf.hpp b/stan/math/prim/prob/frechet_cdf.hpp index d395e4fa4e9..9a20382d400 100644 --- a/stan/math/prim/prob/frechet_cdf.hpp +++ b/stan/math/prim/prob/frechet_cdf.hpp @@ -25,7 +25,7 @@ namespace math { template * = nullptr> -return_type_t frechet_cdf(const T_y& y, +inline return_type_t frechet_cdf(const T_y& y, const T_shape& alpha, const T_scale& sigma) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/frechet_cdf_log.hpp b/stan/math/prim/prob/frechet_cdf_log.hpp index 0474e32f96f..0b41ebc4520 100644 --- a/stan/math/prim/prob/frechet_cdf_log.hpp +++ b/stan/math/prim/prob/frechet_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use frechet_lcdf */ template -return_type_t frechet_cdf_log(const T_y& y, +inline return_type_t frechet_cdf_log(const T_y& y, const T_shape& alpha, const T_scale& sigma) { return frechet_lcdf(y, alpha, sigma); diff --git a/stan/math/prim/prob/frechet_lccdf.hpp b/stan/math/prim/prob/frechet_lccdf.hpp index ede31ddc105..eb2cc3ecf00 100644 --- a/stan/math/prim/prob/frechet_lccdf.hpp +++ b/stan/math/prim/prob/frechet_lccdf.hpp @@ -25,7 +25,7 @@ namespace math { template * = nullptr> -return_type_t frechet_lccdf(const T_y& y, +inline return_type_t frechet_lccdf(const T_y& y, const T_shape& alpha, const T_scale& sigma) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/frechet_lcdf.hpp b/stan/math/prim/prob/frechet_lcdf.hpp index 72ae9d2f980..7d91821cd18 100644 --- a/stan/math/prim/prob/frechet_lcdf.hpp +++ b/stan/math/prim/prob/frechet_lcdf.hpp @@ -23,7 +23,7 @@ namespace math { template * = nullptr> -return_type_t frechet_lcdf(const T_y& y, +inline return_type_t frechet_lcdf(const T_y& y, const T_shape& alpha, const T_scale& sigma) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/frechet_lpdf.hpp b/stan/math/prim/prob/frechet_lpdf.hpp index 20ae50fb899..46963ce0662 100644 --- a/stan/math/prim/prob/frechet_lpdf.hpp +++ b/stan/math/prim/prob/frechet_lpdf.hpp @@ -28,7 +28,7 @@ namespace math { template * = nullptr> -return_type_t frechet_lpdf(const T_y& y, +inline return_type_t frechet_lpdf(const T_y& y, const T_shape& alpha, const T_scale& sigma) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/gamma_ccdf_log.hpp b/stan/math/prim/prob/gamma_ccdf_log.hpp index 5de76f43a64..f7648535672 100644 --- a/stan/math/prim/prob/gamma_ccdf_log.hpp +++ b/stan/math/prim/prob/gamma_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use gamma_lccdf */ template -return_type_t gamma_ccdf_log( +inline return_type_t gamma_ccdf_log( const T_y& y, const T_shape& alpha, const T_inv_scale& beta) { return gamma_lccdf(y, alpha, beta); } diff --git a/stan/math/prim/prob/gamma_cdf.hpp b/stan/math/prim/prob/gamma_cdf.hpp index f924707cf38..8319257534c 100644 --- a/stan/math/prim/prob/gamma_cdf.hpp +++ b/stan/math/prim/prob/gamma_cdf.hpp @@ -38,7 +38,7 @@ namespace math { * @throw std::domain_error if y is not greater than or equal to 0. */ template -return_type_t gamma_cdf(const T_y& y, +inline return_type_t gamma_cdf(const T_y& y, const T_shape& alpha, const T_inv_scale& beta) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/gamma_cdf_log.hpp b/stan/math/prim/prob/gamma_cdf_log.hpp index 37e67599f8a..3ec0e7a1e48 100644 --- a/stan/math/prim/prob/gamma_cdf_log.hpp +++ b/stan/math/prim/prob/gamma_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use gamma_lcdf */ template -return_type_t gamma_cdf_log( +inline return_type_t gamma_cdf_log( const T_y& y, const T_shape& alpha, const T_inv_scale& beta) { return gamma_lcdf(y, alpha, beta); } diff --git a/stan/math/prim/prob/gamma_lccdf.hpp b/stan/math/prim/prob/gamma_lccdf.hpp index c356209f898..2f57ca762a1 100644 --- a/stan/math/prim/prob/gamma_lccdf.hpp +++ b/stan/math/prim/prob/gamma_lccdf.hpp @@ -22,7 +22,7 @@ namespace stan { namespace math { template -return_type_t gamma_lccdf(const T_y& y, +inline return_type_t gamma_lccdf(const T_y& y, const T_shape& alpha, const T_inv_scale& beta) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/gamma_lcdf.hpp b/stan/math/prim/prob/gamma_lcdf.hpp index 27d13619064..8d184687ddc 100644 --- a/stan/math/prim/prob/gamma_lcdf.hpp +++ b/stan/math/prim/prob/gamma_lcdf.hpp @@ -22,7 +22,7 @@ namespace stan { namespace math { template -return_type_t gamma_lcdf(const T_y& y, +inline return_type_t gamma_lcdf(const T_y& y, const T_shape& alpha, const T_inv_scale& beta) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/gamma_lpdf.hpp b/stan/math/prim/prob/gamma_lpdf.hpp index 9b5d325f144..9c056d215a6 100644 --- a/stan/math/prim/prob/gamma_lpdf.hpp +++ b/stan/math/prim/prob/gamma_lpdf.hpp @@ -49,7 +49,7 @@ namespace math { template * = nullptr> -return_type_t gamma_lpdf(const T_y& y, +inline return_type_t gamma_lpdf(const T_y& y, const T_shape& alpha, const T_inv_scale& beta) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/gumbel_ccdf_log.hpp b/stan/math/prim/prob/gumbel_ccdf_log.hpp index 13a6280e380..320ffd56c71 100644 --- a/stan/math/prim/prob/gumbel_ccdf_log.hpp +++ b/stan/math/prim/prob/gumbel_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use gumbel_lccdf */ template -return_type_t gumbel_ccdf_log(const T_y& y, +inline return_type_t gumbel_ccdf_log(const T_y& y, const T_loc& mu, const T_scale& beta) { return gumbel_lccdf(y, mu, beta); diff --git a/stan/math/prim/prob/gumbel_cdf.hpp b/stan/math/prim/prob/gumbel_cdf.hpp index 87ad0b527e2..3510a83ccd3 100644 --- a/stan/math/prim/prob/gumbel_cdf.hpp +++ b/stan/math/prim/prob/gumbel_cdf.hpp @@ -36,7 +36,7 @@ namespace math { template * = nullptr> -return_type_t gumbel_cdf(const T_y& y, const T_loc& mu, +inline return_type_t gumbel_cdf(const T_y& y, const T_loc& mu, const T_scale& beta) { using T_partials_return = partials_return_t; using T_partials_array = Eigen::Array; diff --git a/stan/math/prim/prob/gumbel_cdf_log.hpp b/stan/math/prim/prob/gumbel_cdf_log.hpp index adbeeefb110..ab5ebc98c48 100644 --- a/stan/math/prim/prob/gumbel_cdf_log.hpp +++ b/stan/math/prim/prob/gumbel_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use gumbel_lcdf */ template -return_type_t gumbel_cdf_log(const T_y& y, const T_loc& mu, +inline return_type_t gumbel_cdf_log(const T_y& y, const T_loc& mu, const T_scale& beta) { return gumbel_lcdf(y, mu, beta); } diff --git a/stan/math/prim/prob/gumbel_lccdf.hpp b/stan/math/prim/prob/gumbel_lccdf.hpp index 963b1b26135..1cc6cda8c47 100644 --- a/stan/math/prim/prob/gumbel_lccdf.hpp +++ b/stan/math/prim/prob/gumbel_lccdf.hpp @@ -36,7 +36,7 @@ namespace math { template * = nullptr> -return_type_t gumbel_lccdf(const T_y& y, const T_loc& mu, +inline return_type_t gumbel_lccdf(const T_y& y, const T_loc& mu, const T_scale& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/gumbel_lcdf.hpp b/stan/math/prim/prob/gumbel_lcdf.hpp index e8e31fa4370..4722c83d898 100644 --- a/stan/math/prim/prob/gumbel_lcdf.hpp +++ b/stan/math/prim/prob/gumbel_lcdf.hpp @@ -35,7 +35,7 @@ namespace math { template * = nullptr> -return_type_t gumbel_lcdf(const T_y& y, const T_loc& mu, +inline return_type_t gumbel_lcdf(const T_y& y, const T_loc& mu, const T_scale& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/gumbel_lpdf.hpp b/stan/math/prim/prob/gumbel_lpdf.hpp index ef0f175306c..1cac94f70fd 100644 --- a/stan/math/prim/prob/gumbel_lpdf.hpp +++ b/stan/math/prim/prob/gumbel_lpdf.hpp @@ -37,7 +37,7 @@ namespace math { template * = nullptr> -return_type_t gumbel_lpdf(const T_y& y, const T_loc& mu, +inline return_type_t gumbel_lpdf(const T_y& y, const T_loc& mu, const T_scale& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/hypergeometric_lpmf.hpp b/stan/math/prim/prob/hypergeometric_lpmf.hpp index ea27fb1e8ba..69d11b4194f 100644 --- a/stan/math/prim/prob/hypergeometric_lpmf.hpp +++ b/stan/math/prim/prob/hypergeometric_lpmf.hpp @@ -15,7 +15,7 @@ namespace math { // n: #white balls drawn; N: #balls drawn; // a: #white balls; b: #black balls template -double hypergeometric_lpmf(const T_n& n, const T_N& N, const T_a& a, +inline double hypergeometric_lpmf(const T_n& n, const T_N& N, const T_a& a, const T_b& b) { static constexpr const char* function = "hypergeometric_lpmf"; check_bounded(function, "Successes variable", value_of(n), 0, a); diff --git a/stan/math/prim/prob/inv_chi_square_ccdf_log.hpp b/stan/math/prim/prob/inv_chi_square_ccdf_log.hpp index 80c3267d035..f07eaef24d3 100644 --- a/stan/math/prim/prob/inv_chi_square_ccdf_log.hpp +++ b/stan/math/prim/prob/inv_chi_square_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use inv_chi_square_lccdf */ template -return_type_t inv_chi_square_ccdf_log(const T_y& y, +inline return_type_t inv_chi_square_ccdf_log(const T_y& y, const T_dof& nu) { return inv_chi_square_lccdf(y, nu); } diff --git a/stan/math/prim/prob/inv_chi_square_cdf.hpp b/stan/math/prim/prob/inv_chi_square_cdf.hpp index 3c14fe1f1e8..c02d09f1a5e 100644 --- a/stan/math/prim/prob/inv_chi_square_cdf.hpp +++ b/stan/math/prim/prob/inv_chi_square_cdf.hpp @@ -34,7 +34,7 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -return_type_t inv_chi_square_cdf(const T_y& y, const T_dof& nu) { +inline return_type_t inv_chi_square_cdf(const T_y& y, const T_dof& nu) { using T_partials_return = partials_return_t; using std::exp; using std::pow; diff --git a/stan/math/prim/prob/inv_chi_square_cdf_log.hpp b/stan/math/prim/prob/inv_chi_square_cdf_log.hpp index c5f7fb91ff9..176ba481003 100644 --- a/stan/math/prim/prob/inv_chi_square_cdf_log.hpp +++ b/stan/math/prim/prob/inv_chi_square_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use inv_chi_square_lcdf */ template -return_type_t inv_chi_square_cdf_log(const T_y& y, +inline return_type_t inv_chi_square_cdf_log(const T_y& y, const T_dof& nu) { return inv_chi_square_lcdf(y, nu); } diff --git a/stan/math/prim/prob/inv_chi_square_lccdf.hpp b/stan/math/prim/prob/inv_chi_square_lccdf.hpp index c4f41a1bef4..484bab336c6 100644 --- a/stan/math/prim/prob/inv_chi_square_lccdf.hpp +++ b/stan/math/prim/prob/inv_chi_square_lccdf.hpp @@ -35,7 +35,7 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -return_type_t inv_chi_square_lccdf(const T_y& y, const T_dof& nu) { +inline return_type_t inv_chi_square_lccdf(const T_y& y, const T_dof& nu) { using T_partials_return = partials_return_t; using std::exp; using std::log; diff --git a/stan/math/prim/prob/inv_chi_square_lcdf.hpp b/stan/math/prim/prob/inv_chi_square_lcdf.hpp index d4446ca374a..90fc5ef2b00 100644 --- a/stan/math/prim/prob/inv_chi_square_lcdf.hpp +++ b/stan/math/prim/prob/inv_chi_square_lcdf.hpp @@ -35,7 +35,7 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -return_type_t inv_chi_square_lcdf(const T_y& y, const T_dof& nu) { +inline return_type_t inv_chi_square_lcdf(const T_y& y, const T_dof& nu) { using T_partials_return = partials_return_t; using std::exp; using std::log; diff --git a/stan/math/prim/prob/inv_chi_square_lpdf.hpp b/stan/math/prim/prob/inv_chi_square_lpdf.hpp index cfbb02d94e8..a74c4ed8814 100644 --- a/stan/math/prim/prob/inv_chi_square_lpdf.hpp +++ b/stan/math/prim/prob/inv_chi_square_lpdf.hpp @@ -46,7 +46,7 @@ namespace math { template * = nullptr> -return_type_t inv_chi_square_lpdf(const T_y& y, const T_dof& nu) { +inline 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; diff --git a/stan/math/prim/prob/inv_gamma_ccdf_log.hpp b/stan/math/prim/prob/inv_gamma_ccdf_log.hpp index 7dccc2cb7fb..3bfbe77cbb9 100644 --- a/stan/math/prim/prob/inv_gamma_ccdf_log.hpp +++ b/stan/math/prim/prob/inv_gamma_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use inv_gamma_lccdf */ template -return_type_t inv_gamma_ccdf_log(const T_y& y, +inline return_type_t inv_gamma_ccdf_log(const T_y& y, const T_shape& alpha, const T_scale& beta) { return inv_gamma_lccdf(y, alpha, beta); diff --git a/stan/math/prim/prob/inv_gamma_cdf.hpp b/stan/math/prim/prob/inv_gamma_cdf.hpp index c0f625a96e8..b28e66043b4 100644 --- a/stan/math/prim/prob/inv_gamma_cdf.hpp +++ b/stan/math/prim/prob/inv_gamma_cdf.hpp @@ -37,7 +37,7 @@ namespace math { */ template -return_type_t inv_gamma_cdf(const T_y& y, +inline return_type_t inv_gamma_cdf(const T_y& y, const T_shape& alpha, const T_scale& beta) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/inv_gamma_cdf_log.hpp b/stan/math/prim/prob/inv_gamma_cdf_log.hpp index 83f56f27273..c9aa5b3ff86 100644 --- a/stan/math/prim/prob/inv_gamma_cdf_log.hpp +++ b/stan/math/prim/prob/inv_gamma_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use inv_gamma_lcdf */ template -return_type_t inv_gamma_cdf_log(const T_y& y, +inline return_type_t inv_gamma_cdf_log(const T_y& y, const T_shape& alpha, const T_scale& beta) { return inv_gamma_lcdf(y, alpha, beta); diff --git a/stan/math/prim/prob/inv_gamma_lccdf.hpp b/stan/math/prim/prob/inv_gamma_lccdf.hpp index 9326d826f9e..e2af203ca02 100644 --- a/stan/math/prim/prob/inv_gamma_lccdf.hpp +++ b/stan/math/prim/prob/inv_gamma_lccdf.hpp @@ -22,7 +22,7 @@ namespace stan { namespace math { template -return_type_t inv_gamma_lccdf(const T_y& y, +inline return_type_t inv_gamma_lccdf(const T_y& y, const T_shape& alpha, const T_scale& beta) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/inv_gamma_lcdf.hpp b/stan/math/prim/prob/inv_gamma_lcdf.hpp index 7873531cbd0..9ba2529b2e4 100644 --- a/stan/math/prim/prob/inv_gamma_lcdf.hpp +++ b/stan/math/prim/prob/inv_gamma_lcdf.hpp @@ -22,7 +22,7 @@ namespace stan { namespace math { template -return_type_t inv_gamma_lcdf(const T_y& y, +inline return_type_t inv_gamma_lcdf(const T_y& y, const T_shape& alpha, const T_scale& beta) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/inv_gamma_lpdf.hpp b/stan/math/prim/prob/inv_gamma_lpdf.hpp index 758f3363b34..be9e0547b3e 100644 --- a/stan/math/prim/prob/inv_gamma_lpdf.hpp +++ b/stan/math/prim/prob/inv_gamma_lpdf.hpp @@ -41,7 +41,7 @@ namespace math { template * = nullptr> -return_type_t inv_gamma_lpdf(const T_y& y, +inline return_type_t inv_gamma_lpdf(const T_y& y, const T_shape& alpha, const T_scale& beta) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/inv_wishart_cholesky_lpdf.hpp b/stan/math/prim/prob/inv_wishart_cholesky_lpdf.hpp index 10269b81da5..a24e66891d6 100644 --- a/stan/math/prim/prob/inv_wishart_cholesky_lpdf.hpp +++ b/stan/math/prim/prob/inv_wishart_cholesky_lpdf.hpp @@ -40,7 +40,7 @@ namespace math { template * = nullptr, require_all_matrix_t* = nullptr> -return_type_t inv_wishart_cholesky_lpdf( +inline return_type_t inv_wishart_cholesky_lpdf( const T_y& L_Y, const T_dof& nu, const T_scale& L_S) { using Eigen::Lower; using T_L_Y_ref = ref_type_t; diff --git a/stan/math/prim/prob/inv_wishart_lpdf.hpp b/stan/math/prim/prob/inv_wishart_lpdf.hpp index f9cb03de64a..a52c513c937 100644 --- a/stan/math/prim/prob/inv_wishart_lpdf.hpp +++ b/stan/math/prim/prob/inv_wishart_lpdf.hpp @@ -42,7 +42,7 @@ namespace math { * semi-positive definite. */ template -return_type_t inv_wishart_lpdf(const T_y& W, +inline return_type_t inv_wishart_lpdf(const T_y& W, const T_dof& nu, const T_scale& S) { using Eigen::Dynamic; diff --git a/stan/math/prim/prob/lkj_corr_cholesky_lpdf.hpp b/stan/math/prim/prob/lkj_corr_cholesky_lpdf.hpp index 85adc58e728..30f8b700191 100644 --- a/stan/math/prim/prob/lkj_corr_cholesky_lpdf.hpp +++ b/stan/math/prim/prob/lkj_corr_cholesky_lpdf.hpp @@ -15,7 +15,7 @@ namespace math { // LKJ_Corr(L|eta) [ L Cholesky factor of correlation matrix // eta > 0; eta == 1 <-> uniform] template -return_type_t lkj_corr_cholesky_lpdf(const T_covar& L, +inline return_type_t lkj_corr_cholesky_lpdf(const T_covar& L, const T_shape& eta) { using lp_ret = return_type_t; static constexpr const char* function = "lkj_corr_cholesky_lpdf"; diff --git a/stan/math/prim/prob/lkj_corr_lpdf.hpp b/stan/math/prim/prob/lkj_corr_lpdf.hpp index 4314a11e47c..66e59edd3f7 100644 --- a/stan/math/prim/prob/lkj_corr_lpdf.hpp +++ b/stan/math/prim/prob/lkj_corr_lpdf.hpp @@ -13,7 +13,7 @@ namespace stan { namespace math { template -return_type_t do_lkj_constant(const T_shape& eta, +inline return_type_t do_lkj_constant(const T_shape& eta, const unsigned int& K) { // Lewandowski, Kurowicka, and Joe (2009) theorem 5 return_type_t constant; @@ -46,7 +46,7 @@ return_type_t do_lkj_constant(const T_shape& eta, // LKJ_Corr(y|eta) [ y correlation matrix (not covariance matrix) // eta > 0; eta == 1 <-> uniform] template -return_type_t lkj_corr_lpdf(const T_y& y, const T_shape& eta) { +inline return_type_t lkj_corr_lpdf(const T_y& y, const T_shape& eta) { static constexpr const char* function = "lkj_corr_lpdf"; return_type_t lp(0.0); diff --git a/stan/math/prim/prob/lkj_cov_lpdf.hpp b/stan/math/prim/prob/lkj_cov_lpdf.hpp index 951e1bf53b7..1755b11283f 100644 --- a/stan/math/prim/prob/lkj_cov_lpdf.hpp +++ b/stan/math/prim/prob/lkj_cov_lpdf.hpp @@ -18,7 +18,7 @@ namespace math { template * = nullptr, require_all_eigen_col_vector_t* = nullptr> -return_type_t lkj_cov_lpdf(const T_y& y, +inline return_type_t lkj_cov_lpdf(const T_y& y, const T_loc& mu, const T_scale& sigma, const T_shape& eta) { @@ -65,7 +65,7 @@ return_type_t lkj_cov_lpdf(const T_y& y, template * = nullptr, require_all_stan_scalar_t* = nullptr> -return_type_t lkj_cov_lpdf(const T_y& y, +inline return_type_t lkj_cov_lpdf(const T_y& y, const T_loc& mu, const T_scale& sigma, const T_shape& eta) { diff --git a/stan/math/prim/prob/logistic_ccdf_log.hpp b/stan/math/prim/prob/logistic_ccdf_log.hpp index d1016cab4cf..b5c7f8297db 100644 --- a/stan/math/prim/prob/logistic_ccdf_log.hpp +++ b/stan/math/prim/prob/logistic_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use logistic_lccdf */ template -return_type_t logistic_ccdf_log(const T_y& y, +inline return_type_t logistic_ccdf_log(const T_y& y, const T_loc& mu, const T_scale& sigma) { return logistic_lccdf(y, mu, sigma); diff --git a/stan/math/prim/prob/logistic_cdf.hpp b/stan/math/prim/prob/logistic_cdf.hpp index 9d61d7bcc59..61da9efe20d 100644 --- a/stan/math/prim/prob/logistic_cdf.hpp +++ b/stan/math/prim/prob/logistic_cdf.hpp @@ -22,7 +22,7 @@ namespace math { template * = nullptr> -return_type_t logistic_cdf(const T_y& y, const T_loc& mu, +inline return_type_t logistic_cdf(const T_y& y, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; using std::exp; diff --git a/stan/math/prim/prob/logistic_cdf_log.hpp b/stan/math/prim/prob/logistic_cdf_log.hpp index eb3b2757f13..55f50890f35 100644 --- a/stan/math/prim/prob/logistic_cdf_log.hpp +++ b/stan/math/prim/prob/logistic_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use logistic_lcdf */ template -return_type_t logistic_cdf_log(const T_y& y, +inline return_type_t logistic_cdf_log(const T_y& y, const T_loc& mu, const T_scale& sigma) { return logistic_lcdf(y, mu, sigma); diff --git a/stan/math/prim/prob/logistic_lccdf.hpp b/stan/math/prim/prob/logistic_lccdf.hpp index 408db8ec58b..d37d2b1bb0f 100644 --- a/stan/math/prim/prob/logistic_lccdf.hpp +++ b/stan/math/prim/prob/logistic_lccdf.hpp @@ -22,7 +22,7 @@ namespace math { template * = nullptr> -return_type_t logistic_lccdf(const T_y& y, const T_loc& mu, +inline return_type_t logistic_lccdf(const T_y& y, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; using std::exp; diff --git a/stan/math/prim/prob/logistic_lcdf.hpp b/stan/math/prim/prob/logistic_lcdf.hpp index 727f33d2160..dabfc0beaa2 100644 --- a/stan/math/prim/prob/logistic_lcdf.hpp +++ b/stan/math/prim/prob/logistic_lcdf.hpp @@ -22,7 +22,7 @@ namespace math { template * = nullptr> -return_type_t logistic_lcdf(const T_y& y, const T_loc& mu, +inline return_type_t logistic_lcdf(const T_y& y, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; using std::exp; diff --git a/stan/math/prim/prob/logistic_lpdf.hpp b/stan/math/prim/prob/logistic_lpdf.hpp index a220fb397b2..c73c2a36e1d 100644 --- a/stan/math/prim/prob/logistic_lpdf.hpp +++ b/stan/math/prim/prob/logistic_lpdf.hpp @@ -25,7 +25,7 @@ namespace math { template * = nullptr> -return_type_t logistic_lpdf(const T_y& y, const T_loc& mu, +inline return_type_t logistic_lpdf(const T_y& y, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/loglogistic_cdf.hpp b/stan/math/prim/prob/loglogistic_cdf.hpp index dc630aaca0d..72c27f37b31 100644 --- a/stan/math/prim/prob/loglogistic_cdf.hpp +++ b/stan/math/prim/prob/loglogistic_cdf.hpp @@ -43,7 +43,7 @@ namespace math { template * = nullptr> -return_type_t loglogistic_cdf(const T_y& y, +inline return_type_t loglogistic_cdf(const T_y& y, const T_scale& alpha, const T_shape& beta) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/loglogistic_lpdf.hpp b/stan/math/prim/prob/loglogistic_lpdf.hpp index 81735aca52d..24cb18bbcd1 100644 --- a/stan/math/prim/prob/loglogistic_lpdf.hpp +++ b/stan/math/prim/prob/loglogistic_lpdf.hpp @@ -42,7 +42,7 @@ namespace math { template * = nullptr> -return_type_t loglogistic_lpdf(const T_y& y, +inline return_type_t loglogistic_lpdf(const T_y& y, const T_scale& alpha, const T_shape& beta) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/lognormal_ccdf_log.hpp b/stan/math/prim/prob/lognormal_ccdf_log.hpp index d85fe848ec9..e282d2e961d 100644 --- a/stan/math/prim/prob/lognormal_ccdf_log.hpp +++ b/stan/math/prim/prob/lognormal_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use lognormal_lccdf */ template -return_type_t lognormal_ccdf_log(const T_y& y, +inline return_type_t lognormal_ccdf_log(const T_y& y, const T_loc& mu, const T_scale& sigma) { return lognormal_lccdf(y, mu, sigma); diff --git a/stan/math/prim/prob/lognormal_cdf.hpp b/stan/math/prim/prob/lognormal_cdf.hpp index 11cf048b63c..75f27962bc6 100644 --- a/stan/math/prim/prob/lognormal_cdf.hpp +++ b/stan/math/prim/prob/lognormal_cdf.hpp @@ -25,7 +25,7 @@ namespace math { template * = nullptr> -return_type_t lognormal_cdf(const T_y& y, const T_loc& mu, +inline return_type_t lognormal_cdf(const T_y& y, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/lognormal_cdf_log.hpp b/stan/math/prim/prob/lognormal_cdf_log.hpp index ef4ab1983b2..511b50efdf1 100644 --- a/stan/math/prim/prob/lognormal_cdf_log.hpp +++ b/stan/math/prim/prob/lognormal_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use lognormal_lcdf */ template -return_type_t lognormal_cdf_log(const T_y& y, +inline return_type_t lognormal_cdf_log(const T_y& y, const T_loc& mu, const T_scale& sigma) { return lognormal_lcdf(y, mu, sigma); diff --git a/stan/math/prim/prob/lognormal_lccdf.hpp b/stan/math/prim/prob/lognormal_lccdf.hpp index 8cd9bfabbc7..b399165be45 100644 --- a/stan/math/prim/prob/lognormal_lccdf.hpp +++ b/stan/math/prim/prob/lognormal_lccdf.hpp @@ -25,7 +25,7 @@ namespace math { template * = nullptr> -return_type_t lognormal_lccdf(const T_y& y, +inline return_type_t lognormal_lccdf(const T_y& y, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/lognormal_lcdf.hpp b/stan/math/prim/prob/lognormal_lcdf.hpp index 08f89430ad3..540542980e3 100644 --- a/stan/math/prim/prob/lognormal_lcdf.hpp +++ b/stan/math/prim/prob/lognormal_lcdf.hpp @@ -25,7 +25,7 @@ namespace math { template * = nullptr> -return_type_t lognormal_lcdf(const T_y& y, const T_loc& mu, +inline return_type_t lognormal_lcdf(const T_y& y, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/lognormal_lpdf.hpp b/stan/math/prim/prob/lognormal_lpdf.hpp index 92b545ca67d..25a710ca8a1 100644 --- a/stan/math/prim/prob/lognormal_lpdf.hpp +++ b/stan/math/prim/prob/lognormal_lpdf.hpp @@ -25,7 +25,7 @@ namespace math { template * = nullptr> -return_type_t lognormal_lpdf(const T_y& y, const T_loc& mu, +inline return_type_t lognormal_lpdf(const T_y& y, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/matrix_normal_prec_lpdf.hpp b/stan/math/prim/prob/matrix_normal_prec_lpdf.hpp index 76d9718ccd3..329abd940d9 100644 --- a/stan/math/prim/prob/matrix_normal_prec_lpdf.hpp +++ b/stan/math/prim/prob/matrix_normal_prec_lpdf.hpp @@ -33,7 +33,7 @@ namespace math { template * = nullptr> -return_type_t matrix_normal_prec_lpdf( +inline return_type_t matrix_normal_prec_lpdf( const T_y& y, const T_Mu& Mu, const T_Sigma& Sigma, const T_D& D) { static constexpr const char* function = "matrix_normal_prec_lpdf"; check_positive(function, "Sigma rows", Sigma.rows()); @@ -81,7 +81,7 @@ return_type_t matrix_normal_prec_lpdf( template * = nullptr> -return_type_t matrix_normal_prec_lpdf( +inline return_type_t matrix_normal_prec_lpdf( const T_y& y, const T_Mu& Mu, const T_Sigma& Sigma, const T_D& D) { return matrix_normal_prec_lpdf(y, Mu, Sigma, D); } diff --git a/stan/math/prim/prob/multi_gp_cholesky_lpdf.hpp b/stan/math/prim/prob/multi_gp_cholesky_lpdf.hpp index c3066358b7a..64088e7e690 100644 --- a/stan/math/prim/prob/multi_gp_cholesky_lpdf.hpp +++ b/stan/math/prim/prob/multi_gp_cholesky_lpdf.hpp @@ -38,7 +38,7 @@ namespace math { template * = nullptr, require_eigen_col_vector_t* = nullptr> -return_type_t multi_gp_cholesky_lpdf(const T_y& y, +inline 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; diff --git a/stan/math/prim/prob/multi_gp_lpdf.hpp b/stan/math/prim/prob/multi_gp_lpdf.hpp index 4a505e40937..2ea9c88d700 100644 --- a/stan/math/prim/prob/multi_gp_lpdf.hpp +++ b/stan/math/prim/prob/multi_gp_lpdf.hpp @@ -33,7 +33,7 @@ namespace math { template * = nullptr, require_col_vector_t* = nullptr> -return_type_t multi_gp_lpdf(const T_y& y, +inline return_type_t multi_gp_lpdf(const T_y& y, const T_covar& Sigma, const T_w& w) { using T_lp = return_type_t; diff --git a/stan/math/prim/prob/multi_normal_cholesky_lpdf.hpp b/stan/math/prim/prob/multi_normal_cholesky_lpdf.hpp index 04bbc8baba8..59ca107df6d 100644 --- a/stan/math/prim/prob/multi_normal_cholesky_lpdf.hpp +++ b/stan/math/prim/prob/multi_normal_cholesky_lpdf.hpp @@ -45,7 +45,7 @@ template * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_covar>* = nullptr> -return_type_t multi_normal_cholesky_lpdf( +inline return_type_t multi_normal_cholesky_lpdf( const T_y& y, const T_loc& mu, const T_covar& L) { static constexpr const char* function = "multi_normal_cholesky_lpdf"; using T_covar_elem = typename scalar_type::type; @@ -204,7 +204,7 @@ template * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_covar>* = nullptr> -return_type_t multi_normal_cholesky_lpdf( +inline return_type_t multi_normal_cholesky_lpdf( const T_y& y, const T_loc& mu, const T_covar& L) { static constexpr const char* function = "multi_normal_cholesky_lpdf"; using T_covar_elem = typename scalar_type::type; diff --git a/stan/math/prim/prob/multi_normal_lpdf.hpp b/stan/math/prim/prob/multi_normal_lpdf.hpp index 95e3b272705..84a90d78750 100644 --- a/stan/math/prim/prob/multi_normal_lpdf.hpp +++ b/stan/math/prim/prob/multi_normal_lpdf.hpp @@ -25,7 +25,7 @@ template * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_covar>* = nullptr> -return_type_t multi_normal_lpdf(const T_y& y, +inline return_type_t multi_normal_lpdf(const T_y& y, const T_loc& mu, const T_covar& Sigma) { using T_covar_elem = typename scalar_type::type; @@ -159,7 +159,7 @@ template * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_covar>* = nullptr> -return_type_t multi_normal_lpdf(const T_y& y, +inline return_type_t multi_normal_lpdf(const T_y& y, const T_loc& mu, const T_covar& Sigma) { using T_covar_elem = typename scalar_type::type; diff --git a/stan/math/prim/prob/multi_normal_prec_lpdf.hpp b/stan/math/prim/prob/multi_normal_prec_lpdf.hpp index 2bedbe52c7a..cf2d7d048a6 100644 --- a/stan/math/prim/prob/multi_normal_prec_lpdf.hpp +++ b/stan/math/prim/prob/multi_normal_prec_lpdf.hpp @@ -17,7 +17,7 @@ namespace stan { namespace math { template -return_type_t multi_normal_prec_lpdf( +inline return_type_t multi_normal_prec_lpdf( const T_y& y, const T_loc& mu, const T_covar& Sigma) { using T_covar_elem = typename scalar_type::type; using lp_type = return_type_t; 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 acbbdf4f5ec..d119460be62 100644 --- a/stan/math/prim/prob/multi_student_t_cholesky_lpdf.hpp +++ b/stan/math/prim/prob/multi_student_t_cholesky_lpdf.hpp @@ -54,7 +54,7 @@ template < require_any_not_vector_vt* = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_covar>* = nullptr> -return_type_t multi_student_t_cholesky_lpdf( +inline return_type_t multi_student_t_cholesky_lpdf( const T_y& y, const T_dof& nu, const T_loc& mu, const T_covar& L) { static constexpr const char* function = "multi_student_t_cholesky"; using T_covar_elem = typename scalar_type::type; @@ -242,7 +242,7 @@ template * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_dof, T_loc, T_covar>* = nullptr> -return_type_t multi_student_t_cholesky_lpdf( +inline return_type_t multi_student_t_cholesky_lpdf( const T_y& y, const T_dof& nu, const T_loc& mu, const T_covar& L) { static const char* function = "multi_student_t_cholesky"; using T_covar_elem = typename scalar_type::type; diff --git a/stan/math/prim/prob/multi_student_t_lpdf.hpp b/stan/math/prim/prob/multi_student_t_lpdf.hpp index a14c3313875..f4e0798d9c2 100644 --- a/stan/math/prim/prob/multi_student_t_lpdf.hpp +++ b/stan/math/prim/prob/multi_student_t_lpdf.hpp @@ -40,7 +40,7 @@ namespace math { */ template -return_type_t multi_student_t_lpdf( +inline return_type_t multi_student_t_lpdf( const T_y& y, const T_dof& nu, const T_loc& mu, const T_scale& Sigma) { using T_scale_elem = typename scalar_type::type; using lp_type = return_type_t; diff --git a/stan/math/prim/prob/multinomial_logit_lpmf.hpp b/stan/math/prim/prob/multinomial_logit_lpmf.hpp index 0ee9a867424..e6c0996fe01 100644 --- a/stan/math/prim/prob/multinomial_logit_lpmf.hpp +++ b/stan/math/prim/prob/multinomial_logit_lpmf.hpp @@ -22,7 +22,7 @@ namespace math { */ template , require_eigen_col_vector_t* = nullptr> -return_type_t multinomial_logit_lpmf(const std::vector& ns, +inline return_type_t multinomial_logit_lpmf(const std::vector& ns, const T_beta& beta) { static constexpr const char* function = "multinomial_logit_lpmf"; check_size_match(function, "Size of number of trials variable", ns.size(), @@ -52,7 +52,7 @@ return_type_t multinomial_logit_lpmf(const std::vector& ns, } template * = nullptr> -return_type_t multinomial_logit_lpmf(const std::vector& ns, +inline return_type_t multinomial_logit_lpmf(const std::vector& ns, const T_beta& beta) { return multinomial_logit_lpmf(ns, beta); } diff --git a/stan/math/prim/prob/multinomial_lpmf.hpp b/stan/math/prim/prob/multinomial_lpmf.hpp index 38af773d002..051e8f9c03a 100644 --- a/stan/math/prim/prob/multinomial_lpmf.hpp +++ b/stan/math/prim/prob/multinomial_lpmf.hpp @@ -14,7 +14,7 @@ namespace math { // 0 <= theta[n] <= 1; SUM theta = 1] template * = nullptr> -return_type_t multinomial_lpmf(const std::vector& ns, +inline return_type_t multinomial_lpmf(const std::vector& ns, const T_prob& theta) { static constexpr const char* function = "multinomial_lpmf"; check_size_match(function, "Size of number of trials variable", ns.size(), @@ -42,7 +42,7 @@ return_type_t multinomial_lpmf(const std::vector& ns, } template -return_type_t multinomial_lpmf(const std::vector& ns, +inline return_type_t multinomial_lpmf(const std::vector& ns, const T_prob& theta) { return multinomial_lpmf(ns, theta); } diff --git a/stan/math/prim/prob/neg_binomial_2_ccdf_log.hpp b/stan/math/prim/prob/neg_binomial_2_ccdf_log.hpp index bf65c709fee..6e603e961e7 100644 --- a/stan/math/prim/prob/neg_binomial_2_ccdf_log.hpp +++ b/stan/math/prim/prob/neg_binomial_2_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use neg_binomial_2_lccdf */ template -return_type_t neg_binomial_2_ccdf_log( +inline return_type_t neg_binomial_2_ccdf_log( const T_n& n, const T_location& mu, const T_precision& phi) { return neg_binomial_2_lccdf(n, mu, phi); } diff --git a/stan/math/prim/prob/neg_binomial_2_cdf.hpp b/stan/math/prim/prob/neg_binomial_2_cdf.hpp index 6f25c513454..47cab11d76d 100644 --- a/stan/math/prim/prob/neg_binomial_2_cdf.hpp +++ b/stan/math/prim/prob/neg_binomial_2_cdf.hpp @@ -21,7 +21,7 @@ namespace stan { namespace math { template -return_type_t neg_binomial_2_cdf( +inline return_type_t neg_binomial_2_cdf( const T_n& n, const T_location& mu, const T_precision& phi) { using T_partials_return = partials_return_t; using T_n_ref = ref_type_t; diff --git a/stan/math/prim/prob/neg_binomial_2_cdf_log.hpp b/stan/math/prim/prob/neg_binomial_2_cdf_log.hpp index 850e862fb1e..80b88ead1d6 100644 --- a/stan/math/prim/prob/neg_binomial_2_cdf_log.hpp +++ b/stan/math/prim/prob/neg_binomial_2_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use neg_binomial_2_lcdf */ template -return_type_t neg_binomial_2_cdf_log( +inline return_type_t neg_binomial_2_cdf_log( const T_n& n, const T_location& mu, const T_precision& phi) { return neg_binomial_2_lcdf(n, mu, phi); } diff --git a/stan/math/prim/prob/neg_binomial_2_lccdf.hpp b/stan/math/prim/prob/neg_binomial_2_lccdf.hpp index 2154e96a44d..0da477fee7c 100644 --- a/stan/math/prim/prob/neg_binomial_2_lccdf.hpp +++ b/stan/math/prim/prob/neg_binomial_2_lccdf.hpp @@ -14,7 +14,7 @@ namespace math { // Temporary neg_binomial_2_ccdf implementation that // transforms the input parameters and calls neg_binomial_ccdf template -return_type_t neg_binomial_2_lccdf( +inline 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; diff --git a/stan/math/prim/prob/neg_binomial_2_lcdf.hpp b/stan/math/prim/prob/neg_binomial_2_lcdf.hpp index 86eee78c5de..207e5532730 100644 --- a/stan/math/prim/prob/neg_binomial_2_lcdf.hpp +++ b/stan/math/prim/prob/neg_binomial_2_lcdf.hpp @@ -15,7 +15,7 @@ namespace stan { namespace math { template -return_type_t neg_binomial_2_lcdf( +inline return_type_t neg_binomial_2_lcdf( const T_n& n, const T_location& mu, const T_precision& phi) { using std::log; using T_n_ref = ref_type_t; 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 d7c39d1704d..b9999ab2ec4 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 @@ -64,7 +64,7 @@ namespace math { template * = nullptr> -return_type_t neg_binomial_2_log_glm_lpmf( +inline return_type_t neg_binomial_2_log_glm_lpmf( const T_y& y, const T_x& x, const T_alpha& alpha, const T_beta& beta, const T_precision& phi) { using Eigen::Array; 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 d6629faedac..44564538fbf 100644 --- a/stan/math/prim/prob/neg_binomial_2_log_lpmf.hpp +++ b/stan/math/prim/prob/neg_binomial_2_log_lpmf.hpp @@ -25,7 +25,7 @@ template * = nullptr> -return_type_t neg_binomial_2_log_lpmf( +inline return_type_t neg_binomial_2_log_lpmf( const T_n& n, const T_log_location& eta, const T_precision& phi) { using T_partials_return = partials_return_t; using std::exp; diff --git a/stan/math/prim/prob/neg_binomial_2_lpmf.hpp b/stan/math/prim/prob/neg_binomial_2_lpmf.hpp index b10f4db185f..0b6808c060f 100644 --- a/stan/math/prim/prob/neg_binomial_2_lpmf.hpp +++ b/stan/math/prim/prob/neg_binomial_2_lpmf.hpp @@ -22,7 +22,7 @@ namespace math { template * = nullptr> -return_type_t neg_binomial_2_lpmf( +inline return_type_t neg_binomial_2_lpmf( const T_n& n, const T_location& mu, const T_precision& phi) { using T_partials_return = partials_return_t; using std::log; diff --git a/stan/math/prim/prob/neg_binomial_ccdf_log.hpp b/stan/math/prim/prob/neg_binomial_ccdf_log.hpp index edba938ed20..3bb604a2a6d 100644 --- a/stan/math/prim/prob/neg_binomial_ccdf_log.hpp +++ b/stan/math/prim/prob/neg_binomial_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use neg_binomial_lccdf */ template -return_type_t neg_binomial_ccdf_log( +inline return_type_t neg_binomial_ccdf_log( const T_n& n, const T_shape& alpha, const T_inv_scale& beta) { return neg_binomial_lccdf(n, alpha, beta); } diff --git a/stan/math/prim/prob/neg_binomial_cdf.hpp b/stan/math/prim/prob/neg_binomial_cdf.hpp index 72e15ac4747..ebcc5b57107 100644 --- a/stan/math/prim/prob/neg_binomial_cdf.hpp +++ b/stan/math/prim/prob/neg_binomial_cdf.hpp @@ -22,7 +22,7 @@ namespace stan { namespace math { template -return_type_t neg_binomial_cdf(const T_n& n, +inline return_type_t neg_binomial_cdf(const T_n& n, const T_shape& alpha, const T_inv_scale& beta) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/neg_binomial_cdf_log.hpp b/stan/math/prim/prob/neg_binomial_cdf_log.hpp index e1b5ae8a552..2f9a11fdeac 100644 --- a/stan/math/prim/prob/neg_binomial_cdf_log.hpp +++ b/stan/math/prim/prob/neg_binomial_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use neg_binomial_lcdf */ template -return_type_t neg_binomial_cdf_log( +inline return_type_t neg_binomial_cdf_log( const T_n& n, const T_shape& alpha, const T_inv_scale& beta) { return neg_binomial_lcdf(n, alpha, beta); } diff --git a/stan/math/prim/prob/neg_binomial_lccdf.hpp b/stan/math/prim/prob/neg_binomial_lccdf.hpp index 7f6c6313ee6..cc24a6b79a7 100644 --- a/stan/math/prim/prob/neg_binomial_lccdf.hpp +++ b/stan/math/prim/prob/neg_binomial_lccdf.hpp @@ -24,7 +24,7 @@ namespace stan { namespace math { template -return_type_t neg_binomial_lccdf( +inline return_type_t neg_binomial_lccdf( const T_n& n, const T_shape& alpha, const T_inv_scale& beta_param) { using T_partials_return = partials_return_t; using std::exp; diff --git a/stan/math/prim/prob/neg_binomial_lcdf.hpp b/stan/math/prim/prob/neg_binomial_lcdf.hpp index 480a8b5527e..ba85ba41d0d 100644 --- a/stan/math/prim/prob/neg_binomial_lcdf.hpp +++ b/stan/math/prim/prob/neg_binomial_lcdf.hpp @@ -24,7 +24,7 @@ namespace stan { namespace math { template -return_type_t neg_binomial_lcdf( +inline return_type_t neg_binomial_lcdf( const T_n& n, const T_shape& alpha, const T_inv_scale& beta_param) { using T_partials_return = partials_return_t; using std::exp; diff --git a/stan/math/prim/prob/neg_binomial_lpmf.hpp b/stan/math/prim/prob/neg_binomial_lpmf.hpp index 438116ada48..c06760a7bd2 100644 --- a/stan/math/prim/prob/neg_binomial_lpmf.hpp +++ b/stan/math/prim/prob/neg_binomial_lpmf.hpp @@ -30,7 +30,7 @@ constexpr double neg_binomial_alpha_cutoff = 1e10; template * = nullptr> -return_type_t neg_binomial_lpmf(const T_n& n, +inline return_type_t neg_binomial_lpmf(const T_n& n, const T_shape& alpha, const T_inv_scale& beta) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/normal_id_glm_lpdf.hpp b/stan/math/prim/prob/normal_id_glm_lpdf.hpp index d653222e682..c8cebf0b3f8 100644 --- a/stan/math/prim/prob/normal_id_glm_lpdf.hpp +++ b/stan/math/prim/prob/normal_id_glm_lpdf.hpp @@ -53,7 +53,7 @@ namespace math { */ template * = nullptr> -return_type_t normal_id_glm_lpdf( +inline return_type_t normal_id_glm_lpdf( const T_y& y, const T_x& x, const T_alpha& alpha, const T_beta& beta, const T_scale& sigma) { using Eigen::Array; diff --git a/stan/math/prim/prob/normal_sufficient_lpdf.hpp b/stan/math/prim/prob/normal_sufficient_lpdf.hpp index 37e1365f169..eb1ca56ef7b 100644 --- a/stan/math/prim/prob/normal_sufficient_lpdf.hpp +++ b/stan/math/prim/prob/normal_sufficient_lpdf.hpp @@ -51,7 +51,7 @@ namespace math { */ template -return_type_t normal_sufficient_lpdf( +inline return_type_t normal_sufficient_lpdf( const T_y& y_bar, const T_s& s_squared, const T_n& n_obs, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/ordered_logistic_glm_lpmf.hpp b/stan/math/prim/prob/ordered_logistic_glm_lpmf.hpp index 8bb3f3cef09..b90b50020c5 100644 --- a/stan/math/prim/prob/ordered_logistic_glm_lpmf.hpp +++ b/stan/math/prim/prob/ordered_logistic_glm_lpmf.hpp @@ -46,7 +46,7 @@ namespace math { template * = nullptr, require_all_col_vector_t* = nullptr> -return_type_t ordered_logistic_glm_lpmf( +inline return_type_t ordered_logistic_glm_lpmf( const T_y& y, const T_x& x, const T_beta& beta, const T_cuts& cuts) { using Eigen::Array; using Eigen::Dynamic; @@ -210,7 +210,7 @@ return_type_t ordered_logistic_glm_lpmf( } template -return_type_t ordered_logistic_glm_lpmf( +inline return_type_t ordered_logistic_glm_lpmf( const T_y& y, const T_x& x, const T_beta& beta, const T_cuts& cuts) { return ordered_logistic_glm_lpmf(y, x, beta, cuts); } diff --git a/stan/math/prim/prob/ordered_logistic_lpmf.hpp b/stan/math/prim/prob/ordered_logistic_lpmf.hpp index d102fbbd068..31fa9ace8ef 100644 --- a/stan/math/prim/prob/ordered_logistic_lpmf.hpp +++ b/stan/math/prim/prob/ordered_logistic_lpmf.hpp @@ -72,7 +72,7 @@ namespace math { template * = nullptr> -return_type_t ordered_logistic_lpmf(const T_y& y, +inline return_type_t ordered_logistic_lpmf(const T_y& y, const T_loc& lambda, const T_cut& c) { using T_partials_return = partials_return_t; @@ -204,7 +204,7 @@ return_type_t ordered_logistic_lpmf(const T_y& y, } template -return_type_t ordered_logistic_lpmf(const T_y& y, +inline return_type_t ordered_logistic_lpmf(const T_y& y, const T_loc& lambda, const T_cut& c) { return ordered_logistic_lpmf(y, lambda, c); diff --git a/stan/math/prim/prob/ordered_probit_lpmf.hpp b/stan/math/prim/prob/ordered_probit_lpmf.hpp index 0ba3dcfd71b..d0943c51637 100644 --- a/stan/math/prim/prob/ordered_probit_lpmf.hpp +++ b/stan/math/prim/prob/ordered_probit_lpmf.hpp @@ -45,7 +45,7 @@ namespace math { * of different lengths. */ template -return_type_t ordered_probit_lpmf(const T_y& y, +inline return_type_t ordered_probit_lpmf(const T_y& y, const T_loc& lambda, const T_cut& c) { using std::exp; @@ -101,7 +101,7 @@ return_type_t ordered_probit_lpmf(const T_y& y, } template -return_type_t ordered_probit_lpmf(const T_y& y, +inline return_type_t ordered_probit_lpmf(const T_y& y, const T_loc& lambda, const T_cut& c) { return ordered_probit_lpmf(y, lambda, c); diff --git a/stan/math/prim/prob/pareto_ccdf_log.hpp b/stan/math/prim/prob/pareto_ccdf_log.hpp index e36ed34f4c4..7262966c9ce 100644 --- a/stan/math/prim/prob/pareto_ccdf_log.hpp +++ b/stan/math/prim/prob/pareto_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use pareto_lccdf */ template -return_type_t pareto_ccdf_log(const T_y& y, +inline return_type_t pareto_ccdf_log(const T_y& y, const T_scale& y_min, const T_shape& alpha) { return pareto_lccdf(y, y_min, alpha); diff --git a/stan/math/prim/prob/pareto_cdf.hpp b/stan/math/prim/prob/pareto_cdf.hpp index 66cc2feafe1..0fc4ddb5d86 100644 --- a/stan/math/prim/prob/pareto_cdf.hpp +++ b/stan/math/prim/prob/pareto_cdf.hpp @@ -20,7 +20,7 @@ namespace math { template * = nullptr> -return_type_t pareto_cdf(const T_y& y, +inline return_type_t pareto_cdf(const T_y& y, const T_scale& y_min, const T_shape& alpha) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/pareto_cdf_log.hpp b/stan/math/prim/prob/pareto_cdf_log.hpp index 1a6359ec49d..7dbae9d856b 100644 --- a/stan/math/prim/prob/pareto_cdf_log.hpp +++ b/stan/math/prim/prob/pareto_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use pareto_lcdf */ template -return_type_t pareto_cdf_log(const T_y& y, +inline return_type_t pareto_cdf_log(const T_y& y, const T_scale& y_min, const T_shape& alpha) { return pareto_lcdf(y, y_min, alpha); diff --git a/stan/math/prim/prob/pareto_lccdf.hpp b/stan/math/prim/prob/pareto_lccdf.hpp index d8be81d1685..49971688545 100644 --- a/stan/math/prim/prob/pareto_lccdf.hpp +++ b/stan/math/prim/prob/pareto_lccdf.hpp @@ -24,7 +24,7 @@ namespace math { template * = nullptr> -return_type_t pareto_lccdf(const T_y& y, +inline return_type_t pareto_lccdf(const T_y& y, const T_scale& y_min, const T_shape& alpha) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/pareto_lcdf.hpp b/stan/math/prim/prob/pareto_lcdf.hpp index 45d42e1c8e4..9117d2c9958 100644 --- a/stan/math/prim/prob/pareto_lcdf.hpp +++ b/stan/math/prim/prob/pareto_lcdf.hpp @@ -24,7 +24,7 @@ namespace math { template * = nullptr> -return_type_t pareto_lcdf(const T_y& y, +inline return_type_t pareto_lcdf(const T_y& y, const T_scale& y_min, const T_shape& alpha) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/pareto_lpdf.hpp b/stan/math/prim/prob/pareto_lpdf.hpp index 602d5a54a6a..d3408f6387a 100644 --- a/stan/math/prim/prob/pareto_lpdf.hpp +++ b/stan/math/prim/prob/pareto_lpdf.hpp @@ -24,7 +24,7 @@ namespace math { template * = nullptr> -return_type_t pareto_lpdf(const T_y& y, +inline return_type_t pareto_lpdf(const T_y& y, const T_scale& y_min, const T_shape& alpha) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/pareto_type_2_ccdf_log.hpp b/stan/math/prim/prob/pareto_type_2_ccdf_log.hpp index 3f298b323c7..15e0e949a25 100644 --- a/stan/math/prim/prob/pareto_type_2_ccdf_log.hpp +++ b/stan/math/prim/prob/pareto_type_2_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use pareto_type_2_lccdf */ template -return_type_t pareto_type_2_ccdf_log( +inline return_type_t pareto_type_2_ccdf_log( const T_y& y, const T_loc& mu, const T_scale& lambda, const T_shape& alpha) { return pareto_type_2_lccdf(y, mu, lambda, diff --git a/stan/math/prim/prob/pareto_type_2_cdf.hpp b/stan/math/prim/prob/pareto_type_2_cdf.hpp index c94d3f3078f..7a492ee9cb8 100644 --- a/stan/math/prim/prob/pareto_type_2_cdf.hpp +++ b/stan/math/prim/prob/pareto_type_2_cdf.hpp @@ -21,7 +21,7 @@ namespace math { template * = nullptr> -return_type_t pareto_type_2_cdf( +inline return_type_t pareto_type_2_cdf( const T_y& y, const T_loc& mu, const T_scale& lambda, const T_shape& alpha) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/pareto_type_2_cdf_log.hpp b/stan/math/prim/prob/pareto_type_2_cdf_log.hpp index ef23dd83c8d..89128ff5a2c 100644 --- a/stan/math/prim/prob/pareto_type_2_cdf_log.hpp +++ b/stan/math/prim/prob/pareto_type_2_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use pareto_type_2_lcdf */ template -return_type_t pareto_type_2_cdf_log( +inline return_type_t pareto_type_2_cdf_log( const T_y& y, const T_loc& mu, const T_scale& lambda, const T_shape& alpha) { return pareto_type_2_lcdf(y, mu, lambda, alpha); diff --git a/stan/math/prim/prob/pareto_type_2_lccdf.hpp b/stan/math/prim/prob/pareto_type_2_lccdf.hpp index 2dc651b2ba9..56ec5ed804b 100644 --- a/stan/math/prim/prob/pareto_type_2_lccdf.hpp +++ b/stan/math/prim/prob/pareto_type_2_lccdf.hpp @@ -21,7 +21,7 @@ namespace math { template * = nullptr> -return_type_t pareto_type_2_lccdf( +inline return_type_t pareto_type_2_lccdf( const T_y& y, const T_loc& mu, const T_scale& lambda, const T_shape& alpha) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/pareto_type_2_lcdf.hpp b/stan/math/prim/prob/pareto_type_2_lcdf.hpp index 286ea5ee6d9..9d1c175a3a0 100644 --- a/stan/math/prim/prob/pareto_type_2_lcdf.hpp +++ b/stan/math/prim/prob/pareto_type_2_lcdf.hpp @@ -21,7 +21,7 @@ namespace math { template * = nullptr> -return_type_t pareto_type_2_lcdf( +inline return_type_t pareto_type_2_lcdf( const T_y& y, const T_loc& mu, const T_scale& lambda, const T_shape& alpha) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/pareto_type_2_lpdf.hpp b/stan/math/prim/prob/pareto_type_2_lpdf.hpp index 4a4e9e85360..9cac66a418e 100644 --- a/stan/math/prim/prob/pareto_type_2_lpdf.hpp +++ b/stan/math/prim/prob/pareto_type_2_lpdf.hpp @@ -24,7 +24,7 @@ template * = nullptr> -return_type_t pareto_type_2_lpdf( +inline return_type_t pareto_type_2_lpdf( const T_y& y, const T_loc& mu, const T_scale& lambda, const T_shape& alpha) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/poisson_binomial_ccdf_log.hpp b/stan/math/prim/prob/poisson_binomial_ccdf_log.hpp index c0909344e10..e4392b31fa7 100644 --- a/stan/math/prim/prob/poisson_binomial_ccdf_log.hpp +++ b/stan/math/prim/prob/poisson_binomial_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use poisson_binomial_lccdf */ template -return_type_t poisson_binomial_ccdf_log(const T_y& y, +inline return_type_t poisson_binomial_ccdf_log(const T_y& y, const T_theta& theta) { return poisson_binomial_lccdf(y, theta); } diff --git a/stan/math/prim/prob/poisson_binomial_cdf.hpp b/stan/math/prim/prob/poisson_binomial_cdf.hpp index f47abf7472d..aadfa3ae907 100644 --- a/stan/math/prim/prob/poisson_binomial_cdf.hpp +++ b/stan/math/prim/prob/poisson_binomial_cdf.hpp @@ -33,7 +33,7 @@ namespace math { * @throw std::invalid_argument If y and theta are different lengths */ template -return_type_t poisson_binomial_cdf(const T_y& y, +inline return_type_t poisson_binomial_cdf(const T_y& y, const T_theta& theta) { static constexpr const char* function = "poisson_binomial_cdf"; @@ -63,7 +63,7 @@ return_type_t poisson_binomial_cdf(const T_y& y, } template -return_type_t poisson_binomial_cdf(const T_y& y, +inline return_type_t poisson_binomial_cdf(const T_y& y, const T_theta& theta) { return poisson_binomial_cdf(y, theta); } diff --git a/stan/math/prim/prob/poisson_binomial_cdf_log.hpp b/stan/math/prim/prob/poisson_binomial_cdf_log.hpp index e82a26c0ce0..e6fb9c0655d 100644 --- a/stan/math/prim/prob/poisson_binomial_cdf_log.hpp +++ b/stan/math/prim/prob/poisson_binomial_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use poisson_binomial_lcdf */ template -return_type_t poisson_binomial_cdf_log(const T_y& y, +inline return_type_t poisson_binomial_cdf_log(const T_y& y, const T_theta& theta) { return poisson_binomial_lcdf(y, theta); } diff --git a/stan/math/prim/prob/poisson_binomial_lccdf.hpp b/stan/math/prim/prob/poisson_binomial_lccdf.hpp index 8d946f1a4c6..79de8853754 100644 --- a/stan/math/prim/prob/poisson_binomial_lccdf.hpp +++ b/stan/math/prim/prob/poisson_binomial_lccdf.hpp @@ -34,7 +34,7 @@ namespace math { * @throw std::invalid_argument If y and theta are different lengths */ template -return_type_t poisson_binomial_lccdf(const T_y& y, +inline return_type_t poisson_binomial_lccdf(const T_y& y, const T_theta& theta) { static constexpr const char* function = "poisson_binomial_lccdf"; @@ -74,7 +74,7 @@ return_type_t poisson_binomial_lccdf(const T_y& y, } template -return_type_t poisson_binomial_lccdf(const T_y& y, +inline return_type_t poisson_binomial_lccdf(const T_y& y, const T_theta& theta) { return poisson_binomial_lccdf(y, theta); } diff --git a/stan/math/prim/prob/poisson_binomial_lcdf.hpp b/stan/math/prim/prob/poisson_binomial_lcdf.hpp index 7d449aa0caa..5a5c30befab 100644 --- a/stan/math/prim/prob/poisson_binomial_lcdf.hpp +++ b/stan/math/prim/prob/poisson_binomial_lcdf.hpp @@ -33,7 +33,7 @@ namespace math { * @throw std::invalid_argument If y and theta are different lengths */ template -return_type_t poisson_binomial_lcdf(const T_y& y, +inline return_type_t poisson_binomial_lcdf(const T_y& y, const T_theta& theta) { static constexpr const char* function = "poisson_binomial_lcdf"; @@ -64,7 +64,7 @@ return_type_t poisson_binomial_lcdf(const T_y& y, } template -return_type_t poisson_binomial_lcdf(const T_y& y, +inline return_type_t poisson_binomial_lcdf(const T_y& y, const T_theta& theta) { return poisson_binomial_lcdf(y, theta); } diff --git a/stan/math/prim/prob/poisson_binomial_lpmf.hpp b/stan/math/prim/prob/poisson_binomial_lpmf.hpp index 709a709c756..6e2342c1020 100644 --- a/stan/math/prim/prob/poisson_binomial_lpmf.hpp +++ b/stan/math/prim/prob/poisson_binomial_lpmf.hpp @@ -25,7 +25,7 @@ namespace math { * @throw std::invalid_argument If y and theta are different lengths */ template -return_type_t poisson_binomial_lpmf(const T_y& y, +inline return_type_t poisson_binomial_lpmf(const T_y& y, const T_theta& theta) { static constexpr const char* function = "poisson_binomial_lpmf"; @@ -57,7 +57,7 @@ return_type_t poisson_binomial_lpmf(const T_y& y, } template -return_type_t poisson_binomial_lpmf(const T_y& y, +inline return_type_t poisson_binomial_lpmf(const T_y& y, const T_theta& theta) { return poisson_binomial_lpmf(y, theta); } diff --git a/stan/math/prim/prob/poisson_ccdf_log.hpp b/stan/math/prim/prob/poisson_ccdf_log.hpp index a07a343acc3..dfff61cb62f 100644 --- a/stan/math/prim/prob/poisson_ccdf_log.hpp +++ b/stan/math/prim/prob/poisson_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use poisson_lccdf */ template -return_type_t poisson_ccdf_log(const T_n& n, const T_rate& lambda) { +inline return_type_t poisson_ccdf_log(const T_n& n, const T_rate& lambda) { return poisson_lccdf(n, lambda); } diff --git a/stan/math/prim/prob/poisson_cdf.hpp b/stan/math/prim/prob/poisson_cdf.hpp index 0db9a18dd41..c6ba4b866e0 100644 --- a/stan/math/prim/prob/poisson_cdf.hpp +++ b/stan/math/prim/prob/poisson_cdf.hpp @@ -24,7 +24,7 @@ namespace math { // Poisson CDF template -return_type_t poisson_cdf(const T_n& n, const T_rate& lambda) { +inline return_type_t poisson_cdf(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; diff --git a/stan/math/prim/prob/poisson_cdf_log.hpp b/stan/math/prim/prob/poisson_cdf_log.hpp index bccca07aa31..94dfe55421c 100644 --- a/stan/math/prim/prob/poisson_cdf_log.hpp +++ b/stan/math/prim/prob/poisson_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use poisson_lcdf */ template -return_type_t poisson_cdf_log(const T_n& n, const T_rate& lambda) { +inline return_type_t poisson_cdf_log(const T_n& n, const T_rate& lambda) { return poisson_lcdf(n, lambda); } diff --git a/stan/math/prim/prob/poisson_lccdf.hpp b/stan/math/prim/prob/poisson_lccdf.hpp index 94fb6469c98..c3a622cfb9d 100644 --- a/stan/math/prim/prob/poisson_lccdf.hpp +++ b/stan/math/prim/prob/poisson_lccdf.hpp @@ -25,7 +25,7 @@ namespace stan { namespace math { template -return_type_t poisson_lccdf(const T_n& n, const T_rate& lambda) { +inline 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; diff --git a/stan/math/prim/prob/poisson_lcdf.hpp b/stan/math/prim/prob/poisson_lcdf.hpp index b9aec6efe45..31baff192c3 100644 --- a/stan/math/prim/prob/poisson_lcdf.hpp +++ b/stan/math/prim/prob/poisson_lcdf.hpp @@ -25,7 +25,7 @@ namespace stan { namespace math { template -return_type_t poisson_lcdf(const T_n& n, const T_rate& lambda) { +inline 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; diff --git a/stan/math/prim/prob/poisson_log_glm_lpmf.hpp b/stan/math/prim/prob/poisson_log_glm_lpmf.hpp index be44d4a7ecd..4cd518257b3 100644 --- a/stan/math/prim/prob/poisson_log_glm_lpmf.hpp +++ b/stan/math/prim/prob/poisson_log_glm_lpmf.hpp @@ -50,7 +50,7 @@ namespace math { */ template * = nullptr> -return_type_t poisson_log_glm_lpmf(const T_y& y, +inline return_type_t poisson_log_glm_lpmf(const T_y& y, const T_x& x, const T_alpha& alpha, const T_beta& beta) { diff --git a/stan/math/prim/prob/poisson_log_lpmf.hpp b/stan/math/prim/prob/poisson_log_lpmf.hpp index a0450197af5..c1b4645dae4 100644 --- a/stan/math/prim/prob/poisson_log_lpmf.hpp +++ b/stan/math/prim/prob/poisson_log_lpmf.hpp @@ -26,7 +26,7 @@ namespace math { template * = nullptr> -return_type_t poisson_log_lpmf(const T_n& n, +inline return_type_t poisson_log_lpmf(const T_n& n, const T_log_rate& alpha) { using T_partials_return = partials_return_t; using T_n_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/poisson_lpmf.hpp b/stan/math/prim/prob/poisson_lpmf.hpp index a35ef780a03..a235c16be5a 100644 --- a/stan/math/prim/prob/poisson_lpmf.hpp +++ b/stan/math/prim/prob/poisson_lpmf.hpp @@ -26,7 +26,7 @@ namespace math { template * = nullptr> -return_type_t poisson_lpmf(const T_n& n, const T_rate& lambda) { +inline return_type_t poisson_lpmf(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; diff --git a/stan/math/prim/prob/rayleigh_ccdf_log.hpp b/stan/math/prim/prob/rayleigh_ccdf_log.hpp index b966f1e3901..c5e20450d94 100644 --- a/stan/math/prim/prob/rayleigh_ccdf_log.hpp +++ b/stan/math/prim/prob/rayleigh_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use rayleigh_lccdf */ template -return_type_t rayleigh_ccdf_log(const T_y& y, +inline return_type_t rayleigh_ccdf_log(const T_y& y, const T_scale& sigma) { return rayleigh_lccdf(y, sigma); } diff --git a/stan/math/prim/prob/rayleigh_cdf.hpp b/stan/math/prim/prob/rayleigh_cdf.hpp index 38eba480df7..b2b66bf08da 100644 --- a/stan/math/prim/prob/rayleigh_cdf.hpp +++ b/stan/math/prim/prob/rayleigh_cdf.hpp @@ -22,7 +22,7 @@ namespace math { template * = nullptr> -return_type_t rayleigh_cdf(const T_y& y, const T_scale& sigma) { +inline 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; diff --git a/stan/math/prim/prob/rayleigh_cdf_log.hpp b/stan/math/prim/prob/rayleigh_cdf_log.hpp index 831bb8a188e..7530aff4399 100644 --- a/stan/math/prim/prob/rayleigh_cdf_log.hpp +++ b/stan/math/prim/prob/rayleigh_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use rayleigh_lcdf */ template -return_type_t rayleigh_cdf_log(const T_y& y, +inline return_type_t rayleigh_cdf_log(const T_y& y, const T_scale& sigma) { return rayleigh_lcdf(y, sigma); } diff --git a/stan/math/prim/prob/rayleigh_lccdf.hpp b/stan/math/prim/prob/rayleigh_lccdf.hpp index e8f8dc0b9c8..cd85d1c2f38 100644 --- a/stan/math/prim/prob/rayleigh_lccdf.hpp +++ b/stan/math/prim/prob/rayleigh_lccdf.hpp @@ -20,7 +20,7 @@ namespace math { template * = nullptr> -return_type_t rayleigh_lccdf(const T_y& y, const T_scale& sigma) { +inline 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; diff --git a/stan/math/prim/prob/rayleigh_lcdf.hpp b/stan/math/prim/prob/rayleigh_lcdf.hpp index 93ff1463ec8..ac51c4da7c8 100644 --- a/stan/math/prim/prob/rayleigh_lcdf.hpp +++ b/stan/math/prim/prob/rayleigh_lcdf.hpp @@ -22,7 +22,7 @@ namespace math { template * = nullptr> -return_type_t rayleigh_lcdf(const T_y& y, const T_scale& sigma) { +inline 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; diff --git a/stan/math/prim/prob/rayleigh_lpdf.hpp b/stan/math/prim/prob/rayleigh_lpdf.hpp index 1316d81d520..d69f57fae56 100644 --- a/stan/math/prim/prob/rayleigh_lpdf.hpp +++ b/stan/math/prim/prob/rayleigh_lpdf.hpp @@ -22,7 +22,7 @@ namespace math { template * = nullptr> -return_type_t rayleigh_lpdf(const T_y& y, const T_scale& sigma) { +inline 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; diff --git a/stan/math/prim/prob/scaled_inv_chi_square_ccdf_log.hpp b/stan/math/prim/prob/scaled_inv_chi_square_ccdf_log.hpp index 3a02fa58bcc..f507a380483 100644 --- a/stan/math/prim/prob/scaled_inv_chi_square_ccdf_log.hpp +++ b/stan/math/prim/prob/scaled_inv_chi_square_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use scaled_inv_chi_square_lccdf */ template -return_type_t scaled_inv_chi_square_ccdf_log( +inline return_type_t scaled_inv_chi_square_ccdf_log( const T_y& y, const T_dof& nu, const T_scale& s) { return scaled_inv_chi_square_lccdf(y, nu, s); } 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 62389b900cf..8f7734cabed 100644 --- a/stan/math/prim/prob/scaled_inv_chi_square_cdf.hpp +++ b/stan/math/prim/prob/scaled_inv_chi_square_cdf.hpp @@ -35,7 +35,7 @@ namespace math { * @throw std::domain_error if y is not greater than 0. */ template -return_type_t scaled_inv_chi_square_cdf(const T_y& y, +inline return_type_t scaled_inv_chi_square_cdf(const T_y& y, const T_dof& nu, const T_scale& s) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/scaled_inv_chi_square_cdf_log.hpp b/stan/math/prim/prob/scaled_inv_chi_square_cdf_log.hpp index 61ac261e1e1..087cd5e1f4b 100644 --- a/stan/math/prim/prob/scaled_inv_chi_square_cdf_log.hpp +++ b/stan/math/prim/prob/scaled_inv_chi_square_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use scaled_inv_chi_square_lcdf */ template -return_type_t scaled_inv_chi_square_cdf_log( +inline return_type_t scaled_inv_chi_square_cdf_log( const T_y& y, const T_dof& nu, const T_scale& s) { return scaled_inv_chi_square_lcdf(y, nu, 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 dfaa148e9c7..5d14e326e18 100644 --- a/stan/math/prim/prob/scaled_inv_chi_square_lccdf.hpp +++ b/stan/math/prim/prob/scaled_inv_chi_square_lccdf.hpp @@ -22,7 +22,7 @@ namespace stan { namespace math { template -return_type_t scaled_inv_chi_square_lccdf( +inline return_type_t scaled_inv_chi_square_lccdf( const T_y& y, const T_dof& nu, const T_scale& s) { using T_partials_return = partials_return_t; using std::exp; 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 07dae6187ab..ad017867c8d 100644 --- a/stan/math/prim/prob/scaled_inv_chi_square_lcdf.hpp +++ b/stan/math/prim/prob/scaled_inv_chi_square_lcdf.hpp @@ -22,7 +22,7 @@ namespace stan { namespace math { template -return_type_t scaled_inv_chi_square_lcdf( +inline return_type_t scaled_inv_chi_square_lcdf( const T_y& y, const T_dof& nu, const T_scale& s) { using T_partials_return = partials_return_t; using std::exp; 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 75f19f82908..d2a19422727 100644 --- a/stan/math/prim/prob/scaled_inv_chi_square_lpdf.hpp +++ b/stan/math/prim/prob/scaled_inv_chi_square_lpdf.hpp @@ -44,7 +44,7 @@ namespace math { template * = nullptr> -return_type_t scaled_inv_chi_square_lpdf( +inline return_type_t scaled_inv_chi_square_lpdf( const T_y& y, const T_dof& nu, const T_scale& s) { using T_partials_return = partials_return_t; using std::log; diff --git a/stan/math/prim/prob/skew_double_exponential_cdf.hpp b/stan/math/prim/prob/skew_double_exponential_cdf.hpp index 47f2a7957f1..c10f27c33ce 100644 --- a/stan/math/prim/prob/skew_double_exponential_cdf.hpp +++ b/stan/math/prim/prob/skew_double_exponential_cdf.hpp @@ -38,7 +38,7 @@ namespace math { template * = nullptr> -return_type_t skew_double_exponential_cdf( +inline 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; diff --git a/stan/math/prim/prob/skew_double_exponential_lccdf.hpp b/stan/math/prim/prob/skew_double_exponential_lccdf.hpp index 7a1eff6d51a..45160027641 100644 --- a/stan/math/prim/prob/skew_double_exponential_lccdf.hpp +++ b/stan/math/prim/prob/skew_double_exponential_lccdf.hpp @@ -37,7 +37,7 @@ namespace math { template * = nullptr> -return_type_t skew_double_exponential_lccdf( +inline return_type_t skew_double_exponential_lccdf( const T_y& y, const T_loc& mu, const T_scale& sigma, const T_skewness& tau) { static constexpr const char* function = "skew_double_exponential_lccdf"; diff --git a/stan/math/prim/prob/skew_double_exponential_lcdf.hpp b/stan/math/prim/prob/skew_double_exponential_lcdf.hpp index 68d1df8014f..a7846725f0c 100644 --- a/stan/math/prim/prob/skew_double_exponential_lcdf.hpp +++ b/stan/math/prim/prob/skew_double_exponential_lcdf.hpp @@ -38,7 +38,7 @@ namespace math { template * = nullptr> -return_type_t skew_double_exponential_lcdf( +inline return_type_t skew_double_exponential_lcdf( const T_y& y, const T_loc& mu, const T_scale& sigma, const T_skewness& tau) { using std::exp; diff --git a/stan/math/prim/prob/skew_double_exponential_lpdf.hpp b/stan/math/prim/prob/skew_double_exponential_lpdf.hpp index 2ae881b7466..f5b6efd98f9 100644 --- a/stan/math/prim/prob/skew_double_exponential_lpdf.hpp +++ b/stan/math/prim/prob/skew_double_exponential_lpdf.hpp @@ -40,7 +40,7 @@ template * = nullptr> -return_type_t skew_double_exponential_lpdf( +inline return_type_t skew_double_exponential_lpdf( const T_y& y, const T_loc& mu, const T_scale& sigma, const T_skewness& tau) { using T_partials_return = partials_return_t; @@ -126,7 +126,7 @@ return_type_t skew_double_exponential_lpdf( } template -return_type_t skew_double_exponential_lpdf( +inline return_type_t skew_double_exponential_lpdf( const T_y& y, const T_loc& mu, const T_scale& sigma, const T_skewness& tau) { return skew_double_exponential_lpdf(y, mu, sigma, tau); diff --git a/stan/math/prim/prob/skew_normal_ccdf_log.hpp b/stan/math/prim/prob/skew_normal_ccdf_log.hpp index fd911ea9bad..b261d7d3efb 100644 --- a/stan/math/prim/prob/skew_normal_ccdf_log.hpp +++ b/stan/math/prim/prob/skew_normal_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use skew_normal_lccdf */ template -return_type_t skew_normal_ccdf_log( +inline return_type_t skew_normal_ccdf_log( const T_y& y, const T_loc& mu, const T_scale& sigma, const T_shape& alpha) { return skew_normal_lccdf(y, mu, sigma, alpha); } diff --git a/stan/math/prim/prob/skew_normal_cdf.hpp b/stan/math/prim/prob/skew_normal_cdf.hpp index 259c097dbdc..5fe8e76582d 100644 --- a/stan/math/prim/prob/skew_normal_cdf.hpp +++ b/stan/math/prim/prob/skew_normal_cdf.hpp @@ -25,7 +25,7 @@ namespace stan { namespace math { template -return_type_t skew_normal_cdf( +inline return_type_t skew_normal_cdf( const T_y& y, const T_loc& mu, const T_scale& sigma, const T_shape& alpha) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/skew_normal_cdf_log.hpp b/stan/math/prim/prob/skew_normal_cdf_log.hpp index e3326eb1cad..b6962bb0117 100644 --- a/stan/math/prim/prob/skew_normal_cdf_log.hpp +++ b/stan/math/prim/prob/skew_normal_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use skew_normal_lcdf */ template -return_type_t skew_normal_cdf_log( +inline return_type_t skew_normal_cdf_log( const T_y& y, const T_loc& mu, const T_scale& sigma, const T_shape& alpha) { return skew_normal_lcdf(y, mu, sigma, alpha); } diff --git a/stan/math/prim/prob/skew_normal_lccdf.hpp b/stan/math/prim/prob/skew_normal_lccdf.hpp index 4d96775f6bc..63bc3943e9f 100644 --- a/stan/math/prim/prob/skew_normal_lccdf.hpp +++ b/stan/math/prim/prob/skew_normal_lccdf.hpp @@ -23,7 +23,7 @@ namespace stan { namespace math { template -return_type_t skew_normal_lccdf( +inline return_type_t skew_normal_lccdf( const T_y& y, const T_loc& mu, const T_scale& sigma, const T_shape& alpha) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/skew_normal_lcdf.hpp b/stan/math/prim/prob/skew_normal_lcdf.hpp index f6ee6066c90..97457163b4e 100644 --- a/stan/math/prim/prob/skew_normal_lcdf.hpp +++ b/stan/math/prim/prob/skew_normal_lcdf.hpp @@ -25,7 +25,7 @@ namespace stan { namespace math { template -return_type_t skew_normal_lcdf( +inline return_type_t skew_normal_lcdf( const T_y& y, const T_loc& mu, const T_scale& sigma, const T_shape& alpha) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/skew_normal_lpdf.hpp b/stan/math/prim/prob/skew_normal_lpdf.hpp index 58f1f63d1ae..473f93dd306 100644 --- a/stan/math/prim/prob/skew_normal_lpdf.hpp +++ b/stan/math/prim/prob/skew_normal_lpdf.hpp @@ -26,7 +26,7 @@ template * = nullptr> -return_type_t skew_normal_lpdf( +inline return_type_t skew_normal_lpdf( const T_y& y, const T_loc& mu, const T_scale& sigma, const T_shape& alpha) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/std_normal_lpdf.hpp b/stan/math/prim/prob/std_normal_lpdf.hpp index 50cc1fd5a26..02c86b87a32 100644 --- a/stan/math/prim/prob/std_normal_lpdf.hpp +++ b/stan/math/prim/prob/std_normal_lpdf.hpp @@ -29,7 +29,7 @@ namespace math { template < bool propto, typename T_y, require_all_not_nonscalar_prim_or_rev_kernel_expression_t* = nullptr> -return_type_t std_normal_lpdf(const T_y& y) { +inline 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 constexpr const char* function = "std_normal_lpdf"; diff --git a/stan/math/prim/prob/student_t_ccdf_log.hpp b/stan/math/prim/prob/student_t_ccdf_log.hpp index 7512ba1d33e..372305a97c3 100644 --- a/stan/math/prim/prob/student_t_ccdf_log.hpp +++ b/stan/math/prim/prob/student_t_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use student_t_lccdf */ template -return_type_t student_t_ccdf_log( +inline return_type_t student_t_ccdf_log( const T_y& y, const T_dof& nu, const T_loc& mu, const T_scale& sigma) { return student_t_lccdf(y, nu, mu, sigma); } diff --git a/stan/math/prim/prob/student_t_cdf.hpp b/stan/math/prim/prob/student_t_cdf.hpp index d8517f0f76f..a247b0baddb 100644 --- a/stan/math/prim/prob/student_t_cdf.hpp +++ b/stan/math/prim/prob/student_t_cdf.hpp @@ -20,7 +20,7 @@ namespace stan { namespace math { template -return_type_t student_t_cdf(const T_y& y, +inline return_type_t student_t_cdf(const T_y& y, const T_dof& nu, const T_loc& mu, const T_scale& sigma) { diff --git a/stan/math/prim/prob/student_t_cdf_log.hpp b/stan/math/prim/prob/student_t_cdf_log.hpp index b9b7e181ddc..85d06eba156 100644 --- a/stan/math/prim/prob/student_t_cdf_log.hpp +++ b/stan/math/prim/prob/student_t_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use student_t_lcdf */ template -return_type_t student_t_cdf_log( +inline return_type_t student_t_cdf_log( const T_y& y, const T_dof& nu, const T_loc& mu, const T_scale& sigma) { return student_t_lcdf(y, nu, mu, sigma); } diff --git a/stan/math/prim/prob/student_t_lccdf.hpp b/stan/math/prim/prob/student_t_lccdf.hpp index e513ada28dd..af8cb6208b0 100644 --- a/stan/math/prim/prob/student_t_lccdf.hpp +++ b/stan/math/prim/prob/student_t_lccdf.hpp @@ -21,7 +21,7 @@ namespace stan { namespace math { template -return_type_t student_t_lccdf( +inline return_type_t student_t_lccdf( const T_y& y, const T_dof& nu, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_t; diff --git a/stan/math/prim/prob/student_t_lcdf.hpp b/stan/math/prim/prob/student_t_lcdf.hpp index d9390702751..420b030aad0 100644 --- a/stan/math/prim/prob/student_t_lcdf.hpp +++ b/stan/math/prim/prob/student_t_lcdf.hpp @@ -21,7 +21,7 @@ namespace stan { namespace math { template -return_type_t student_t_lcdf(const T_y& y, +inline return_type_t student_t_lcdf(const T_y& y, const T_dof& nu, const T_loc& mu, const T_scale& sigma) { diff --git a/stan/math/prim/prob/student_t_lpdf.hpp b/stan/math/prim/prob/student_t_lpdf.hpp index 0ea4f569007..d20df94191f 100644 --- a/stan/math/prim/prob/student_t_lpdf.hpp +++ b/stan/math/prim/prob/student_t_lpdf.hpp @@ -56,7 +56,7 @@ template * = nullptr> -return_type_t student_t_lpdf(const T_y& y, +inline return_type_t student_t_lpdf(const T_y& y, const T_dof& nu, const T_loc& mu, const T_scale& sigma) { diff --git a/stan/math/prim/prob/uniform_ccdf_log.hpp b/stan/math/prim/prob/uniform_ccdf_log.hpp index 166750fa448..8a87e750f2e 100644 --- a/stan/math/prim/prob/uniform_ccdf_log.hpp +++ b/stan/math/prim/prob/uniform_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use uniform_lccdf */ template -return_type_t uniform_ccdf_log(const T_y& y, +inline return_type_t uniform_ccdf_log(const T_y& y, const T_low& alpha, const T_high& beta) { return uniform_lccdf(y, alpha, beta); diff --git a/stan/math/prim/prob/uniform_cdf.hpp b/stan/math/prim/prob/uniform_cdf.hpp index eb3811cd81b..72dc8370acc 100644 --- a/stan/math/prim/prob/uniform_cdf.hpp +++ b/stan/math/prim/prob/uniform_cdf.hpp @@ -20,7 +20,7 @@ namespace math { template * = nullptr> -return_type_t uniform_cdf(const T_y& y, const T_low& alpha, +inline return_type_t uniform_cdf(const T_y& y, const T_low& alpha, const T_high& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/uniform_cdf_log.hpp b/stan/math/prim/prob/uniform_cdf_log.hpp index 2047ed4d6d9..1d88f70dc32 100644 --- a/stan/math/prim/prob/uniform_cdf_log.hpp +++ b/stan/math/prim/prob/uniform_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use uniform_lcdf */ template -return_type_t uniform_cdf_log(const T_y& y, +inline return_type_t uniform_cdf_log(const T_y& y, const T_low& alpha, const T_high& beta) { return uniform_lcdf(y, alpha, beta); diff --git a/stan/math/prim/prob/uniform_lccdf.hpp b/stan/math/prim/prob/uniform_lccdf.hpp index 06656a69333..da206a113e9 100644 --- a/stan/math/prim/prob/uniform_lccdf.hpp +++ b/stan/math/prim/prob/uniform_lccdf.hpp @@ -22,7 +22,7 @@ namespace math { template * = nullptr> -return_type_t uniform_lccdf(const T_y& y, +inline return_type_t uniform_lccdf(const T_y& y, const T_low& alpha, const T_high& beta) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/uniform_lcdf.hpp b/stan/math/prim/prob/uniform_lcdf.hpp index b31c24f6b08..7c65c52a2d5 100644 --- a/stan/math/prim/prob/uniform_lcdf.hpp +++ b/stan/math/prim/prob/uniform_lcdf.hpp @@ -22,7 +22,7 @@ namespace math { template * = nullptr> -return_type_t uniform_lcdf(const T_y& y, const T_low& alpha, +inline return_type_t uniform_lcdf(const T_y& y, const T_low& alpha, const T_high& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/uniform_lpdf.hpp b/stan/math/prim/prob/uniform_lpdf.hpp index 39174904a26..22a702e3270 100644 --- a/stan/math/prim/prob/uniform_lpdf.hpp +++ b/stan/math/prim/prob/uniform_lpdf.hpp @@ -44,7 +44,7 @@ namespace math { template * = nullptr> -return_type_t uniform_lpdf(const T_y& y, const T_low& alpha, +inline return_type_t uniform_lpdf(const T_y& y, const T_low& alpha, const T_high& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/von_mises_cdf.hpp b/stan/math/prim/prob/von_mises_cdf.hpp index 545d502e950..dcc5ffc7fb6 100644 --- a/stan/math/prim/prob/von_mises_cdf.hpp +++ b/stan/math/prim/prob/von_mises_cdf.hpp @@ -20,7 +20,7 @@ namespace internal { * scipy. */ template -return_type_t von_mises_cdf_series(const T_x& x, const T_k& k) { +inline return_type_t von_mises_cdf_series(const T_x& x, const T_k& k) { const double pi = stan::math::pi(); int p = value_of_rec(28 + 0.5 * k - 100 / (k + 5) + 1); auto s = sin(x); @@ -49,7 +49,7 @@ return_type_t von_mises_cdf_series(const T_x& x, const T_k& k) { * is well-approximated by a normal distribution. */ template -return_type_t von_mises_cdf_normalapprox(const T_x& x, const T_k& k) { +inline return_type_t von_mises_cdf_normalapprox(const T_x& x, const T_k& k) { using std::exp; using std::sqrt; @@ -68,7 +68,7 @@ return_type_t von_mises_cdf_normalapprox(const T_x& x, const T_k& k) { * the cdf with a Gaussian. Otherwise, use the expansion from scipy. */ template -return_type_t von_mises_cdf_centered(const T_x& x, const T_k& k) { +inline return_type_t von_mises_cdf_centered(const T_x& x, const T_k& k) { using return_t = return_type_t; return_t f; if (k < 49) { diff --git a/stan/math/prim/prob/von_mises_lpdf.hpp b/stan/math/prim/prob/von_mises_lpdf.hpp index fbf01e3cf84..b80c2869b78 100644 --- a/stan/math/prim/prob/von_mises_lpdf.hpp +++ b/stan/math/prim/prob/von_mises_lpdf.hpp @@ -23,7 +23,7 @@ namespace stan { namespace math { template -return_type_t von_mises_lpdf(T_y const& y, T_loc const& mu, +inline return_type_t von_mises_lpdf(T_y const& y, T_loc const& mu, T_scale const& kappa) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/weibull_ccdf_log.hpp b/stan/math/prim/prob/weibull_ccdf_log.hpp index 6f7f5aef93c..e59ddbec7d4 100644 --- a/stan/math/prim/prob/weibull_ccdf_log.hpp +++ b/stan/math/prim/prob/weibull_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use weibull_lccdf */ template -return_type_t weibull_ccdf_log(const T_y& y, +inline return_type_t weibull_ccdf_log(const T_y& y, const T_shape& alpha, const T_scale& sigma) { return weibull_lccdf(y, alpha, sigma); diff --git a/stan/math/prim/prob/weibull_cdf.hpp b/stan/math/prim/prob/weibull_cdf.hpp index 1cb33774dd1..8c2750be1a9 100644 --- a/stan/math/prim/prob/weibull_cdf.hpp +++ b/stan/math/prim/prob/weibull_cdf.hpp @@ -36,7 +36,7 @@ namespace math { template * = nullptr> -return_type_t weibull_cdf(const T_y& y, +inline return_type_t weibull_cdf(const T_y& y, const T_shape& alpha, const T_scale& sigma) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/weibull_cdf_log.hpp b/stan/math/prim/prob/weibull_cdf_log.hpp index bad0dcfcbb8..b72ffc9bbc3 100644 --- a/stan/math/prim/prob/weibull_cdf_log.hpp +++ b/stan/math/prim/prob/weibull_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { * @deprecated use weibull_lcdf */ template -return_type_t weibull_cdf_log(const T_y& y, +inline return_type_t weibull_cdf_log(const T_y& y, const T_shape& alpha, const T_scale& sigma) { return weibull_lcdf(y, alpha, sigma); diff --git a/stan/math/prim/prob/weibull_lccdf.hpp b/stan/math/prim/prob/weibull_lccdf.hpp index cc73f1819da..792d6085bc2 100644 --- a/stan/math/prim/prob/weibull_lccdf.hpp +++ b/stan/math/prim/prob/weibull_lccdf.hpp @@ -34,7 +34,7 @@ namespace math { template * = nullptr> -return_type_t weibull_lccdf(const T_y& y, +inline return_type_t weibull_lccdf(const T_y& y, const T_shape& alpha, const T_scale& sigma) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/weibull_lcdf.hpp b/stan/math/prim/prob/weibull_lcdf.hpp index 5ba9ac23471..943d7e9539d 100644 --- a/stan/math/prim/prob/weibull_lcdf.hpp +++ b/stan/math/prim/prob/weibull_lcdf.hpp @@ -36,7 +36,7 @@ namespace math { template * = nullptr> -return_type_t weibull_lcdf(const T_y& y, +inline return_type_t weibull_lcdf(const T_y& y, const T_shape& alpha, const T_scale& sigma) { using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/weibull_lpdf.hpp b/stan/math/prim/prob/weibull_lpdf.hpp index 906eec39418..84729f1599d 100644 --- a/stan/math/prim/prob/weibull_lpdf.hpp +++ b/stan/math/prim/prob/weibull_lpdf.hpp @@ -37,7 +37,7 @@ namespace math { template * = nullptr> -return_type_t weibull_lpdf(const T_y& y, +inline return_type_t weibull_lpdf(const T_y& y, const T_shape& alpha, const T_scale& sigma) { using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/wiener_lpdf.hpp b/stan/math/prim/prob/wiener_lpdf.hpp index 05c785691cf..5c2f113a07e 100644 --- a/stan/math/prim/prob/wiener_lpdf.hpp +++ b/stan/math/prim/prob/wiener_lpdf.hpp @@ -76,7 +76,7 @@ namespace math { */ template -return_type_t wiener_lpdf( +inline return_type_t wiener_lpdf( const T_y& y, const T_alpha& alpha, const T_tau& tau, const T_beta& beta, const T_delta& delta) { using T_return_type = return_type_t; diff --git a/stan/math/prim/prob/wishart_cholesky_lpdf.hpp b/stan/math/prim/prob/wishart_cholesky_lpdf.hpp index 8c2cf0107e7..57f9b803aad 100644 --- a/stan/math/prim/prob/wishart_cholesky_lpdf.hpp +++ b/stan/math/prim/prob/wishart_cholesky_lpdf.hpp @@ -39,7 +39,7 @@ namespace math { template * = nullptr, require_all_matrix_t* = nullptr> -return_type_t wishart_cholesky_lpdf(const T_y& L_Y, +inline return_type_t wishart_cholesky_lpdf(const T_y& L_Y, const T_dof& nu, const T_scale& L_S) { using Eigen::Lower; diff --git a/stan/math/prim/prob/wishart_lpdf.hpp b/stan/math/prim/prob/wishart_lpdf.hpp index 145bf7552cd..9a87f59a4fc 100644 --- a/stan/math/prim/prob/wishart_lpdf.hpp +++ b/stan/math/prim/prob/wishart_lpdf.hpp @@ -46,7 +46,7 @@ namespace math { template * = nullptr, require_all_matrix_t* = nullptr> -return_type_t wishart_lpdf(const T_y& W, const T_dof& nu, +inline return_type_t wishart_lpdf(const T_y& W, const T_dof& nu, const T_scale& S) { using Eigen::Dynamic; using Eigen::Lower; diff --git a/stan/math/rev/constraint/cholesky_corr_constrain.hpp b/stan/math/rev/constraint/cholesky_corr_constrain.hpp index e61fcbc5cbd..d61df1ae7cb 100644 --- a/stan/math/rev/constraint/cholesky_corr_constrain.hpp +++ b/stan/math/rev/constraint/cholesky_corr_constrain.hpp @@ -25,7 +25,7 @@ namespace math { * @return Cholesky factor of correlation matrix */ template * = nullptr> -var_value cholesky_corr_constrain(const T& y, int K) { +inline var_value cholesky_corr_constrain(const T& y, int K) { using std::sqrt; int k_choose_2 = (K * (K - 1)) / 2; check_size_match("cholesky_corr_constrain", "y.size()", y.size(), @@ -89,7 +89,7 @@ var_value cholesky_corr_constrain(const T& y, int K) { * @return Cholesky factor of correlation matrix */ template * = nullptr> -var_value cholesky_corr_constrain(const T& y, int K, +inline var_value cholesky_corr_constrain(const T& y, int K, scalar_type_t& lp) { using Eigen::Dynamic; using Eigen::Matrix; diff --git a/stan/math/rev/constraint/cholesky_factor_constrain.hpp b/stan/math/rev/constraint/cholesky_factor_constrain.hpp index 17d18d7ee0e..54c79640e4e 100644 --- a/stan/math/rev/constraint/cholesky_factor_constrain.hpp +++ b/stan/math/rev/constraint/cholesky_factor_constrain.hpp @@ -27,7 +27,7 @@ namespace math { * @return Cholesky factor */ template * = nullptr> -var_value cholesky_factor_constrain(const T& x, int M, int N) { +inline var_value cholesky_factor_constrain(const T& x, int M, int N) { using std::exp; check_greater_or_equal("cholesky_factor_constrain", "num rows (must be greater or equal to num cols)", M, @@ -86,7 +86,7 @@ var_value cholesky_factor_constrain(const T& x, int M, int N) { * @return Cholesky factor */ template * = nullptr> -var_value cholesky_factor_constrain(const T& x, int M, int N, +inline var_value cholesky_factor_constrain(const T& x, int M, int N, scalar_type_t& lp) { check_size_match("cholesky_factor_constrain", "x.size()", x.size(), "((N * (N + 1)) / 2 + (M - N) * N)", diff --git a/stan/math/rev/constraint/corr_matrix_constrain.hpp b/stan/math/rev/constraint/corr_matrix_constrain.hpp index c3d1b8d2f7d..1e6d1885db5 100644 --- a/stan/math/rev/constraint/corr_matrix_constrain.hpp +++ b/stan/math/rev/constraint/corr_matrix_constrain.hpp @@ -38,7 +38,7 @@ namespace math { * matrix. */ template * = nullptr> -var_value corr_matrix_constrain(const T& x, Eigen::Index k) { +inline var_value corr_matrix_constrain(const T& x, Eigen::Index k) { Eigen::Index k_choose_2 = (k * (k - 1)) / 2; check_size_match("cov_matrix_constrain", "x.size()", x.size(), "k_choose_2", k_choose_2); @@ -66,7 +66,7 @@ var_value corr_matrix_constrain(const T& x, Eigen::Index k) { * @param lp Log probability reference to increment. */ template * = nullptr> -var_value corr_matrix_constrain(const T& x, Eigen::Index k, +inline var_value corr_matrix_constrain(const T& x, Eigen::Index k, scalar_type_t& lp) { Eigen::Index k_choose_2 = (k * (k - 1)) / 2; check_size_match("cov_matrix_constrain", "x.size()", x.size(), "k_choose_2", diff --git a/stan/math/rev/constraint/cov_matrix_constrain.hpp b/stan/math/rev/constraint/cov_matrix_constrain.hpp index ccf4ac496ba..bb74ba3a274 100644 --- a/stan/math/rev/constraint/cov_matrix_constrain.hpp +++ b/stan/math/rev/constraint/cov_matrix_constrain.hpp @@ -29,7 +29,7 @@ namespace math { * @throws std::invalid_argument if (x.size() != K + (K choose 2)). */ template * = nullptr> -var_value cov_matrix_constrain(const T& x, Eigen::Index K) { +inline var_value cov_matrix_constrain(const T& x, Eigen::Index K) { using std::exp; check_size_match("cov_matrix_constrain", "x.size()", x.size(), @@ -74,7 +74,7 @@ var_value cov_matrix_constrain(const T& x, Eigen::Index K) { * @throws std::domain_error if (x.size() != K + (K choose 2)). */ template * = nullptr> -var_value cov_matrix_constrain(const T& x, Eigen::Index K, +inline var_value cov_matrix_constrain(const T& x, Eigen::Index K, scalar_type_t& lp) { using std::exp; using std::log; diff --git a/stan/math/rev/constraint/cov_matrix_constrain_lkj.hpp b/stan/math/rev/constraint/cov_matrix_constrain_lkj.hpp index 1e8d8ea3e8c..3fc0d63e6cf 100644 --- a/stan/math/rev/constraint/cov_matrix_constrain_lkj.hpp +++ b/stan/math/rev/constraint/cov_matrix_constrain_lkj.hpp @@ -32,7 +32,7 @@ namespace math { * correlations and deviations. */ template * = nullptr> -var_value cov_matrix_constrain_lkj(const T& x, size_t k) { +inline var_value cov_matrix_constrain_lkj(const T& x, size_t k) { size_t k_choose_2 = (k * (k - 1)) / 2; return read_cov_matrix(corr_constrain(x.head(k_choose_2)), positive_constrain(x.tail(k))); @@ -64,7 +64,7 @@ var_value cov_matrix_constrain_lkj(const T& x, size_t k) { * correlations and deviations. */ template * = nullptr> -var_value cov_matrix_constrain_lkj(const T& x, size_t k, +inline var_value cov_matrix_constrain_lkj(const T& x, size_t k, scalar_type_t& lp) { size_t k_choose_2 = (k * (k - 1)) / 2; return read_cov_matrix(corr_constrain(x.head(k_choose_2)), diff --git a/stan/math/rev/constraint/ordered_constrain.hpp b/stan/math/rev/constraint/ordered_constrain.hpp index f029e586e33..fe8255e7c0d 100644 --- a/stan/math/rev/constraint/ordered_constrain.hpp +++ b/stan/math/rev/constraint/ordered_constrain.hpp @@ -70,7 +70,7 @@ inline auto ordered_constrain(T&& x) { * @return Positive, increasing ordered vector. */ template * = nullptr> -auto ordered_constrain(VarVec&& x, scalar_type_t& lp) { +inline auto ordered_constrain(VarVec&& x, scalar_type_t& lp) { if (x.size() > 1) { lp += sum(x.tail(x.size() - 1)); } diff --git a/stan/math/rev/constraint/sum_to_zero_constrain.hpp b/stan/math/rev/constraint/sum_to_zero_constrain.hpp index 644dead5fe8..23ac3eefc41 100644 --- a/stan/math/rev/constraint/sum_to_zero_constrain.hpp +++ b/stan/math/rev/constraint/sum_to_zero_constrain.hpp @@ -25,7 +25,7 @@ namespace internal { * @param z_adj The adjoint of the zero-sum vector (size N + 1) */ template -void sum_to_zero_vector_backprop(T&& y_adj, const Eigen::VectorXd& z_adj) { +inline void sum_to_zero_vector_backprop(T&& y_adj, const Eigen::VectorXd& z_adj) { const auto N = y_adj.size(); double sum_u_adj = 0; diff --git a/stan/math/rev/core/build_vari_array.hpp b/stan/math/rev/core/build_vari_array.hpp index f8c177dedd8..8d627f0d192 100644 --- a/stan/math/rev/core/build_vari_array.hpp +++ b/stan/math/rev/core/build_vari_array.hpp @@ -18,7 +18,7 @@ namespace math { * @return Flat array of vari pointers */ template -vari** build_vari_array(const Eigen::Matrix& x) { +inline vari** build_vari_array(const Eigen::Matrix& x) { vari** x_vi_ = ChainableStack::instance_->memalloc_.alloc_array(x.size()); for (int i = 0; i < x.size(); ++i) { diff --git a/stan/math/rev/core/callback_vari.hpp b/stan/math/rev/core/callback_vari.hpp index a270430145e..f3d7a114d72 100644 --- a/stan/math/rev/core/callback_vari.hpp +++ b/stan/math/rev/core/callback_vari.hpp @@ -38,7 +38,7 @@ struct callback_vari : public vari_value { * @param functor functor or other callable to call in the reverse pass */ template -internal::callback_vari, F>* make_callback_vari(T&& value, +inline internal::callback_vari, F>* make_callback_vari(T&& value, F&& functor) { return new internal::callback_vari, F>( std::move(value), std::forward(functor)); @@ -58,7 +58,7 @@ internal::callback_vari, F>* make_callback_vari(T&& value, * @param functor functor or other callable to call in the reverse pass */ template -var_value> make_callback_var(T&& value, F&& functor) { +inline var_value> make_callback_var(T&& value, F&& functor) { return var_value>( make_callback_vari(std::move(value), std::forward(functor))); } diff --git a/stan/math/rev/core/chainable_object.hpp b/stan/math/rev/core/chainable_object.hpp index d4e22bb966d..c2726c9d494 100644 --- a/stan/math/rev/core/chainable_object.hpp +++ b/stan/math/rev/core/chainable_object.hpp @@ -55,7 +55,7 @@ class chainable_object : public chainable_alloc { * @return pointer to object held in `chainable_object` */ template -auto make_chainable_ptr(T&& obj) { +inline auto make_chainable_ptr(T&& obj) { auto ptr = new chainable_object(std::forward(obj)); return &ptr->get(); } @@ -110,7 +110,7 @@ class unsafe_chainable_object : public chainable_alloc { * @return pointer to object held in `chainable_object` */ template -auto make_unsafe_chainable_ptr(T&& obj) { +inline auto make_unsafe_chainable_ptr(T&& obj) { auto ptr = new unsafe_chainable_object(std::forward(obj)); return &ptr->get(); } diff --git a/stan/math/rev/fun/diag_post_multiply.hpp b/stan/math/rev/fun/diag_post_multiply.hpp index fdcea382495..5d8affa18f6 100644 --- a/stan/math/rev/fun/diag_post_multiply.hpp +++ b/stan/math/rev/fun/diag_post_multiply.hpp @@ -24,7 +24,7 @@ namespace math { template * = nullptr, require_vector_t* = nullptr, require_any_st_var* = nullptr> -auto diag_post_multiply(const T1& m1, const T2& m2) { +inline auto diag_post_multiply(const T1& m1, const T2& m2) { check_size_match("diag_post_multiply", "m2.size()", m2.size(), "m1.cols()", m1.cols()); using inner_ret_type = decltype(value_of(m1) * value_of(m2).asDiagonal()); diff --git a/stan/math/rev/fun/diag_pre_multiply.hpp b/stan/math/rev/fun/diag_pre_multiply.hpp index 80f8eb44100..1636c5e7918 100644 --- a/stan/math/rev/fun/diag_pre_multiply.hpp +++ b/stan/math/rev/fun/diag_pre_multiply.hpp @@ -24,7 +24,7 @@ namespace math { template * = nullptr, require_matrix_t* = nullptr, require_any_st_var* = nullptr> -auto diag_pre_multiply(const T1& m1, const T2& m2) { +inline auto diag_pre_multiply(const T1& m1, const T2& m2) { check_size_match("diag_pre_multiply", "m1.size()", m1.size(), "m2.rows()", m2.rows()); using inner_ret_type = decltype(value_of(m1).asDiagonal() * value_of(m2)); diff --git a/stan/math/rev/fun/elt_divide.hpp b/stan/math/rev/fun/elt_divide.hpp index a3f2a58b971..31438097663 100644 --- a/stan/math/rev/fun/elt_divide.hpp +++ b/stan/math/rev/fun/elt_divide.hpp @@ -25,7 +25,7 @@ namespace math { template * = nullptr, require_any_rev_matrix_t* = nullptr> -auto elt_divide(const Mat1& m1, const Mat2& m2) { +inline auto elt_divide(const Mat1& m1, const Mat2& m2) { check_matching_dims("elt_divide", "m1", m1, "m2", m2); using inner_ret_type = decltype((value_of(m1).array() / value_of(m2).array()).matrix()); @@ -78,7 +78,7 @@ auto elt_divide(const Mat1& m1, const Mat2& m2) { */ template * = nullptr, require_var_matrix_t* = nullptr> -auto elt_divide(Scal s, const Mat& m) { +inline auto elt_divide(Scal s, const Mat& m) { plain_type_t res = value_of(s) / m.val().array(); reverse_pass_callback([m, s, res]() mutable { diff --git a/stan/math/rev/fun/elt_multiply.hpp b/stan/math/rev/fun/elt_multiply.hpp index a706efbc4bc..d2e52f19159 100644 --- a/stan/math/rev/fun/elt_multiply.hpp +++ b/stan/math/rev/fun/elt_multiply.hpp @@ -26,7 +26,7 @@ namespace math { template * = nullptr, require_any_rev_matrix_t* = nullptr> -auto elt_multiply(const Mat1& m1, const Mat2& m2) { +inline auto elt_multiply(const Mat1& m1, const Mat2& m2) { check_matching_dims("elt_multiply", "m1", m1, "m2", m2); using inner_ret_type = decltype(value_of(m1).cwiseProduct(value_of(m2))); using ret_type = return_var_matrix_t; diff --git a/stan/math/rev/fun/from_var_value.hpp b/stan/math/rev/fun/from_var_value.hpp index c222ea2d4b1..c3bbd2529b3 100644 --- a/stan/math/rev/fun/from_var_value.hpp +++ b/stan/math/rev/fun/from_var_value.hpp @@ -17,7 +17,7 @@ namespace math { * @param a matrix to convert */ template * = nullptr> -Eigen::Matrix from_var_value( +inline Eigen::Matrix from_var_value( const T& a) { arena_matrix> res(a.val()); @@ -37,7 +37,7 @@ template < conjunction, is_var>>, std::is_same, var>, bool_constant, var>::value>>* = nullptr> -T from_var_value(T&& a) { +inline T from_var_value(T&& a) { return std::forward(a); } @@ -49,7 +49,7 @@ T from_var_value(T&& a) { * @param a std::vector of elements to convert */ template -auto from_var_value(const std::vector& a) { +inline auto from_var_value(const std::vector& a) { std::vector()))> out; out.reserve(a.size()); for (size_t i = 0; i < a.size(); ++i) { diff --git a/stan/math/rev/fun/hypergeometric_1F0.hpp b/stan/math/rev/fun/hypergeometric_1F0.hpp index b591b7eb739..282e592037c 100644 --- a/stan/math/rev/fun/hypergeometric_1F0.hpp +++ b/stan/math/rev/fun/hypergeometric_1F0.hpp @@ -31,7 +31,7 @@ namespace math { template * = nullptr, require_any_var_t* = nullptr> -var hypergeometric_1F0(const Ta& a, const Tz& z) { +inline var hypergeometric_1F0(const Ta& a, const Tz& z) { double a_val = value_of(a); double z_val = value_of(z); double rtn = hypergeometric_1F0(a_val, z_val); diff --git a/stan/math/rev/fun/log_determinant_ldlt.hpp b/stan/math/rev/fun/log_determinant_ldlt.hpp index aea6ad030b5..71e4d43a685 100644 --- a/stan/math/rev/fun/log_determinant_ldlt.hpp +++ b/stan/math/rev/fun/log_determinant_ldlt.hpp @@ -19,7 +19,7 @@ namespace math { * @return ln(det(A)) */ template * = nullptr> -var log_determinant_ldlt(LDLT_factor& A) { +inline var log_determinant_ldlt(LDLT_factor& A) { if (A.matrix().size() == 0) { return 0; } diff --git a/stan/math/rev/fun/log_softmax.hpp b/stan/math/rev/fun/log_softmax.hpp index 9fddcbf8545..92650558b65 100644 --- a/stan/math/rev/fun/log_softmax.hpp +++ b/stan/math/rev/fun/log_softmax.hpp @@ -54,7 +54,7 @@ class log_softmax_elt_vari : public vari { * @throw std::domain_error if the input size is 0 */ template * = nullptr> -auto log_softmax(const T& x) { +inline auto log_softmax(const T& x) { const int a_size = x.size(); check_nonzero_size("log_softmax", "x", x); diff --git a/stan/math/rev/fun/read_corr_L.hpp b/stan/math/rev/fun/read_corr_L.hpp index 3512f4d0692..d8e8e329730 100644 --- a/stan/math/rev/fun/read_corr_L.hpp +++ b/stan/math/rev/fun/read_corr_L.hpp @@ -33,7 +33,7 @@ namespace math { * canonical partial correlations. */ template * = nullptr> -auto read_corr_L(const T& CPCs, size_t K) { // on (-1, 1) +inline auto read_corr_L(const T& CPCs, size_t K) { // on (-1, 1) using ret_type = var_value; if (K == 0) { @@ -132,7 +132,7 @@ auto read_corr_L(const T& CPCs, size_t K) { // on (-1, 1) */ template * = nullptr, require_stan_scalar_t* = nullptr> -auto read_corr_L(const T1& CPCs, size_t K, T2& log_prob) { +inline auto read_corr_L(const T1& CPCs, size_t K, T2& log_prob) { using ret_val_type = Eigen::MatrixXd; using ret_type = var_value; diff --git a/stan/math/rev/fun/read_cov_matrix.hpp b/stan/math/rev/fun/read_cov_matrix.hpp index 46609964bc2..65362850543 100644 --- a/stan/math/rev/fun/read_cov_matrix.hpp +++ b/stan/math/rev/fun/read_cov_matrix.hpp @@ -27,7 +27,7 @@ namespace math { */ template * = nullptr> -var_value read_cov_matrix(const T_CPCs& CPCs, const T_sds& sds, +inline var_value read_cov_matrix(const T_CPCs& CPCs, const T_sds& sds, scalar_type_t& log_prob) { return multiply_lower_tri_self_transpose(read_cov_L(CPCs, sds, log_prob)); } diff --git a/stan/math/rev/fun/sd.hpp b/stan/math/rev/fun/sd.hpp index b5be0261467..25c27cad876 100644 --- a/stan/math/rev/fun/sd.hpp +++ b/stan/math/rev/fun/sd.hpp @@ -25,7 +25,7 @@ namespace math { * @throw domain error size is not greater than zero. */ template * = nullptr> -var sd(const T& x) { +inline var sd(const T& x) { using std::sqrt; using T_vi = promote_scalar_t; using T_d = promote_scalar_t; @@ -68,7 +68,7 @@ var sd(const T& x) { * @throw domain error size is not greater than zero. */ template * = nullptr> -var sd(const T& x) { +inline var sd(const T& x) { check_nonzero_size("sd", "x", x); if (x.size() == 1) { @@ -94,7 +94,7 @@ var sd(const T& x) { * @throw domain error size is not greater than zero. */ template * = nullptr> -auto sd(T&& m) { +inline auto sd(T&& m) { return apply_vector_unary::reduce(std::forward(m), [](auto&& x) { return sd(std::forward(x)); }); diff --git a/stan/math/rev/fun/variance.hpp b/stan/math/rev/fun/variance.hpp index f10356af71e..57892c27234 100644 --- a/stan/math/rev/fun/variance.hpp +++ b/stan/math/rev/fun/variance.hpp @@ -59,7 +59,7 @@ inline var variance(const std::vector& v) { * @return sample variance of specified matrix */ template * = nullptr> -var variance(const EigMat& m) { +inline var variance(const EigMat& m) { const auto& mat = to_ref(m); check_nonzero_size("variance", "m", mat); if (mat.size() == 1) { diff --git a/stan/math/rev/functor/algebra_solver_fp.hpp b/stan/math/rev/functor/algebra_solver_fp.hpp index 871f5f1b09e..922eff29f82 100644 --- a/stan/math/rev/functor/algebra_solver_fp.hpp +++ b/stan/math/rev/functor/algebra_solver_fp.hpp @@ -362,7 +362,7 @@ struct FixedPointSolver, fp_jac_type> { * std::runtime_error) if solver exceeds max_num_steps. */ template -Eigen::Matrix algebra_solver_fp( +inline Eigen::Matrix algebra_solver_fp( const F& f, const Eigen::Matrix& x, const Eigen::Matrix& y, const std::vector& x_r, const std::vector& x_i, const std::vector& u_scale, diff --git a/stan/math/rev/functor/algebra_system.hpp b/stan/math/rev/functor/algebra_system.hpp index 76b32ffe77f..559fb537079 100644 --- a/stan/math/rev/functor/algebra_system.hpp +++ b/stan/math/rev/functor/algebra_system.hpp @@ -98,7 +98,7 @@ struct hybrj_functor_solver : nlo_functor { // TODO(jgaeb): Remove this when the chain method of the fixed point solver is // updated. template -void algebra_solver_check(const Eigen::Matrix& x, +inline void algebra_solver_check(const Eigen::Matrix& x, const Eigen::Matrix y, const std::vector& dat, const std::vector& dat_int, diff --git a/stan/math/rev/functor/dae.hpp b/stan/math/rev/functor/dae.hpp index ce5022ef13f..c574b02924b 100644 --- a/stan/math/rev/functor/dae.hpp +++ b/stan/math/rev/functor/dae.hpp @@ -49,7 +49,7 @@ namespace math { */ template * = nullptr> -std::vector, -1, 1>> +inline std::vector, -1, 1>> dae_tol_impl(const char* func, const F& f, const T_yy& yy0, const T_yp& yp0, double t0, const std::vector& ts, double rtol, double atol, int64_t max_num_steps, std::ostream* msgs, const T_Args&... args) { @@ -121,7 +121,7 @@ dae_tol_impl(const char* func, const F& f, const T_yy& yy0, const T_yp& yp0, */ template * = nullptr> -std::vector, -1, 1>> +inline std::vector, -1, 1>> dae_tol(const F& f, const T_yy& yy0, const T_yp& yp0, double t0, const std::vector& ts, double rtol, double atol, int64_t max_num_steps, std::ostream* msgs, const T_Args&... args) { @@ -163,7 +163,7 @@ dae_tol(const F& f, const T_yy& yy0, const T_yp& yp0, double t0, */ template * = nullptr> -std::vector, -1, 1>> +inline std::vector, -1, 1>> dae(const F& f, const T_yy& yy0, const T_yp& yp0, double t0, const std::vector& ts, std::ostream* msgs, const T_Args&... args) { return dae_tol_impl("dae", f, yy0, yp0, t0, ts, 1.e-10, 1.e-10, 1e8, msgs, diff --git a/stan/math/rev/functor/finite_diff_hessian_auto.hpp b/stan/math/rev/functor/finite_diff_hessian_auto.hpp index 6e63c6f9a9d..e0ac6ae427c 100644 --- a/stan/math/rev/functor/finite_diff_hessian_auto.hpp +++ b/stan/math/rev/functor/finite_diff_hessian_auto.hpp @@ -40,7 +40,7 @@ namespace internal { * @param[out] hess_fx Hessian of function at argument */ template -void finite_diff_hessian_auto(const F& f, const Eigen::VectorXd& x, double& fx, +inline void finite_diff_hessian_auto(const F& f, const Eigen::VectorXd& x, double& fx, Eigen::VectorXd& grad_fx, Eigen::MatrixXd& hess_fx) { int d = x.size(); diff --git a/stan/math/rev/functor/finite_diff_hessian_times_vector_auto.hpp b/stan/math/rev/functor/finite_diff_hessian_times_vector_auto.hpp index b86c7c8a6af..5ed0af87d25 100644 --- a/stan/math/rev/functor/finite_diff_hessian_times_vector_auto.hpp +++ b/stan/math/rev/functor/finite_diff_hessian_times_vector_auto.hpp @@ -41,7 +41,7 @@ namespace internal { * @param[out] hvp Product of Hessian and vector at argument */ template -void finite_diff_hessian_times_vector_auto(const F& f, const Eigen::VectorXd& x, +inline void finite_diff_hessian_times_vector_auto(const F& f, const Eigen::VectorXd& x, const Eigen::VectorXd& v, double& fx, Eigen::VectorXd& hvp) { fx = f(x); diff --git a/stan/math/rev/functor/gradient.hpp b/stan/math/rev/functor/gradient.hpp index 984facf177b..db7f1588b0b 100644 --- a/stan/math/rev/functor/gradient.hpp +++ b/stan/math/rev/functor/gradient.hpp @@ -43,7 +43,7 @@ namespace math { * @param[out] grad_fx Gradient of function at argument */ template -void gradient(const F& f, const Eigen::Matrix& x, +inline void gradient(const F& f, const Eigen::Matrix& x, double& fx, Eigen::Matrix& grad_fx) { nested_rev_autodiff nested; @@ -99,7 +99,7 @@ void gradient(const F& f, const Eigen::Matrix& x, */ template * = nullptr> -void gradient(const F& f, const EigVec& x, double& fx, InputIt first_grad_fx, +inline void gradient(const F& f, const EigVec& x, double& fx, InputIt first_grad_fx, InputIt last_grad_fx) { nested_rev_autodiff nested; diff --git a/stan/math/rev/functor/jacobian.hpp b/stan/math/rev/functor/jacobian.hpp index 75692b06911..0f070da560a 100644 --- a/stan/math/rev/functor/jacobian.hpp +++ b/stan/math/rev/functor/jacobian.hpp @@ -11,7 +11,7 @@ namespace stan { namespace math { template -void jacobian(const F& f, const Eigen::Matrix& x, +inline void jacobian(const F& f, const Eigen::Matrix& x, Eigen::Matrix& fx, Eigen::Matrix& J) { using Eigen::Dynamic; diff --git a/stan/math/rev/functor/kinsol_solve.hpp b/stan/math/rev/functor/kinsol_solve.hpp index 08e21e73822..fdbecf392ce 100644 --- a/stan/math/rev/functor/kinsol_solve.hpp +++ b/stan/math/rev/functor/kinsol_solve.hpp @@ -58,7 +58,7 @@ namespace math { * negative flag that is not due to hitting max_num_steps. */ template -Eigen::VectorXd kinsol_solve(const F1& f, const Eigen::VectorXd& x, +inline Eigen::VectorXd kinsol_solve(const F1& f, const Eigen::VectorXd& x, const double scaling_step_tol, // = 1e-3 const double function_tolerance, // = 1e-6 const int64_t max_num_steps, // = 200 diff --git a/stan/math/rev/functor/map_rect_concurrent.hpp b/stan/math/rev/functor/map_rect_concurrent.hpp index 7b7bf42a643..a56bd13c320 100644 --- a/stan/math/rev/functor/map_rect_concurrent.hpp +++ b/stan/math/rev/functor/map_rect_concurrent.hpp @@ -20,7 +20,7 @@ namespace internal { template *> -Eigen::Matrix, Eigen::Dynamic, 1> +inline Eigen::Matrix, Eigen::Dynamic, 1> map_rect_concurrent( const T_shared_param& shared_params, const std::vector>& diff --git a/stan/math/rev/functor/ode_adams.hpp b/stan/math/rev/functor/ode_adams.hpp index 500cd2e4c92..01837a4fb33 100644 --- a/stan/math/rev/functor/ode_adams.hpp +++ b/stan/math/rev/functor/ode_adams.hpp @@ -47,7 +47,7 @@ namespace math { */ template * = nullptr> -std::vector, +inline std::vector, Eigen::Dynamic, 1>> ode_adams_tol_impl(const char* function_name, const F& f, const T_y0& y0, const T_t0& t0, const std::vector& ts, @@ -101,7 +101,7 @@ ode_adams_tol_impl(const char* function_name, const F& f, const T_y0& y0, */ template * = nullptr> -std::vector, +inline std::vector, Eigen::Dynamic, 1>> ode_adams_tol(const F& f, const T_y0& y0, const T_t0& t0, const std::vector& ts, double relative_tolerance, @@ -144,7 +144,7 @@ ode_adams_tol(const F& f, const T_y0& y0, const T_t0& t0, */ template * = nullptr> -std::vector, +inline std::vector, Eigen::Dynamic, 1>> ode_adams(const F& f, const T_y0& y0, const T_t0& t0, const std::vector& ts, std::ostream* msgs, diff --git a/stan/math/rev/functor/ode_adjoint.hpp b/stan/math/rev/functor/ode_adjoint.hpp index 261788285b0..147a3e4b1d7 100644 --- a/stan/math/rev/functor/ode_adjoint.hpp +++ b/stan/math/rev/functor/ode_adjoint.hpp @@ -68,7 +68,7 @@ template * = nullptr, require_any_not_st_arithmetic* = nullptr> -auto ode_adjoint_impl( +inline auto ode_adjoint_impl( const char* function_name, F&& f, const T_y0& y0, const T_t0& t0, const std::vector& ts, double relative_tolerance_forward, const T_abs_tol_fwd& absolute_tolerance_forward, @@ -152,7 +152,7 @@ template * = nullptr, require_all_st_arithmetic* = nullptr> -std::vector ode_adjoint_impl( +inline std::vector ode_adjoint_impl( const char* function_name, F&& f, const T_y0& y0, const T_t0& t0, const std::vector& ts, double relative_tolerance_forward, const T_abs_tol_fwd& absolute_tolerance_forward, @@ -240,7 +240,7 @@ template * = nullptr> -auto ode_adjoint_tol_ctl( +inline auto ode_adjoint_tol_ctl( F&& f, const T_y0& y0, const T_t0& t0, const std::vector& ts, double relative_tolerance_forward, const T_abs_tol_fwd& absolute_tolerance_forward, diff --git a/stan/math/rev/functor/ode_bdf.hpp b/stan/math/rev/functor/ode_bdf.hpp index 009bfe75c00..9bb2058e136 100644 --- a/stan/math/rev/functor/ode_bdf.hpp +++ b/stan/math/rev/functor/ode_bdf.hpp @@ -48,7 +48,7 @@ namespace math { */ template * = nullptr> -std::vector, +inline std::vector, Eigen::Dynamic, 1>> ode_bdf_tol_impl(const char* function_name, const F& f, const T_y0& y0, const T_t0& t0, const std::vector& ts, @@ -102,7 +102,7 @@ ode_bdf_tol_impl(const char* function_name, const F& f, const T_y0& y0, */ template * = nullptr> -std::vector, +inline std::vector, Eigen::Dynamic, 1>> ode_bdf_tol(const F& f, const T_y0& y0, const T_t0& t0, const std::vector& ts, double relative_tolerance, @@ -145,7 +145,7 @@ ode_bdf_tol(const F& f, const T_y0& y0, const T_t0& t0, */ template * = nullptr> -std::vector, +inline std::vector, Eigen::Dynamic, 1>> ode_bdf(const F& f, const T_y0& y0, const T_t0& t0, const std::vector& ts, std::ostream* msgs, const T_Args&... args) { diff --git a/stan/math/rev/functor/ode_store_sensitivities.hpp b/stan/math/rev/functor/ode_store_sensitivities.hpp index 915ed898136..f8c9ce942d7 100644 --- a/stan/math/rev/functor/ode_store_sensitivities.hpp +++ b/stan/math/rev/functor/ode_store_sensitivities.hpp @@ -33,7 +33,7 @@ template ...>* = nullptr> -Eigen::Matrix ode_store_sensitivities( +inline Eigen::Matrix ode_store_sensitivities( const F& f, const std::vector& coupled_state, const Eigen::Matrix& y0, const T_t0& t0, const T_t& t, std::ostream* msgs, const Args&... args) { diff --git a/stan/math/rev/functor/solve_newton.hpp b/stan/math/rev/functor/solve_newton.hpp index 33a31da6281..9459df3bba4 100644 --- a/stan/math/rev/functor/solve_newton.hpp +++ b/stan/math/rev/functor/solve_newton.hpp @@ -56,7 +56,7 @@ namespace math { template * = nullptr, require_all_st_arithmetic* = nullptr> -Eigen::VectorXd solve_newton_tol(const F& f, const T& x, +inline Eigen::VectorXd solve_newton_tol(const F& f, const T& x, const double scaling_step_size, const double function_tolerance, const int64_t max_num_steps, @@ -135,7 +135,7 @@ Eigen::VectorXd solve_newton_tol(const F& f, const T& x, template * = nullptr, require_any_st_var* = nullptr> -Eigen::Matrix solve_newton_tol( +inline Eigen::Matrix solve_newton_tol( const F& f, const T& x, const double scaling_step_size, const double function_tolerance, const int64_t max_num_steps, std::ostream* const msgs, const T_Args&... args) { @@ -236,7 +236,7 @@ Eigen::Matrix solve_newton_tol( */ template * = nullptr> -Eigen::Matrix, Eigen::Dynamic, 1> solve_newton( +inline Eigen::Matrix, Eigen::Dynamic, 1> solve_newton( const F& f, const T& x, std::ostream* const msgs, const T_Args&... args) { double scaling_step_size = 1e-3; double function_tolerance = 1e-6; @@ -292,7 +292,7 @@ Eigen::Matrix, Eigen::Dynamic, 1> solve_newton( */ template * = nullptr> -Eigen::Matrix, Eigen::Dynamic, 1> algebra_solver_newton( +inline Eigen::Matrix, Eigen::Dynamic, 1> algebra_solver_newton( const F& f, const T1& x, const T2& y, const std::vector& dat, const std::vector& dat_int, std::ostream* const msgs = nullptr, const double scaling_step_size = 1e-3, diff --git a/stan/math/rev/functor/solve_powell.hpp b/stan/math/rev/functor/solve_powell.hpp index 587875c2445..52f974b19e1 100644 --- a/stan/math/rev/functor/solve_powell.hpp +++ b/stan/math/rev/functor/solve_powell.hpp @@ -45,7 +45,7 @@ namespace math { */ template * = nullptr> -T& solve_powell_call_solver(const F& f, T& x, std::ostream* const msgs, +inline T& solve_powell_call_solver(const F& f, T& x, std::ostream* const msgs, const double relative_tolerance, const double function_tolerance, const int64_t max_num_steps, const Args&... args) { @@ -125,7 +125,7 @@ T& solve_powell_call_solver(const F& f, T& x, std::ostream* const msgs, template * = nullptr, require_all_st_arithmetic* = nullptr> -Eigen::VectorXd solve_powell_tol(const F& f, const T& x, +inline Eigen::VectorXd solve_powell_tol(const F& f, const T& x, const double relative_tolerance, const double function_tolerance, const int64_t max_num_steps, @@ -185,7 +185,7 @@ Eigen::VectorXd solve_powell_tol(const F& f, const T& x, */ template * = nullptr> -Eigen::Matrix, Eigen::Dynamic, 1> solve_powell( +inline Eigen::Matrix, Eigen::Dynamic, 1> solve_powell( const F& f, const T& x, std::ostream* const msgs, const T_Args&... args) { double relative_tolerance = 1e-10; double function_tolerance = 1e-6; @@ -248,7 +248,7 @@ Eigen::Matrix, Eigen::Dynamic, 1> solve_powell( */ template * = nullptr> -Eigen::Matrix, Eigen::Dynamic, 1> algebra_solver( +inline Eigen::Matrix, Eigen::Dynamic, 1> algebra_solver( const F& f, const T1& x, const T2& y, const std::vector& dat, const std::vector& dat_int, std::ostream* msgs = nullptr, const double relative_tolerance = 1e-10, @@ -322,7 +322,7 @@ Eigen::Matrix, Eigen::Dynamic, 1> algebra_solver( template * = nullptr, require_any_st_var* = nullptr> -Eigen::Matrix solve_powell_tol( +inline Eigen::Matrix solve_powell_tol( const F& f, const T& x, const double relative_tolerance, const double function_tolerance, const int64_t max_num_steps, std::ostream* const msgs, const T_Args&... args) { diff --git a/test/expressions/expression_test_helpers.hpp b/test/expressions/expression_test_helpers.hpp index 43551bfdfbb..db953a50e84 100644 --- a/test/expressions/expression_test_helpers.hpp +++ b/test/expressions/expression_test_helpers.hpp @@ -113,34 +113,34 @@ T make_pos_definite_matrix(double value = 0.4, int size = 1) { } template * = nullptr> -void expect_eq(T a, T b, const char* msg) { +inline void expect_eq(T a, T b, const char* msg) { EXPECT_EQ(a, b) << msg; } -void expect_eq(math::var a, math::var b, const char* msg) { +inline void expect_eq(math::var a, math::var b, const char* msg) { EXPECT_EQ(a.val(), b.val()) << msg; } template * = nullptr> -void expect_eq(math::fvar a, math::fvar b, const char* msg) { +inline void expect_eq(math::fvar a, math::fvar b, const char* msg) { expect_eq(a.val(), b.val(), msg); expect_eq(a.d(), b.d(), msg); } template * = nullptr> -void expect_eq(std::complex a, std::complex b, const char* msg) { +inline void expect_eq(std::complex a, std::complex b, const char* msg) { expect_eq(a.real(), b.real(), msg); expect_eq(a.imag(), b.imag(), msg); } -void expect_eq(std::complex a, std::complex b, +inline void expect_eq(std::complex a, std::complex b, const char* msg) { expect_eq(a.real(), b.real(), msg); expect_eq(a.imag(), b.imag(), msg); } template * = nullptr> -void expect_eq(std::complex> a, std::complex> b, +inline void expect_eq(std::complex> a, std::complex> b, const char* msg) { expect_eq(a.real(), b.real(), msg); expect_eq(a.imag(), b.imag(), msg); @@ -148,7 +148,7 @@ void expect_eq(std::complex> a, std::complex> b, template * = nullptr, require_vt_same* = nullptr> -void expect_eq(const T1& a, const T2& b, const char* msg) { +inline void expect_eq(const T1& a, const T2& b, const char* msg) { EXPECT_EQ(a.rows(), b.rows()) << msg; EXPECT_EQ(a.cols(), b.cols()) << msg; const auto& a_ref = math::to_ref(a); @@ -161,7 +161,7 @@ void expect_eq(const T1& a, const T2& b, const char* msg) { } template -void expect_eq(const std::vector& a, const std::vector& b, +inline void expect_eq(const std::vector& a, const std::vector& b, const char* msg) { EXPECT_EQ(a.size(), b.size()); for (int i = 0; i < a.size(); i++) { @@ -170,21 +170,21 @@ void expect_eq(const std::vector& a, const std::vector& b, } template * = nullptr> -void expect_eq(const T& t1, const T& t2, const char* msg) { +inline void expect_eq(const T& t1, const T& t2, const char* msg) { stan::math::for_each( [&msg](auto&& elt1, auto&& elt2) { expect_eq(elt1, elt2, msg); }, t1, t2); } template * = nullptr> -void expect_adj_eq(const T& a, const T& b, const char* msg = "expect_ad_eq") {} +inline void expect_adj_eq(const T& a, const T& b, const char* msg = "expect_ad_eq") {} -void expect_adj_eq(math::var a, math::var b, const char* msg = "expect_ad_eq") { +inline void expect_adj_eq(math::var a, math::var b, const char* msg = "expect_ad_eq") { EXPECT_EQ(a.adj(), b.adj()) << msg; } template * = nullptr, require_vt_same* = nullptr> -void expect_adj_eq(const T1& a, const T2& b, const char* msg = "expect_ad_eq") { +inline void expect_adj_eq(const T1& a, const T2& b, const char* msg = "expect_ad_eq") { EXPECT_EQ(a.rows(), b.rows()) << msg; EXPECT_EQ(a.cols(), b.cols()) << msg; const auto& a_ref = math::to_ref(a); @@ -197,7 +197,7 @@ void expect_adj_eq(const T1& a, const T2& b, const char* msg = "expect_ad_eq") { } template -void expect_adj_eq(const std::vector& a, const std::vector& b, +inline void expect_adj_eq(const std::vector& a, const std::vector& b, const char* msg = "expect_ad_eq") { EXPECT_EQ(a.size(), b.size()) << msg; for (int i = 0; i < a.size(); i++) { @@ -205,8 +205,8 @@ void expect_adj_eq(const std::vector& a, const std::vector& b, } } -void grad(stan::math::var& a) { a.grad(); } -void grad(std::complex& a) { +inline void grad(stan::math::var& a) { a.grad(); } +inline void grad(std::complex& a) { a.real().grad(); a.imag().grad(); } @@ -225,7 +225,7 @@ scalar_type_t sum_if_number(const T& a) { return recursive_sum(a); } template * = nullptr> -double sum_if_number(const T& a) { +inline double sum_if_number(const T& a) { return 0; } diff --git a/test/prob/generate_tests.cpp b/test/prob/generate_tests.cpp index f9563f839ae..2371944c1a7 100644 --- a/test/prob/generate_tests.cpp +++ b/test/prob/generate_tests.cpp @@ -22,7 +22,7 @@ int ROW_VECTORS = 1; int ROW_VECTORS = 0; #endif -void push_args(vector& args, const string& type) { +inline void push_args(vector& args, const string& type) { if (type.compare("varmat") == 0) { args.push_back("var"); args.push_back("std::vector"); @@ -40,7 +40,7 @@ void push_args(vector& args, const string& type) { } } -vector lookup_argument(const string& argument, const int& ind) { +inline vector lookup_argument(const string& argument, const int& ind) { using boost::iequals; vector args; if (iequals(argument, "int")) { @@ -83,7 +83,7 @@ std::ostream& operator<<(std::ostream& o, vector& vec) { return o; } -void write_includes(vector& outs, const string& include) { +inline void write_includes(vector& outs, const string& include) { for (size_t n = 0; n < outs.size(); n++) { std::ostream* out = outs[n]; *out << "#include " << endl; @@ -97,7 +97,7 @@ void write_includes(vector& outs, const string& include) { } } -vector tokenize_arguments(const string& arguments) { +inline vector tokenize_arguments(const string& arguments) { vector tokens; string delimiters = ", "; string args_only_string = arguments.substr(arguments.find(":") + 1); @@ -117,7 +117,7 @@ size_t size(const vector >& sequences) { return N; } -bool is_argument_list(const string& line) { +inline bool is_argument_list(const string& line) { size_t comment = line.find("// "); if (comment == string::npos) return false; @@ -180,7 +180,7 @@ pair read_test_name_from_file(const string& file) { return name; } -vector > build_argument_sequence(const string& arguments, +inline vector > build_argument_sequence(const string& arguments, const int& ind) { vector argument_list = tokenize_arguments(arguments); vector > argument_sequence; @@ -244,7 +244,7 @@ int num_ints(string arguments) { return num; } -void write_types_typedef(vector& outs, string base, size_t& N, +inline void write_types_typedef(vector& outs, string base, size_t& N, vector > argument_sequence, const size_t depth, const int& index, const int& N_TESTS) { @@ -300,7 +300,7 @@ size_t write_types(vector& outs, return N; } -void write_test(vector& outs, const string& test_name, +inline void write_test(vector& outs, const string& test_name, const string& fixture_name, const size_t N, const int& index, const int& N_TESTS) { for (size_t n = 0; n < N; n++) { @@ -359,7 +359,7 @@ void write_test(vector& outs, const string& test_name, } } -void write_test_cases(vector& outs, const string& file, +inline void write_test_cases(vector& outs, const string& file, const vector >& argument_sequence, const int& index, const int& N_TESTS) { pair name = read_test_name_from_file(file); diff --git a/test/prob/utility.hpp b/test/prob/utility.hpp index 757a035be5c..4fe50048e12 100644 --- a/test/prob/utility.hpp +++ b/test/prob/utility.hpp @@ -56,7 +56,7 @@ std::ostream& operator<<(std::ostream& os, const vector& param) { // ------------------------------------------------------------ template -T get_param(const vector& params, const size_t n) { +inline T get_param(const vector& params, const size_t n) { T param = 0; if (n < params.size()) param = params[n]; @@ -69,7 +69,7 @@ empty get_param(const vector& /*params*/, const size_t /*n*/) { } template <> -fvar get_param>(const vector& params, +inline fvar get_param>(const vector& params, const size_t n) { fvar param = 0; if (n < params.size()) { @@ -79,7 +79,7 @@ fvar get_param>(const vector& params, return param; } template <> -fvar get_param>(const vector& params, const size_t n) { +inline fvar get_param>(const vector& params, const size_t n) { fvar param = 0; if (n < params.size()) { param = params[n]; @@ -88,7 +88,7 @@ fvar get_param>(const vector& params, const size_t n) { return param; } template <> -fvar> get_param>>(const vector& params, +inline fvar> get_param>>(const vector& params, const size_t n) { fvar> param = 0; if (n < params.size()) { @@ -98,7 +98,7 @@ fvar> get_param>>(const vector& params, return param; } template <> -fvar> get_param>>(const vector& params, +inline fvar> get_param>>(const vector& params, const size_t n) { fvar> param = 0; if (n < params.size()) { @@ -112,7 +112,7 @@ fvar> get_param>>(const vector& params, // default template handles Eigen::Matrix template * = nullptr> -T get_params(const vector>& parameters, const size_t p) { +inline T get_params(const vector>& parameters, const size_t p) { T param(parameters.size()); for (size_t n = 0; n < parameters.size(); n++) if (p < parameters[0].size()) @@ -122,7 +122,7 @@ T get_params(const vector>& parameters, const size_t p) { // handle `var_value` where T is an Eigen type template * = nullptr> -T get_params(const vector>& parameters, const size_t p) { +inline T get_params(const vector>& parameters, const size_t p) { typename T::value_type param(parameters.size()); for (size_t n = 0; n < parameters.size(); n++) if (p < parameters[0].size()) @@ -138,7 +138,7 @@ empty get_params(const vector>& /*parameters*/, } // handle scalars template <> -double get_params(const vector>& parameters, +inline double get_params(const vector>& parameters, const size_t p) { double param(0); if (p < parameters[0].size()) @@ -146,14 +146,14 @@ double get_params(const vector>& parameters, return param; } template <> -var get_params(const vector>& parameters, const size_t p) { +inline var get_params(const vector>& parameters, const size_t p) { var param(0); if (p < parameters[0].size()) param = parameters[0][p]; return param; } template <> -fvar get_params>(const vector>& parameters, +inline fvar get_params>(const vector>& parameters, const size_t p) { fvar param(0); if (p < parameters[0].size()) { @@ -163,7 +163,7 @@ fvar get_params>(const vector>& parameters, return param; } template <> -fvar get_params>(const vector>& parameters, +inline fvar get_params>(const vector>& parameters, const size_t p) { fvar param(0); if (p < parameters[0].size()) { @@ -201,7 +201,7 @@ int get_params(const vector>& parameters, const size_t p) { } // handle vectors template <> -vector get_params>(const vector>& parameters, +inline vector get_params>(const vector>& parameters, const size_t p) { vector param(parameters.size()); for (size_t n = 0; n < parameters.size(); n++) @@ -219,7 +219,7 @@ vector get_params>( return param; } template <> -vector get_params>(const vector>& parameters, +inline vector get_params>(const vector>& parameters, const size_t p) { vector param(parameters.size()); for (size_t n = 0; n < parameters.size(); n++) @@ -276,7 +276,7 @@ vector>> get_params>>>( // default template handles Eigen::Matrix template * = nullptr> -T get_params(const vector>& parameters, const size_t /*n*/, +inline T get_params(const vector>& parameters, const size_t /*n*/, const size_t p) { T param(parameters.size()); for (size_t i = 0; i < parameters.size(); i++) @@ -287,7 +287,7 @@ T get_params(const vector>& parameters, const size_t /*n*/, // handle `var_value` where T is an Eigen type template * = nullptr> -T get_params(const vector>& parameters, const size_t /*n*/, +inline T get_params(const vector>& parameters, const size_t /*n*/, const size_t p) { typename T::value_type param(parameters.size()); for (size_t i = 0; i < parameters.size(); i++) @@ -304,7 +304,7 @@ empty get_params(const vector>& /*parameters*/, } // handle scalars template <> -double get_params(const vector>& parameters, +inline double get_params(const vector>& parameters, const size_t n, const size_t p) { double param(0); if (p < parameters[0].size()) @@ -312,7 +312,7 @@ double get_params(const vector>& parameters, return param; } template <> -var get_params(const vector>& parameters, const size_t n, +inline var get_params(const vector>& parameters, const size_t n, const size_t p) { var param(0); if (p < parameters[0].size()) @@ -320,7 +320,7 @@ var get_params(const vector>& parameters, const size_t n, return param; } template <> -fvar get_params>(const vector>& parameters, +inline fvar get_params>(const vector>& parameters, const size_t n, const size_t p) { fvar param(0); if (p < parameters[0].size()) { @@ -330,7 +330,7 @@ fvar get_params>(const vector>& parameters, return param; } template <> -fvar get_params>(const vector>& parameters, +inline fvar get_params>(const vector>& parameters, const size_t n, const size_t p) { fvar param(0); if (p < parameters[0].size()) { @@ -369,7 +369,7 @@ int get_params(const vector>& parameters, const size_t n, } // handle vectors template <> -vector get_params>(const vector>& parameters, +inline vector get_params>(const vector>& parameters, const size_t /*n*/, const size_t p) { vector param(parameters.size()); for (size_t i = 0; i < parameters.size(); i++) @@ -388,7 +388,7 @@ vector get_params>( return param; } template <> -vector get_params>(const vector>& parameters, +inline vector get_params>(const vector>& parameters, const size_t /*n*/, const size_t p) { vector param(parameters.size()); for (size_t i = 0; i < parameters.size(); i++) @@ -448,7 +448,7 @@ vector>> get_params>>>( // ------------------------------------------------------------ // default template handles Eigen::Matrix template * = nullptr> -T get_repeated_params(const vector& parameters, const size_t p, +inline T get_repeated_params(const vector& parameters, const size_t p, const size_t N_REPEAT) { T params(N_REPEAT); stan::value_type_t param; @@ -467,7 +467,7 @@ T get_repeated_params(const vector& parameters, const size_t p, // handle `var_value` where T is an Eigen type template * = nullptr> -T get_repeated_params(const vector& parameters, const size_t p, +inline T get_repeated_params(const vector& parameters, const size_t p, const size_t N_REPEAT) { typename T::value_type params(N_REPEAT); double param; @@ -486,7 +486,7 @@ T get_repeated_params(const vector& parameters, const size_t p, // handle `std::vector` template * = nullptr> -T get_repeated_params(const vector& parameters, const size_t p, +inline T get_repeated_params(const vector& parameters, const size_t p, const size_t N_REPEAT) { T params(N_REPEAT); stan::value_type_t param; @@ -506,13 +506,13 @@ T get_repeated_params(const vector& parameters, const size_t p, // handle empty template ::value>* = nullptr> -T get_repeated_params(const vector&, const size_t, const size_t) { +inline T get_repeated_params(const vector&, const size_t, const size_t) { return T(); } // handle scalars template * = nullptr> -T get_repeated_params(const vector& parameters, const size_t p, +inline T get_repeated_params(const vector& parameters, const size_t p, const size_t /*N_REPEAT*/) { if (p < parameters.size()) return get_param(parameters, p); @@ -593,86 +593,86 @@ struct any_vector { // ------------------------------------------------------------ template * = nullptr> -void add_adjoints(vector& /*x*/, T& /*p*/) {} +inline void add_adjoints(vector& /*x*/, T& /*p*/) {} template <> -void add_adjoints(vector& x, var& p) { +inline void add_adjoints(vector& x, var& p) { x.push_back(p.adj()); } template * = nullptr> -void add_adjoints(vector& x, T& p) { +inline void add_adjoints(vector& x, T& p) { for (size_type n = 0; n < p.size(); n++) { x.push_back(p.adj().coeff(n)); } } template <> -void add_adjoints>(vector& x, vector& p) { +inline void add_adjoints>(vector& x, vector& p) { for (size_type n = 0; n < p.size(); n++) x.push_back(p[n].adj()); } template <> -void add_adjoints>( +inline void add_adjoints>( vector& x, Eigen::Matrix& p) { for (size_type n = 0; n < p.size(); n++) x.push_back(p(n).adj()); } template <> -void add_adjoints>( +inline void add_adjoints>( vector& x, Eigen::Matrix& p) { for (size_type n = 0; n < p.size(); n++) x.push_back(p(n).adj()); } template <> -void add_adjoints>(vector& x, fvar& p) { +inline void add_adjoints>(vector& x, fvar& p) { x.push_back(p.val_.adj()); } template <> -void add_adjoints>>(vector& x, vector>& p) { +inline void add_adjoints>>(vector& x, vector>& p) { for (size_t n = 0; n < p.size(); n++) x.push_back(p[n].val_.adj()); } template <> -void add_adjoints, 1, Eigen::Dynamic>>( +inline void add_adjoints, 1, Eigen::Dynamic>>( vector& x, Eigen::Matrix, 1, Eigen::Dynamic>& p) { for (size_type n = 0; n < p.size(); n++) x.push_back(p(n).val_.adj()); } template <> -void add_adjoints, Eigen::Dynamic, 1>>( +inline void add_adjoints, Eigen::Dynamic, 1>>( vector& x, Eigen::Matrix, Eigen::Dynamic, 1>& p) { for (size_type n = 0; n < p.size(); n++) x.push_back(p(n).val_.adj()); } template <> -void add_adjoints>>(vector& x, fvar>& p) { +inline void add_adjoints>>(vector& x, fvar>& p) { x.push_back(p.val_.val_.adj()); } template <> -void add_adjoints>>>(vector& x, +inline void add_adjoints>>>(vector& x, vector>>& p) { for (size_t n = 0; n < p.size(); n++) x.push_back(p[n].val_.val_.adj()); } template <> -void add_adjoints>, 1, Eigen::Dynamic>>( +inline void add_adjoints>, 1, Eigen::Dynamic>>( vector& x, Eigen::Matrix>, 1, Eigen::Dynamic>& p) { for (size_type n = 0; n < p.size(); n++) x.push_back(p(n).val_.val_.adj()); } template <> -void add_adjoints>, Eigen::Dynamic, 1>>( +inline void add_adjoints>, Eigen::Dynamic, 1>>( vector& x, Eigen::Matrix>, Eigen::Dynamic, 1>& p) { for (size_type n = 0; n < p.size(); n++) x.push_back(p(n).val_.val_.adj()); @@ -680,7 +680,7 @@ void add_adjoints>, Eigen::Dynamic, 1>>( template -void add_adjoints(vector& x, T0& p0, T1& p1, T2& p2, T3& p3, T4& p4, +inline void add_adjoints(vector& x, T0& p0, T1& p1, T2& p2, T3& p3, T4& p4, T5& p5) { if (!is_constant_all::value) add_adjoints(x, p0); diff --git a/test/unit/math/expect_near_rel.hpp b/test/unit/math/expect_near_rel.hpp index 7d05c91850a..e6c9d03df90 100644 --- a/test/unit/math/expect_near_rel.hpp +++ b/test/unit/math/expect_near_rel.hpp @@ -26,7 +26,7 @@ namespace internal { * @param tol relative tolerance */ template ...> -void expect_near_rel_finite(const std::string& msg, const T1& x1, const T2& x2, +inline void expect_near_rel_finite(const std::string& msg, const T1& x1, const T2& x2, const relative_tolerance tol = relative_tolerance(), const char* x1_name = "x1", const char* x2_name = "x2") { @@ -38,7 +38,7 @@ void expect_near_rel_finite(const std::string& msg, const T1& x1, const T2& x2, template ...> -void expect_near_rel_finite(const std::string& msg, const EigMat1& x1, +inline void expect_near_rel_finite(const std::string& msg, const EigMat1& x1, const EigMat2& x2, const char* x1_name = "x1", const char* x2_name = "x2") { EXPECT_EQ(x1.rows(), x2.rows()); @@ -51,7 +51,7 @@ void expect_near_rel_finite(const std::string& msg, const EigMat1& x1, } template -void expect_near_rel_finite(const std::string& msg, const std::vector& x1, +inline void expect_near_rel_finite(const std::string& msg, const std::vector& x1, const std::vector& x2, const char* x1_name = "x1", const char* x2_name = "x2") { @@ -78,7 +78,7 @@ void expect_near_rel_finite(const std::string& msg, const std::vector& x1, * @param tol relative tolerance */ template ...> -void expect_near_rel(const std::string& msg, const T1& x1, const T2& x2, +inline void expect_near_rel(const std::string& msg, const T1& x1, const T2& x2, relative_tolerance tol = relative_tolerance(), const char* x1_name = "x1", const char* x2_name = "x2") { if (stan::math::is_nan(x1) || stan::math::is_nan(x2)) { @@ -112,7 +112,7 @@ void expect_near_rel(const std::string& msg, const T1& x1, const T2& x2, */ template ...> -void expect_near_rel(const std::string& msg, EigMat1&& x1, EigMat2&& x2, +inline void expect_near_rel(const std::string& msg, EigMat1&& x1, EigMat2&& x2, relative_tolerance tol = relative_tolerance(), const char* x1_name = "x1", const char* x2_name = "x2") { EXPECT_EQ(x1.rows(), x2.rows()) @@ -167,7 +167,7 @@ void expect_near_rel(const std::string& msg, EigMat1&& x1, EigMat2&& x2, * @param[in] tol relative tolerance */ template -void expect_near_rel(const std::string& msg, const std::vector& x1, +inline void expect_near_rel(const std::string& msg, const std::vector& x1, const std::vector& x2, relative_tolerance tol = relative_tolerance(), const char* x1_name = "x1", const char* x2_name = "x2") { @@ -195,7 +195,7 @@ void expect_near_rel(const std::string& msg, const std::vector& x1, * @param tol[in] tolerance for comparison */ template -void expect_near_rel(const std::string& msg, const std::complex& z1, +inline void expect_near_rel(const std::string& msg, const std::complex& z1, const std::complex& z2, relative_tolerance tol = relative_tolerance(), const char* x1_name = "x1", const char* x2_name = "x2") { @@ -217,7 +217,7 @@ void expect_near_rel(const std::string& msg, const std::complex& z1, * @param tol[in] tolerance for comparison */ template -void expect_near_rel(const std::string& msg, const T1& x1, +inline void expect_near_rel(const std::string& msg, const T1& x1, const std::complex& z2, relative_tolerance tol = relative_tolerance(), const char* x1_name = "x1", const char* x2_name = "x2") { @@ -239,7 +239,7 @@ void expect_near_rel(const std::string& msg, const T1& x1, * @param tol[in] tolerance for comparison */ template -void expect_near_rel(const std::string& msg, const std::complex& z1, +inline void expect_near_rel(const std::string& msg, const std::complex& z1, const T2& x2, relative_tolerance tol = relative_tolerance(), const char* x1_name = "x1", const char* x2_name = "x2") { diff --git a/test/unit/math/fwd/core/std_iterator_traits_test.cpp b/test/unit/math/fwd/core/std_iterator_traits_test.cpp index 6a4d2edb352..1dc75e69364 100644 --- a/test/unit/math/fwd/core/std_iterator_traits_test.cpp +++ b/test/unit/math/fwd/core/std_iterator_traits_test.cpp @@ -2,7 +2,7 @@ #include template -void expect_iterator_traits() { +inline void expect_iterator_traits() { using traits = std::iterator_traits; T a; T b; diff --git a/test/unit/math/fwd/fun/accumulator_test.cpp b/test/unit/math/fwd/fun/accumulator_test.cpp index 70e217d56d3..3d0f6657298 100644 --- a/test/unit/math/fwd/fun/accumulator_test.cpp +++ b/test/unit/math/fwd/fun/accumulator_test.cpp @@ -4,7 +4,7 @@ // test sum of first n numbers for sum of a template -void test_sum(stan::math::accumulator& a, int n) { +inline void test_sum(stan::math::accumulator& a, int n) { EXPECT_TRUE((n * (n + 1)) / 2 == a.sum()); } diff --git a/test/unit/math/fwd/fun/rank_test.cpp b/test/unit/math/fwd/fun/rank_test.cpp index 3d62240c411..a0b4c2ca2f0 100644 --- a/test/unit/math/fwd/fun/rank_test.cpp +++ b/test/unit/math/fwd/fun/rank_test.cpp @@ -4,7 +4,7 @@ #include template -void test_rank() { +inline void test_rank() { using stan::math::rank; T c(1); @@ -38,7 +38,7 @@ void test_rank() { } template -void test_rank_int() { +inline void test_rank_int() { using stan::math::rank; T c(1); diff --git a/test/unit/math/fwd/fun/sort_indices_test.cpp b/test/unit/math/fwd/fun/sort_indices_test.cpp index 43a9431f824..7a72ae516e5 100644 --- a/test/unit/math/fwd/fun/sort_indices_test.cpp +++ b/test/unit/math/fwd/fun/sort_indices_test.cpp @@ -2,7 +2,7 @@ #include #include -void test_sort_indices_asc(std::vector val) { +inline void test_sort_indices_asc(std::vector val) { using stan::math::fvar; using stan::math::sort_indices_asc; using stan::math::sort_indices_desc; @@ -24,7 +24,7 @@ void test_sort_indices_asc(std::vector val) { EXPECT_FALSE(x_sorted[i] == x[j]); } -void test_sort_indices_asc3(std::vector val) { +inline void test_sort_indices_asc3(std::vector val) { using stan::math::fvar; using stan::math::sort_indices_asc; using stan::math::sort_indices_desc; @@ -46,7 +46,7 @@ void test_sort_indices_asc3(std::vector val) { EXPECT_FALSE(x_sorted[i] == x[j]); } -void test_sort_indices_desc(std::vector val) { +inline void test_sort_indices_desc(std::vector val) { using stan::math::fvar; using stan::math::sort_indices_asc; using stan::math::sort_indices_desc; @@ -68,7 +68,7 @@ void test_sort_indices_desc(std::vector val) { EXPECT_FALSE(x_sorted[i] == x[j]); } -void test_sort_indices_desc3(std::vector val) { +inline void test_sort_indices_desc3(std::vector val) { using stan::math::fvar; using stan::math::sort_indices_asc; using stan::math::sort_indices_desc; @@ -91,7 +91,7 @@ void test_sort_indices_desc3(std::vector val) { } template -void test_sort_indices_asc(Eigen::Matrix val) { +inline void test_sort_indices_asc(Eigen::Matrix val) { using stan::math::fvar; using stan::math::sort_indices_asc; using stan::math::sort_indices_desc; @@ -117,7 +117,7 @@ void test_sort_indices_asc(Eigen::Matrix val) { } template -void test_sort_indices_asc3(Eigen::Matrix val) { +inline void test_sort_indices_asc3(Eigen::Matrix val) { using stan::math::fvar; using stan::math::sort_indices_asc; using stan::math::sort_indices_desc; @@ -143,7 +143,7 @@ void test_sort_indices_asc3(Eigen::Matrix val) { } template -void test_sort_indices_desc(Eigen::Matrix val) { +inline void test_sort_indices_desc(Eigen::Matrix val) { using stan::math::fvar; using stan::math::sort_indices_asc; using stan::math::sort_indices_desc; @@ -169,7 +169,7 @@ void test_sort_indices_desc(Eigen::Matrix val) { } template -void test_sort_indices_desc3(Eigen::Matrix val) { +inline void test_sort_indices_desc3(Eigen::Matrix val) { using stan::math::fvar; using stan::math::sort_indices_asc; using stan::math::sort_indices_desc; diff --git a/test/unit/math/fwd/meta/is_constant_all_test.cpp b/test/unit/math/fwd/meta/is_constant_all_test.cpp index 7a4fbd85f2b..43a0c456482 100644 --- a/test/unit/math/fwd/meta/is_constant_all_test.cpp +++ b/test/unit/math/fwd/meta/is_constant_all_test.cpp @@ -2,7 +2,7 @@ #include template -void expect_not_const() { +inline void expect_not_const() { using stan::is_constant_all; bool temp = is_constant_all::value; EXPECT_FALSE(temp); diff --git a/test/unit/math/laplace/laplace_utility.hpp b/test/unit/math/laplace/laplace_utility.hpp index b60494c345d..8e5734ffe61 100644 --- a/test/unit/math/laplace/laplace_utility.hpp +++ b/test/unit/math/laplace/laplace_utility.hpp @@ -182,7 +182,7 @@ struct diagonal_kernel_functor { }; template -void run_solver_grid(F&& body, ThetaVec&& theta_0) { +inline void run_solver_grid(F&& body, ThetaVec&& theta_0) { constexpr std::array solver_nums{1, 2, 3}; // [1, 3] constexpr std::array hessian_block_sizes{1, 2, 3}; // [1, 2] constexpr std::array max_steps_line_searches{0, 10}; // 0, 10 diff --git a/test/unit/math/mix/constraint/cholesky_corr_constrain_test.cpp b/test/unit/math/mix/constraint/cholesky_corr_constrain_test.cpp index 788848c8c2c..89e1ebb7e39 100644 --- a/test/unit/math/mix/constraint/cholesky_corr_constrain_test.cpp +++ b/test/unit/math/mix/constraint/cholesky_corr_constrain_test.cpp @@ -32,7 +32,7 @@ auto g3(const T& x) { } template -void expect_cholesky_corr_transform(const T& x) { +inline void expect_cholesky_corr_transform(const T& x) { stan::test::ad_tolerances tols; tols.hessian_hessian_ = 1e-2; tols.hessian_fvar_hessian_ = 1e-2; diff --git a/test/unit/math/mix/constraint/corr_matrix_constrain_test.cpp b/test/unit/math/mix/constraint/corr_matrix_constrain_test.cpp index 3dba44cd792..2b766dd7660 100644 --- a/test/unit/math/mix/constraint/corr_matrix_constrain_test.cpp +++ b/test/unit/math/mix/constraint/corr_matrix_constrain_test.cpp @@ -32,7 +32,7 @@ auto g3(const T& x) { } template -void expect_corr_matrix_transform(const T& x) { +inline void expect_corr_matrix_transform(const T& x) { stan::test::ad_tolerances tols; tols.hessian_hessian_ = 1e-2; tols.hessian_fvar_hessian_ = 1e-2; diff --git a/test/unit/math/mix/constraint/cov_matrix_constrain_test.cpp b/test/unit/math/mix/constraint/cov_matrix_constrain_test.cpp index 7352c9f45b2..ba9d959d57d 100644 --- a/test/unit/math/mix/constraint/cov_matrix_constrain_test.cpp +++ b/test/unit/math/mix/constraint/cov_matrix_constrain_test.cpp @@ -32,7 +32,7 @@ auto g3(const T& x) { } template -void expect_cov_matrix_transform(const T& x) { +inline void expect_cov_matrix_transform(const T& x) { using stan::test::relative_tolerance; stan::test::ad_tolerances tols; tols.hessian_hessian_ = relative_tolerance(1e-3, 1e-3); diff --git a/test/unit/math/mix/constraint/identity_constrain_test.cpp b/test/unit/math/mix/constraint/identity_constrain_test.cpp index 2b01211f0f1..750da07ad1e 100644 --- a/test/unit/math/mix/constraint/identity_constrain_test.cpp +++ b/test/unit/math/mix/constraint/identity_constrain_test.cpp @@ -3,23 +3,23 @@ namespace identity_constrain_test { template -T g1(const T& x) { +inline T g1(const T& x) { return stan::math::identity_constrain(x); } template -T g2(const T& x) { +inline T g2(const T& x) { T lp = 0; return stan::math::identity_constrain(x, lp); } template -T g3(const T& x) { +inline T g3(const T& x) { T lp = 0; stan::math::identity_constrain(x, lp); return lp; } } // namespace identity_constrain_test -void expect_identity_constrain(double x) { +inline void expect_identity_constrain(double x) { auto f1 = [](const auto& x) { return identity_constrain_test::g1(x); }; auto f2 = [](const auto& x) { return identity_constrain_test::g2(x); }; auto f3 = [](const auto& x) { return identity_constrain_test::g3(x); }; diff --git a/test/unit/math/mix/constraint/lb_constrain_matvar_test.cpp b/test/unit/math/mix/constraint/lb_constrain_matvar_test.cpp index 61ba6939963..4b2cb37f018 100644 --- a/test/unit/math/mix/constraint/lb_constrain_matvar_test.cpp +++ b/test/unit/math/mix/constraint/lb_constrain_matvar_test.cpp @@ -3,7 +3,7 @@ namespace lb_constrain_test { template -void expect_matvar(const T1& x, const T2& lb) { +inline void expect_matvar(const T1& x, const T2& lb) { auto f1 = [](const auto& x, const auto& lb) { stan::return_type_t lp = 0; return stan::math::lb_constrain(x, lb, lp); @@ -30,7 +30,7 @@ void expect_matvar(const T1& x, const T2& lb) { } template -void expect_vec_matvar(const T1& x, const T2& lb) { +inline void expect_vec_matvar(const T1& x, const T2& lb) { auto f1 = [](const auto& x, const auto& lb) { stan::return_type_t lp = 0; return stan::math::lb_constrain(x, lb, lp); diff --git a/test/unit/math/mix/constraint/lb_constrain_test.cpp b/test/unit/math/mix/constraint/lb_constrain_test.cpp index cb0f99cd5ec..377507d4acd 100644 --- a/test/unit/math/mix/constraint/lb_constrain_test.cpp +++ b/test/unit/math/mix/constraint/lb_constrain_test.cpp @@ -3,7 +3,7 @@ namespace lb_constrain_test { template -void expect(const T1& x, const T2& lb) { +inline void expect(const T1& x, const T2& lb) { auto f1 = [](const auto& x, const auto& lb) { stan::return_type_t lp = 0; return stan::math::lb_constrain(x, lb, lp); @@ -30,7 +30,7 @@ void expect(const T1& x, const T2& lb) { } template -void expect_vec(const T1& x, const T2& lb) { +inline void expect_vec(const T1& x, const T2& lb) { auto f1 = [](const auto& x, const auto& lb) { stan::return_type_t lp = 0; return stan::math::lb_constrain(x, lb, lp); diff --git a/test/unit/math/mix/constraint/lub_constrain_helpers.hpp b/test/unit/math/mix/constraint/lub_constrain_helpers.hpp index 2d600df51f1..83e5be961c9 100644 --- a/test/unit/math/mix/constraint/lub_constrain_helpers.hpp +++ b/test/unit/math/mix/constraint/lub_constrain_helpers.hpp @@ -3,7 +3,7 @@ namespace lub_constrain_tests { template -void expect(const T1& x, const T2& lb, const T3& ub) { +inline void expect(const T1& x, const T2& lb, const T3& ub) { auto f1 = [](const auto& x, const auto& lb, const auto& ub) { stan::return_type_t lp = 0; return stan::math::lub_constrain(x, lb, ub, lp); @@ -39,7 +39,7 @@ void expect(const T1& x, const T2& lb, const T3& ub) { stan::test::expect_ad(f6, x, lb, ub); } template -void expect_vec(const T1& x, const T2& lb, const T3& ub) { +inline void expect_vec(const T1& x, const T2& lb, const T3& ub) { auto f1 = [](const auto& x, const auto& lb, const auto& ub) { stan::return_type_t lp = 0; return stan::math::lub_constrain(x, lb, ub, lp); diff --git a/test/unit/math/mix/constraint/lub_constrain_matvar_test.cpp b/test/unit/math/mix/constraint/lub_constrain_matvar_test.cpp index f202e4af27b..ab15f2d8a89 100644 --- a/test/unit/math/mix/constraint/lub_constrain_matvar_test.cpp +++ b/test/unit/math/mix/constraint/lub_constrain_matvar_test.cpp @@ -2,7 +2,7 @@ namespace lub_constrain_tests { template -void expect_matvar(const T1& x, const T2& lb, const T3& ub) { +inline void expect_matvar(const T1& x, const T2& lb, const T3& ub) { auto f1 = [](const auto& x, const auto& lb, const auto& ub) { stan::return_type_t lp = 0; return stan::math::lub_constrain(x, lb, ub, lp); diff --git a/test/unit/math/mix/constraint/offset_multiplier_constrain_helpers.hpp b/test/unit/math/mix/constraint/offset_multiplier_constrain_helpers.hpp index 92f063e207c..c04df3c75ca 100644 --- a/test/unit/math/mix/constraint/offset_multiplier_constrain_helpers.hpp +++ b/test/unit/math/mix/constraint/offset_multiplier_constrain_helpers.hpp @@ -3,7 +3,7 @@ namespace offset_multiplier_constrain_tests { template -void expect(const T1& x, const T2& mu, const T3& sigma) { +inline void expect(const T1& x, const T2& mu, const T3& sigma) { auto f1 = [](const auto& x, const auto& mu, const auto& sigma) { stan::return_type_t lp = 0; return stan::math::offset_multiplier_constrain(x, mu, sigma, lp); @@ -31,7 +31,7 @@ void expect(const T1& x, const T2& mu, const T3& sigma) { stan::test::expect_ad(f4, x, mu, sigma); } template -void expect_vec(const T1& x, const T2& mu, const T3& sigma) { +inline void expect_vec(const T1& x, const T2& mu, const T3& sigma) { auto f1 = [](const auto& x, const auto& mu, const auto& sigma) { stan::return_type_t lp = 0; return stan::math::offset_multiplier_constrain(x, mu, sigma, lp); diff --git a/test/unit/math/mix/constraint/offset_multiplier_constrain_matvar_helpers.hpp b/test/unit/math/mix/constraint/offset_multiplier_constrain_matvar_helpers.hpp index fc299d5dfb5..b51d5ca26fe 100644 --- a/test/unit/math/mix/constraint/offset_multiplier_constrain_matvar_helpers.hpp +++ b/test/unit/math/mix/constraint/offset_multiplier_constrain_matvar_helpers.hpp @@ -3,7 +3,7 @@ namespace offset_multiplier_constrain_tests { template -void expect_matvar(const T1& x, const T2& mu, const T3& sigma) { +inline void expect_matvar(const T1& x, const T2& mu, const T3& sigma) { auto f1 = [](const auto& x, const auto& mu, const auto& sigma) { stan::return_type_t lp = 0; return stan::math::offset_multiplier_constrain(x, mu, sigma, lp); @@ -31,7 +31,7 @@ void expect_matvar(const T1& x, const T2& mu, const T3& sigma) { stan::test::expect_ad_matvar(f4, x, mu, sigma); } template -void expect_vec_matvar(const T1& x, const T2& mu, const T3& sigma) { +inline void expect_vec_matvar(const T1& x, const T2& mu, const T3& sigma) { auto f1 = [](const auto& x, const auto& mu, const auto& sigma) { stan::return_type_t lp = 0; return stan::math::offset_multiplier_constrain(x, mu, sigma, lp); diff --git a/test/unit/math/mix/constraint/ordered_constrain_test.cpp b/test/unit/math/mix/constraint/ordered_constrain_test.cpp index 4615d197867..7e80967504b 100644 --- a/test/unit/math/mix/constraint/ordered_constrain_test.cpp +++ b/test/unit/math/mix/constraint/ordered_constrain_test.cpp @@ -2,24 +2,24 @@ namespace ordered_constrain_test { template -T g1(const T& x) { +inline T g1(const T& x) { stan::scalar_type_t lp = 0; return stan::math::ordered_constrain(x, lp); } template -T g2(const T& x) { +inline T g2(const T& x) { stan::scalar_type_t lp = 0; return stan::math::ordered_constrain(x, lp); } template -stan::scalar_type_t g3(const T& x) { +inline stan::scalar_type_t g3(const T& x) { stan::scalar_type_t lp = 0; stan::math::ordered_constrain(x, lp); return lp; } template -void expect_ordered_transform(const T& x) { +inline void expect_ordered_transform(const T& x) { auto f1 = [](const auto& x) { return g1(x); }; auto f2 = [](const auto& x) { return g2(x); }; auto f3 = [](const auto& x) { return g3(x); }; diff --git a/test/unit/math/mix/constraint/positive_ordered_constrain_test.cpp b/test/unit/math/mix/constraint/positive_ordered_constrain_test.cpp index 137226f8524..e98be4ac24e 100644 --- a/test/unit/math/mix/constraint/positive_ordered_constrain_test.cpp +++ b/test/unit/math/mix/constraint/positive_ordered_constrain_test.cpp @@ -2,24 +2,24 @@ namespace positive_ordered_constrain_test { template -T g1(const T& x) { +inline T g1(const T& x) { stan::scalar_type_t lp = 0; return stan::math::positive_ordered_constrain(x, lp); } template -T g2(const T& x) { +inline T g2(const T& x) { stan::scalar_type_t lp = 0; return stan::math::positive_ordered_constrain(x, lp); } template -stan::scalar_type_t g3(const T& x) { +inline stan::scalar_type_t g3(const T& x) { typename stan::scalar_type::type lp = 0; stan::math::positive_ordered_constrain(x, lp); return lp; } template -void expect_positive_ordered_transform(const T& x) { +inline void expect_positive_ordered_transform(const T& x) { auto f1 = [](const auto& x) { return g1(x); }; auto f2 = [](const auto& x) { return g2(x); }; auto f3 = [](const auto& x) { return g3(x); }; diff --git a/test/unit/math/mix/constraint/simplex_constrain_test.cpp b/test/unit/math/mix/constraint/simplex_constrain_test.cpp index 04c538fe0e7..68d820210b3 100644 --- a/test/unit/math/mix/constraint/simplex_constrain_test.cpp +++ b/test/unit/math/mix/constraint/simplex_constrain_test.cpp @@ -2,12 +2,12 @@ namespace simplex_constrain_test { template -T g1(const T& x) { +inline T g1(const T& x) { stan::scalar_type_t lp = 0; return stan::math::simplex_constrain(x, lp); } template -T g2(const T& x) { +inline T g2(const T& x) { stan::scalar_type_t lp = 0; return stan::math::simplex_constrain(x, lp); } @@ -19,7 +19,7 @@ typename stan::scalar_type::type g3(const T& x) { } template -void expect_simplex_transform(const T& x) { +inline void expect_simplex_transform(const T& x) { auto f1 = [](const auto& x) { return g1(x); }; auto f2 = [](const auto& x) { return g2(x); }; auto f3 = [](const auto& x) { return g3(x); }; diff --git a/test/unit/math/mix/constraint/stochastic_column_constrain_test.cpp b/test/unit/math/mix/constraint/stochastic_column_constrain_test.cpp index 995db3d1e7a..8171fb13f0e 100644 --- a/test/unit/math/mix/constraint/stochastic_column_constrain_test.cpp +++ b/test/unit/math/mix/constraint/stochastic_column_constrain_test.cpp @@ -2,12 +2,12 @@ namespace stochastic_column_constrain_test { template -T g1(const T& x) { +inline T g1(const T& x) { stan::scalar_type_t lp = 0; return stan::math::stochastic_column_constrain(x, lp); } template -T g2(const T& x) { +inline T g2(const T& x) { stan::scalar_type_t lp = 0; return stan::math::stochastic_column_constrain(x, lp); } @@ -19,7 +19,7 @@ typename stan::scalar_type::type g3(const T& x) { } template -void expect_simplex_transform(const T& x) { +inline void expect_simplex_transform(const T& x) { auto f1 = [](const auto& x) { return g1(x); }; auto f2 = [](const auto& x) { return g2(x); }; auto f3 = [](const auto& x) { return g3(x); }; diff --git a/test/unit/math/mix/constraint/stochastic_row_constrain_test.cpp b/test/unit/math/mix/constraint/stochastic_row_constrain_test.cpp index d40921d3032..071fc7849a7 100644 --- a/test/unit/math/mix/constraint/stochastic_row_constrain_test.cpp +++ b/test/unit/math/mix/constraint/stochastic_row_constrain_test.cpp @@ -2,12 +2,12 @@ namespace stochastic_row_constrain_test { template -T g1(const T& x) { +inline T g1(const T& x) { stan::scalar_type_t lp = 0; return stan::math::stochastic_row_constrain(x, lp); } template -T g2(const T& x) { +inline T g2(const T& x) { stan::scalar_type_t lp = 0; return stan::math::stochastic_row_constrain(x, lp); } @@ -19,7 +19,7 @@ typename stan::scalar_type::type g3(const T& x) { } template -void expect_simplex_transform(const T& x) { +inline void expect_simplex_transform(const T& x) { auto f1 = [](const auto& x) { return g1(x); }; auto f2 = [](const auto& x) { return g2(x); }; auto f3 = [](const auto& x) { return g3(x); }; diff --git a/test/unit/math/mix/constraint/sum_to_zero_constrain_test.cpp b/test/unit/math/mix/constraint/sum_to_zero_constrain_test.cpp index cb18967bb03..dbfd9ae5289 100644 --- a/test/unit/math/mix/constraint/sum_to_zero_constrain_test.cpp +++ b/test/unit/math/mix/constraint/sum_to_zero_constrain_test.cpp @@ -2,12 +2,12 @@ namespace sum_to_zero_constrain_test { template -T g1(const T& x) { +inline T g1(const T& x) { stan::scalar_type_t lp = 0; return stan::math::sum_to_zero_constrain(x, lp); } template -T g2(const T& x) { +inline T g2(const T& x) { stan::scalar_type_t lp = 0; return stan::math::sum_to_zero_constrain(x, lp); } @@ -19,7 +19,7 @@ typename stan::scalar_type::type g3(const T& x) { } template -void expect_sum_to_zero_transform(const T& x) { +inline void expect_sum_to_zero_transform(const T& x) { auto f1 = [](const auto& x) { return g1(x); }; auto f2 = [](const auto& x) { return g2(x); }; auto f3 = [](const auto& x) { return g3(x); }; diff --git a/test/unit/math/mix/constraint/unit_vector_constrain_test.cpp b/test/unit/math/mix/constraint/unit_vector_constrain_test.cpp index cd26807db3a..e113f4f2dfa 100644 --- a/test/unit/math/mix/constraint/unit_vector_constrain_test.cpp +++ b/test/unit/math/mix/constraint/unit_vector_constrain_test.cpp @@ -21,7 +21,7 @@ auto g3(const T& x) { } template -void expect_unit_vector_constrain(const T& x) { +inline void expect_unit_vector_constrain(const T& x) { stan::test::ad_tolerances tols; tols.gradient_fvar_grad_ = 1e0; tols.hessian_grad_ = 1e0; diff --git a/test/unit/math/mix/core/operator_logical_and_test.cpp b/test/unit/math/mix/core/operator_logical_and_test.cpp index 5e68e08b014..24ab3098b37 100644 --- a/test/unit/math/mix/core/operator_logical_and_test.cpp +++ b/test/unit/math/mix/core/operator_logical_and_test.cpp @@ -3,7 +3,7 @@ #include #include -void test_logical_and(double x, double y) { +inline void test_logical_and(double x, double y) { using stan::math::fvar; using stan::math::var; diff --git a/test/unit/math/mix/core/operator_logical_or_test.cpp b/test/unit/math/mix/core/operator_logical_or_test.cpp index 3e53c865dd8..42cea8233d0 100644 --- a/test/unit/math/mix/core/operator_logical_or_test.cpp +++ b/test/unit/math/mix/core/operator_logical_or_test.cpp @@ -3,7 +3,7 @@ #include #include -void test_logical_or(double x, double y) { +inline void test_logical_or(double x, double y) { using stan::math::fvar; using stan::math::var; diff --git a/test/unit/math/mix/core/operator_unary_not_test.cpp b/test/unit/math/mix/core/operator_unary_not_test.cpp index b6fb1762280..a0d4e86827e 100644 --- a/test/unit/math/mix/core/operator_unary_not_test.cpp +++ b/test/unit/math/mix/core/operator_unary_not_test.cpp @@ -2,7 +2,7 @@ #include #include -void test_unary_not(double x) { +inline void test_unary_not(double x) { using stan::math::fvar; using stan::math::var; diff --git a/test/unit/math/mix/core/std_complex_test.cpp b/test/unit/math/mix/core/std_complex_test.cpp index 23f253b348d..dbcd83e208d 100644 --- a/test/unit/math/mix/core/std_complex_test.cpp +++ b/test/unit/math/mix/core/std_complex_test.cpp @@ -3,7 +3,7 @@ #include template -void test_constructor_init_type() { +inline void test_constructor_init_type() { S a = 2; std::complex z(a); EXPECT_EQ(a, z.real()); @@ -11,7 +11,7 @@ void test_constructor_init_type() { } template -void test_binary_constructor(const T1& x, const T2& y) { +inline void test_binary_constructor(const T1& x, const T2& y) { using stan::math::value_of_rec; std::complex z(x, y); EXPECT_EQ(1.1, value_of_rec(z.real())); @@ -19,7 +19,7 @@ void test_binary_constructor(const T1& x, const T2& y) { } template -void test_set_real_imag() { +inline void test_set_real_imag() { std::complex z; z.real(3.2); EXPECT_TRUE(z.real() == 3.2); @@ -28,7 +28,7 @@ void test_set_real_imag() { } template -void test_std_complex_constructor() { +inline void test_std_complex_constructor() { using stan::math::value_of_rec; using c_t = std::complex; @@ -77,12 +77,12 @@ TEST(mathMixCore, stdComplexConstructor) { // convenience for type inference of T template -std::complex to_std_complex(const T& x) { +inline std::complex to_std_complex(const T& x) { return {x}; } template -void expect_common_complex(const F& f) { +inline void expect_common_complex(const F& f) { // cover all quadrants and projections for (double re : std::vector{-1.4, -1e-3, 0, 2e-3, 2.3}) { for (double im : std::vector{-0.5, -3e-3, 0, 4e-3, 1.5}) { @@ -92,7 +92,7 @@ void expect_common_complex(const F& f) { } template -void expect_common_for_complex(const F& f) { +inline void expect_common_for_complex(const F& f) { for (double re : std::vector{-3.9, -1e-3, 0, 2e-3, 4.1}) { stan::test::expect_ad(f, re); } diff --git a/test/unit/math/mix/fun/accumulator_test.cpp b/test/unit/math/mix/fun/accumulator_test.cpp index 855b92330e2..da2efc19164 100644 --- a/test/unit/math/mix/fun/accumulator_test.cpp +++ b/test/unit/math/mix/fun/accumulator_test.cpp @@ -4,7 +4,7 @@ // test sum of first n numbers for sum of a template -void test_sum(stan::math::accumulator& a, int n) { +inline void test_sum(stan::math::accumulator& a, int n) { EXPECT_TRUE((n * (n + 1)) / 2 == a.sum()); } diff --git a/test/unit/math/mix/fun/append_array_test.cpp b/test/unit/math/mix/fun/append_array_test.cpp index 0cf6dd04288..d6965d4b968 100644 --- a/test/unit/math/mix/fun/append_array_test.cpp +++ b/test/unit/math/mix/fun/append_array_test.cpp @@ -47,7 +47,7 @@ typedef Eigen::Matrix Mffv; * @param z Output variable */ template -void build(int n1, int n0, T1& z) { +inline void build(int n1, int n0, T1& z) { std::random_device rd; std::mt19937 mt(rd()); z = T1(rd()); @@ -68,7 +68,7 @@ void build(int n1, int n0, T1& z) { * @param z Output variable */ template -void build(int n1, int n0, Eigen::Matrix& z) { +inline void build(int n1, int n0, Eigen::Matrix& z) { z = Eigen::Matrix(R == 1 ? 1 : n1, C == 1 ? 1 : n0); for (int i = 0; i < z.rows(); i++) { @@ -89,7 +89,7 @@ void build(int n1, int n0, Eigen::Matrix& z) { * @param z Output variable */ template -void build(int n2, int n1, int n0, std::vector& z) { +inline void build(int n2, int n1, int n0, std::vector& z) { z.resize(n2); for (int i = 0; i < n2; i++) { build(n1, n0, z[i]); @@ -108,7 +108,7 @@ void build(int n2, int n1, int n0, std::vector& z) { * @param z Output variable */ template -void build(int n3, int n2, int n1, int n0, std::vector& z) { +inline void build(int n3, int n2, int n1, int n0, std::vector& z) { z.resize(n3); for (int i = 0; i < n3; i++) { build(n2, n1, n0, z[i]); @@ -120,42 +120,42 @@ void build(int n3, int n2, int n1, int n0, std::vector& z) { * * @param z1 Argument */ -double get_value(const double& z1) { return z1; } +inline double get_value(const double& z1) { return z1; } /** * Get value of var. * * @param z1 Argument */ -double get_value(const var& z1) { return z1.val(); } +inline double get_value(const var& z1) { return z1.val(); } /** * Get value of fd * * @param z1 Argument */ -double get_value(const fd& z1) { return z1.val(); } +inline double get_value(const fd& z1) { return z1.val(); } /** * Get value of fvar * * @param z1 Argument */ -double get_value(const fv& z1) { return z1.val().val(); } +inline double get_value(const fv& z1) { return z1.val().val(); } /** * Get value of fvar > * * @param z1 Argument */ -double get_value(const ffd& z1) { return z1.val().val(); } +inline double get_value(const ffd& z1) { return z1.val().val(); } /** * Get value of fvar > * * @param z1 Argument */ -double get_value(const ffv& z1) { return z1.val().val().val(); } +inline double get_value(const ffv& z1) { return z1.val().val().val(); } /** * Check if variables are equal via floating point macro @@ -166,7 +166,7 @@ double get_value(const ffv& z1) { return z1.val().val().val(); } * @param z2 Second argument */ template -void check_eq(const T1& z1, const T2& z2) { +inline void check_eq(const T1& z1, const T2& z2) { EXPECT_FLOAT_EQ(get_value(z1), get_value(z2)); } @@ -177,7 +177,7 @@ void check_eq(const T1& z1, const T2& z2) { * @param z2 Second integer */ template <> -void check_eq(const int& z1, const int& z2) { +inline void check_eq(const int& z1, const int& z2) { EXPECT_EQ(z1, z2); } @@ -190,7 +190,7 @@ void check_eq(const int& z1, const int& z2) { * @param z2 Second matrix */ template -void check_eq(const Eigen::Matrix& z1, +inline void check_eq(const Eigen::Matrix& z1, const Eigen::Matrix& z2) { EXPECT_EQ(z1.rows(), z2.rows()); EXPECT_EQ(z1.cols(), z2.cols()); @@ -209,7 +209,7 @@ void check_eq(const Eigen::Matrix& z1, * @param z2 Second std::vector */ template -void check_eq(const std::vector& z1, const std::vector& z2) { +inline void check_eq(const std::vector& z1, const std::vector& z2) { EXPECT_EQ(z1.size(), z2.size()); for (size_t i = 0; i < z1.size(); i++) check_eq(z1[i], z2[i]); @@ -225,7 +225,7 @@ void check_eq(const std::vector& z1, const std::vector& z2) { * @tparam T3 Element type of return std::vector */ template -void checkv() { +inline void checkv() { std::vector x; std::vector y; std::vector result; @@ -255,7 +255,7 @@ void checkv() { * @tparam T3 Element type of return std::vector */ template -void checkvv() { +inline void checkvv() { std::vector > x; std::vector > y; std::vector > result; @@ -284,7 +284,7 @@ void checkvv() { * @tparam T3 Element type of third container */ template -void check() { +inline void check() { // repeat the checks a few times since they're random for (int i = 0; i < 3; i++) { checkv(); diff --git a/test/unit/math/mix/fun/cholesky_decompose_test.cpp b/test/unit/math/mix/fun/cholesky_decompose_test.cpp index 3413c3e8d74..940c53ad3de 100644 --- a/test/unit/math/mix/fun/cholesky_decompose_test.cpp +++ b/test/unit/math/mix/fun/cholesky_decompose_test.cpp @@ -23,7 +23,7 @@ auto f(int dof) { auto f_matvar = [](const auto& x) { return stan::math::cholesky_decompose(x); }; -void expect_cholesky(const Eigen::MatrixXd& Sigma) { +inline void expect_cholesky(const Eigen::MatrixXd& Sigma) { Eigen::VectorXd yy = stan::math::cov_matrix_free(Sigma); // lazy, solving for x in x = (N * (N + 1)) / 2 int dof = .5 * (std::sqrt(8 * yy.size() + 1) - 1); diff --git a/test/unit/math/mix/fun/complex_schur_decompose_test.cpp b/test/unit/math/mix/fun/complex_schur_decompose_test.cpp index 8c55eb42d85..e1d2b89afc1 100644 --- a/test/unit/math/mix/fun/complex_schur_decompose_test.cpp +++ b/test/unit/math/mix/fun/complex_schur_decompose_test.cpp @@ -50,7 +50,7 @@ TEST(mathMixFun, complexSchurDecompose) { } template -void test_complex_schur_decompose(const Eigen::MatrixXd& x) { +inline void test_complex_schur_decompose(const Eigen::MatrixXd& x) { using stan::math::complex_schur_decompose; using stan::math::complex_schur_decompose_t; using stan::math::complex_schur_decompose_u; @@ -70,7 +70,7 @@ void test_complex_schur_decompose(const Eigen::MatrixXd& x) { } template -void test_complex_schur_decompose_complex(const Eigen::MatrixXd& x) { +inline void test_complex_schur_decompose_complex(const Eigen::MatrixXd& x) { using stan::math::complex_schur_decompose; using stan::math::complex_schur_decompose_t; using stan::math::complex_schur_decompose_u; diff --git a/test/unit/math/mix/fun/conj_test.cpp b/test/unit/math/mix/fun/conj_test.cpp index 359e1b0437a..8fa0a949a66 100644 --- a/test/unit/math/mix/fun/conj_test.cpp +++ b/test/unit/math/mix/fun/conj_test.cpp @@ -10,7 +10,7 @@ TEST(mathMixMatFun, conj) { } template -void test_vectorized_conj() { +inline void test_vectorized_conj() { using stan::math::value_of_rec; using complex_t = std::complex; using complex_matrix = Eigen::Matrix; diff --git a/test/unit/math/mix/fun/copysign_test.cpp b/test/unit/math/mix/fun/copysign_test.cpp index e7b111c994f..ff268b9822f 100644 --- a/test/unit/math/mix/fun/copysign_test.cpp +++ b/test/unit/math/mix/fun/copysign_test.cpp @@ -6,14 +6,14 @@ #include template -void expect_eq_signbit(const U& u, const V& v) { +inline void expect_eq_signbit(const U& u, const V& v) { using stan::math::signbit; using std::signbit; EXPECT_EQ(signbit(u), signbit(v)); } template -void expect_copysign() { +inline void expect_copysign() { using stan::math::copysign; using stan::math::copysign_non_zero; using stan::math::is_nan; diff --git a/test/unit/math/mix/fun/cumulative_sum_test.cpp b/test/unit/math/mix/fun/cumulative_sum_test.cpp index e049cf17cf8..2ee291be6bb 100644 --- a/test/unit/math/mix/fun/cumulative_sum_test.cpp +++ b/test/unit/math/mix/fun/cumulative_sum_test.cpp @@ -1,7 +1,7 @@ #include #include -void expect_cumulative_sum(std::vector& x) { +inline void expect_cumulative_sum(std::vector& x) { auto f = [](const auto& y) { return stan::math::cumulative_sum(y); }; Eigen::VectorXd v = Eigen::Map(x.data(), x.size()); Eigen::RowVectorXd rv = Eigen::Map(x.data(), x.size()); diff --git a/test/unit/math/mix/fun/diag_post_multiply_test.cpp b/test/unit/math/mix/fun/diag_post_multiply_test.cpp index 011ea2fef2e..19d874fcd05 100644 --- a/test/unit/math/mix/fun/diag_post_multiply_test.cpp +++ b/test/unit/math/mix/fun/diag_post_multiply_test.cpp @@ -1,6 +1,6 @@ #include -void expect_diag_post_multiply(const Eigen::MatrixXd& a, +inline void expect_diag_post_multiply(const Eigen::MatrixXd& a, const Eigen::VectorXd& v) { auto f = [](const auto& x, const auto& y) { return stan::math::diag_post_multiply(x, y); diff --git a/test/unit/math/mix/fun/diag_pre_multiply_test.cpp b/test/unit/math/mix/fun/diag_pre_multiply_test.cpp index fa9d96f6cdb..915a67d0ef8 100644 --- a/test/unit/math/mix/fun/diag_pre_multiply_test.cpp +++ b/test/unit/math/mix/fun/diag_pre_multiply_test.cpp @@ -1,7 +1,7 @@ #include #include -void expect_diag_pre_multiply(const Eigen::VectorXd& v, +inline void expect_diag_pre_multiply(const Eigen::VectorXd& v, const Eigen::MatrixXd& a) { auto f = [](const auto& x, const auto& y) { return stan::math::diag_pre_multiply(x, y); diff --git a/test/unit/math/mix/fun/eigen_comparisons_test.cpp b/test/unit/math/mix/fun/eigen_comparisons_test.cpp index b0bfd6e5682..18124aa4073 100644 --- a/test/unit/math/mix/fun/eigen_comparisons_test.cpp +++ b/test/unit/math/mix/fun/eigen_comparisons_test.cpp @@ -4,7 +4,7 @@ template -void test_comparison(Op operation, const Container1Plain& container1_plain, +inline void test_comparison(Op operation, const Container1Plain& container1_plain, const Container2Plain& container2_plain) { EXPECT_MATRIX_EQ( operation(container1_plain, container2_plain), @@ -17,7 +17,7 @@ void test_comparison(Op operation, const Container1Plain& container1_plain, template -void test_comparison_combinations(Op operation, +inline void test_comparison_combinations(Op operation, const ContainerPlain& container1_plain, const ContainerPlain& container2_plain) { test_comparison(operation, container1_plain, @@ -29,7 +29,7 @@ void test_comparison_combinations(Op operation, } template -void test_comparison_all_shapes(Op operation) { +inline void test_comparison_all_shapes(Op operation) { Eigen::ArrayXXd m1(3, 2); m1 << -1, 2, 0.0, 0.5, 1, 1.5; Eigen::ArrayXXd m2(3, 2); @@ -54,7 +54,7 @@ void test_comparison_all_shapes(Op operation) { } template -void test_all_comparisons() { +inline void test_all_comparisons() { test_comparison_all_shapes( [](const auto& a, const auto& b) { return a < b; }); test_comparison_all_shapes( diff --git a/test/unit/math/mix/fun/eigendecompose_identity_complex_test.cpp b/test/unit/math/mix/fun/eigendecompose_identity_complex_test.cpp index 65be4d32153..33857d1632c 100644 --- a/test/unit/math/mix/fun/eigendecompose_identity_complex_test.cpp +++ b/test/unit/math/mix/fun/eigendecompose_identity_complex_test.cpp @@ -1,7 +1,7 @@ #include template -void expect_identity_matrix_complex(const T& x) { +inline void expect_identity_matrix_complex(const T& x) { EXPECT_EQ(x.rows(), x.cols()); for (int j = 0; j < x.cols(); ++j) { for (int i = 0; i < x.rows(); ++i) { @@ -12,7 +12,7 @@ void expect_identity_matrix_complex(const T& x) { } template -void expectComplexEigenvectorsId() { +inline void expectComplexEigenvectorsId() { Eigen::Matrix, -1, -1> c22(2, 2); c22 << stan::math::to_complex(T(0), T(-1)), stan::math::to_complex(T(0), T(0)), stan::math::to_complex(T(2), T(0)), diff --git a/test/unit/math/mix/fun/eigendecompose_identity_test.cpp b/test/unit/math/mix/fun/eigendecompose_identity_test.cpp index 8a2f99ddc3f..9e9e385e216 100644 --- a/test/unit/math/mix/fun/eigendecompose_identity_test.cpp +++ b/test/unit/math/mix/fun/eigendecompose_identity_test.cpp @@ -1,7 +1,7 @@ #include template -void expect_identity_matrix(const T& x) { +inline void expect_identity_matrix(const T& x) { EXPECT_EQ(x.rows(), x.cols()); for (int j = 0; j < x.cols(); ++j) { for (int i = 0; i < x.rows(); ++i) { @@ -11,7 +11,7 @@ void expect_identity_matrix(const T& x) { } template -void expectEigenvectorsId() { +inline void expectEigenvectorsId() { for (const auto& m_d : stan::test::square_test_matrices(1, 2)) { Eigen::Matrix m(m_d); auto vecs = stan::math::eigenvectors(m).eval(); diff --git a/test/unit/math/mix/fun/fft_test.cpp b/test/unit/math/mix/fun/fft_test.cpp index 62edc1684df..df7dc105d82 100644 --- a/test/unit/math/mix/fun/fft_test.cpp +++ b/test/unit/math/mix/fun/fft_test.cpp @@ -1,6 +1,6 @@ #include -void expect_fft(const Eigen::VectorXcd& x) { +inline void expect_fft(const Eigen::VectorXcd& x) { for (int m = 0; m < x.rows(); ++m) { auto g = [m](const auto& x) { using stan::math::fft; @@ -39,7 +39,7 @@ TEST(mathMixFun, fft) { expect_fft(x4); } -void expect_inv_fft(const Eigen::VectorXcd& x) { +inline void expect_inv_fft(const Eigen::VectorXcd& x) { for (int m = 0; m < x.rows(); ++m) { auto g = [m](const auto& x) { using stan::math::inv_fft; @@ -78,7 +78,7 @@ TEST(mathMixFun, invFft) { expect_inv_fft(x4); } -void expect_fft2(const Eigen::MatrixXcd& x) { +inline void expect_fft2(const Eigen::MatrixXcd& x) { for (int n = 0; n < x.cols(); ++n) { for (int m = 0; m < x.rows(); ++m) { auto g = [m, n](const auto& x) { @@ -125,7 +125,7 @@ TEST(mathMixFun, fft2) { expect_fft2(x33); } -void expect_inv_fft2(const Eigen::MatrixXcd& x) { +inline void expect_inv_fft2(const Eigen::MatrixXcd& x) { for (int n = 0; n < x.cols(); ++n) { for (int m = 0; m < x.rows(); ++m) { auto g = [m, n](const auto& x) { diff --git a/test/unit/math/mix/fun/get_imag_test.cpp b/test/unit/math/mix/fun/get_imag_test.cpp index f60f6760e2b..d54d3987c1a 100644 --- a/test/unit/math/mix/fun/get_imag_test.cpp +++ b/test/unit/math/mix/fun/get_imag_test.cpp @@ -7,7 +7,7 @@ TEST(mathMixMatFun, get_imag) { } template -void test_vectorized_get_imag() { +inline void test_vectorized_get_imag() { using complex_t = std::complex; using matrix_t = Eigen::Matrix; using complex_matrix = Eigen::Matrix; diff --git a/test/unit/math/mix/fun/get_real_test.cpp b/test/unit/math/mix/fun/get_real_test.cpp index 48a3ea2bb4c..5cac21bc97f 100644 --- a/test/unit/math/mix/fun/get_real_test.cpp +++ b/test/unit/math/mix/fun/get_real_test.cpp @@ -7,7 +7,7 @@ TEST(mathMixMatFun, get_real) { } template -void test_vectorized_get_real() { +inline void test_vectorized_get_real() { using complex_t = std::complex; using matrix_t = Eigen::Matrix; using complex_matrix = Eigen::Matrix; diff --git a/test/unit/math/mix/fun/head_test.cpp b/test/unit/math/mix/fun/head_test.cpp index 46671852af3..44e817e20de 100644 --- a/test/unit/math/mix/fun/head_test.cpp +++ b/test/unit/math/mix/fun/head_test.cpp @@ -2,7 +2,7 @@ #include template -void expect_head(const T& x, int n) { +inline void expect_head(const T& x, int n) { auto f = [](int i) { return [=](const auto& y) { return stan::math::head(y, i); }; }; diff --git a/test/unit/math/mix/fun/isfinite_test.cpp b/test/unit/math/mix/fun/isfinite_test.cpp index ef1f8dc8bd4..3b172b28657 100644 --- a/test/unit/math/mix/fun/isfinite_test.cpp +++ b/test/unit/math/mix/fun/isfinite_test.cpp @@ -3,7 +3,7 @@ #include template -void expect_isfinite() { +inline void expect_isfinite() { using stan::math::isfinite; using std::isfinite; using std::numeric_limits; diff --git a/test/unit/math/mix/fun/isinf_test.cpp b/test/unit/math/mix/fun/isinf_test.cpp index 86d9f5a4d55..d4ac41fafc1 100644 --- a/test/unit/math/mix/fun/isinf_test.cpp +++ b/test/unit/math/mix/fun/isinf_test.cpp @@ -2,7 +2,7 @@ #include template -void expect_isinf() { +inline void expect_isinf() { // C++ idiom for clients of the math lib // std::isnan explicit using; stan::math::nan by ADL using std::isinf; diff --git a/test/unit/math/mix/fun/isnan_test.cpp b/test/unit/math/mix/fun/isnan_test.cpp index 6470dce1a3c..9a7efe47ab9 100644 --- a/test/unit/math/mix/fun/isnan_test.cpp +++ b/test/unit/math/mix/fun/isnan_test.cpp @@ -2,7 +2,7 @@ #include template -void expect_isnan() { +inline void expect_isnan() { // C++ idiom for clients of the math library // std::isnan explicit using; stan::math::nan by ADL using std::isnan; diff --git a/test/unit/math/mix/fun/isnormal_test.cpp b/test/unit/math/mix/fun/isnormal_test.cpp index e345e45042a..8cdb8a1c6fa 100644 --- a/test/unit/math/mix/fun/isnormal_test.cpp +++ b/test/unit/math/mix/fun/isnormal_test.cpp @@ -3,7 +3,7 @@ #include template -void expect_isnormal() { +inline void expect_isnormal() { using stan::math::isnormal; using std::isnormal; using std::numeric_limits; diff --git a/test/unit/math/mix/fun/log_mix_part2_test.cpp b/test/unit/math/mix/fun/log_mix_part2_test.cpp index ac6643dc1d7..73c7e3689aa 100644 --- a/test/unit/math/mix/fun/log_mix_part2_test.cpp +++ b/test/unit/math/mix/fun/log_mix_part2_test.cpp @@ -2,7 +2,7 @@ #include #include -void expect_log_mix(const std::vector& p, +inline void expect_log_mix(const std::vector& p, const std::vector& d) { auto f = [](const auto& x, const auto& y) { return stan::math::log_mix(x, y); }; @@ -26,14 +26,14 @@ void expect_log_mix(const std::vector& p, stan::test::expect_ad(tols, f, p_rv, d_rv); } -std::vector to_vectors( +inline std::vector to_vectors( const std::vector>& xs) { std::vector ys; for (const auto& x : xs) ys.push_back(stan::test::to_vector(x)); return ys; } -std::vector to_row_vectors( +inline std::vector to_row_vectors( const std::vector>& xs) { std::vector ys; for (const auto& x : xs) @@ -41,7 +41,7 @@ std::vector to_row_vectors( return ys; } -void expect_log_mix(const std::vector& p, +inline void expect_log_mix(const std::vector& p, const std::vector>& ds) { auto f = [](const auto& x, const auto& y) { return stan::math::log_mix(x, y); }; diff --git a/test/unit/math/mix/fun/logb_test.cpp b/test/unit/math/mix/fun/logb_test.cpp index 840ee6f3d47..96bb72d5d35 100644 --- a/test/unit/math/mix/fun/logb_test.cpp +++ b/test/unit/math/mix/fun/logb_test.cpp @@ -4,13 +4,13 @@ #include template -void expect_logb(double x) { +inline void expect_logb(double x) { using std::logb; T xt(x); stan::test::expect_near_rel("logb", logb(x), logb(xt)); } -void expect_all_logb(double x) { +inline void expect_all_logb(double x) { using stan::math::fvar; using stan::math::var; expect_logb(x); diff --git a/test/unit/math/mix/fun/matrix_exp_multiply_test.cpp b/test/unit/math/mix/fun/matrix_exp_multiply_test.cpp index 2babb51e35c..cea51aae5da 100644 --- a/test/unit/math/mix/fun/matrix_exp_multiply_test.cpp +++ b/test/unit/math/mix/fun/matrix_exp_multiply_test.cpp @@ -6,7 +6,7 @@ auto f_idx(int i, int j) { }; } -void expect_matrix_exp_multiply(int m, int n) { +inline void expect_matrix_exp_multiply(int m, int n) { auto f = [](const auto& x, auto& y) { return stan::math::matrix_exp_multiply(x, y); }; diff --git a/test/unit/math/mix/fun/max_test.cpp b/test/unit/math/mix/fun/max_test.cpp index f450e8be8b7..fe60483fa67 100644 --- a/test/unit/math/mix/fun/max_test.cpp +++ b/test/unit/math/mix/fun/max_test.cpp @@ -2,7 +2,7 @@ #include template -void expect_max(const T& m) { +inline void expect_max(const T& m) { auto f = [](const auto& x) { return stan::math::max(x); }; Eigen::VectorXd v(m.size()); Eigen::RowVectorXd rv(m.size()); diff --git a/test/unit/math/mix/fun/mean_test.cpp b/test/unit/math/mix/fun/mean_test.cpp index a770fb1245a..f3d95164c1b 100644 --- a/test/unit/math/mix/fun/mean_test.cpp +++ b/test/unit/math/mix/fun/mean_test.cpp @@ -1,7 +1,7 @@ #include template -void expect_mean(const T& m) { +inline void expect_mean(const T& m) { auto f = [](const auto& x) { return stan::math::mean(x); }; Eigen::VectorXd v(m.size()); Eigen::RowVectorXd rv(m.size()); diff --git a/test/unit/math/mix/fun/min_test.cpp b/test/unit/math/mix/fun/min_test.cpp index e7e024ea204..a0fedec9743 100644 --- a/test/unit/math/mix/fun/min_test.cpp +++ b/test/unit/math/mix/fun/min_test.cpp @@ -2,7 +2,7 @@ #include template -void expect_min(const T& m) { +inline void expect_min(const T& m) { auto f = [](const auto& x) { return stan::math::min(x); }; Eigen::VectorXd v(m.size()); Eigen::RowVectorXd rv(m.size()); diff --git a/test/unit/math/mix/fun/multiply_util.hpp b/test/unit/math/mix/fun/multiply_util.hpp index cda507842c6..70e1e52557a 100644 --- a/test/unit/math/mix/fun/multiply_util.hpp +++ b/test/unit/math/mix/fun/multiply_util.hpp @@ -3,7 +3,7 @@ #include template -void instantiate_multiply() { +inline void instantiate_multiply() { using stan::math::multiply; T v_scalar = 1.0; double d_scalar = 1.0; diff --git a/test/unit/math/mix/fun/pow_part1_test.cpp b/test/unit/math/mix/fun/pow_part1_test.cpp index 72100764562..2f100b24458 100644 --- a/test/unit/math/mix/fun/pow_part1_test.cpp +++ b/test/unit/math/mix/fun/pow_part1_test.cpp @@ -4,7 +4,7 @@ #include template -void expect_arith_instantiate() { +inline void expect_arith_instantiate() { auto a1 = stan::math::pow(T(1.0), 1); auto b1 = stan::math::pow(T(1.0), 1.0); auto c1 = stan::math::pow(1, T(1.0)); diff --git a/test/unit/math/mix/fun/prod_test.cpp b/test/unit/math/mix/fun/prod_test.cpp index 4326e18ceff..a9ac41c9c5b 100644 --- a/test/unit/math/mix/fun/prod_test.cpp +++ b/test/unit/math/mix/fun/prod_test.cpp @@ -2,7 +2,7 @@ #include template -void expect_prod(const T& m) { +inline void expect_prod(const T& m) { auto f = [](const auto& x) { return stan::math::prod(x); }; Eigen::VectorXd v(m.size()); for (int i = 0; i < m.size(); ++i) { diff --git a/test/unit/math/mix/fun/promote_scalar_test.cpp b/test/unit/math/mix/fun/promote_scalar_test.cpp index f49637881ea..84bb8101e75 100644 --- a/test/unit/math/mix/fun/promote_scalar_test.cpp +++ b/test/unit/math/mix/fun/promote_scalar_test.cpp @@ -8,22 +8,22 @@ namespace stan { namespace math { namespace test { template * = nullptr> -void expect_same_value_of_rec(T&& a, S&& b) { +inline void expect_same_value_of_rec(T&& a, S&& b) { using stan::math::value_of_rec; EXPECT_EQ(value_of_rec(a), value_of_rec(b)); } template * = nullptr> -void expect_same_value_of_rec(T&& a, S&& b) { +inline void expect_same_value_of_rec(T&& a, S&& b) { using stan::math::value_of_rec; EXPECT_MATRIX_EQ(value_of_rec(a), value_of_rec(b)); } template * = nullptr> -void expect_same_value_of_rec(T&& a, S&& b); +inline void expect_same_value_of_rec(T&& a, S&& b); template * = nullptr> -void expect_same_value_of_rec(T&& a, S&& b) { +inline void expect_same_value_of_rec(T&& a, S&& b) { using stan::math::value_of_rec; for (size_t i = 0; i < a.size(); ++i) { expect_same_value_of_rec(a[i], b[i]); @@ -31,7 +31,7 @@ void expect_same_value_of_rec(T&& a, S&& b) { } template *> -void expect_same_value_of_rec(T&& a, S&& b) { +inline void expect_same_value_of_rec(T&& a, S&& b) { stan::math::for_each( [](auto&& test, auto&& result) { stan::math::test::expect_same_value_of_rec(test, result); @@ -44,7 +44,7 @@ void expect_same_value_of_rec(T&& a, S&& b) { } // namespace stan template -void test_promote_scalar() { +inline void test_promote_scalar() { using eig_mat = Eigen::Matrix; auto tester_gen = []() { return std::make_tuple(UnPromotedType(1.0), eig_mat::Random(2, 2).eval(), @@ -86,7 +86,7 @@ TEST(mixFun, promote_scalar_tuple) { } template -void test_promote_scalar_basic() { +inline void test_promote_scalar_basic() { std::tuple x{UnPromotedType(3.5), UnPromotedType(4.5)}; std::tuple, UnPromotedType> z diff --git a/test/unit/math/mix/fun/pseudo_eigenvectors_test.cpp b/test/unit/math/mix/fun/pseudo_eigenvectors_test.cpp index f8695e2dd8a..fc0bb475a8a 100644 --- a/test/unit/math/mix/fun/pseudo_eigenvectors_test.cpp +++ b/test/unit/math/mix/fun/pseudo_eigenvectors_test.cpp @@ -16,7 +16,7 @@ TEST(mathMixFun, pseudoEigenvectors) { } template -void expect_zero_matrix(const T& m) { +inline void expect_zero_matrix(const T& m) { for (int j = 0; j < m.cols(); ++j) { for (int i = 0; i < m.rows(); ++i) { EXPECT_NEAR(0.0, stan::math::value_of_rec(m(i, j)), 1e-6); @@ -25,7 +25,7 @@ void expect_zero_matrix(const T& m) { } template -void test_pseudo_eigendecomposition() { +inline void test_pseudo_eigendecomposition() { using stan::math::pseudo_eigenvalues; using stan::math::pseudo_eigenvectors; for (const auto& x : stan::test::square_test_matrices(1, 3)) { diff --git a/test/unit/math/mix/fun/rank_test.cpp b/test/unit/math/mix/fun/rank_test.cpp index 9d15638b47b..16497887f6c 100644 --- a/test/unit/math/mix/fun/rank_test.cpp +++ b/test/unit/math/mix/fun/rank_test.cpp @@ -4,7 +4,7 @@ #include template -void test_rank() { +inline void test_rank() { using stan::math::rank; T c(1); @@ -38,7 +38,7 @@ void test_rank() { } template -void test_rank_int() { +inline void test_rank_int() { using stan::math::rank; T c(1); diff --git a/test/unit/math/mix/fun/scalbn_test.cpp b/test/unit/math/mix/fun/scalbn_test.cpp index e02da4c82a4..a564cbc71da 100644 --- a/test/unit/math/mix/fun/scalbn_test.cpp +++ b/test/unit/math/mix/fun/scalbn_test.cpp @@ -4,7 +4,7 @@ #include template -void expect_scalbn(double x) { +inline void expect_scalbn(double x) { using std::scalbn; T xt(x); for (int n = 2; n < 5; ++n) { @@ -12,7 +12,7 @@ void expect_scalbn(double x) { } } -void expect_all_scalbn(double x) { +inline void expect_all_scalbn(double x) { using stan::math::fvar; using stan::math::var; expect_scalbn(x); diff --git a/test/unit/math/mix/fun/sd_test.cpp b/test/unit/math/mix/fun/sd_test.cpp index 2ef3b6c5aa3..e9f4538ee1b 100644 --- a/test/unit/math/mix/fun/sd_test.cpp +++ b/test/unit/math/mix/fun/sd_test.cpp @@ -1,7 +1,7 @@ #include template -void expect_sd(const T& m, const stan::test::ad_tolerances& tols +inline void expect_sd(const T& m, const stan::test::ad_tolerances& tols = stan::test::ad_tolerances()) { auto f = [](const auto& x) { return stan::math::sd(x); }; Eigen::VectorXd v(m.size()); diff --git a/test/unit/math/mix/fun/signbit_test.cpp b/test/unit/math/mix/fun/signbit_test.cpp index 357c9d72121..419c4cca304 100644 --- a/test/unit/math/mix/fun/signbit_test.cpp +++ b/test/unit/math/mix/fun/signbit_test.cpp @@ -3,7 +3,7 @@ #include template -void expect_signbit() { +inline void expect_signbit() { using stan::math::signbit; using std::numeric_limits; using std::signbit; diff --git a/test/unit/math/mix/fun/sort_indices_test.cpp b/test/unit/math/mix/fun/sort_indices_test.cpp index a3ce18d88c8..f337cc2845e 100644 --- a/test/unit/math/mix/fun/sort_indices_test.cpp +++ b/test/unit/math/mix/fun/sort_indices_test.cpp @@ -2,7 +2,7 @@ #include #include -void test_sort_indices_asc2(std::vector val) { +inline void test_sort_indices_asc2(std::vector val) { using stan::math::fvar; using stan::math::sort_indices_asc; using stan::math::var; @@ -24,7 +24,7 @@ void test_sort_indices_asc2(std::vector val) { EXPECT_FALSE(x_sorted[i] == x[j]); } -void test_sort_indices_asc4(std::vector val) { +inline void test_sort_indices_asc4(std::vector val) { using stan::math::fvar; using stan::math::sort_indices_asc; using stan::math::var; @@ -46,7 +46,7 @@ void test_sort_indices_asc4(std::vector val) { EXPECT_FALSE(x_sorted[i] == x[j]); } -void test_sort_indices_desc2(std::vector val) { +inline void test_sort_indices_desc2(std::vector val) { using stan::math::fvar; using stan::math::sort_indices_desc; using stan::math::var; @@ -68,7 +68,7 @@ void test_sort_indices_desc2(std::vector val) { EXPECT_FALSE(x_sorted[i] == x[j]); } -void test_sort_indices_desc4(std::vector val) { +inline void test_sort_indices_desc4(std::vector val) { using stan::math::fvar; using stan::math::sort_indices_desc; using stan::math::var; @@ -91,7 +91,7 @@ void test_sort_indices_desc4(std::vector val) { } template -void test_sort_indices_asc2(Eigen::Matrix val) { +inline void test_sort_indices_asc2(Eigen::Matrix val) { using stan::math::fvar; using stan::math::sort_indices_asc; using stan::math::var; @@ -117,7 +117,7 @@ void test_sort_indices_asc2(Eigen::Matrix val) { } template -void test_sort_indices_asc4(Eigen::Matrix val) { +inline void test_sort_indices_asc4(Eigen::Matrix val) { using stan::math::fvar; using stan::math::sort_indices_asc; using stan::math::var; @@ -143,7 +143,7 @@ void test_sort_indices_asc4(Eigen::Matrix val) { } template -void test_sort_indices_desc2(Eigen::Matrix val) { +inline void test_sort_indices_desc2(Eigen::Matrix val) { using stan::math::fvar; using stan::math::sort_indices_desc; using stan::math::var; @@ -169,7 +169,7 @@ void test_sort_indices_desc2(Eigen::Matrix val) { } template -void test_sort_indices_desc4(Eigen::Matrix val) { +inline void test_sort_indices_desc4(Eigen::Matrix val) { using stan::math::fvar; using stan::math::sort_indices_desc; using stan::math::var; diff --git a/test/unit/math/mix/fun/sort_test.cpp b/test/unit/math/mix/fun/sort_test.cpp index ad786a567e3..a41292c6f77 100644 --- a/test/unit/math/mix/fun/sort_test.cpp +++ b/test/unit/math/mix/fun/sort_test.cpp @@ -2,7 +2,7 @@ #include #include -void expect_sort(const std::vector& sv, +inline void expect_sort(const std::vector& sv, const stan::test::ad_tolerances& tols = stan::test::ad_tolerances()) { auto f_asc = [](const auto& x) { return stan::math::sort_asc(x); }; diff --git a/test/unit/math/mix/fun/squared_distance_test.cpp b/test/unit/math/mix/fun/squared_distance_test.cpp index 29822f54c0b..2c71f963731 100644 --- a/test/unit/math/mix/fun/squared_distance_test.cpp +++ b/test/unit/math/mix/fun/squared_distance_test.cpp @@ -16,7 +16,7 @@ TEST(mathMixScalFun, squaredDistance) { stan::test::expect_ad(f, nan, 1.0); stan::test::expect_ad(f, nan, nan); } -void expect_squared_distance(const std::vector& sv1, +inline void expect_squared_distance(const std::vector& sv1, const std::vector& sv2, const stan::test::ad_tolerances& tols = stan::test::ad_tolerances()) { diff --git a/test/unit/math/mix/fun/sum_test.cpp b/test/unit/math/mix/fun/sum_test.cpp index 7bbeb075346..cce57b4d9f7 100644 --- a/test/unit/math/mix/fun/sum_test.cpp +++ b/test/unit/math/mix/fun/sum_test.cpp @@ -2,7 +2,7 @@ #include template -void expect_sum(const T& m) { +inline void expect_sum(const T& m) { using stan::test::expect_ad_matvar; auto f = [](const auto& x) { return stan::math::sum(x); }; Eigen::VectorXd v = stan::math::to_vector(m); diff --git a/test/unit/math/mix/fun/tail_test.cpp b/test/unit/math/mix/fun/tail_test.cpp index ccb7febd42e..c79284061b2 100644 --- a/test/unit/math/mix/fun/tail_test.cpp +++ b/test/unit/math/mix/fun/tail_test.cpp @@ -2,7 +2,7 @@ #include template -void expect_tail(const T& x, int n) { +inline void expect_tail(const T& x, int n) { auto f = [](int i) { return [=](const auto& y) { return stan::math::tail(y, i); }; }; diff --git a/test/unit/math/mix/fun/transpose_test.cpp b/test/unit/math/mix/fun/transpose_test.cpp index 25d0069969c..db7e67a8ffe 100644 --- a/test/unit/math/mix/fun/transpose_test.cpp +++ b/test/unit/math/mix/fun/transpose_test.cpp @@ -1,6 +1,6 @@ #include -void expect_transpose(const Eigen::MatrixXd& m) { +inline void expect_transpose(const Eigen::MatrixXd& m) { auto f = [](const auto& x) { return stan::math::transpose(x); }; Eigen::VectorXd v = stan::test::to_vector(m); Eigen::RowVectorXd rv = stan::test::to_row_vector(m); diff --git a/test/unit/math/mix/fun/ub_constrain_matvar_test.cpp b/test/unit/math/mix/fun/ub_constrain_matvar_test.cpp index 5efcfbe6cda..a739e72c91a 100644 --- a/test/unit/math/mix/fun/ub_constrain_matvar_test.cpp +++ b/test/unit/math/mix/fun/ub_constrain_matvar_test.cpp @@ -3,7 +3,7 @@ namespace ub_constrain_test { template -void expect_matvar(const T1& x, const T2& ub) { +inline void expect_matvar(const T1& x, const T2& ub) { auto f1 = [](const auto& x, const auto& ub) { stan::return_type_t lp = 0; return stan::math::ub_constrain(x, ub, lp); @@ -30,7 +30,7 @@ void expect_matvar(const T1& x, const T2& ub) { } template -void expect_vec_matvar(const T1& x, const T2& ub) { +inline void expect_vec_matvar(const T1& x, const T2& ub) { auto f1 = [](const auto& x, const auto& ub) { stan::return_type_t lp = 0; return stan::math::ub_constrain(x, ub, lp); diff --git a/test/unit/math/mix/fun/ub_constrain_test.cpp b/test/unit/math/mix/fun/ub_constrain_test.cpp index 90ec887fcd2..e1c79d55ddc 100644 --- a/test/unit/math/mix/fun/ub_constrain_test.cpp +++ b/test/unit/math/mix/fun/ub_constrain_test.cpp @@ -3,7 +3,7 @@ namespace ub_constrain_test { template -void expect(const T1& x, const T2& ub) { +inline void expect(const T1& x, const T2& ub) { auto f1 = [](const auto& x, const auto& ub) { stan::return_type_t lp = 0; return stan::math::ub_constrain(x, ub, lp); @@ -30,7 +30,7 @@ void expect(const T1& x, const T2& ub) { } template -void expect_vec(const T1& x, const T2& ub) { +inline void expect_vec(const T1& x, const T2& ub) { auto f1 = [](const auto& x, const auto& ub) { stan::return_type_t lp = 0; return stan::math::ub_constrain(x, ub, lp); diff --git a/test/unit/math/mix/fun/variance_test.cpp b/test/unit/math/mix/fun/variance_test.cpp index f4f26364eb0..5b6d77a324a 100644 --- a/test/unit/math/mix/fun/variance_test.cpp +++ b/test/unit/math/mix/fun/variance_test.cpp @@ -1,7 +1,7 @@ #include #include -void expect_variance(const Eigen::MatrixXd& m) { +inline void expect_variance(const Eigen::MatrixXd& m) { auto f = [](const auto& x) { return stan::math::variance(x); }; Eigen::VectorXd v = stan::test::to_vector(m); Eigen::RowVectorXd rv = stan::math::to_row_vector(m); diff --git a/test/unit/math/mix/functor/finite_diff_grad_hessian_auto_test.cpp b/test/unit/math/mix/functor/finite_diff_grad_hessian_auto_test.cpp index cecc05b8e7a..4cae04c02d2 100644 --- a/test/unit/math/mix/functor/finite_diff_grad_hessian_auto_test.cpp +++ b/test/unit/math/mix/functor/finite_diff_grad_hessian_auto_test.cpp @@ -5,7 +5,7 @@ #include template -void test_grad_hessian_finite_diff(const std::string& msg, const F& f, +inline void test_grad_hessian_finite_diff(const std::string& msg, const F& f, Eigen::VectorXd& x) { double fx; Eigen::VectorXd grad_fx; diff --git a/test/unit/math/mix/functor/finite_diff_gradient_auto_test.cpp b/test/unit/math/mix/functor/finite_diff_gradient_auto_test.cpp index e288331aae0..eeae792742a 100644 --- a/test/unit/math/mix/functor/finite_diff_gradient_auto_test.cpp +++ b/test/unit/math/mix/functor/finite_diff_gradient_auto_test.cpp @@ -4,7 +4,7 @@ #include template -void expect_match_autodiff(const F& f, Eigen::VectorXd x) { +inline void expect_match_autodiff(const F& f, Eigen::VectorXd x) { double fx_fd; Eigen::VectorXd grad_fx_fd; stan::math::finite_diff_gradient_auto(f, x, fx_fd, grad_fx_fd); diff --git a/test/unit/math/mix/functor/reduce_sum_util.hpp b/test/unit/math/mix/functor/reduce_sum_util.hpp index 9d70fe1054c..6666d7eea2f 100644 --- a/test/unit/math/mix/functor/reduce_sum_util.hpp +++ b/test/unit/math/mix/functor/reduce_sum_util.hpp @@ -15,7 +15,7 @@ namespace math { namespace test { template -void expect_ad_reduce_sum_lpdf(T1&& data, T2&& arg) { +inline void expect_ad_reduce_sum_lpdf(T1&& data, T2&& arg) { using stan::math::test::reduce_sum_int_sum_lpdf; using stan::math::test::reduce_sum_static_int_sum_lpdf; using stan::math::test::reduce_sum_static_sum_lpdf; diff --git a/test/unit/math/mix/meta/base_type_test.cpp b/test/unit/math/mix/meta/base_type_test.cpp index f1454afbefc..e71c0bc851f 100644 --- a/test/unit/math/mix/meta/base_type_test.cpp +++ b/test/unit/math/mix/meta/base_type_test.cpp @@ -5,7 +5,7 @@ #include template -void expect_base() { +inline void expect_base() { EXPECT_SAME_TYPE(R, typename stan::base_type::type); EXPECT_SAME_TYPE(R, stan::base_type_t); EXPECT_SAME_TYPE(R, typename stan::base_type::type); @@ -17,7 +17,7 @@ void expect_base() { } template -void test_base() { +inline void test_base() { // scalar types expect_base(); diff --git a/test/unit/math/mix/meta/eigen_utils.hpp b/test/unit/math/mix/meta/eigen_utils.hpp index b44df145390..09f9fb7ebb8 100644 --- a/test/unit/math/mix/meta/eigen_utils.hpp +++ b/test/unit/math/mix/meta/eigen_utils.hpp @@ -26,7 +26,7 @@ namespace test { */ template class Checker> -void test_eigen_sparse_matrix() { +inline void test_eigen_sparse_matrix() { using Eigen::EigenBase; using Eigen::SparseCompressedBase; using Eigen::SparseMapBase; @@ -70,7 +70,7 @@ void test_eigen_sparse_matrix() { */ template class Checker, typename EigenType> -void test_eigen_dense_hierarchy() { +inline void test_eigen_dense_hierarchy() { using Eigen::ArrayBase; using Eigen::DenseBase; using Eigen::EigenBase; @@ -117,7 +117,7 @@ void test_eigen_dense_hierarchy() { */ template class Checker, typename EigenType> -void test_eigen_dense_exprs() { +inline void test_eigen_dense_exprs() { std::remove_reference_t A; std::remove_reference_t B; @@ -155,7 +155,7 @@ void test_eigen_dense_exprs() { */ template class Checker> -void test_eigen_dense_decomp_matrix() { +inline void test_eigen_dense_decomp_matrix() { using Eigen::DenseBase; using Eigen::EigenBase; using Eigen::MapBase; @@ -176,7 +176,7 @@ void test_eigen_dense_decomp_matrix() { */ template class Checker> -void test_eigen_dense_decomp_array() { +inline void test_eigen_dense_decomp_array() { using Eigen::DenseBase; using Eigen::EigenBase; using Eigen::MapBase; @@ -211,7 +211,7 @@ void test_eigen_dense_decomp_array() { template class Checker, template class EigenType, int... EigenDims> -void all_eigen_dense() { +inline void all_eigen_dense() { using stan::math::fvar; using stan::math::var; @@ -250,7 +250,7 @@ void all_eigen_dense() { template class Checker, template class EigenType, int... EigenDims> -void all_eigen_dense_exprs() { +inline void all_eigen_dense_exprs() { using stan::math::fvar; using stan::math::var; test_eigen_dense_exprs class Checker> -void all_eigen_dense_decomp() { +inline void all_eigen_dense_decomp() { using stan::math::fvar; using stan::math::var; @@ -307,7 +307,7 @@ void all_eigen_dense_decomp() { */ template class Checker> -void all_eigen_sparse() { +inline void all_eigen_sparse() { using stan::math::fvar; using stan::math::var; diff --git a/test/unit/math/mix/meta/is_complex_test.cpp b/test/unit/math/mix/meta/is_complex_test.cpp index 61969d80578..9d2dda8c90c 100644 --- a/test/unit/math/mix/meta/is_complex_test.cpp +++ b/test/unit/math/mix/meta/is_complex_test.cpp @@ -5,12 +5,12 @@ #include template -void expect_is_complex() { +inline void expect_is_complex() { EXPECT_EQ(expected, stan::is_complex::value); } template -void test_is_complex() { +inline void test_is_complex() { expect_is_complex>(); expect_is_complex>(); expect_is_complex&>(); @@ -37,12 +37,12 @@ TEST(stanMathMix, isComplex) { } template -void expect_is_vt_complex() { +inline void expect_is_vt_complex() { EXPECT_EQ(expected, stan::is_vt_complex::value); } template -void test_is_vt_complex() { +inline void test_is_vt_complex() { using complex_std_vec = std::vector>; using complex_eigen_vec = Eigen::Matrix, -1, 1>; expect_is_vt_complex(); @@ -78,12 +78,12 @@ TEST(stanMathMix, is_vt_Complex) { } template -void expect_is_vt_not_complex() { +inline void expect_is_vt_not_complex() { EXPECT_EQ(expected, stan::is_vt_not_complex::value); } template -void test_is_vt_not_complex() { +inline void test_is_vt_not_complex() { using complex_std_vec = std::vector>; using complex_eigen_vec = Eigen::Matrix, -1, 1>; expect_is_vt_not_complex(); diff --git a/test/unit/math/mix/meta/is_constant_all_test.cpp b/test/unit/math/mix/meta/is_constant_all_test.cpp index ad52f661747..e4e48782f45 100644 --- a/test/unit/math/mix/meta/is_constant_all_test.cpp +++ b/test/unit/math/mix/meta/is_constant_all_test.cpp @@ -2,7 +2,7 @@ #include template -void expect_not_const() { +inline void expect_not_const() { using stan::is_constant_all; bool temp = is_constant_all::value; EXPECT_FALSE(temp); diff --git a/test/unit/math/mix/meta/return_type_test.cpp b/test/unit/math/mix/meta/return_type_test.cpp index 64bce0a1ae4..ae284528055 100644 --- a/test/unit/math/mix/meta/return_type_test.cpp +++ b/test/unit/math/mix/meta/return_type_test.cpp @@ -5,13 +5,13 @@ #include template -void expect_return() { +inline void expect_return() { EXPECT_SAME_TYPE(R, typename stan::return_type::type); EXPECT_SAME_TYPE(R, stan::return_type_t); } template -void test_return() { +inline void test_return() { // scalar types expect_return(); expect_return(); diff --git a/test/unit/math/mix/meta/scalar_type_test.cpp b/test/unit/math/mix/meta/scalar_type_test.cpp index 96f54517078..6f9450aad9d 100644 --- a/test/unit/math/mix/meta/scalar_type_test.cpp +++ b/test/unit/math/mix/meta/scalar_type_test.cpp @@ -4,7 +4,7 @@ #include template -void expect_scalar_type() { +inline void expect_scalar_type() { using stan::scalar_type_t; static_assert(std::is_same>::value, "NOT SAME"); static_assert(std::is_same>::value, "NOT SAME"); @@ -19,7 +19,7 @@ void expect_scalar_type() { } template -void test_scalar_type() { +inline void test_scalar_type() { using Eigen::Matrix; using std::complex; using std::vector; diff --git a/test/unit/math/mix/prob/dirichlet_test.cpp b/test/unit/math/mix/prob/dirichlet_test.cpp index 419dd83dccd..0b1ea61dae0 100644 --- a/test/unit/math/mix/prob/dirichlet_test.cpp +++ b/test/unit/math/mix/prob/dirichlet_test.cpp @@ -2,7 +2,7 @@ namespace dirichlet_test { template -std::vector vectorize_softmax(const std::vector& y) { +inline std::vector vectorize_softmax(const std::vector& y) { std::vector y_simplex; for (size_t i = 0; i < y.size(); ++i) { y_simplex.push_back(stan::math::softmax(y[i])); @@ -11,7 +11,7 @@ std::vector vectorize_softmax(const std::vector& y) { } template * = nullptr> -T vectorize_softmax(const T& y) { +inline T vectorize_softmax(const T& y) { return stan::math::softmax(y); } } // namespace dirichlet_test diff --git a/test/unit/math/mix/prob/higher_order_utils.hpp b/test/unit/math/mix/prob/higher_order_utils.hpp index 369b7d3f2b8..0905fc5b90f 100644 --- a/test/unit/math/mix/prob/higher_order_utils.hpp +++ b/test/unit/math/mix/prob/higher_order_utils.hpp @@ -4,7 +4,7 @@ #include #include -void test_hess_eq(Eigen::Matrix hess_1, +inline void test_hess_eq(Eigen::Matrix hess_1, Eigen::Matrix hess_2) { for (int i = 0; i < hess_1.size(); ++i) { double tolerance = 1e-6 * fmax(fabs(hess_1(i)), fabs(hess_2(i))) + 1e-10; @@ -12,7 +12,7 @@ void test_hess_eq(Eigen::Matrix hess_1, } } -void test_grad_hess_eq(std::vector > g_hess_1, +inline void test_grad_hess_eq(std::vector > g_hess_1, std::vector > g_hess_2) { for (size_t m = 0; m < g_hess_1.size(); ++m) for (int i = 0; i < g_hess_1[m].size(); ++i) { diff --git a/test/unit/math/opencl/cholesky_decompose_test.cpp b/test/unit/math/opencl/cholesky_decompose_test.cpp index 8ed13db61ac..c056bc91b61 100644 --- a/test/unit/math/opencl/cholesky_decompose_test.cpp +++ b/test/unit/math/opencl/cholesky_decompose_test.cpp @@ -30,7 +30,7 @@ TEST(MathMatrixOpenCL, cholesky_decompose_cpu_vs_cl_small) { } namespace { -void cholesky_decompose_test(int size) { +inline void cholesky_decompose_test(int size) { stan::math::matrix_d m1 = stan::math::matrix_d::Random(size, size); stan::math::matrix_d m1_pos_def = m1 * m1.transpose() + size * Eigen::MatrixXd::Identity(size, size); diff --git a/test/unit/math/opencl/kernel_generator/elt_function_cl_test.cpp b/test/unit/math/opencl/kernel_generator/elt_function_cl_test.cpp index 10562ffb173..b97b945172f 100644 --- a/test/unit/math/opencl/kernel_generator/elt_function_cl_test.cpp +++ b/test/unit/math/opencl/kernel_generator/elt_function_cl_test.cpp @@ -19,7 +19,7 @@ using stan::math::matrix_cl; namespace stan { namespace math { -MatrixXd rsqrt(const MatrixXd& a) { return stan::math::inv_sqrt(a); } +inline MatrixXd rsqrt(const MatrixXd& a) { return stan::math::inv_sqrt(a); } } // namespace math } // namespace stan diff --git a/test/unit/math/opencl/kernel_generator/reference_kernel.hpp b/test/unit/math/opencl/kernel_generator/reference_kernel.hpp index f50a82a3b16..e486fa8526c 100644 --- a/test/unit/math/opencl/kernel_generator/reference_kernel.hpp +++ b/test/unit/math/opencl/kernel_generator/reference_kernel.hpp @@ -14,7 +14,7 @@ namespace test { * @param filename Name of the file * @return file content */ -std::string load_reference_kernel(const std::string& filename) { +inline std::string load_reference_kernel(const std::string& filename) { std::string path = "test/unit/math/opencl/kernel_generator/reference_kernels/" + filename; std::ifstream input(path); @@ -31,7 +31,7 @@ std::string load_reference_kernel(const std::string& filename) { * @param kernel content to write in the file * @throw ios_base::failure File could not be opened or written. */ -void store_reference_kernel_if_needed(const std::string& filename, +inline void store_reference_kernel_if_needed(const std::string& filename, const std::string& kernel) { #ifdef STAN_TEST_KERNEL_GENERATOR_STORE_REFERENCE_KERNELS std::string path diff --git a/test/unit/math/opencl/prim/crossprod_test.cpp b/test/unit/math/opencl/prim/crossprod_test.cpp index 32965619e81..4172bb70c32 100644 --- a/test/unit/math/opencl/prim/crossprod_test.cpp +++ b/test/unit/math/opencl/prim/crossprod_test.cpp @@ -3,7 +3,7 @@ #include #include -void test_crossprod(const stan::math::matrix_d& x) { +inline void test_crossprod(const stan::math::matrix_d& x) { using stan::math::crossprod; stan::math::matrix_cl x_cl(x); stan::math::matrix_d y_cl = from_matrix_cl(crossprod(x_cl)); diff --git a/test/unit/math/opencl/prim/mdivide_left_tri_low_test.cpp b/test/unit/math/opencl/prim/mdivide_left_tri_low_test.cpp index 89e66e4f1c0..c0151631ed1 100644 --- a/test/unit/math/opencl/prim/mdivide_left_tri_low_test.cpp +++ b/test/unit/math/opencl/prim/mdivide_left_tri_low_test.cpp @@ -28,7 +28,7 @@ TEST(MathMatrixCL, mdivide_left_tri_low_cl_exception) { EXPECT_THROW(stan::math::mdivide_left_tri_low(m5, m5), std::invalid_argument); } -void mdivide_left_tri_low_Ab_test(int size) { +inline void mdivide_left_tri_low_Ab_test(int size) { boost::random::mt19937 rng; auto m1 = stan::math::matrix_d(size, size); for (int i = 0; i < size; i++) { @@ -56,7 +56,7 @@ void mdivide_left_tri_low_Ab_test(int size) { } } -void mdivide_left_tri_low_A_test(int size) { +inline void mdivide_left_tri_low_A_test(int size) { boost::random::mt19937 rng; auto m1 = stan::math::matrix_d(size, size); for (int i = 0; i < size; i++) { diff --git a/test/unit/math/opencl/prim/mdivide_right_tri_low_test.cpp b/test/unit/math/opencl/prim/mdivide_right_tri_low_test.cpp index 9c4cc3ceb91..a339cfbb107 100644 --- a/test/unit/math/opencl/prim/mdivide_right_tri_low_test.cpp +++ b/test/unit/math/opencl/prim/mdivide_right_tri_low_test.cpp @@ -28,7 +28,7 @@ TEST(MathMatrixCL, mdivide_right_tri_low_cl_exception) { std::invalid_argument); } -void mdivide_right_tri_low_Ab_test(int size) { +inline void mdivide_right_tri_low_Ab_test(int size) { boost::random::mt19937 rng; auto m1 = stan::math::matrix_d(size, size); for (int i = 0; i < size; i++) { diff --git a/test/unit/math/opencl/prim/tcrossprod_test.cpp b/test/unit/math/opencl/prim/tcrossprod_test.cpp index 5059db1580e..31eaad2962a 100644 --- a/test/unit/math/opencl/prim/tcrossprod_test.cpp +++ b/test/unit/math/opencl/prim/tcrossprod_test.cpp @@ -3,7 +3,7 @@ #include #include -void test_tcrossprod(const stan::math::matrix_d& x) { +inline void test_tcrossprod(const stan::math::matrix_d& x) { using stan::math::tcrossprod; stan::math::matrix_cl x_cl(x); stan::math::matrix_d y_cl = from_matrix_cl(tcrossprod(x_cl)); diff --git a/test/unit/math/opencl/tri_inverse_test.cpp b/test/unit/math/opencl/tri_inverse_test.cpp index 9eda4495e94..98c36794892 100644 --- a/test/unit/math/opencl/tri_inverse_test.cpp +++ b/test/unit/math/opencl/tri_inverse_test.cpp @@ -24,7 +24,7 @@ TEST(MathMatrixCL, inverse_cl_exception) { EXPECT_THROW(m3 = tri_inverse(m5), std::invalid_argument); } -void lower_inverse_test(int size) { +inline void lower_inverse_test(int size) { boost::random::mt19937 rng; auto m1 = stan::math::matrix_d(size, size); for (int i = 0; i < size; i++) { @@ -55,7 +55,7 @@ void lower_inverse_test(int size) { EXPECT_LT(max_error, 1e-8); } -void upper_inverse_test(int size) { +inline void upper_inverse_test(int size) { boost::random::mt19937 rng; auto m1 = stan::math::matrix_d(size, size); for (int i = 0; i < size; i++) { diff --git a/test/unit/math/opencl/util.hpp b/test/unit/math/opencl/util.hpp index 9170a8d848c..8cc2fb7eae2 100644 --- a/test/unit/math/opencl/util.hpp +++ b/test/unit/math/opencl/util.hpp @@ -17,7 +17,7 @@ namespace test { namespace internal { template * = nullptr> -T opencl_argument(const T& x) { +inline T opencl_argument(const T& x) { return x; } template * = nullptr> @@ -26,7 +26,7 @@ auto opencl_argument(const T& x) { } template >>* = nullptr> -T var_argument(const T& x) { +inline T var_argument(const T& x) { return x; } template * = nullptr> -void expect_eq(T a, T b, const char* msg) { +inline void expect_eq(T a, T b, const char* msg) { stan::test::expect_near_rel(msg, a, b); } -void expect_eq(math::var a, math::var b, const char* msg) { +inline void expect_eq(math::var a, math::var b, const char* msg) { stan::test::expect_near_rel(msg, a.val(), b.val()); } template * = nullptr, require_all_not_st_var* = nullptr> -void expect_eq(const T1& a, const T2& b, const char* msg) { +inline void expect_eq(const T1& a, const T2& b, const char* msg) { EXPECT_EQ(a.rows(), b.rows()) << msg; EXPECT_EQ(a.cols(), b.cols()) << msg; const auto& a_ref = math::to_ref(a); @@ -68,11 +68,11 @@ void expect_eq(const T1& a, const T2& b, const char* msg) { } } template * = nullptr> -void expect_eq(const T1& a, const T2& b, const char* msg) { +inline void expect_eq(const T1& a, const T2& b, const char* msg) { expect_eq(a.val(), b.val(), msg); } template -void expect_eq(const std::vector& a, const std::vector& b, +inline void expect_eq(const std::vector& a, const std::vector& b, const char* msg) { EXPECT_EQ(a.size(), b.size()); for (int i = 0; i < a.size(); i++) { @@ -81,12 +81,12 @@ void expect_eq(const std::vector& a, const std::vector& b, } template * = nullptr> -void expect_eq(const T1& a, const T2& b, const char* msg) { +inline void expect_eq(const T1& a, const T2& b, const char* msg) { expect_eq(from_matrix_cl>(a), b, msg); } template * = nullptr> -void expect_eq(const T1& a, const T2& b, const char* msg) { +inline void expect_eq(const T1& a, const T2& b, const char* msg) { expect_eq(a, from_matrix_cl>(b), msg); } @@ -104,13 +104,13 @@ auto recursive_sum(const std::vector& a) { } template * = nullptr> -void expect_adj_near(const T& a, const T& b, const char* msg) {} -void expect_adj_near(var a, var b, const char* msg) { +inline void expect_adj_near(const T& a, const T& b, const char* msg) {} +inline void expect_adj_near(var a, var b, const char* msg) { stan::test::expect_near_rel(msg, a.adj(), b.adj()); } template * = nullptr, require_vt_same* = nullptr> -void expect_adj_near(const T1& a, const T2& b, const char* msg) { +inline void expect_adj_near(const T1& a, const T2& b, const char* msg) { EXPECT_EQ(a.rows(), b.rows()) << msg; EXPECT_EQ(a.cols(), b.cols()) << msg; const auto& a_ref = math::to_ref(a); @@ -118,7 +118,7 @@ void expect_adj_near(const T1& a, const T2& b, const char* msg) { stan::test::expect_near_rel(msg, a_ref.adj(), b_ref.adj()); } template -void expect_adj_near(const std::vector& a, const std::vector& b, +inline void expect_adj_near(const std::vector& a, const std::vector& b, const char* msg) { EXPECT_EQ(a.size(), b.size()) << msg; for (int i = 0; i < a.size(); i++) { @@ -127,11 +127,11 @@ void expect_adj_near(const std::vector& a, const std::vector& b, } template -void prim_rev_argument_combinations(Functor f) { +inline void prim_rev_argument_combinations(Functor f) { f(std::make_tuple(), std::make_tuple()); } template -void prim_rev_argument_combinations(const Functor& f, const Arg0& arg0, +inline void prim_rev_argument_combinations(const Functor& f, const Arg0& arg0, const Args&... args) { prim_rev_argument_combinations( [&f, &arg0](const auto& args1, const auto& args2) { @@ -156,7 +156,7 @@ void prim_rev_argument_combinations(const Functor& f, const Arg0& arg0, } template -void compare_cpu_opencl_prim_rev_impl(const Functor& functor, +inline void compare_cpu_opencl_prim_rev_impl(const Functor& functor, std::index_sequence, const Args&... args) { prim_rev_argument_combinations( @@ -192,7 +192,7 @@ void compare_cpu_opencl_prim_rev_impl(const Functor& functor, template -void compare_cpu_opencl_prim_rev_impl(const FunctorCPU& functorCPU, +inline void compare_cpu_opencl_prim_rev_impl(const FunctorCPU& functorCPU, const FunctorCL& functorCL, std::index_sequence, const Args&... args) { @@ -227,7 +227,7 @@ auto to_vector_if(const T& x, std::size_t N) { return Eigen::Matrix::Constant(N, x); } template * = nullptr> -T to_vector_if(const T& x, std::size_t N) { +inline T to_vector_if(const T& x, std::size_t N) { return x; } @@ -242,7 +242,7 @@ int64_t rows(const T& x) { } template -void test_opencl_broadcasting_prim_rev_impl(const Functor& functor, +inline void test_opencl_broadcasting_prim_rev_impl(const Functor& functor, std::index_sequence, const Args&... args) { prim_rev_argument_combinations( @@ -304,7 +304,7 @@ void test_opencl_broadcasting_prim_rev_impl(const Functor& functor, * in CPU memory (no vars, no arguments on the OpenCL device). */ template -void compare_cpu_opencl_prim(const Functor& functor, const Args&... args) { +inline void compare_cpu_opencl_prim(const Functor& functor, const Args&... args) { auto res_cpu = eval(functor(args...)); auto res_opencl = eval(functor(internal::opencl_argument(args)...)); internal::expect_eq(res_cpu, res_opencl, @@ -328,7 +328,7 @@ void compare_cpu_opencl_prim(const Functor& functor, const Args&... args) { * in CPU memory (no vars, no arguments on the OpenCL device). */ template -void compare_cpu_opencl_prim_rev(const Functor& functor, const Args&... args) { +inline void compare_cpu_opencl_prim_rev(const Functor& functor, const Args&... args) { internal::compare_cpu_opencl_prim_rev_impl( functor, std::make_index_sequence{}, args...); recover_memory(); @@ -352,7 +352,7 @@ void compare_cpu_opencl_prim_rev(const Functor& functor, const Args&... args) { * in CPU memory (no vars, no arguments on the OpenCL device). */ template -void compare_cpu_opencl_prim_rev_separate(const FunctorCPU& functorCPU, +inline void compare_cpu_opencl_prim_rev_separate(const FunctorCPU& functorCPU, const FunctorCL& fucntorCL, const Args&... args) { internal::compare_cpu_opencl_prim_rev_impl( @@ -384,7 +384,7 @@ template * = nullptr, require_stan_scalar_t< std::tuple_element_t>>* = nullptr> -void test_opencl_broadcasting_prim_rev(const Functor& functor, +inline void test_opencl_broadcasting_prim_rev(const Functor& functor, const Args&... args) { internal::test_opencl_broadcasting_prim_rev_impl( functor, std::make_index_sequence{}, args...); diff --git a/test/unit/math/prim/constraint/cholesky_corr_transform_test.cpp b/test/unit/math/prim/constraint/cholesky_corr_transform_test.cpp index 712fc6616e4..4f6deed1af4 100644 --- a/test/unit/math/prim/constraint/cholesky_corr_transform_test.cpp +++ b/test/unit/math/prim/constraint/cholesky_corr_transform_test.cpp @@ -25,7 +25,7 @@ TEST(ProbTransform, CholeskyCorrelation4) { EXPECT_FLOAT_EQ(L(m, n), x(m, n)); } -void test_cholesky_correlation_values( +inline void test_cholesky_correlation_values( const Eigen::Matrix& L) { using Eigen::Dynamic; using Eigen::Matrix; diff --git a/test/unit/math/prim/err/elementwise_check_test.cpp b/test/unit/math/prim/err/elementwise_check_test.cpp index aa61fbadecd..377e7cdb1bc 100644 --- a/test/unit/math/prim/err/elementwise_check_test.cpp +++ b/test/unit/math/prim/err/elementwise_check_test.cpp @@ -9,24 +9,24 @@ namespace elementwise_check_test { auto p = [](const auto& x) { return !stan::math::is_nan(x); }; template -void do_check(const T& x) { +inline void do_check(const T& x) { stan::math::elementwise_check([](const auto& x) { return p(x); }, "elementwise_check_tests", "x", x, "not nan"); } template -bool do_is(const T& x) { +inline bool do_is(const T& x) { return stan::math::elementwise_is([](const auto& x) { return p(x); }, x); } template -void expect_good(const T& x) { +inline void expect_good(const T& x) { EXPECT_NO_THROW(do_check(x)); EXPECT_TRUE(do_is(x)); } template -void expect_bad(const T& x) { +inline void expect_bad(const T& x) { EXPECT_THROW(do_check(x), std::domain_error); EXPECT_FALSE(do_is(x)); } diff --git a/test/unit/math/prim/fun/accumulator_test.cpp b/test/unit/math/prim/fun/accumulator_test.cpp index 7eca88dc798..a3eef3e2c16 100644 --- a/test/unit/math/prim/fun/accumulator_test.cpp +++ b/test/unit/math/prim/fun/accumulator_test.cpp @@ -4,7 +4,7 @@ // test sum of first n numbers for sum of a template -void test_sum(stan::math::accumulator& a, int n) { +inline void test_sum(stan::math::accumulator& a, int n) { EXPECT_FLOAT_EQ((n * (n + 1)) / 2, a.sum()); } diff --git a/test/unit/math/prim/fun/assign_test.cpp b/test/unit/math/prim/fun/assign_test.cpp index 89c5422f7e8..be85d0f4924 100644 --- a/test/unit/math/prim/fun/assign_test.cpp +++ b/test/unit/math/prim/fun/assign_test.cpp @@ -7,7 +7,7 @@ #include template -void test_print_mat_size(const std::string& expected) { +inline void test_print_mat_size(const std::string& expected) { using stan::math::print_mat_size; std::stringstream ss; stan::math::print_mat_size(ss); diff --git a/test/unit/math/prim/fun/binary_scalar_tester.hpp b/test/unit/math/prim/fun/binary_scalar_tester.hpp index 747b948f99f..b08c3c53122 100644 --- a/test/unit/math/prim/fun/binary_scalar_tester.hpp +++ b/test/unit/math/prim/fun/binary_scalar_tester.hpp @@ -20,7 +20,7 @@ namespace test { */ template * = nullptr> -void binary_scalar_tester_impl(const F& f, const T1& x, const T2& y) { +inline void binary_scalar_tester_impl(const F& f, const T1& x, const T2& y) { auto vec_vec = math::eval(f(x, y)); auto vec_scal = math::eval(f(x, y(0))); auto scal_vec = math::eval(f(x(0), y)); @@ -90,7 +90,7 @@ void binary_scalar_tester_impl(const F& f, const T1& x, const T2& y) { */ template * = nullptr> -void binary_scalar_tester_impl(const F& f, const T1& x, const T2& y) { +inline void binary_scalar_tester_impl(const F& f, const T1& x, const T2& y) { auto vec_vec = math::eval(f(x, y)); auto vec_scal = math::eval(f(x, y[0])); auto scal_vec = math::eval(f(x[0], y)); @@ -162,7 +162,7 @@ template , require_eigen_matrix_dynamic_t* = nullptr, require_std_vector_t* = nullptr> -void binary_scalar_tester_impl(const F& f, const T1& x, const T2& y) { +inline void binary_scalar_tester_impl(const F& f, const T1& x, const T2& y) { auto vec_vec = math::eval(f(x, y)); for (int r = 0; r < x.rows(); ++r) { for (int c = 0; c < x.cols(); ++c) { @@ -215,7 +215,7 @@ template , require_std_vector_t* = nullptr, require_eigen_matrix_dynamic_t* = nullptr> -void binary_scalar_tester_impl(const F& f, const T1& x, const T2& y) { +inline void binary_scalar_tester_impl(const F& f, const T1& x, const T2& y) { auto vec_vec = math::eval(f(x, y)); for (int r = 0; r < y.rows(); ++r) { for (int c = 0; c < y.cols(); ++c) { @@ -281,7 +281,7 @@ void binary_scalar_tester_impl(const F& f, const T1& x, const T2& y) { */ template * = nullptr> -void binary_scalar_tester(const F& f, const T1& x, const T2& y) { +inline void binary_scalar_tester(const F& f, const T1& x, const T2& y) { binary_scalar_tester_impl(f, x, y); binary_scalar_tester_impl(f, x.transpose().eval(), y.transpose().eval()); binary_scalar_tester_impl(f, x.replicate(1, x.size()).eval(), @@ -311,7 +311,7 @@ template * = nullptr, require_any_std_vector_st* = nullptr, require_any_eigen_matrix_dynamic_t* = nullptr> -void binary_scalar_tester(const F& f, const T1& x, const T2& y) { +inline void binary_scalar_tester(const F& f, const T1& x, const T2& y) { binary_scalar_tester_impl(f, x, y); } @@ -329,7 +329,7 @@ void binary_scalar_tester(const F& f, const T1& x, const T2& y) { */ template * = nullptr> -void binary_scalar_tester(const F& f, const T1& x, const T2& y) { +inline void binary_scalar_tester(const F& f, const T1& x, const T2& y) { binary_scalar_tester_impl(f, x, y); } @@ -350,7 +350,7 @@ void binary_scalar_tester(const F& f, const T1& x, const T2& y) { template * = nullptr, require_eigen_vector_t* = nullptr> -void binary_scalar_tester(const F& f, const T1& x, const T2& y) { +inline void binary_scalar_tester(const F& f, const T1& x, const T2& y) { binary_scalar_tester_impl(f, x, y); binary_scalar_tester_impl(f, x, y.transpose()); binary_scalar_tester_impl(f, x, y.array()); @@ -373,7 +373,7 @@ void binary_scalar_tester(const F& f, const T1& x, const T2& y) { template * = nullptr, require_std_vector_t* = nullptr> -void binary_scalar_tester(const F& f, const T1& x, const T2& y) { +inline void binary_scalar_tester(const F& f, const T1& x, const T2& y) { binary_scalar_tester_impl(f, x, y); binary_scalar_tester_impl(f, x.transpose(), y); binary_scalar_tester_impl(f, x.array(), y); diff --git a/test/unit/math/prim/fun/binomial_coefficient_log_test.cpp b/test/unit/math/prim/fun/binomial_coefficient_log_test.cpp index 439eaf3a8c1..7ab57f460b8 100644 --- a/test/unit/math/prim/fun/binomial_coefficient_log_test.cpp +++ b/test/unit/math/prim/fun/binomial_coefficient_log_test.cpp @@ -5,7 +5,7 @@ #include template -void test_binom_coefficient(const T_N& N, const T_n& n) { +inline void test_binom_coefficient(const T_N& N, const T_n& n) { using stan::math::binomial_coefficient_log; EXPECT_FLOAT_EQ(lgamma(N + 1) - lgamma(n + 1) - lgamma(N - n + 1), binomial_coefficient_log(N, n)) diff --git a/test/unit/math/prim/fun/choose_test.cpp b/test/unit/math/prim/fun/choose_test.cpp index b5bc0f197c5..0630db85065 100644 --- a/test/unit/math/prim/fun/choose_test.cpp +++ b/test/unit/math/prim/fun/choose_test.cpp @@ -13,7 +13,7 @@ int finite_choose_test(int N, int n) { return round_to_int(exp(lgamma(N + 1) - lgamma(n + 1) - lgamma(N - n + 1))); } -void test_choose_finite(int N, int n) { +inline void test_choose_finite(int N, int n) { using stan::math::choose; if (n > N) EXPECT_EQ(0, choose(N, n)); diff --git a/test/unit/math/prim/fun/crossprod_test.cpp b/test/unit/math/prim/fun/crossprod_test.cpp index 6bdb9b8682a..b81f59575cd 100644 --- a/test/unit/math/prim/fun/crossprod_test.cpp +++ b/test/unit/math/prim/fun/crossprod_test.cpp @@ -1,7 +1,7 @@ #include #include -void test_crossprod(const stan::math::matrix_d& x) { +inline void test_crossprod(const stan::math::matrix_d& x) { using stan::math::crossprod; stan::math::matrix_d y = crossprod(x); stan::math::matrix_d xtx = x.transpose() * x; diff --git a/test/unit/math/prim/fun/cumulative_sum_test.cpp b/test/unit/math/prim/fun/cumulative_sum_test.cpp index f1bf96fce04..34634c978f8 100644 --- a/test/unit/math/prim/fun/cumulative_sum_test.cpp +++ b/test/unit/math/prim/fun/cumulative_sum_test.cpp @@ -3,7 +3,7 @@ #include template -void test_cumulative_sum() { +inline void test_cumulative_sum() { using stan::math::cumulative_sum; T c(1); diff --git a/test/unit/math/prim/fun/divide_test.cpp b/test/unit/math/prim/fun/divide_test.cpp index 0b5c0b1dd58..c1227f2a51d 100644 --- a/test/unit/math/prim/fun/divide_test.cpp +++ b/test/unit/math/prim/fun/divide_test.cpp @@ -37,7 +37,7 @@ TEST(MathFunctions, divide) { EXPECT_EQ(-2, divide(-44, 17)); } -void test_divide_modulus(int a, int b) { +inline void test_divide_modulus(int a, int b) { using stan::math::divide; using stan::math::modulus; EXPECT_EQ(a, divide(a, b) * b + modulus(a, b)); diff --git a/test/unit/math/prim/fun/linspaced_row_vector_test.cpp b/test/unit/math/prim/fun/linspaced_row_vector_test.cpp index a5d08ba3305..2719decdb08 100644 --- a/test/unit/math/prim/fun/linspaced_row_vector_test.cpp +++ b/test/unit/math/prim/fun/linspaced_row_vector_test.cpp @@ -3,7 +3,7 @@ #include #include -void expect_linspaced_row_vector(int K, double low, double high, +inline void expect_linspaced_row_vector(int K, double low, double high, const Eigen::RowVectorXd& expected) { Eigen::RowVectorXd found = stan::math::linspaced_row_vector(K, low, high); EXPECT_MATRIX_FLOAT_EQ(expected, found); diff --git a/test/unit/math/prim/fun/linspaced_vector_test.cpp b/test/unit/math/prim/fun/linspaced_vector_test.cpp index 26ec8524347..7520f0a35c3 100644 --- a/test/unit/math/prim/fun/linspaced_vector_test.cpp +++ b/test/unit/math/prim/fun/linspaced_vector_test.cpp @@ -3,7 +3,7 @@ #include #include -void expect_linspaced_vector(int K, double low, double high, +inline void expect_linspaced_vector(int K, double low, double high, const Eigen::VectorXd& expected) { Eigen::VectorXd found = stan::math::linspaced_vector(K, low, high); EXPECT_MATRIX_FLOAT_EQ(expected, found); diff --git a/test/unit/math/prim/fun/log_diff_exp_test.cpp b/test/unit/math/prim/fun/log_diff_exp_test.cpp index e1177030a2c..1ba173573ff 100644 --- a/test/unit/math/prim/fun/log_diff_exp_test.cpp +++ b/test/unit/math/prim/fun/log_diff_exp_test.cpp @@ -4,7 +4,7 @@ #include #include -void test_log_diff_exp(double a, double b) { +inline void test_log_diff_exp(double a, double b) { using stan::math::log_diff_exp; using std::exp; using std::log; diff --git a/test/unit/math/prim/fun/log_mix_test.cpp b/test/unit/math/prim/fun/log_mix_test.cpp index 8ea8fb77d6a..f28405a45dd 100644 --- a/test/unit/math/prim/fun/log_mix_test.cpp +++ b/test/unit/math/prim/fun/log_mix_test.cpp @@ -17,7 +17,7 @@ TEST(MathFunctions, log_mix_exceptions) { EXPECT_THROW(log_mix(0.5, 10, std::numeric_limits::quiet_NaN()), std::domain_error); } -void test_log_mix(double theta, double lambda1, double lambda2) { +inline void test_log_mix(double theta, double lambda1, double lambda2) { using stan::math::log_mix; using stan::math::row_vector_d; using stan::math::vector_d; @@ -34,7 +34,7 @@ TEST(MathFunctions, log_mix_values) { } template -void log_mix_val_test(T_a a, T_b b) { +inline void log_mix_val_test(T_a a, T_b b) { using stan::math::log_mix; a[0] = 0.321; a[1] = 0.115; diff --git a/test/unit/math/prim/fun/log_softmax_test.cpp b/test/unit/math/prim/fun/log_softmax_test.cpp index a75a50e281c..0b84292fd1e 100644 --- a/test/unit/math/prim/fun/log_softmax_test.cpp +++ b/test/unit/math/prim/fun/log_softmax_test.cpp @@ -2,7 +2,7 @@ #include #include -void test_log_softmax(const Eigen::Matrix& theta) { +inline void test_log_softmax(const Eigen::Matrix& theta) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::log_softmax; diff --git a/test/unit/math/prim/fun/log_sum_exp_test.cpp b/test/unit/math/prim/fun/log_sum_exp_test.cpp index 6b13f9c4970..b515e61ae77 100644 --- a/test/unit/math/prim/fun/log_sum_exp_test.cpp +++ b/test/unit/math/prim/fun/log_sum_exp_test.cpp @@ -5,14 +5,14 @@ #include #include -void test_log_sum_exp(double a, double b) { +inline void test_log_sum_exp(double a, double b) { using stan::math::log_sum_exp; using std::exp; using std::log; EXPECT_FLOAT_EQ(log(exp(a) + exp(b)), log_sum_exp(a, b)); } -void test_log_sum_exp(const std::vector& as) { +inline void test_log_sum_exp(const std::vector& as) { using stan::math::log_sum_exp; using std::exp; using std::log; @@ -73,7 +73,7 @@ TEST(MathFunctions, log_sum_exp_nan) { } template -void test_log_sum_exp(const Eigen::Matrix& as) { +inline void test_log_sum_exp(const Eigen::Matrix& as) { using stan::math::log_sum_exp; using std::exp; using std::log; diff --git a/test/unit/math/prim/fun/multiply_lower_tri_self_transpose_test.cpp b/test/unit/math/prim/fun/multiply_lower_tri_self_transpose_test.cpp index 4d8332fefb2..4c7a9289b1d 100644 --- a/test/unit/math/prim/fun/multiply_lower_tri_self_transpose_test.cpp +++ b/test/unit/math/prim/fun/multiply_lower_tri_self_transpose_test.cpp @@ -1,7 +1,7 @@ #include #include -stan::math::matrix_d generate_large_L_tri_mat() { +inline stan::math::matrix_d generate_large_L_tri_mat() { stan::math::matrix_d x; double vals[10000]; @@ -15,7 +15,7 @@ stan::math::matrix_d generate_large_L_tri_mat() { return x; } -void test_multiply_lower_tri_self_transpose(const stan::math::matrix_d& x) { +inline void test_multiply_lower_tri_self_transpose(const stan::math::matrix_d& x) { using stan::math::multiply_lower_tri_self_transpose; stan::math::matrix_d y = multiply_lower_tri_self_transpose(x); stan::math::matrix_d xp = x; diff --git a/test/unit/math/prim/fun/promote_type_test_util.hpp b/test/unit/math/prim/fun/promote_type_test_util.hpp index 950d95ef956..c7eaa64cdd0 100644 --- a/test/unit/math/prim/fun/promote_type_test_util.hpp +++ b/test/unit/math/prim/fun/promote_type_test_util.hpp @@ -8,7 +8,7 @@ // E is expected value of promote_scalar_type::type template -void expect_promote_type() { +inline void expect_promote_type() { using stan::math::promote_scalar_type; using stan::math::test::type_name; using promoted_S = typename promote_scalar_type::type; diff --git a/test/unit/math/prim/fun/quantile_test.cpp b/test/unit/math/prim/fun/quantile_test.cpp index 957a2a2974a..a939a1098ac 100644 --- a/test/unit/math/prim/fun/quantile_test.cpp +++ b/test/unit/math/prim/fun/quantile_test.cpp @@ -5,7 +5,7 @@ #include template -void test_quantile_double() { +inline void test_quantile_double() { using stan::math::index_type_t; using stan::math::quantile; @@ -87,7 +87,7 @@ TEST(MathFunctions, quantileStdVecInt) { } template * = nullptr> -void test_quantile_double() { +inline void test_quantile_double() { using stan::math::index_type_t; using stan::math::quantile; diff --git a/test/unit/math/prim/fun/rank_test.cpp b/test/unit/math/prim/fun/rank_test.cpp index 6e71b59cd3a..711fd755d73 100644 --- a/test/unit/math/prim/fun/rank_test.cpp +++ b/test/unit/math/prim/fun/rank_test.cpp @@ -3,7 +3,7 @@ #include template -void test_rank() { +inline void test_rank() { using stan::math::rank; T c(1); @@ -37,7 +37,7 @@ void test_rank() { } template -void test_rank_int() { +inline void test_rank_int() { using stan::math::rank; T c(1); diff --git a/test/unit/math/prim/fun/scalar_seq_view_test.cpp b/test/unit/math/prim/fun/scalar_seq_view_test.cpp index 92f0052958b..8b887046e79 100644 --- a/test/unit/math/prim/fun/scalar_seq_view_test.cpp +++ b/test/unit/math/prim/fun/scalar_seq_view_test.cpp @@ -58,7 +58,7 @@ TEST(MathMetaPrim, ScalarSeqViewArray) { } template -void expect_scalar_seq_view_values(C v) { +inline void expect_scalar_seq_view_values(C v) { using stan::scalar_seq_view; v << 1.1, 2.2, 3.3, 4.4; diff --git a/test/unit/math/prim/fun/sort_indices_test.cpp b/test/unit/math/prim/fun/sort_indices_test.cpp index 44085083454..99e470bb4c3 100644 --- a/test/unit/math/prim/fun/sort_indices_test.cpp +++ b/test/unit/math/prim/fun/sort_indices_test.cpp @@ -3,7 +3,7 @@ #include template -void test_sort_indices_asc() { +inline void test_sort_indices_asc() { using stan::math::sort_indices_asc; using idx_t = stan::math::index_type_t; @@ -47,7 +47,7 @@ TEST(MathMatrixPrimMat, sort_indices_asc) { } template -void test_sort_indices_desc() { +inline void test_sort_indices_desc() { using stan::math::sort_indices_desc; using idx_t = stan::math::index_type_t; diff --git a/test/unit/math/prim/fun/sort_test.cpp b/test/unit/math/prim/fun/sort_test.cpp index 55de6a3b0fd..a2ca1f10c1e 100644 --- a/test/unit/math/prim/fun/sort_test.cpp +++ b/test/unit/math/prim/fun/sort_test.cpp @@ -6,7 +6,7 @@ #include template -void test_sort_asc() { +inline void test_sort_asc() { using stan::math::index_type_t; using stan::math::sort_asc; @@ -72,7 +72,7 @@ TEST(MathMatrixPrimMat, sort_asc) { } template -void test_sort_desc() { +inline void test_sort_desc() { using stan::math::index_type_t; using stan::math::sort_desc; diff --git a/test/unit/math/prim/fun/sort_test_util.hpp b/test/unit/math/prim/fun/sort_test_util.hpp index a6241cb6467..e36b80830f9 100644 --- a/test/unit/math/prim/fun/sort_test_util.hpp +++ b/test/unit/math/prim/fun/sort_test_util.hpp @@ -6,7 +6,7 @@ #include template -void test_sort_asc_throws() { +inline void test_sort_asc_throws() { using stan::math::sort_asc; C xs0; @@ -31,7 +31,7 @@ void test_sort_asc_throws() { } template -void test_sort_desc_throws() { +inline void test_sort_desc_throws() { using stan::math::sort_desc; C xs0; diff --git a/test/unit/math/prim/fun/tcrossprod_test.cpp b/test/unit/math/prim/fun/tcrossprod_test.cpp index a19bfe37e29..b54d9702305 100644 --- a/test/unit/math/prim/fun/tcrossprod_test.cpp +++ b/test/unit/math/prim/fun/tcrossprod_test.cpp @@ -1,7 +1,7 @@ #include #include -void test_tcrossprod(const stan::math::matrix_d& x) { +inline void test_tcrossprod(const stan::math::matrix_d& x) { using stan::math::tcrossprod; stan::math::matrix_d y = tcrossprod(x); stan::math::matrix_d xxt = x * x.transpose(); diff --git a/test/unit/math/prim/fun/ternary_scalar_tester.hpp b/test/unit/math/prim/fun/ternary_scalar_tester.hpp index a17b887669c..c509f278e4a 100644 --- a/test/unit/math/prim/fun/ternary_scalar_tester.hpp +++ b/test/unit/math/prim/fun/ternary_scalar_tester.hpp @@ -24,7 +24,7 @@ namespace test { */ template * = nullptr> -void ternary_scalar_tester_impl(const F& f, const T1& x, const T2& y, +inline void ternary_scalar_tester_impl(const F& f, const T1& x, const T2& y, const T3& z) { auto mat_mat_mat = math::eval(f(x, y, z)); auto mat_mat_scal = math::eval(f(x, y, z(0))); @@ -146,7 +146,7 @@ void ternary_scalar_tester_impl(const F& f, const T1& x, const T2& y, */ template * = nullptr> -void ternary_scalar_tester_impl(const F& f, const T1& x, const T2& y, +inline void ternary_scalar_tester_impl(const F& f, const T1& x, const T2& y, const T3& z) { auto mat_mat_mat = math::eval(f(x, y, z)); auto mat_mat_scal = math::eval(f(x, y, z[0])); @@ -266,7 +266,7 @@ void ternary_scalar_tester_impl(const F& f, const T1& x, const T2& y, */ template * = nullptr> -void ternary_scalar_tester(const F& f, const T1& x, const T2& y, const T3& z) { +inline void ternary_scalar_tester(const F& f, const T1& x, const T2& y, const T3& z) { ternary_scalar_tester_impl(f, x, y, z); ternary_scalar_tester_impl(f, x.transpose().eval(), y.transpose().eval(), z.transpose().eval()); diff --git a/test/unit/math/prim/fun/to_complex_test.cpp b/test/unit/math/prim/fun/to_complex_test.cpp index 7f4d0e340aa..575dc6fa03a 100644 --- a/test/unit/math/prim/fun/to_complex_test.cpp +++ b/test/unit/math/prim/fun/to_complex_test.cpp @@ -3,7 +3,7 @@ #include template -void test_constructor(const T& re, const S& im) { +inline void test_constructor(const T& re, const S& im) { std::complex z1(re, im); std::complex z2 = stan::math::to_complex(re, im); EXPECT_EQ(z1, z2); diff --git a/test/unit/math/prim/fun/to_matrix_test.cpp b/test/unit/math/prim/fun/to_matrix_test.cpp index 5776a5f7183..5862c0a4afa 100644 --- a/test/unit/math/prim/fun/to_matrix_test.cpp +++ b/test/unit/math/prim/fun/to_matrix_test.cpp @@ -17,7 +17,7 @@ inline Eigen::Matrix row_major_to_column_major( } // [T] -> Matrix -void test_to_matrix_array_answers(int m, int n) { +inline void test_to_matrix_array_answers(int m, int n) { using stan::math::to_matrix; std::vector vec(m * n); std::vector vec_int(m * n); @@ -55,7 +55,7 @@ TEST(ToMatrixArray, exceptions) { } // Matrix -> Matrix -void test_to_matrix_matrix_answers(int m, int n) { +inline void test_to_matrix_matrix_answers(int m, int n) { using stan::math::to_matrix; Eigen::MatrixXd a(m, n); for (int i = 0; i < m * n; ++i) @@ -71,7 +71,7 @@ TEST(ToMatrixMatrix, answers) { } // Matrix -> Matrix (with reshape) -void test_to_matrix_matrix_reshape_answers(int m1, int n1, int m2, int n2) { +inline void test_to_matrix_matrix_reshape_answers(int m1, int n1, int m2, int n2) { using stan::math::to_matrix; Eigen::MatrixXd a(m1, n1); Eigen::MatrixXd b(m2, n2); @@ -120,7 +120,7 @@ TEST(ToMatrixMatrixReshape, answers) { } // Vector -> Matrix -void test_to_vector_matrix_answers(int m, int m2, int n2) { +inline void test_to_vector_matrix_answers(int m, int m2, int n2) { using stan::math::to_matrix; Eigen::VectorXd a(m); Eigen::MatrixXd b(m2, n2); @@ -161,7 +161,7 @@ TEST(ToMatrixVector, answers) { } // RowVector -> Matrix -void test_to_row_vector_matrix_answers(int n, int m2, int n2) { +inline void test_to_row_vector_matrix_answers(int n, int m2, int n2) { using stan::math::to_matrix; Eigen::RowVectorXd a(n); Eigen::MatrixXd b(m2, n2); @@ -202,7 +202,7 @@ TEST(ToMatrixRowVector, answers) { } // [[T]] -> Matrix -void test_to_matrix_2darray_answers(int m, int n) { +inline void test_to_matrix_2darray_answers(int m, int n) { using stan::math::to_matrix; std::vector > vec(m, std::vector(n)); std::vector > vec_int(m, std::vector(n)); diff --git a/test/unit/math/prim/functor/hcubature_test.cpp b/test/unit/math/prim/functor/hcubature_test.cpp index 79a3b917f05..0669d7a9086 100644 --- a/test/unit/math/prim/functor/hcubature_test.cpp +++ b/test/unit/math/prim/functor/hcubature_test.cpp @@ -101,7 +101,7 @@ inline auto f7(const T_x& x, double a) { template -void test_integration(const F& f, const ArgsTupleT& pars, int dim, const T_a& a, +inline void test_integration(const F& f, const ArgsTupleT& pars, int dim, const T_a& a, const T_b& b, int maxEval, double reqAbsError, const T_relerr& reqRelError, double val) { using stan::math::hcubature; diff --git a/test/unit/math/prim/functor/integrate_1d_impl_test.cpp b/test/unit/math/prim/functor/integrate_1d_impl_test.cpp index 9d6c665800e..9ca35d7123d 100644 --- a/test/unit/math/prim/functor/integrate_1d_impl_test.cpp +++ b/test/unit/math/prim/functor/integrate_1d_impl_test.cpp @@ -150,7 +150,7 @@ struct f16 { } }; -double lbaX_pdf(double X, double t, double A, double v, double s, +inline double lbaX_pdf(double X, double t, double A, double v, double s, std::ostream *pstream__) { double b_A_tv_ts; double b_tv_ts; @@ -166,7 +166,7 @@ double lbaX_pdf(double X, double t, double A, double v, double s, return pdf; } -double lbaX_cdf(double X, double t, double A, double v, double s, +inline double lbaX_cdf(double X, double t, double A, double v, double s, std::ostream *pstream__) { double b_A_tv; double b_tv; @@ -192,7 +192,7 @@ double lbaX_cdf(double X, double t, double A, double v, double s, return cdf; } -double rank_density(double x, double xc, const std::vector &theta, +inline double rank_density(double x, double xc, const std::vector &theta, const std::vector &x_r, const std::vector &x_i, std::ostream *pstream__) { double t = theta[0]; @@ -214,7 +214,7 @@ struct rank_density_functor__ { } }; -double order(double down, double up, const std::vector &theta, +inline double order(double down, double up, const std::vector &theta, const std::vector &x_r, std::ostream *pstream__) { std::vector x_i; @@ -252,7 +252,7 @@ double order(double down, double up, const std::vector &theta, * @param val correct value of integral */ template -void test_integration(const F &f, double a, double b, double val, +inline void test_integration(const F &f, double a, double b, double val, const Args &... args) { using stan::math::integrate_1d_impl; diff --git a/test/unit/math/prim/functor/integrate_1d_test.cpp b/test/unit/math/prim/functor/integrate_1d_test.cpp index fca9c52e0de..c9c90383f37 100644 --- a/test/unit/math/prim/functor/integrate_1d_test.cpp +++ b/test/unit/math/prim/functor/integrate_1d_test.cpp @@ -214,7 +214,7 @@ struct f17 { } }; -double lbaX_pdf(double X, double t, double A, double v, double s, +inline double lbaX_pdf(double X, double t, double A, double v, double s, std::ostream *pstream__) { double b_A_tv_ts; double b_tv_ts; @@ -230,7 +230,7 @@ double lbaX_pdf(double X, double t, double A, double v, double s, return pdf; } -double lbaX_cdf(double X, double t, double A, double v, double s, +inline double lbaX_cdf(double X, double t, double A, double v, double s, std::ostream *pstream__) { double b_A_tv; double b_tv; @@ -256,7 +256,7 @@ double lbaX_cdf(double X, double t, double A, double v, double s, return cdf; } -double rank_density(double x, double xc, const std::vector &theta, +inline double rank_density(double x, double xc, const std::vector &theta, const std::vector &x_r, const std::vector &x_i, std::ostream *pstream__) { double t = theta[0]; @@ -277,7 +277,7 @@ struct rank_density_functor__ { } }; -double order(double down, double up, const std::vector &theta, +inline double order(double down, double up, const std::vector &theta, const std::vector &x_r, std::ostream *pstream__) { std::vector x_i; @@ -315,7 +315,7 @@ double order(double down, double up, const std::vector &theta, * @param val correct value of integral */ template -void test_integration(const F &f, double a, double b, +inline void test_integration(const F &f, double a, double b, std::vector thetas, const std::vector &x_r, const std::vector &x_i, double val) { diff --git a/test/unit/math/prim/functor/reduce_sum_util.hpp b/test/unit/math/prim/functor/reduce_sum_util.hpp index 94025e06664..18172224e22 100644 --- a/test/unit/math/prim/functor/reduce_sum_util.hpp +++ b/test/unit/math/prim/functor/reduce_sum_util.hpp @@ -11,7 +11,7 @@ namespace stan { namespace math { namespace test { -std::ostream* get_new_msg() { +inline std::ostream* get_new_msg() { std::ostream* msgs = nullptr; return msgs; } @@ -147,7 +147,7 @@ struct grouped_count_lpdf { }; template -void test_slices(T1 result, T2&& vec_value, Args&&... args) { +inline void test_slices(T1 result, T2&& vec_value, Args&&... args) { using stan::math::test::get_new_msg; using stan::math::test::sum_lpdf; diff --git a/test/unit/math/prim/functor/utils_threads.hpp b/test/unit/math/prim/functor/utils_threads.hpp index 45853058e2d..77de14ffeb2 100644 --- a/test/unit/math/prim/functor/utils_threads.hpp +++ b/test/unit/math/prim/functor/utils_threads.hpp @@ -5,7 +5,7 @@ #include // utility to set number of threads to use -void set_n_threads(int num_threads) { +inline void set_n_threads(int num_threads) { static char env_string[256]; std::string num_threads_str = std::to_string(num_threads); snprintf(env_string, sizeof(env_string), "STAN_NUM_THREADS=%s", @@ -14,7 +14,7 @@ void set_n_threads(int num_threads) { } // Can't easily use std::string as putenv require non-const char* -void set_n_threads(const char* value) { +inline void set_n_threads(const char* value) { static char env_string[256]; snprintf(env_string, sizeof(env_string), "STAN_NUM_THREADS=%s", value); putenv(env_string); diff --git a/test/unit/math/prim/meta/apply_template_permutations.hpp b/test/unit/math/prim/meta/apply_template_permutations.hpp index 46bc9dc1fc0..2dc804c0711 100644 --- a/test/unit/math/prim/meta/apply_template_permutations.hpp +++ b/test/unit/math/prim/meta/apply_template_permutations.hpp @@ -132,7 +132,7 @@ struct apply_template_permutations_helper -void apply_template_permutations(const T_functor& func, const T_param& param) { +inline void apply_template_permutations(const T_functor& func, const T_param& param) { apply_template_permutations_helper::value - 1, diff --git a/test/unit/math/prim/meta/is_constant_all_test.cpp b/test/unit/math/prim/meta/is_constant_all_test.cpp index f1458b71060..3aae724cf86 100644 --- a/test/unit/math/prim/meta/is_constant_all_test.cpp +++ b/test/unit/math/prim/meta/is_constant_all_test.cpp @@ -3,7 +3,7 @@ #include template -void expect_is_const() { +inline void expect_is_const() { using stan::is_constant_all; bool temp = is_constant_all::value; EXPECT_TRUE(temp); diff --git a/test/unit/math/prim/prob/VectorRNGTestRig.hpp b/test/unit/math/prim/prob/VectorRNGTestRig.hpp index e7d347f17cf..1de8889e4b1 100644 --- a/test/unit/math/prim/prob/VectorRNGTestRig.hpp +++ b/test/unit/math/prim/prob/VectorRNGTestRig.hpp @@ -218,32 +218,32 @@ class VectorRNGTestRig { }; template <> -std::vector VectorRNGTestRig::get_good_p1() const { +inline std::vector VectorRNGTestRig::get_good_p1() const { return good_p1_int_; } template <> -std::vector VectorRNGTestRig::get_bad_p1() const { +inline std::vector VectorRNGTestRig::get_bad_p1() const { return bad_p1_int_; } template <> -std::vector VectorRNGTestRig::get_good_p2() const { +inline std::vector VectorRNGTestRig::get_good_p2() const { return good_p2_int_; } template <> -std::vector VectorRNGTestRig::get_bad_p2() const { +inline std::vector VectorRNGTestRig::get_bad_p2() const { return bad_p2_int_; } template <> -std::vector VectorRNGTestRig::get_good_p3() const { +inline std::vector VectorRNGTestRig::get_good_p3() const { return good_p3_int_; } template <> -std::vector VectorRNGTestRig::get_bad_p3() const { +inline std::vector VectorRNGTestRig::get_bad_p3() const { return bad_p3_int_; } diff --git a/test/unit/math/prim/prob/dirichlet_test.cpp b/test/unit/math/prim/prob/dirichlet_test.cpp index 777252a54e7..e2386ed08a7 100644 --- a/test/unit/math/prim/prob/dirichlet_test.cpp +++ b/test/unit/math/prim/prob/dirichlet_test.cpp @@ -131,14 +131,14 @@ TEST(ProbDistributions, DirichletBounds) { << "size mismatch: theta is a 2-vector, alpha is a 4-vector"; } -double chi_square(std::vector bin, std::vector expect) { +inline double chi_square(std::vector bin, std::vector expect) { double chi = 0; for (size_t j = 0; j < bin.size(); j++) chi += ((bin[j] - expect[j]) * (bin[j] - expect[j]) / expect[j]); return chi; } -void test_dirichlet3_1(Eigen::VectorXd alpha) { +inline void test_dirichlet3_1(Eigen::VectorXd alpha) { boost::random::mt19937 rng; int N = 10000; int K = stan::math::round(2 * std::pow(N, 0.4)); @@ -164,7 +164,7 @@ void test_dirichlet3_1(Eigen::VectorXd alpha) { EXPECT_TRUE(chi_square(bin, expect) < quantile(complement(mydist, 1e-6))); } -void test_dirichlet3_2(Eigen::VectorXd alpha) { +inline void test_dirichlet3_2(Eigen::VectorXd alpha) { using Eigen::Dynamic; using Eigen::Matrix; using Eigen::VectorXd; diff --git a/test/unit/math/prim/prob/hmm_util.hpp b/test/unit/math/prim/prob/hmm_util.hpp index 9f4f3e011bb..fe114281107 100644 --- a/test/unit/math/prim/prob/hmm_util.hpp +++ b/test/unit/math/prim/prob/hmm_util.hpp @@ -49,7 +49,7 @@ inline stan::return_type_t hmm_marginal_test_wrapper( * 0: normal(mu, sigma) * 1: normal(-mu, sigma) */ -double state_lpdf(double y, double abs_mu, double sigma, int state) { +inline double state_lpdf(double y, double abs_mu, double sigma, int state) { int x = state == 0 ? 1 : -1; double chi = (y - x * abs_mu) / sigma; return -0.5 * chi * chi - 0.5 * std::log(2 * M_PI) - std::log(sigma); diff --git a/test/unit/math/prim/prob/loglogistic_test.cpp b/test/unit/math/prim/prob/loglogistic_test.cpp index 94a38ea4cc7..38422afd7ee 100644 --- a/test/unit/math/prim/prob/loglogistic_test.cpp +++ b/test/unit/math/prim/prob/loglogistic_test.cpp @@ -23,7 +23,7 @@ class LoglogisticTestRig : public VectorRNGTestRig { } }; -double icdf(double x, double alpha, double beta) { +inline double icdf(double x, double alpha, double beta) { return alpha * pow(x / (1 - x), 1 / beta); } diff --git a/test/unit/math/prim/prob/matrix_normal_prec_rng_test.cpp b/test/unit/math/prim/prob/matrix_normal_prec_rng_test.cpp index 32a550ef72b..0d3b4f7cc9f 100644 --- a/test/unit/math/prim/prob/matrix_normal_prec_rng_test.cpp +++ b/test/unit/math/prim/prob/matrix_normal_prec_rng_test.cpp @@ -131,7 +131,7 @@ TEST(ProbDistributionsMatrixNormalPrecRng, ErrorSize) { * Assert that the samples come from the normal distribution with this * mean and variance. */ -void assert_matches_normal_distribution(const double mean, +inline void assert_matches_normal_distribution(const double mean, const double variance, const std::vector &samples) { using Eigen::MatrixXd; @@ -146,7 +146,7 @@ void assert_matches_normal_distribution(const double mean, assert_matches_quantiles(samples, quantiles, 1e-6); } -std::vector extract_entry(const unsigned int r, const unsigned int c, +inline std::vector extract_entry(const unsigned int r, const unsigned int c, const std::vector &samples) { using Eigen::MatrixXd; using stan::math::matrix_normal_prec_rng; @@ -156,7 +156,7 @@ std::vector extract_entry(const unsigned int r, const unsigned int c, return univariate_samples; } -std::vector extract_sum_of_entries( +inline std::vector extract_sum_of_entries( const unsigned int r1, const unsigned int c1, const unsigned int r2, const unsigned int c2, const std::vector &samples) { using Eigen::MatrixXd; diff --git a/test/unit/math/prim/prob/neg_binomial_test.cpp b/test/unit/math/prim/prob/neg_binomial_test.cpp index a3696eaa49a..8a18143f618 100644 --- a/test/unit/math/prim/prob/neg_binomial_test.cpp +++ b/test/unit/math/prim/prob/neg_binomial_test.cpp @@ -71,7 +71,7 @@ TEST(ProbDistributionsNegBinomial, error_check) { } } -void expected_bin_sizes(double* expect, const int K, const int N, +inline void expected_bin_sizes(double* expect, const int K, const int N, const double alpha, const double beta) { long double p = 0; for (int i = 0; i < K; i++) { diff --git a/test/unit/math/prim/prob/ordered_logistic_test.cpp b/test/unit/math/prim/prob/ordered_logistic_test.cpp index 9f71fb8b253..e87a14734f6 100644 --- a/test/unit/math/prim/prob/ordered_logistic_test.cpp +++ b/test/unit/math/prim/prob/ordered_logistic_test.cpp @@ -5,7 +5,7 @@ #include #include -stan::math::vector_d get_simplex_inv_logit(double lambda, +inline stan::math::vector_d get_simplex_inv_logit(double lambda, const stan::math::vector_d& c) { using stan::math::inv_logit; int K = c.size() + 1; diff --git a/test/unit/math/prim/prob/ordered_probit_test.cpp b/test/unit/math/prim/prob/ordered_probit_test.cpp index 44ca2754e89..eb6978aaa92 100644 --- a/test/unit/math/prim/prob/ordered_probit_test.cpp +++ b/test/unit/math/prim/prob/ordered_probit_test.cpp @@ -4,7 +4,7 @@ #include #include -stan::math::vector_d get_simplex_Phi(double lambda, +inline stan::math::vector_d get_simplex_Phi(double lambda, const stan::math::vector_d& c) { using stan::math::Phi; int K = c.size() + 1; diff --git a/test/unit/math/prim/prob/skew_double_exponential_test.cpp b/test/unit/math/prim/prob/skew_double_exponential_test.cpp index 3c9b27bc0a1..9132a2f188c 100644 --- a/test/unit/math/prim/prob/skew_double_exponential_test.cpp +++ b/test/unit/math/prim/prob/skew_double_exponential_test.cpp @@ -22,7 +22,7 @@ class SkewDoubleExponentialTestRig : public VectorRNGTestRig { } }; -double icdf(double z, double mu, double sigma, double tau) { +inline double icdf(double z, double mu, double sigma, double tau) { if (z < tau) { return log(z / tau) * sigma / (2.0 * (1.0 - tau)) + mu; } else { diff --git a/test/unit/math/prim/prob/util.hpp b/test/unit/math/prim/prob/util.hpp index 0089e0f584b..eac4d589747 100644 --- a/test/unit/math/prim/prob/util.hpp +++ b/test/unit/math/prim/prob/util.hpp @@ -10,7 +10,7 @@ * Uses a chi-squared test to assert that a vector of observed counts * is consistent with a vector of expected counts. Useful for testing RNGs. */ -void assert_chi_squared(const std::vector& counts, +inline void assert_chi_squared(const std::vector& counts, const std::vector& expected, double tolerance) { int bins = counts.size(); EXPECT_EQ(bins, expected.size()); @@ -33,7 +33,7 @@ void assert_chi_squared(const std::vector& counts, * upper bound bin_boundaries[i], using a chi-squared goodness of fit * test. bin_boundaries is assumed sorted in increasing order. **/ -void assert_matches_bins(const std::vector& samples, +inline void assert_matches_bins(const std::vector& samples, const std::vector& bin_boundaries, const std::vector& proportions, double tolerance) { @@ -71,7 +71,7 @@ void assert_matches_bins(const std::vector& samples, * distributed among the quantiles.size() equiprobable bins, who's * upper bounds are given in quantiles in increasing order. */ -void assert_matches_quantiles(const std::vector& samples, +inline void assert_matches_quantiles(const std::vector& samples, const std::vector& quantiles, double tolerance) { int K = quantiles.size(); diff --git a/test/unit/math/prim/prob/vector_rng_test_helper.hpp b/test/unit/math/prim/prob/vector_rng_test_helper.hpp index 8c49d65aa9b..6abe303971b 100644 --- a/test/unit/math/prim/prob/vector_rng_test_helper.hpp +++ b/test/unit/math/prim/prob/vector_rng_test_helper.hpp @@ -17,7 +17,7 @@ namespace internal { template -void shuffle_container(C& x) { +inline void shuffle_container(C& x) { std::random_device rng; std::mt19937 twister(rng()); std::shuffle(x.begin(), x.end(), twister); @@ -39,7 +39,7 @@ using ArgumentTypes * @param params Values to copy into params */ template -void assign_parameter_values(T_param& params, +inline void assign_parameter_values(T_param& params, const std::vector& values) { if (values.size() == 0) return; @@ -58,7 +58,7 @@ void assign_parameter_values(T_param& params, * @param params Parameter vector to write values to * @param params Values to copy into params */ -void assign_parameter_values(std::vector& params, +inline void assign_parameter_values(std::vector& params, const std::vector& values) { if (values.size() == 0) return; @@ -77,7 +77,7 @@ void assign_parameter_values(std::vector& params, * @param params Parameter vector to write values to * @param params Values to copy into params */ -void assign_parameter_values(std::vector& params, +inline void assign_parameter_values(std::vector& params, const std::vector& values) { if (values.size() == 0) return; @@ -93,7 +93,7 @@ void assign_parameter_values(std::vector& params, * @param param Output parameter to write value to * @param params Vector with value to copy into param */ -void assign_parameter_values(double& param, const std::vector& values) { +inline void assign_parameter_values(double& param, const std::vector& values) { if (values.size() == 0) return; @@ -106,7 +106,7 @@ void assign_parameter_values(double& param, const std::vector& values) { * @param param Output parameter to write value to * @param params Vector with value to copy into param */ -void assign_parameter_values(int& param, const std::vector& values) { +inline void assign_parameter_values(int& param, const std::vector& values) { if (values.size() == 0) return; @@ -121,7 +121,7 @@ void assign_parameter_values(int& param, const std::vector& values) { * @param N New size */ template -void resize_if_vector(T& v, int N) { +inline void resize_if_vector(T& v, int N) { v.resize(N); } @@ -129,13 +129,13 @@ void resize_if_vector(T& v, int N) { * For doubles, resize_if_vector does nothing */ template <> -void resize_if_vector(double& v, int N) {} +inline void resize_if_vector(double& v, int N) {} /* * For ints, resize_if_vector does nothing */ template <> -void resize_if_vector(int& v, int N) {} +inline void resize_if_vector(int& v, int N) {} /* * check_dist_throws feeds rig.generate_samples various @@ -295,7 +295,7 @@ struct check_dist_throws { * @param T_rig Test rig for random number generator */ template -void check_dist_throws_all_types(const T_rig& rig) { +inline void check_dist_throws_all_types(const T_rig& rig) { apply_template_permutations( check_dist_throws{}, rig); } @@ -310,7 +310,7 @@ void check_dist_throws_all_types(const T_rig& rig) { * @param T_rig Test rig for random number generator */ template -void check_dist_throws_int_first_argument(const T_rig& rig) { +inline void check_dist_throws_int_first_argument(const T_rig& rig) { apply_template_permutations>, ArgumentTypes, ArgumentTypes>(check_dist_throws{}, rig); } @@ -326,7 +326,7 @@ void check_dist_throws_int_first_argument(const T_rig& rig) { * @param T_rig Test rig for random number generator */ template -void check_dist_throws_real_first_argument(const T_rig& rig) { +inline void check_dist_throws_real_first_argument(const T_rig& rig) { apply_template_permutations>, ArgumentTypes, ArgumentTypes>(check_dist_throws{}, rig); @@ -340,7 +340,7 @@ void check_dist_throws_real_first_argument(const T_rig& rig) { * @return vector of length 1 with value v */ template -std::vector promote_to_vector(T v) { +inline std::vector promote_to_vector(T v) { return std::vector(1, v); } @@ -349,7 +349,7 @@ std::vector promote_to_vector(T v) { * just using std::move but cpplint complained about use of unapproved Rvalues. */ template -std::vector promote_to_vector(std::vector v) { +inline std::vector promote_to_vector(std::vector v) { return v; } @@ -430,7 +430,7 @@ struct check_quantiles { * @param T_rig Test rig for random number generator */ template -void check_quantiles_no_params(const T_rig& rig) { +inline void check_quantiles_no_params(const T_rig& rig) { apply_template_permutations, std::tuple, std::tuple>(check_quantiles{}, rig); } @@ -444,7 +444,7 @@ void check_quantiles_no_params(const T_rig& rig) { * @param T_rig Test rig for random number generator */ template -void check_quantiles_real(const T_rig& rig) { +inline void check_quantiles_real(const T_rig& rig) { apply_template_permutations, std::tuple>(check_quantiles{}, rig); } @@ -458,7 +458,7 @@ void check_quantiles_real(const T_rig& rig) { * @param T_rig Test rig for random number generator */ template -void check_quantiles_real_real(const T_rig& rig) { +inline void check_quantiles_real_real(const T_rig& rig) { apply_template_permutations>( check_quantiles{}, rig); } @@ -474,7 +474,7 @@ void check_quantiles_real_real(const T_rig& rig) { * @param T_rig Test rig for random number generator */ template -void check_quantiles_real_first_argument(const T_rig& rig) { +inline void check_quantiles_real_first_argument(const T_rig& rig) { apply_template_permutations>, ArgumentTypes, std::tuple>( check_quantiles{}, rig); @@ -489,7 +489,7 @@ void check_quantiles_real_first_argument(const T_rig& rig) { * @param T_rig Test rig for random number generator */ template -void check_quantiles_real_real_real(const T_rig& rig) { +inline void check_quantiles_real_real_real(const T_rig& rig) { apply_template_permutations( check_quantiles{}, rig); } @@ -636,7 +636,7 @@ struct check_counts { * @param T_rig Test rig for random number generator */ template -void check_counts_real(const T_rig& rig) { +inline void check_counts_real(const T_rig& rig) { apply_template_permutations, std::tuple>(check_counts{}, rig); } @@ -650,7 +650,7 @@ void check_counts_real(const T_rig& rig) { * @param T_rig Test rig for random number generator */ template -void check_counts_real_real(const T_rig& rig) { +inline void check_counts_real_real(const T_rig& rig) { apply_template_permutations>( check_counts{}, rig); } @@ -664,7 +664,7 @@ void check_counts_real_real(const T_rig& rig) { * @param T_rig Test rig for random number generator */ template -void check_counts_real_real_real(const T_rig& rig) { +inline void check_counts_real_real_real(const T_rig& rig) { apply_template_permutations( check_counts{}, rig); } @@ -679,7 +679,7 @@ void check_counts_real_real_real(const T_rig& rig) { * @param T_rig Test rig for random number generator */ template -void check_counts_int_real(const T_rig& rig) { +inline void check_counts_int_real(const T_rig& rig) { apply_template_permutations>, ArgumentTypes, std::tuple>(check_counts{}, rig); } @@ -694,7 +694,7 @@ void check_counts_int_real(const T_rig& rig) { * @param T_rig Test rig for random number generator */ template -void check_counts_int_real_real(const T_rig& rig) { +inline void check_counts_int_real_real(const T_rig& rig) { apply_template_permutations>, ArgumentTypes, ArgumentTypes>(check_counts{}, rig); } diff --git a/test/unit/math/prim/util.hpp b/test/unit/math/prim/util.hpp index a7ec6321093..735fc50f3b7 100644 --- a/test/unit/math/prim/util.hpp +++ b/test/unit/math/prim/util.hpp @@ -85,7 +85,7 @@ namespace unit { * * @param[in] a Matrix to test. */ -void expect_symmetric(const Eigen::MatrixXd& a) { +inline void expect_symmetric(const Eigen::MatrixXd& a) { for (int j = 1; j < a.cols(); ++j) for (int i = 0; i < j; ++i) EXPECT_EQ(a(i, j), a(j, i)) << "failed symmetry at " << i << ", " << j; diff --git a/test/unit/math/rev/core/arena_allocator_test.cpp b/test/unit/math/rev/core/arena_allocator_test.cpp index 0a6a30c7f0b..67d25f145b4 100644 --- a/test/unit/math/rev/core/arena_allocator_test.cpp +++ b/test/unit/math/rev/core/arena_allocator_test.cpp @@ -9,7 +9,7 @@ #include #include -void arena_allocator_test() { +inline void arena_allocator_test() { std::vector> v; v.reserve(3); for (int i = 0; i < 5; i++) { diff --git a/test/unit/math/rev/core/operator_logical_and_test.cpp b/test/unit/math/rev/core/operator_logical_and_test.cpp index 47306748d88..203989162b1 100644 --- a/test/unit/math/rev/core/operator_logical_and_test.cpp +++ b/test/unit/math/rev/core/operator_logical_and_test.cpp @@ -3,7 +3,7 @@ #include #include -void test_logical_and(double x, double y) { +inline void test_logical_and(double x, double y) { using stan::math::var; EXPECT_EQ(x && y, var(x) && var(y)); EXPECT_EQ(x && y, x && var(y)); diff --git a/test/unit/math/rev/core/operator_logical_or_test.cpp b/test/unit/math/rev/core/operator_logical_or_test.cpp index f1a957b9561..c6c4b0b6250 100644 --- a/test/unit/math/rev/core/operator_logical_or_test.cpp +++ b/test/unit/math/rev/core/operator_logical_or_test.cpp @@ -4,7 +4,7 @@ #include #include -void test_logical_or(double x, double y) { +inline void test_logical_or(double x, double y) { stan::math::var x_v = x; stan::math::var y_v = y; EXPECT_EQ(x || y, x_v || y_v); diff --git a/test/unit/math/rev/core/operator_unary_not_test.cpp b/test/unit/math/rev/core/operator_unary_not_test.cpp index 55169e3d3dd..85951a7d17e 100644 --- a/test/unit/math/rev/core/operator_unary_not_test.cpp +++ b/test/unit/math/rev/core/operator_unary_not_test.cpp @@ -3,7 +3,7 @@ #include #include -void test_unary_not(double x) { +inline void test_unary_not(double x) { stan::math::var x_v = x; EXPECT_EQ(!x, !x_v); } diff --git a/test/unit/math/rev/core/var_test.cpp b/test/unit/math/rev/core/var_test.cpp index a2ca9a36d64..01a27cead04 100644 --- a/test/unit/math/rev/core/var_test.cpp +++ b/test/unit/math/rev/core/var_test.cpp @@ -12,7 +12,7 @@ namespace stan { namespace test { template -void ctor_overloads_float_impl() { +inline void ctor_overloads_float_impl() { using stan::math::var_value; using stan::math::vari_value; using stan::math::test::type_name; @@ -36,7 +36,7 @@ void ctor_overloads_float_impl() { } template -void ctor_overloads_float() { +inline void ctor_overloads_float() { ctor_overloads_float_impl(); ctor_overloads_float_impl(); ctor_overloads_float_impl(); @@ -54,7 +54,7 @@ void ctor_overloads_float() { } template -void ctor_overloads_matrix(EigenMat&& xx) { +inline void ctor_overloads_matrix(EigenMat&& xx) { using stan::math::var_value; using stan::math::vari_value; using stan::math::test::type_name; @@ -77,7 +77,7 @@ void ctor_overloads_matrix(EigenMat&& xx) { } template -void ctor_overloads_sparse_matrix(EigenMat&& x) { +inline void ctor_overloads_sparse_matrix(EigenMat&& x) { using stan::math::var_value; using stan::math::vari_value; using stan::math::test::type_name; @@ -317,7 +317,7 @@ TEST_F(AgradRev, var_matrix_views_const) { } template -void var_vector_views_test() { +inline void var_vector_views_test() { using stan::math::var_value; dense_vec A(10); for (Eigen::Index i = 0; i < A.size(); ++i) { @@ -355,7 +355,7 @@ TEST_F(AgradRev, var_vector_views) { } template -void var_vector_views_const_test() { +inline void var_vector_views_const_test() { using stan::math::var_value; dense_vec A(10); for (Eigen::Index i = 0; i < A.size(); ++i) { diff --git a/test/unit/math/rev/fun/accumulator_test.cpp b/test/unit/math/rev/fun/accumulator_test.cpp index a83793f14a6..9f7bb97a6f0 100644 --- a/test/unit/math/rev/fun/accumulator_test.cpp +++ b/test/unit/math/rev/fun/accumulator_test.cpp @@ -4,7 +4,7 @@ #include // test sum of first n numbers for sum of a -void test_sum(stan::math::accumulator& a, int n) { +inline void test_sum(stan::math::accumulator& a, int n) { EXPECT_FLOAT_EQ((n * (n + 1)) / 2, a.sum().val()); } diff --git a/test/unit/math/rev/fun/cholesky_decompose_test.cpp b/test/unit/math/rev/fun/cholesky_decompose_test.cpp index d04fab845a2..4ae06603d79 100644 --- a/test/unit/math/rev/fun/cholesky_decompose_test.cpp +++ b/test/unit/math/rev/fun/cholesky_decompose_test.cpp @@ -5,7 +5,7 @@ #include template -std::vector fill_vec(Eigen::Matrix inp) { +inline std::vector fill_vec(Eigen::Matrix inp) { std::vector ret_vec; ret_vec.reserve(inp.rows()); for (int i = 0; i < inp.rows(); ++i) @@ -130,7 +130,7 @@ struct chol_functor_simple_vec { } }; -void test_gradients(int size, double prec) { +inline void test_gradients(int size, double prec) { std::vector > functors; std::vector > > grads_ad; std::vector > > grads_fd; @@ -165,7 +165,7 @@ void test_gradients(int size, double prec) { } } -void test_gradients_simple(int size, double prec) { +inline void test_gradients_simple(int size, double prec) { std::vector > functors; std::vector > > grads_ad; std::vector > > grads_fd; @@ -214,7 +214,7 @@ void test_gradients_simple(int size, double prec) { } } -void test_gp_grad(int mat_size, double prec) { +inline void test_gp_grad(int mat_size, double prec) { using Eigen::MatrixXd; using Eigen::RowVectorXd; using Eigen::VectorXd; @@ -256,7 +256,7 @@ void test_gp_grad(int mat_size, double prec) { } } -void test_chol_mult(int mat_size, double prec) { +inline void test_chol_mult(int mat_size, double prec) { using Eigen::MatrixXd; using Eigen::RowVectorXd; using Eigen::VectorXd; @@ -290,7 +290,7 @@ void test_chol_mult(int mat_size, double prec) { } } -void test_simple_vec_mult(int size, double prec) { +inline void test_simple_vec_mult(int size, double prec) { Eigen::VectorXd test_vec(size); boost::random::mt19937 rng(2); @@ -329,7 +329,7 @@ void test_simple_vec_mult(int size, double prec) { EXPECT_NEAR(grad_fd(k), grad_ad(k), prec) << " for k=" << k; } -double test_gradient(int size, double prec) { +inline double test_gradient(int size, double prec) { chol_functor_2 functown(size); Eigen::Matrix grads_ad; Eigen::Matrix grads_fd; diff --git a/test/unit/math/rev/fun/lbeta_test.cpp b/test/unit/math/rev/fun/lbeta_test.cpp index 9a16a585a39..93f5afcb565 100644 --- a/test/unit/math/rev/fun/lbeta_test.cpp +++ b/test/unit/math/rev/fun/lbeta_test.cpp @@ -20,7 +20,7 @@ struct identity_tolerances { }; template -void expect_identity(const std::string& msg, +inline void expect_identity(const std::string& msg, const identity_tolerances& tolerances, const F1 lh, const F2 rh, double x_dbl, double y_dbl) { using stan::math::var; diff --git a/test/unit/math/rev/fun/scalar_seq_view_test.cpp b/test/unit/math/rev/fun/scalar_seq_view_test.cpp index 7d8c7686d51..2a18e379d1f 100644 --- a/test/unit/math/rev/fun/scalar_seq_view_test.cpp +++ b/test/unit/math/rev/fun/scalar_seq_view_test.cpp @@ -48,7 +48,7 @@ TEST(MathMetaRev, ScalarSeqViewArrayVarVal) { } template -void expect_scalar_seq_view_value(const C& v) { +inline void expect_scalar_seq_view_value(const C& v) { using stan::scalar_seq_view; scalar_seq_view sv(v); EXPECT_FLOAT_EQ(v.val()(0), sv.val(0)); @@ -60,7 +60,7 @@ void expect_scalar_seq_view_value(const C& v) { } template -void expect_scalar_seq_view_adjoints(const C& v) { +inline void expect_scalar_seq_view_adjoints(const C& v) { using stan::scalar_seq_view; scalar_seq_view sv(v); std::vector stdv(sv.size()); diff --git a/test/unit/math/rev/fun/sort_indices_test.cpp b/test/unit/math/rev/fun/sort_indices_test.cpp index 640abf2b30d..5d812cd5bd1 100644 --- a/test/unit/math/rev/fun/sort_indices_test.cpp +++ b/test/unit/math/rev/fun/sort_indices_test.cpp @@ -3,7 +3,7 @@ #include #include -void test_sort_indices_asc(std::vector val) { +inline void test_sort_indices_asc(std::vector val) { using stan::math::sort_indices_asc; std::vector x; @@ -24,7 +24,7 @@ void test_sort_indices_asc(std::vector val) { EXPECT_FALSE(x_sorted[i] == x[j]); } -void test_sort_indices_desc(std::vector val) { +inline void test_sort_indices_desc(std::vector val) { using stan::math::sort_indices_desc; std::vector x; @@ -46,7 +46,7 @@ void test_sort_indices_desc(std::vector val) { } template -void test_sort_indices_asc(Eigen::Matrix val) { +inline void test_sort_indices_asc(Eigen::Matrix val) { using stan::math::sort_indices_asc; const size_t val_size = val.size(); @@ -70,7 +70,7 @@ void test_sort_indices_asc(Eigen::Matrix val) { } template -void test_sort_indices_desc(Eigen::Matrix val) { +inline void test_sort_indices_desc(Eigen::Matrix val) { using stan::math::sort_indices_desc; const size_t val_size = val.size(); diff --git a/test/unit/math/rev/fun/util.hpp b/test/unit/math/rev/fun/util.hpp index c38dcfa6ec9..7dcccdbf09c 100644 --- a/test/unit/math/rev/fun/util.hpp +++ b/test/unit/math/rev/fun/util.hpp @@ -9,7 +9,7 @@ // vector; Fills the matrix column-wise template -void fill(const std::vector& contents, Eigen::Matrix& M) { +inline void fill(const std::vector& contents, Eigen::Matrix& M) { size_t ij = 0; for (int j = 0; j < C; ++j) for (int i = 0; i < R; ++i) diff --git a/test/unit/math/rev/fun/vector_seq_view_test.cpp b/test/unit/math/rev/fun/vector_seq_view_test.cpp index 17fb4c98580..dc51f5a6301 100644 --- a/test/unit/math/rev/fun/vector_seq_view_test.cpp +++ b/test/unit/math/rev/fun/vector_seq_view_test.cpp @@ -3,7 +3,7 @@ #include template -void test_vec_seq_var(const T& m1) { +inline void test_vec_seq_var(const T& m1) { using stan::vector_seq_view; using stan::math::var; vector_seq_view vsv(m1); diff --git a/test/unit/math/rev/functor/finite_diff_hessian_auto_test.cpp b/test/unit/math/rev/functor/finite_diff_hessian_auto_test.cpp index 9cf08b9d5ee..07e25e7f5ca 100644 --- a/test/unit/math/rev/functor/finite_diff_hessian_auto_test.cpp +++ b/test/unit/math/rev/functor/finite_diff_hessian_auto_test.cpp @@ -65,7 +65,7 @@ struct one_arg { */ template -void test_hessian_finite_diff(const std::string& msg, const F& f, +inline void test_hessian_finite_diff(const std::string& msg, const F& f, Eigen::VectorXd& x) { double fx; Eigen::VectorXd grad_fx; diff --git a/test/unit/math/rev/functor/gradient_test.cpp b/test/unit/math/rev/functor/gradient_test.cpp index d611e4bfab5..7e0ab1f5574 100644 --- a/test/unit/math/rev/functor/gradient_test.cpp +++ b/test/unit/math/rev/functor/gradient_test.cpp @@ -391,7 +391,7 @@ TEST(RevFunctor, gradient_array_threaded_tbb) { } #endif -stan::math::var sum_and_throw(const Matrix& x) { +inline stan::math::var sum_and_throw(const Matrix& x) { stan::math::var y = 0; for (int i = 0; i < x.size(); ++i) y += x(i); diff --git a/test/unit/math/rev/functor/integrate_1d_impl_test.cpp b/test/unit/math/rev/functor/integrate_1d_impl_test.cpp index 39349dd9e45..a1b21391893 100644 --- a/test/unit/math/rev/functor/integrate_1d_impl_test.cpp +++ b/test/unit/math/rev/functor/integrate_1d_impl_test.cpp @@ -142,7 +142,7 @@ struct f13 { * @param v variable * @return adjoint of var */ -double get_adjoint_if_var(stan::math::var v) { return v.adj(); } +inline double get_adjoint_if_var(stan::math::var v) { return v.adj(); } /* * If the argument is not a var, return a NaN @@ -150,7 +150,7 @@ double get_adjoint_if_var(stan::math::var v) { return v.adj(); } * @param v variable * @return NaN */ -double get_adjoint_if_var(double v) { +inline double get_adjoint_if_var(double v) { return std::numeric_limits::quiet_NaN(); } @@ -197,7 +197,7 @@ double get_adjoint_if_var(double v) { * limit (not used if T_b is not var) */ template -void test_derivatives(const F &f, double a, double b, +inline void test_derivatives(const F &f, double a, double b, std::vector thetas, const std::vector &x_r, const std::vector &x_i, double val, diff --git a/test/unit/math/rev/functor/integrate_1d_test.cpp b/test/unit/math/rev/functor/integrate_1d_test.cpp index 672e8145332..7c82b158af2 100644 --- a/test/unit/math/rev/functor/integrate_1d_test.cpp +++ b/test/unit/math/rev/functor/integrate_1d_test.cpp @@ -142,7 +142,7 @@ struct f13 { * @param v variable * @return adjoint of var */ -double get_adjoint_if_var(stan::math::var v) { return v.adj(); } +inline double get_adjoint_if_var(stan::math::var v) { return v.adj(); } /* * If the argument is not a var, return a NaN @@ -150,7 +150,7 @@ double get_adjoint_if_var(stan::math::var v) { return v.adj(); } * @param v variable * @return NaN */ -double get_adjoint_if_var(double v) { +inline double get_adjoint_if_var(double v) { return std::numeric_limits::quiet_NaN(); } @@ -197,7 +197,7 @@ double get_adjoint_if_var(double v) { * limit (not used if T_b is not var) */ template -void test_derivatives(const F &f, double a, double b, +inline void test_derivatives(const F &f, double a, double b, std::vector thetas, const std::vector &x_r, const std::vector &x_i, double val, diff --git a/test/unit/math/rev/functor/map_rect_concurrent_threads_test.cpp b/test/unit/math/rev/functor/map_rect_concurrent_threads_test.cpp index 7237ca43fbf..fbc3e55f4f3 100644 --- a/test/unit/math/rev/functor/map_rect_concurrent_threads_test.cpp +++ b/test/unit/math/rev/functor/map_rect_concurrent_threads_test.cpp @@ -21,7 +21,7 @@ STAN_REGISTER_MAP_RECT(0, hard_work) STAN_REGISTER_MAP_RECT(1, hard_work) -void setup_job(int N, Eigen::VectorXd& shared_params_d, +inline void setup_job(int N, Eigen::VectorXd& shared_params_d, std::vector& job_params_d, std::vector >& x_r, std::vector >& x_i) { diff --git a/test/unit/math/rev/functor/util_algebra_solver.hpp b/test/unit/math/rev/functor/util_algebra_solver.hpp index 34468a49cfe..6a3aaecead2 100644 --- a/test/unit/math/rev/functor/util_algebra_solver.hpp +++ b/test/unit/math/rev/functor/util_algebra_solver.hpp @@ -456,7 +456,7 @@ inline void error_conditions_test(const F& f, } template -void inline unsolvable_test(Eigen::Matrix& y, +inline void inline unsolvable_test(Eigen::Matrix& y, int solver_type = 0, bool use_tol = false) { Eigen::VectorXd x(2); x << 1, 1; @@ -482,7 +482,7 @@ void inline unsolvable_test(Eigen::Matrix& y, } template -void inline unsolvable_flag_test(Eigen::Matrix& y, +inline void inline unsolvable_flag_test(Eigen::Matrix& y, int solver_type = 0, bool use_tol = false) { Eigen::VectorXd x(2); x << 1, 1; diff --git a/test/unit/math/rev/meta/is_constant_all_test.cpp b/test/unit/math/rev/meta/is_constant_all_test.cpp index 8c523c1bde5..07a274a6d48 100644 --- a/test/unit/math/rev/meta/is_constant_all_test.cpp +++ b/test/unit/math/rev/meta/is_constant_all_test.cpp @@ -3,7 +3,7 @@ #include template -void expect_not_const() { +inline void expect_not_const() { using stan::is_constant_all; bool temp = is_constant_all::value; EXPECT_FALSE(temp); diff --git a/test/unit/math/rev/prob/categorical2_test.cpp b/test/unit/math/rev/prob/categorical2_test.cpp index 97b3344a84e..d612fce0956 100644 --- a/test/unit/math/rev/prob/categorical2_test.cpp +++ b/test/unit/math/rev/prob/categorical2_test.cpp @@ -4,7 +4,7 @@ #include template -void expect_propto_categorical_lpmf(unsigned int n1, T_prob theta1, +inline void expect_propto_categorical_lpmf(unsigned int n1, T_prob theta1, unsigned int n2, T_prob theta2, std::string message) { expect_eq_diffs(stan::math::categorical_lpmf(n1, theta1), diff --git a/test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp b/test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp index 4a2cf6c9930..3eb04673f88 100644 --- a/test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp +++ b/test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp @@ -6,7 +6,7 @@ #include template -stan::return_type_t categorical_logit_glm_simple_lpmf( +inline stan::return_type_t categorical_logit_glm_simple_lpmf( const std::vector& y, const T_x& x, const T_alpha& alpha, const T_beta& beta) { using T_return = stan::return_type_t; diff --git a/test/unit/math/rev/prob/dirichlet2_test.cpp b/test/unit/math/rev/prob/dirichlet2_test.cpp index 57f23995c63..4d0b0724b18 100644 --- a/test/unit/math/rev/prob/dirichlet2_test.cpp +++ b/test/unit/math/rev/prob/dirichlet2_test.cpp @@ -4,7 +4,7 @@ #include template -void expect_propto_dirichlet_lpdf(T_prob theta, T_prior_sample_size alpha, +inline void expect_propto_dirichlet_lpdf(T_prob theta, T_prior_sample_size alpha, T_prob theta2, T_prior_sample_size alpha2, std::string message) { expect_eq_diffs(stan::math::dirichlet_lpdf(theta, alpha), diff --git a/test/unit/math/rev/prob/expect_eq_diffs.hpp b/test/unit/math/rev/prob/expect_eq_diffs.hpp index 0dd9f507133..2db47db915a 100644 --- a/test/unit/math/rev/prob/expect_eq_diffs.hpp +++ b/test/unit/math/rev/prob/expect_eq_diffs.hpp @@ -5,7 +5,7 @@ #include #include -void expect_eq_diffs(double x1, double x2, double y1, double y2, +inline void expect_eq_diffs(double x1, double x2, double y1, double y2, std::string message = "") { if (std::isnan(x1 - x2)) EXPECT_TRUE(std::isnan(y1 - y2)) << message; @@ -13,7 +13,7 @@ void expect_eq_diffs(double x1, double x2, double y1, double y2, EXPECT_FLOAT_EQ(x1 - x2, y1 - y2) << message; } -void expect_eq_diffs(const stan::math::var& x1, const stan::math::var& x2, +inline void expect_eq_diffs(const stan::math::var& x1, const stan::math::var& x2, const stan::math::var& y1, const stan::math::var& y2, std::string message = "") { expect_eq_diffs(x1.val(), x2.val(), y1.val(), y2.val(), message); diff --git a/test/unit/math/rev/prob/inv_wishart2_test.cpp b/test/unit/math/rev/prob/inv_wishart2_test.cpp index cc70da88423..005cc9cefad 100644 --- a/test/unit/math/rev/prob/inv_wishart2_test.cpp +++ b/test/unit/math/rev/prob/inv_wishart2_test.cpp @@ -5,7 +5,7 @@ #include template -void expect_propto_inv_wishart_lpdf(T_y W1, T_dof nu1, T_scale S1, T_y W2, +inline void expect_propto_inv_wishart_lpdf(T_y W1, T_dof nu1, T_scale S1, T_y W2, T_dof nu2, T_scale S2, std::string message) { expect_eq_diffs(stan::math::inv_wishart_lpdf(W1, nu1, S1), diff --git a/test/unit/math/rev/prob/inv_wishart_cholesky_test.cpp b/test/unit/math/rev/prob/inv_wishart_cholesky_test.cpp index 8eab1bf18b0..180c968ee17 100644 --- a/test/unit/math/rev/prob/inv_wishart_cholesky_test.cpp +++ b/test/unit/math/rev/prob/inv_wishart_cholesky_test.cpp @@ -5,7 +5,7 @@ #include template -void expect_propto_inv_wishart_cholesky_lpdf(T_y L_Y1, T_dof nu1, T_scale L_S1, +inline void expect_propto_inv_wishart_cholesky_lpdf(T_y L_Y1, T_dof nu1, T_scale L_S1, T_y L_Y2, T_dof nu2, T_scale L_S2, std::string message) { expect_eq_diffs(stan::math::inv_wishart_cholesky_lpdf(L_Y1, nu1, L_S1), diff --git a/test/unit/math/rev/prob/lkj_corr_cholesky_test_functors.hpp b/test/unit/math/rev/prob/lkj_corr_cholesky_test_functors.hpp index e3871ef7c43..6af6594d166 100644 --- a/test/unit/math/rev/prob/lkj_corr_cholesky_test_functors.hpp +++ b/test/unit/math/rev/prob/lkj_corr_cholesky_test_functors.hpp @@ -8,7 +8,7 @@ namespace stan { namespace math { template -return_type_t lkj_corr_cholesky_uc( +inline return_type_t lkj_corr_cholesky_uc( Eigen::Matrix L, T_eta eta, int K) { using math::cholesky_corr_constrain; using math::lkj_corr_cholesky_lpdf; diff --git a/test/unit/math/rev/prob/multi_gp2_test.cpp b/test/unit/math/rev/prob/multi_gp2_test.cpp index 5e5267c1b5b..c0b06738641 100644 --- a/test/unit/math/rev/prob/multi_gp2_test.cpp +++ b/test/unit/math/rev/prob/multi_gp2_test.cpp @@ -8,7 +8,7 @@ #include template -void expect_propto(T_y y1, T_scale sigma1, T_w w1, T_y y2, T_scale sigma2, +inline void expect_propto(T_y y1, T_scale sigma1, T_w w1, T_y y2, T_scale sigma2, T_w w2, std::string message = "") { expect_eq_diffs(stan::math::multi_gp_lpdf(y1, sigma1, w1), stan::math::multi_gp_lpdf(y2, sigma2, w2), diff --git a/test/unit/math/rev/prob/multi_gp_cholesky2_test.cpp b/test/unit/math/rev/prob/multi_gp_cholesky2_test.cpp index 100e9fe9ea9..088928fa79e 100644 --- a/test/unit/math/rev/prob/multi_gp_cholesky2_test.cpp +++ b/test/unit/math/rev/prob/multi_gp_cholesky2_test.cpp @@ -8,7 +8,7 @@ #include template -void expect_propto_multi_gp_cholesky_lpdf(T_y y1, T_scale L1, T_w w1, T_y y2, +inline void expect_propto_multi_gp_cholesky_lpdf(T_y y1, T_scale L1, T_w w1, T_y y2, T_scale L2, T_w w2, std::string message = "") { expect_eq_diffs(stan::math::multi_gp_cholesky_lpdf(y1, L1, w1), diff --git a/test/unit/math/rev/prob/multi_normal2_test.cpp b/test/unit/math/rev/prob/multi_normal2_test.cpp index 13125455b50..a190434ac62 100644 --- a/test/unit/math/rev/prob/multi_normal2_test.cpp +++ b/test/unit/math/rev/prob/multi_normal2_test.cpp @@ -9,7 +9,7 @@ #include template -void expect_propto_multi_normal_lpdf(T_y y1, T_loc mu1, T_scale sigma1, T_y y2, +inline void expect_propto_multi_normal_lpdf(T_y y1, T_loc mu1, T_scale sigma1, T_y y2, T_loc mu2, T_scale sigma2, std::string message = "") { expect_eq_diffs(stan::math::multi_normal_lpdf(y1, mu1, sigma1), @@ -328,7 +328,7 @@ struct vectorized_multi_normal_fun { }; template -void test_all_multi_normal2() { +inline void test_all_multi_normal2() { { std::vector y_(3), mu_(3), sigma_(6); // y diff --git a/test/unit/math/rev/prob/multi_normal_cholesky2_test.cpp b/test/unit/math/rev/prob/multi_normal_cholesky2_test.cpp index 82c46bf55cc..16454831dfb 100644 --- a/test/unit/math/rev/prob/multi_normal_cholesky2_test.cpp +++ b/test/unit/math/rev/prob/multi_normal_cholesky2_test.cpp @@ -129,7 +129,7 @@ struct vectorized_multi_normal_cholesky_fun { }; template -void test_all_multi_normal_cholesky() { +inline void test_all_multi_normal_cholesky() { { using Eigen::Dynamic; using Eigen::Matrix; diff --git a/test/unit/math/rev/prob/multi_normal_prec2_test.cpp b/test/unit/math/rev/prob/multi_normal_prec2_test.cpp index 7047c189c4c..e94f750f445 100644 --- a/test/unit/math/rev/prob/multi_normal_prec2_test.cpp +++ b/test/unit/math/rev/prob/multi_normal_prec2_test.cpp @@ -9,7 +9,7 @@ #include template -void expect_propto_multi_normal_prec_lpdf(T_y y1, T_loc mu1, T_scale sigma1, +inline void expect_propto_multi_normal_prec_lpdf(T_y y1, T_loc mu1, T_scale sigma1, T_y y2, T_loc mu2, T_scale sigma2, std::string message = "") { expect_eq_diffs(stan::math::multi_normal_prec_lpdf(y1, mu1, sigma1), @@ -247,7 +247,7 @@ struct vectorized_multi_normal_prec_fun { }; template -void test_all_multi_normal_prec2() { +inline void test_all_multi_normal_prec2() { { std::vector y_(3), mu_(3), sigma_(6); // y diff --git a/test/unit/math/rev/prob/multi_student_t2_test.cpp b/test/unit/math/rev/prob/multi_student_t2_test.cpp index 3756f653fa7..324a6a1d3cb 100644 --- a/test/unit/math/rev/prob/multi_student_t2_test.cpp +++ b/test/unit/math/rev/prob/multi_student_t2_test.cpp @@ -10,7 +10,7 @@ #include template -void expect_propto_multi_student_t_lpdf(T_y y1, T_dof nu1, T_loc mu1, +inline void expect_propto_multi_student_t_lpdf(T_y y1, T_dof nu1, T_loc mu1, T_scale sigma1, T_y y2, T_dof nu2, T_loc mu2, T_scale sigma2, std::string message = "") { @@ -302,7 +302,7 @@ struct vectorized_multi_student_t_fun { }; template -void test_all_multi_student_t2() { +inline void test_all_multi_student_t2() { { using stan::math::var; std::vector y_(3), mu_(3), sigma_(6); diff --git a/test/unit/math/rev/prob/multi_student_t_cholesky_test.cpp b/test/unit/math/rev/prob/multi_student_t_cholesky_test.cpp index a347fb1276c..5d268357f7f 100644 --- a/test/unit/math/rev/prob/multi_student_t_cholesky_test.cpp +++ b/test/unit/math/rev/prob/multi_student_t_cholesky_test.cpp @@ -10,7 +10,7 @@ #include template -void expect_propto_multi_student_t_cholesky_lpdf(T_y y1, T_dof nu1, T_loc mu1, +inline void expect_propto_multi_student_t_cholesky_lpdf(T_y y1, T_dof nu1, T_loc mu1, T_scale L1, T_y y2, T_dof nu2, T_loc mu2, T_scale L2, std::string message = "") { @@ -311,7 +311,7 @@ struct vectorized_multi_student_t_cholesky_fun { }; template -void test_all_multi_student_t_cholesky() { +inline void test_all_multi_student_t_cholesky() { { using stan::math::var; std::vector y_(3), mu_(3), sigma_(6); diff --git a/test/unit/math/rev/prob/multinomial_logit_test.cpp b/test/unit/math/rev/prob/multinomial_logit_test.cpp index de69f1115bb..a5ea4720cd8 100644 --- a/test/unit/math/rev/prob/multinomial_logit_test.cpp +++ b/test/unit/math/rev/prob/multinomial_logit_test.cpp @@ -6,7 +6,7 @@ #include template -void expect_propto_multinomial_logit_lpmf(std::vector& ns1, T_prob beta1, +inline void expect_propto_multinomial_logit_lpmf(std::vector& ns1, T_prob beta1, std::vector& ns2, T_prob beta2, std::string message) { expect_eq_diffs(stan::math::multinomial_logit_lpmf(ns1, beta1), diff --git a/test/unit/math/rev/prob/multinomial_test.cpp b/test/unit/math/rev/prob/multinomial_test.cpp index 2c358f9bb24..8cf11dce795 100644 --- a/test/unit/math/rev/prob/multinomial_test.cpp +++ b/test/unit/math/rev/prob/multinomial_test.cpp @@ -6,7 +6,7 @@ #include template -void expect_propto_multinomial(std::vector& ns1, T_prob theta1, +inline void expect_propto_multinomial(std::vector& ns1, T_prob theta1, std::vector& ns2, T_prob theta2, std::string message) { expect_eq_diffs(stan::math::multinomial_lpmf(ns1, theta1), diff --git a/test/unit/math/rev/prob/ordered_logistic_glm_lpmf_test.cpp b/test/unit/math/rev/prob/ordered_logistic_glm_lpmf_test.cpp index 3436f57a2f8..6bc23f19985 100644 --- a/test/unit/math/rev/prob/ordered_logistic_glm_lpmf_test.cpp +++ b/test/unit/math/rev/prob/ordered_logistic_glm_lpmf_test.cpp @@ -5,7 +5,7 @@ #include template -stan::return_type_t ordered_logistic_glm_simple_lpmf( +inline stan::return_type_t ordered_logistic_glm_simple_lpmf( const std::vector& y, T_x&& x, T_beta&& beta, T_cuts&& cuts) { using stan::math::as_column_vector_or_scalar; auto&& beta_col = as_column_vector_or_scalar(beta); diff --git a/test/unit/math/rev/prob/test_gradients.hpp b/test/unit/math/rev/prob/test_gradients.hpp index 891091f83f2..00fa6fe13c8 100644 --- a/test/unit/math/rev/prob/test_gradients.hpp +++ b/test/unit/math/rev/prob/test_gradients.hpp @@ -5,7 +5,7 @@ #include #include -void test_grad_eq(Eigen::Matrix grad_1, +inline void test_grad_eq(Eigen::Matrix grad_1, Eigen::Matrix grad_2) { ASSERT_EQ(grad_1.size(), grad_2.size()); for (int i = 0; i < grad_1.size(); ++i) @@ -13,7 +13,7 @@ void test_grad_eq(Eigen::Matrix grad_1, } template -std::vector finite_diffs(const F& fun, const std::vector& args, +inline std::vector finite_diffs(const F& fun, const std::vector& args, double epsilon = 1e-6) { std::vector diffs(args.size()); std::vector args_plus = args; @@ -30,7 +30,7 @@ std::vector finite_diffs(const F& fun, const std::vector& args, } template -std::vector grad(const F& fun, const std::vector& args) { +inline std::vector grad(const F& fun, const std::vector& args) { std::vector x; for (size_t i = 0; i < args.size(); ++i) x.push_back(args[i]); @@ -42,7 +42,7 @@ std::vector grad(const F& fun, const std::vector& args) { } template -void test_grad(const F& fun, const std::vector& args) { +inline void test_grad(const F& fun, const std::vector& args) { using std::fabs; std::vector diffs_finite = finite_diffs(fun, args); std::vector diffs_var = grad(fun, args); diff --git a/test/unit/math/rev/prob/test_gradients_multi_normal.hpp b/test/unit/math/rev/prob/test_gradients_multi_normal.hpp index c42cedadfb2..06ade9afe82 100644 --- a/test/unit/math/rev/prob/test_gradients_multi_normal.hpp +++ b/test/unit/math/rev/prob/test_gradients_multi_normal.hpp @@ -7,7 +7,7 @@ #include template -std::vector finite_diffs_multi_normal( +inline std::vector finite_diffs_multi_normal( const F& fun, const std::vector& vec_y, const std::vector& vec_mu, const std::vector& vec_sigma, double epsilon = 1e-6) { @@ -64,7 +64,7 @@ std::vector finite_diffs_multi_normal( } template -std::vector grad_multi_normal(const F& fun, +inline std::vector grad_multi_normal(const F& fun, const std::vector& vec_y, const std::vector& vec_mu, const std::vector& vec_sigma) { @@ -88,7 +88,7 @@ std::vector grad_multi_normal(const F& fun, } template -void test_grad_multi_normal(const F& fun, const std::vector& vec_y, +inline void test_grad_multi_normal(const F& fun, const std::vector& vec_y, const std::vector& vec_mu, const std::vector& vec_sigma) { using std::fabs; diff --git a/test/unit/math/rev/prob/test_gradients_multi_student_t.hpp b/test/unit/math/rev/prob/test_gradients_multi_student_t.hpp index 76fcda6a8ad..ebe4dde4f48 100644 --- a/test/unit/math/rev/prob/test_gradients_multi_student_t.hpp +++ b/test/unit/math/rev/prob/test_gradients_multi_student_t.hpp @@ -8,7 +8,7 @@ template -std::vector finite_diffs_multi_normal3( +inline std::vector finite_diffs_multi_normal3( const F& fun, const std::vector& vec_y, const std::vector& vec_mu, const std::vector& vec_sigma, const T_nu& nu, double epsilon = 1e-6) { @@ -79,7 +79,7 @@ std::vector finite_diffs_multi_normal3( template -std::vector grad_multi_normal3(const F& fun, +inline std::vector grad_multi_normal3(const F& fun, const std::vector& vec_y, const std::vector& vec_mu, const std::vector& vec_sigma, @@ -108,7 +108,7 @@ std::vector grad_multi_normal3(const F& fun, template -void test_grad_multi_student_t(const F& fun, const std::vector& vec_y, +inline void test_grad_multi_student_t(const F& fun, const std::vector& vec_y, const std::vector& vec_mu, const std::vector& vec_sigma, const T_nu& nu) { diff --git a/test/unit/math/rev/prob/test_gradients_multi_student_t_cholesky.hpp b/test/unit/math/rev/prob/test_gradients_multi_student_t_cholesky.hpp index be0b0c74d0a..1963a7a09fe 100644 --- a/test/unit/math/rev/prob/test_gradients_multi_student_t_cholesky.hpp +++ b/test/unit/math/rev/prob/test_gradients_multi_student_t_cholesky.hpp @@ -8,7 +8,7 @@ template -std::vector finite_diffs_multi_normal2( +inline std::vector finite_diffs_multi_normal2( const F& fun, const std::vector& vec_y, const std::vector& vec_mu, const std::vector& vec_sigma, const T_nu& nu, double epsilon = 1e-6) { @@ -79,7 +79,7 @@ std::vector finite_diffs_multi_normal2( template -std::vector grad_multi_normal2(const F& fun, +inline std::vector grad_multi_normal2(const F& fun, const std::vector& vec_y, const std::vector& vec_mu, const std::vector& vec_sigma, @@ -108,7 +108,7 @@ std::vector grad_multi_normal2(const F& fun, template -void test_grad_multi_student_t_cholesky(const F& fun, +inline void test_grad_multi_student_t_cholesky(const F& fun, const std::vector& vec_y, const std::vector& vec_mu, const std::vector& vec_sigma, diff --git a/test/unit/math/rev/prob/wiener_full_test.cpp b/test/unit/math/rev/prob/wiener_full_test.cpp index bc36395489b..0d92aaab479 100644 --- a/test/unit/math/rev/prob/wiener_full_test.cpp +++ b/test/unit/math/rev/prob/wiener_full_test.cpp @@ -8,7 +8,7 @@ // CHECK THAT ALL VALID SCALAR TYPES ARE ACCEPTED template -void check_scalar_types(F& f, double value, double res, double deriv) { +inline void check_scalar_types(F& f, double value, double res, double deriv) { // - f: Function with a single parameter exposed, all others // have to be scalars // - value: value to be used for the parameter @@ -202,7 +202,7 @@ TEST(ProbWienerFullPrec, wiener_full_prec_all_scalar) { // CHECK THAT ALL VALID Vector TYPES ARE ACCEPTED template -void check_vector_types(F& f, std::vector value, double res) { +inline void check_vector_types(F& f, std::vector value, double res) { // - f: Function where all inputs are vectors // - value: value to be used for the parameter // - res: expected result of calling `f` with `value` diff --git a/test/unit/math/rev/prob/wishart_cholesky_test.cpp b/test/unit/math/rev/prob/wishart_cholesky_test.cpp index f2dca746cea..a74e0d78611 100644 --- a/test/unit/math/rev/prob/wishart_cholesky_test.cpp +++ b/test/unit/math/rev/prob/wishart_cholesky_test.cpp @@ -5,7 +5,7 @@ #include template -void expect_propto_wishart_cholesky_lpdf(T_y L_Y1, T_dof nu1, T_scale L_S1, +inline void expect_propto_wishart_cholesky_lpdf(T_y L_Y1, T_dof nu1, T_scale L_S1, T_y L_Y2, T_dof nu2, T_scale L_S2, std::string message) { expect_eq_diffs(stan::math::wishart_cholesky_lpdf(L_Y1, nu1, L_S1), diff --git a/test/unit/math/rev/prob/wishart_test.cpp b/test/unit/math/rev/prob/wishart_test.cpp index b9622911e64..8f497bfd621 100644 --- a/test/unit/math/rev/prob/wishart_test.cpp +++ b/test/unit/math/rev/prob/wishart_test.cpp @@ -5,7 +5,7 @@ #include template -void expect_propto_wishart_lpdf(T_y W1, T_dof nu1, T_scale S1, T_y W2, +inline void expect_propto_wishart_lpdf(T_y W1, T_dof nu1, T_scale S1, T_y W2, T_dof nu2, T_scale S2, std::string message) { expect_eq_diffs(stan::math::wishart_lpdf(W1, nu1, S1), stan::math::wishart_lpdf(W2, nu2, S2), diff --git a/test/unit/math/test_ad.hpp b/test/unit/math/test_ad.hpp index bc6f186c901..7d5f61dce3d 100644 --- a/test/unit/math/test_ad.hpp +++ b/test/unit/math/test_ad.hpp @@ -123,7 +123,7 @@ auto eval(const std::vector& x) { * @param test_derivs `true` if derivatives should be tested */ template -void test_gradient(const ad_tolerances& tols, const F& f, +inline void test_gradient(const ad_tolerances& tols, const F& f, const Eigen::VectorXd& x, double fx, bool test_derivs = true) { Eigen::VectorXd grad_ad; @@ -165,7 +165,7 @@ void test_gradient(const ad_tolerances& tols, const F& f, * @param test_derivs `true` if derivatives should be tested */ template -void test_gradient_fvar(const ad_tolerances& tols, const F& f, +inline void test_gradient_fvar(const ad_tolerances& tols, const F& f, const Eigen::VectorXd& x, double fx, bool test_derivs = true) { Eigen::VectorXd grad_ad; @@ -206,7 +206,7 @@ void test_gradient_fvar(const ad_tolerances& tols, const F& f, * @param test_derivs `true` if derivatives should be tested */ template -void test_hessian_fvar(const ad_tolerances& tols, const F& f, +inline void test_hessian_fvar(const ad_tolerances& tols, const F& f, const Eigen::VectorXd& x, double fx, bool test_derivs = true) { double fx_ad; @@ -252,7 +252,7 @@ void test_hessian_fvar(const ad_tolerances& tols, const F& f, * @param test_derivs `true` if derivatives should be tested */ template -void test_hessian(const ad_tolerances& tols, const F& f, +inline void test_hessian(const ad_tolerances& tols, const F& f, const Eigen::VectorXd& x, double fx, bool test_derivs = true) { double fx_ad; @@ -297,7 +297,7 @@ void test_hessian(const ad_tolerances& tols, const F& f, * @param test_derivs `true` if derivatives should be tested */ template -void test_grad_hessian(const ad_tolerances& tols, const F& f, +inline void test_grad_hessian(const ad_tolerances& tols, const F& f, const Eigen::VectorXd& x, double fx, bool test_derivs = true) { double fx_ad; @@ -340,7 +340,7 @@ void test_grad_hessian(const ad_tolerances& tols, const F& f, * @param x argument to test */ template -void expect_ad_derivatives(const ad_tolerances& tols, const G& g, +inline void expect_ad_derivatives(const ad_tolerances& tols, const G& g, const Eigen::VectorXd& x) { double gx = g(x); test_gradient(tols, g, x, gx); @@ -367,7 +367,7 @@ void expect_ad_derivatives(const ad_tolerances& tols, const G& g, * @param name_of_T name of type of exception expected */ template -void expect_throw(const F& f, const Eigen::VectorXd& x, +inline void expect_throw(const F& f, const Eigen::VectorXd& x, const std::string& name_of_T) { Eigen::Matrix x_t(x.rows()); for (int i = 0; i < x.rows(); ++i) @@ -390,7 +390,7 @@ void expect_throw(const F& f, const Eigen::VectorXd& x, * @param x argument to test */ template -void expect_all_throw(const F& f, const Eigen::VectorXd& x) { +inline void expect_all_throw(const F& f, const Eigen::VectorXd& x) { using stan::math::fvar; using stan::math::var; expect_throw(f, x, "double"); @@ -414,7 +414,7 @@ void expect_all_throw(const F& f, const Eigen::VectorXd& x) { * @param x argument to evaluate */ template -void expect_all_throw(const F& f, double x1) { +inline void expect_all_throw(const F& f, double x1) { using stan::math::serialize_return; auto h = [&](auto v) { return serialize_return(eval(f(v(0)))); }; Eigen::VectorXd x(1); @@ -432,7 +432,7 @@ void expect_all_throw(const F& f, double x1) { * @param x2 second argument */ template -void expect_all_throw(const F& f, double x1, double x2) { +inline void expect_all_throw(const F& f, double x1, double x2) { using stan::math::serialize_return; auto h = [&](auto v) { return serialize_return(eval(f(v(0), v(1)))); }; Eigen::VectorXd x(2); @@ -451,7 +451,7 @@ void expect_all_throw(const F& f, double x1, double x2) { * @param x3 third argument */ template -void expect_all_throw(const F& f, double x1, double x2, double x3) { +inline void expect_all_throw(const F& f, double x1, double x2, double x3) { using stan::math::serialize_return; auto h = [&](auto v) { return serialize_return(eval(f(v(0), v(1), v(2)))); }; Eigen::VectorXd x(3); @@ -481,7 +481,7 @@ void expect_all_throw(const F& f, double x1, double x2, double x3) { * @param xs sequence of arguments with double-based scalars */ template -void expect_ad_helper(const ad_tolerances& tols, const F& f, const G& g, +inline void expect_ad_helper(const ad_tolerances& tols, const F& f, const G& g, const Eigen::VectorXd& x, Ts... xs) { using stan::math::serialize; auto h @@ -514,7 +514,7 @@ void expect_ad_helper(const ad_tolerances& tols, const F& f, const G& g, * @param x argument to test */ template -void expect_ad_v(const ad_tolerances& tols, const F& f, const T& x) { +inline void expect_ad_v(const ad_tolerances& tols, const F& f, const T& x) { using stan::math::serialize_args; using stan::math::serialize_return; using stan::math::to_deserializer; @@ -543,7 +543,7 @@ void expect_ad_v(const ad_tolerances& tols, const F& f, const T& x) { * @param x argument to test */ template -void expect_ad_v(const ad_tolerances& tols, const F& f, int x) { +inline void expect_ad_v(const ad_tolerances& tols, const F& f, int x) { double x_dbl = static_cast(x); // if f throws on int, must throw everywhere with double @@ -577,7 +577,7 @@ void expect_ad_v(const ad_tolerances& tols, const F& f, int x) { * @param x2 second argument */ template -void expect_ad_vv(const ad_tolerances& tols, const F& f, const T1& x1, +inline void expect_ad_vv(const ad_tolerances& tols, const F& f, const T1& x1, const T2& x2) { using stan::math::serialize_args; using stan::math::serialize_return; @@ -612,7 +612,7 @@ void expect_ad_vv(const ad_tolerances& tols, const F& f, const T1& x1, } template -void expect_ad_vv(const ad_tolerances& tols, const F& f, int x1, const T2& x2) { +inline void expect_ad_vv(const ad_tolerances& tols, const F& f, int x1, const T2& x2) { try { f(x1, x2); } catch (...) { @@ -634,7 +634,7 @@ void expect_ad_vv(const ad_tolerances& tols, const F& f, int x1, const T2& x2) { } template -void expect_ad_vv(const ad_tolerances& tols, const F& f, const T1& x1, int x2) { +inline void expect_ad_vv(const ad_tolerances& tols, const F& f, const T1& x1, int x2) { try { f(x1, x2); } catch (...) { @@ -656,7 +656,7 @@ void expect_ad_vv(const ad_tolerances& tols, const F& f, const T1& x1, int x2) { } template -void expect_ad_vv(const ad_tolerances& tols, const F& f, int x1, int x2) { +inline void expect_ad_vv(const ad_tolerances& tols, const F& f, int x1, int x2) { // this one needs throw test because it's not handled by recursion try { f(x1, x2); @@ -696,7 +696,7 @@ void expect_ad_vv(const ad_tolerances& tols, const F& f, int x1, int x2) { */ template -void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, +inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, const T2& x2, const T3& x3) { using stan::math::serialize_args; using stan::math::serialize_return; @@ -771,7 +771,7 @@ void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, } template -void expect_ad_vvv(const ad_tolerances& tols, const F& f, int x1, int x2, +inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, int x1, int x2, const T3& x3) { try { f(x1, x2, x3); @@ -800,7 +800,7 @@ void expect_ad_vvv(const ad_tolerances& tols, const F& f, int x1, int x2, } template -void expect_ad_vvv(const ad_tolerances& tols, const F& f, int x1, const T2& x2, +inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, int x1, const T2& x2, const T3& x3) { try { f(x1, x2, x3); @@ -824,7 +824,7 @@ void expect_ad_vvv(const ad_tolerances& tols, const F& f, int x1, const T2& x2, } template -void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, int x2, +inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, int x2, const T3& x3) { try { f(x1, x2, x3); @@ -848,7 +848,7 @@ void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, int x2, } template -void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, +inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, const T2& x2, int x3) { try { f(x1, x2, x3); @@ -872,7 +872,7 @@ void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, } template -void expect_ad_vvv(const ad_tolerances& tols, const F& f, int x1, const T2& x2, +inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, int x1, const T2& x2, int x3) { try { f(x1, x2, x3); @@ -901,7 +901,7 @@ void expect_ad_vvv(const ad_tolerances& tols, const F& f, int x1, const T2& x2, } template -void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, int x2, +inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, int x2, int x3) { try { f(x1, x2, x3); @@ -930,7 +930,7 @@ void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, int x2, } template -void expect_ad_vvv(const ad_tolerances& tols, const F& f, int x1, int x2, +inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, int x1, int x2, int x3) { // test exception behavior; other exception cases tested recursively try { @@ -989,18 +989,18 @@ const std::vector& common_nonzero_args() { * * @return sequence of common scalar arguments to test */ -std::vector common_args() { +inline std::vector common_args() { auto result = common_nonzero_args(); result.push_back(0); return result; } -std::vector common_nonzero_int_args() { +inline std::vector common_nonzero_int_args() { static const std::vector args{-1, 1}; return args; } -std::vector common_int_args() { +inline std::vector common_int_args() { std::vector args = common_nonzero_int_args(); args.push_back(0); return args; @@ -1030,7 +1030,7 @@ std::vector common_int_args() { * @param x2 second value being tested */ template -void expect_comparison(const F& f, const T1& x1, const T2& x2) { +inline void expect_comparison(const F& f, const T1& x1, const T2& x2) { using stan::math::fvar; using stan::math::var; typedef var v; @@ -1064,17 +1064,17 @@ void expect_comparison(const F& f, const T1& x1, const T2& x2) { } // namespace internal template -void expect_all_throw(const F& f, double x) { +inline void expect_all_throw(const F& f, double x) { internal::expect_all_throw(f, x); } template -void expect_all_throw(const F& f, double x1, double x2) { +inline void expect_all_throw(const F& f, double x1, double x2) { internal::expect_all_throw(f, x1, x2); } template -void expect_all_throw(const F& f, double x1, double x2, double x3) { +inline void expect_all_throw(const F& f, double x1, double x2, double x3) { internal::expect_all_throw(f, x1, x2, x3); } @@ -1090,7 +1090,7 @@ void expect_all_throw(const F& f, double x1, double x2, double x3) { * @param x value to test */ template -void expect_value(const F& f, const T& x) { +inline void expect_value(const F& f, const T& x) { using stan::math::fvar; using stan::math::var; typedef var v; @@ -1121,7 +1121,7 @@ void expect_value(const F& f, const T& x) { * @param x1 second argument to test */ template -void expect_value(const F& f, const T1& x1, const T2& x2) { +inline void expect_value(const F& f, const T1& x1, const T2& x2) { using stan::math::fvar; using stan::math::var; typedef var v; @@ -1166,7 +1166,7 @@ void expect_value(const F& f, const T1& x1, const T2& x2) { * @param x argument to test */ template -void expect_ad(const ad_tolerances& tols, const F& f, const T& x) { +inline void expect_ad(const ad_tolerances& tols, const F& f, const T& x) { internal::expect_ad_v(tols, f, x); } @@ -1182,7 +1182,7 @@ void expect_ad(const ad_tolerances& tols, const F& f, const T& x) { * @param x argument to test */ template -void expect_ad(const F& f, const T& x) { +inline void expect_ad(const F& f, const T& x) { constexpr ad_tolerances tols; expect_ad(tols, f, x); } @@ -1202,7 +1202,7 @@ void expect_ad(const F& f, const T& x) { * @param x2 second argument to test */ template -void expect_ad(const ad_tolerances& tols, const F& f, const T1& x1, +inline void expect_ad(const ad_tolerances& tols, const F& f, const T1& x1, const T2& x2) { internal::expect_ad_vv(tols, f, x1, x2); } @@ -1220,7 +1220,7 @@ void expect_ad(const ad_tolerances& tols, const F& f, const T1& x1, * @param x2 second argument to test */ template -void expect_ad(const F& f, const T1& x1, const T2& x2) { +inline void expect_ad(const F& f, const T1& x1, const T2& x2) { constexpr ad_tolerances tols; expect_ad(tols, f, x1, x2); } @@ -1243,7 +1243,7 @@ void expect_ad(const F& f, const T1& x1, const T2& x2) { */ template -void expect_ad(const ad_tolerances& tols, const F& f, const T1& x1, +inline void expect_ad(const ad_tolerances& tols, const F& f, const T1& x1, const T2& x2, const T3& x3) { internal::expect_ad_vvv(tols, f, x1, x2, x3); } @@ -1264,7 +1264,7 @@ void expect_ad(const ad_tolerances& tols, const F& f, const T1& x1, */ template -void expect_ad(const F& f, const T1& x1, const T2& x2, const T3& x3) { +inline void expect_ad(const F& f, const T1& x1, const T2& x2, const T3& x3) { constexpr ad_tolerances tols; expect_ad(tols, f, x1, x2, x3); } @@ -1296,7 +1296,7 @@ template < ScalarSupport ComplexSupport = ScalarSupport::Real, typename F, typename T1, stan::require_t< stan::bool_constant>* = nullptr> -void expect_ad_vectorized(const ad_tolerances& tols, const F& f, const T1& x1) { +inline void expect_ad_vectorized(const ad_tolerances& tols, const F& f, const T1& x1) { using Scalar = std::conditional_t::value, double, T1>; using matrix_t = Eigen::Matrix; using vector_t = Eigen::Matrix; @@ -1348,7 +1348,7 @@ void expect_ad_vectorized(const ad_tolerances& tols, const F& f, const T1& x1) { template >* = nullptr> -void expect_ad_vectorized(const ad_tolerances& tols, const F& f, const T1& x1) { +inline void expect_ad_vectorized(const ad_tolerances& tols, const F& f, const T1& x1) { using Scalar = std::conditional_t::value, double, T1>; using matrix_t = Eigen::Matrix; using vector_t = Eigen::Matrix; @@ -1433,7 +1433,7 @@ void expect_ad_vectorized(const ad_tolerances& tols, const F& f, const T1& x1) { template >* = nullptr> -void expect_ad_vectorized(const ad_tolerances& tols, const F& f, const T1& x1) { +inline void expect_ad_vectorized(const ad_tolerances& tols, const F& f, const T1& x1) { using Scalar = std::conditional_t::value, double, T1>; using complex_t = std::complex; using complex_matrix_t = Eigen::Matrix; @@ -1495,7 +1495,7 @@ void expect_ad_vectorized(const ad_tolerances& tols, const F& f, const T1& x1) { */ template -void expect_ad_vectorized(const F& f, const T& x) { +inline void expect_ad_vectorized(const F& f, const T& x) { constexpr ad_tolerances tols; expect_ad_vectorized(tols, f, x); } @@ -1514,7 +1514,7 @@ void expect_ad_vectorized(const F& f, const T& x) { */ template * = nullptr> -void expect_ad_vectorized_binary_impl(const ad_tolerances& tols, const F& f, +inline void expect_ad_vectorized_binary_impl(const ad_tolerances& tols, const F& f, const T1& x, const T2& y) { std::vector nest_x{x, x}; std::vector nest_y{y, y}; @@ -1547,7 +1547,7 @@ void expect_ad_vectorized_binary_impl(const ad_tolerances& tols, const F& f, * @param z argument to test */ template -void expect_ad_vectorized_ternary_impl(const ad_tolerances& tols, const F& f, +inline void expect_ad_vectorized_ternary_impl(const ad_tolerances& tols, const F& f, const T1& x, const T2& y, const T3& z) { std::vector nest_x{x}; std::vector nest_y{y}; @@ -1581,7 +1581,7 @@ void expect_ad_vectorized_ternary_impl(const ad_tolerances& tols, const F& f, */ template * = nullptr> -void expect_ad_vectorized_binary_impl(const ad_tolerances& tols, const F& f, +inline void expect_ad_vectorized_binary_impl(const ad_tolerances& tols, const F& f, const T1& x, const T2& y) { auto f_bind = [&](const auto& x) { return [=](const auto& y) { return f(x, y); }; }; @@ -1610,7 +1610,7 @@ void expect_ad_vectorized_binary_impl(const ad_tolerances& tols, const F& f, */ template * = nullptr> -void expect_ad_vectorized_binary_impl(const ad_tolerances& tols, const F& f, +inline void expect_ad_vectorized_binary_impl(const ad_tolerances& tols, const F& f, const T1& x, const T2& y) { auto f_bind = [&](const auto& y) { return [=](const auto& x) { return f(x, y); }; }; @@ -1639,7 +1639,7 @@ void expect_ad_vectorized_binary_impl(const ad_tolerances& tols, const F& f, */ template * = nullptr> -void expect_ad_vectorized_binary(const ad_tolerances& tols, const F& f, +inline void expect_ad_vectorized_binary(const ad_tolerances& tols, const F& f, const T1& x, const T2& y) { expect_ad_vectorized_binary_impl(tols, f, x, y); expect_ad_vectorized_binary_impl(tols, f, math::to_array_1d(x), @@ -1664,7 +1664,7 @@ void expect_ad_vectorized_binary(const ad_tolerances& tols, const F& f, */ template * = nullptr> -void expect_ad_vectorized_ternary(const ad_tolerances& tols, const F& f, +inline void expect_ad_vectorized_ternary(const ad_tolerances& tols, const F& f, const T1& x, const T2& y, const T3& z) { expect_ad_vectorized_ternary_impl(tols, f, x, y, z); expect_ad_vectorized_ternary_impl(tols, f, math::to_array_1d(x), @@ -1687,7 +1687,7 @@ void expect_ad_vectorized_ternary(const ad_tolerances& tols, const F& f, */ template * = nullptr> -void expect_ad_vectorized_binary(const ad_tolerances& tols, const F& f, +inline void expect_ad_vectorized_binary(const ad_tolerances& tols, const F& f, const T1& x, const T2& y) { expect_ad_vectorized_binary_impl(tols, f, x, y); } @@ -1710,7 +1710,7 @@ void expect_ad_vectorized_binary(const ad_tolerances& tols, const F& f, */ template * = nullptr> -void expect_ad_vectorized_ternary(const ad_tolerances& tols, const F& f, +inline void expect_ad_vectorized_ternary(const ad_tolerances& tols, const F& f, const T1& x, const T2& y, const T3& z) { expect_ad_vectorized_ternary_impl(tols, f, x, y, z); } @@ -1728,7 +1728,7 @@ void expect_ad_vectorized_ternary(const ad_tolerances& tols, const F& f, * @param y argument to test */ template -void expect_ad_vectorized_binary(const F& f, const T1& x, const T2& y) { +inline void expect_ad_vectorized_binary(const F& f, const T1& x, const T2& y) { constexpr ad_tolerances tols; expect_ad_vectorized_binary(tols, f, x, y); } @@ -1748,7 +1748,7 @@ void expect_ad_vectorized_binary(const F& f, const T1& x, const T2& y) { * @param z argument to test */ template -void expect_ad_vectorized_ternary(const F& f, const T1& x, const T2& y, +inline void expect_ad_vectorized_ternary(const F& f, const T1& x, const T2& y, const T3& z) { constexpr ad_tolerances tols; expect_ad_vectorized_ternary(tols, f, x, y, z); @@ -1765,7 +1765,7 @@ void expect_ad_vectorized_ternary(const F& f, const T1& x, const T2& y, * @param f unary functor to test */ template -void expect_common_unary(const F& f) { +inline void expect_common_unary(const F& f) { auto args = internal::common_args(); for (double x1 : args) expect_ad(f, x1); @@ -1785,7 +1785,7 @@ void expect_common_unary(const F& f) { * @param f functor to test */ template -void expect_common_nonzero_unary(const F& f) { +inline void expect_common_nonzero_unary(const F& f) { auto args = internal::common_nonzero_args(); for (double x1 : args) expect_ad(f, x1); @@ -1814,7 +1814,7 @@ void expect_common_nonzero_unary(const F& f) { * for second argments */ template -void expect_common_nonzero_binary(const F& f, bool disable_lhs_int = false) { +inline void expect_common_nonzero_binary(const F& f, bool disable_lhs_int = false) { auto args = internal::common_nonzero_args(); auto int_args = internal::common_nonzero_int_args(); for (double x1 : args) @@ -1858,7 +1858,7 @@ void expect_common_nonzero_binary(const F& f, bool disable_lhs_int = false) { * for second argments */ template -void expect_common_binary(const F& f, bool disable_lhs_int = false) { +inline void expect_common_binary(const F& f, bool disable_lhs_int = false) { auto args = internal::common_args(); auto int_args = internal::common_int_args(); for (double x1 : args) @@ -1881,15 +1881,15 @@ void expect_common_binary(const F& f, bool disable_lhs_int = false) { } } -std::vector common_complex_parts_re() { +inline std::vector common_complex_parts_re() { return {-4, -2.5, -1.5, -0.3, -0.1, 0.1, 1.3, 2.1, 3.9}; } -std::vector common_complex_parts_im() { +inline std::vector common_complex_parts_im() { return {-4, -2.5, -1.5, -0.3, -0.0, 0.0, 1.3, 2.1, 3.9}; } -std::vector> common_complex() { +inline std::vector> common_complex() { std::vector> zs; auto complex_re = common_complex_parts_re(); auto complex_im = common_complex_parts_im(); @@ -1900,7 +1900,7 @@ std::vector> common_complex() { } template -void expect_complex_common(const F& f) { +inline void expect_complex_common(const F& f) { auto zs = common_complex(); for (auto z : zs) { expect_ad(f, z); @@ -1908,7 +1908,7 @@ void expect_complex_common(const F& f) { } template -void expect_complex_common_binary(const F& f) { +inline void expect_complex_common_binary(const F& f) { auto xs = common_complex_parts_re(); auto zs = common_complex(); // complex, complex @@ -1932,7 +1932,7 @@ void expect_complex_common_binary(const F& f) { } template -void expect_complex_compare(const F& f, const std::complex& z1, +inline void expect_complex_compare(const F& f, const std::complex& z1, const std::complex& z2) { using c_t = std::complex; c_t cz1{z1}; @@ -1952,7 +1952,7 @@ void expect_complex_compare(const F& f, const std::complex& z1, } template -void expect_complex_comparison(const F& f, const std::complex& z1, +inline void expect_complex_comparison(const F& f, const std::complex& z1, const std::complex& z2) { using stan::math::fvar; using stan::math::var; @@ -1973,7 +1973,7 @@ void expect_complex_comparison(const F& f, const std::complex& z1, * @param f function to test */ template -void expect_complex_common_comparison(const F& f) { +inline void expect_complex_common_comparison(const F& f) { for (auto z1 : common_complex()) { for (auto z2 : common_complex()) { expect_complex_comparison(f, z1, z2); @@ -2002,7 +2002,7 @@ void expect_complex_common_comparison(const F& f) { template < ScalarSupport ComplexSupport = ScalarSupport::Real, typename F, require_t>* = nullptr> -void expect_common_unary_vectorized(const F& f) { +inline void expect_common_unary_vectorized(const F& f) { constexpr ad_tolerances tols; auto args = internal::common_args(); for (double x1 : args) @@ -2033,7 +2033,7 @@ void expect_common_unary_vectorized(const F& f) { template >* = nullptr> -void expect_common_unary_vectorized(const F& f) { +inline void expect_common_unary_vectorized(const F& f) { constexpr ad_tolerances tols; auto args = internal::common_args(); for (double x1 : args) @@ -2066,14 +2066,14 @@ void expect_common_unary_vectorized(const F& f) { template >* = nullptr> -void expect_common_unary_vectorized(const F& f) { +inline void expect_common_unary_vectorized(const F& f) { constexpr ad_tolerances tols; for (auto x1 : common_complex()) stan::test::expect_ad_vectorized(tols, f, x1); } template -void expect_unary_vectorized(const ad_tolerances& tols, const F& f) {} +inline void expect_unary_vectorized(const ad_tolerances& tols, const F& f) {} /** * Test that the specified vectorized unary function has value and @@ -2091,7 +2091,7 @@ void expect_unary_vectorized(const ad_tolerances& tols, const F& f) {} */ template -void expect_unary_vectorized(const ad_tolerances& tols, const F& f, T x, +inline void expect_unary_vectorized(const ad_tolerances& tols, const F& f, T x, Ts... xs) { expect_ad_vectorized(tols, f, x); expect_unary_vectorized(tols, f, xs...); @@ -2111,7 +2111,7 @@ void expect_unary_vectorized(const ad_tolerances& tols, const F& f, T x, */ template * = nullptr, typename... Ts> -void expect_unary_vectorized(const F& f, Ts... xs) { +inline void expect_unary_vectorized(const F& f, Ts... xs) { constexpr ad_tolerances tols; // default tolerances expect_unary_vectorized(tols, f, xs...); } @@ -2132,7 +2132,7 @@ void expect_unary_vectorized(const F& f, Ts... xs) { template >* = nullptr> -void expect_common_nonzero_unary_vectorized(const F& f) { +inline void expect_common_nonzero_unary_vectorized(const F& f) { constexpr ad_tolerances tols; for (double x : internal::common_nonzero_args()) stan::test::expect_unary_vectorized(tols, f, x); @@ -2156,7 +2156,7 @@ void expect_common_nonzero_unary_vectorized(const F& f) { template >* = nullptr> -void expect_common_nonzero_unary_vectorized(const F& f) { +inline void expect_common_nonzero_unary_vectorized(const F& f) { constexpr ad_tolerances tols; for (double x : internal::common_nonzero_args()) stan::test::expect_unary_vectorized(tols, f, x); @@ -2182,7 +2182,7 @@ void expect_common_nonzero_unary_vectorized(const F& f) { template >* = nullptr> -void expect_common_nonzero_unary_vectorized(const F& f) { +inline void expect_common_nonzero_unary_vectorized(const F& f) { constexpr ad_tolerances tols; for (auto x1 : common_complex()) stan::test::expect_ad_vectorized(tols, f, x1); @@ -2197,7 +2197,7 @@ void expect_common_nonzero_unary_vectorized(const F& f) { * @param f functor to test */ template -void expect_common_comparison(const F& f) { +inline void expect_common_comparison(const F& f) { auto args = internal::common_args(); auto int_args = internal::common_int_args(); for (double x1 : args) @@ -2227,7 +2227,7 @@ void expect_common_comparison(const F& f) { * @param x argument to test */ template -void expect_match_prim(const F1& f1, const F2& f2, const T& x) { +inline void expect_match_prim(const F1& f1, const F2& f2, const T& x) { try { auto y1 = f1(x); try { @@ -2260,7 +2260,7 @@ void expect_match_prim(const F1& f1, const F2& f2, const T& x) { * @param f2 second function to test */ template -void expect_common_prim(const F1& f1, const F2& f2) { +inline void expect_common_prim(const F1& f1, const F2& f2) { for (double x : internal::common_args()) expect_match_prim(f1, f2, x); for (int x : internal::common_int_args()) @@ -2279,7 +2279,7 @@ void expect_common_prim(const F1& f1, const F2& f2) { * @return sequence of covariance matrices between specified sizes * with specified autocorrelation */ -std::vector ar_test_cov_matrices(int N_min, int N_max, +inline std::vector ar_test_cov_matrices(int N_min, int N_max, double rho) { std::vector ys; for (int n = N_min; n <= N_max; ++n) { @@ -2303,7 +2303,7 @@ std::vector ar_test_cov_matrices(int N_min, int N_max, * @param x standard vector input * @return copy as Eigen vector */ -Eigen::VectorXd to_vector(const std::vector& x) { +inline Eigen::VectorXd to_vector(const std::vector& x) { Eigen::VectorXd y(x.size()); for (size_t i = 0; i < x.size(); ++i) y(i) = x[i]; @@ -2320,7 +2320,7 @@ Eigen::VectorXd to_vector(const std::vector& x) { * @return copy as vector */ template -Eigen::VectorXd to_vector(const Eigen::Matrix& x) { +inline Eigen::VectorXd to_vector(const Eigen::Matrix& x) { Eigen::VectorXd y(x.size()); for (int i = 0; i < x.size(); ++i) y(i) = x(i); @@ -2334,7 +2334,7 @@ Eigen::VectorXd to_vector(const Eigen::Matrix& x) { * @param x standard vector input * @return copy as Eigen row vector */ -Eigen::RowVectorXd to_row_vector(const std::vector& x) { +inline Eigen::RowVectorXd to_row_vector(const std::vector& x) { Eigen::RowVectorXd y(x.size()); for (size_t i = 0; i < x.size(); ++i) y(i) = x[i]; @@ -2351,7 +2351,7 @@ Eigen::RowVectorXd to_row_vector(const std::vector& x) { * @return copy as row vector */ template -Eigen::VectorXd to_row_vector(const Eigen::Matrix& x) { +inline Eigen::VectorXd to_row_vector(const Eigen::Matrix& x) { Eigen::RowVectorXd y(x.size()); for (int i = 0; i < x.size(); ++i) y(i) = x(i); @@ -2366,7 +2366,7 @@ Eigen::VectorXd to_row_vector(const Eigen::Matrix& x) { * @param max maximum matrix dimensionality to include * @return square matrices within given dimensionality range (inclusive) */ -std::vector square_test_matrices(int low, int high) { +inline std::vector square_test_matrices(int low, int high) { std::vector xs; Eigen::MatrixXd a00(0, 0); if (0 >= low && 0 <= high) diff --git a/test/unit/math/test_ad_matvar.hpp b/test/unit/math/test_ad_matvar.hpp index be37a177d3d..83d4ecbd78b 100644 --- a/test/unit/math/test_ad_matvar.hpp +++ b/test/unit/math/test_ad_matvar.hpp @@ -35,7 +35,7 @@ template < typename T1, typename T2, require_all_not_std_vector_t, value_type_t>* = nullptr, require_all_std_vector_st* = nullptr> -void expect_near_rel_matvar(const std::string& message, T1&& x, T2&& y, +inline void expect_near_rel_matvar(const std::string& message, T1&& x, T2&& y, const ad_tolerances& tols) { stan::math::check_size_match("expect_near_rel_var", "x", x.size(), "y", y.size()); @@ -52,7 +52,7 @@ void expect_near_rel_matvar(const std::string& message, T1&& x, T2&& y, template * = nullptr, require_all_std_vector_st* = nullptr> -void expect_near_rel_matvar(const std::string& message, T1&& x, T2&& y, +inline void expect_near_rel_matvar(const std::string& message, T1&& x, T2&& y, const ad_tolerances& tols) { stan::math::check_size_match("expect_near_rel_var", "x", x.size(), "y", y.size()); @@ -75,7 +75,7 @@ void expect_near_rel_matvar(const std::string& message, T1&& x, T2&& y, */ template * = nullptr, require_all_not_std_vector_t* = nullptr> -void expect_near_rel_matvar(const std::string& message, T1&& x, T2&& y, +inline void expect_near_rel_matvar(const std::string& message, T1&& x, T2&& y, const ad_tolerances& tols) { expect_near_rel(message + std::string(" values"), x.val(), y.val(), tols.gradient_val_); @@ -96,7 +96,7 @@ void expect_near_rel_matvar(const std::string& message, T1&& x, T2&& y, */ template * = nullptr> -void expect_near_rel_matvar(const std::string& message, T1&& x, T2&& y, +inline void expect_near_rel_matvar(const std::string& message, T1&& x, T2&& y, const ad_tolerances& tols) { expect_near_rel(message + std::string(" doubles"), stan::math::value_of(x), stan::math::value_of(y), tols.gradient_val_); @@ -121,7 +121,7 @@ inline constexpr auto make_tuple_seq(std::index_sequence idxs) { * @param tols Tolerances for comparison */ template -void expect_near_rel_matvar(const std::string& message, +inline void expect_near_rel_matvar(const std::string& message, const std::tuple& x, const std::tuple& y, const ad_tolerances& tols) { @@ -416,7 +416,7 @@ auto make_varmat_compatible(const std::vector>& x) { * @param x Input values to test function at */ template -void expect_ad_matvar_impl(const ad_tolerances& tols, const F& f, +inline void expect_ad_matvar_impl(const ad_tolerances& tols, const F& f, const EigMats&... x) { using stan::is_eigen; using stan::is_var; @@ -534,7 +534,7 @@ void expect_ad_matvar_impl(const ad_tolerances& tols, const F& f, * @param x Value of argument */ template -void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat& x) { +inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat& x) { using varmat = stan::math::var_value; expect_ad_matvar_impl(tols, f, x); @@ -549,7 +549,7 @@ void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat& x) { * @param x Value of argument */ template -void expect_ad_matvar(const F& f, const EigMat& x) { +inline void expect_ad_matvar(const F& f, const EigMat& x) { ad_tolerances tols; expect_ad_matvar(tols, f, x); @@ -568,7 +568,7 @@ void expect_ad_matvar(const F& f, const EigMat& x) { */ template * = nullptr> -void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat1& x, +inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat1& x, const EigMat2& y) { using stan::math::var; using varmat = stan::math::var_value; @@ -583,7 +583,7 @@ void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat1& x, template * = nullptr, require_not_st_integral* = nullptr> -void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat1& x, +inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat1& x, const EigMat2& y) { using stan::math::var; using varmat = stan::math::var_value; @@ -594,7 +594,7 @@ void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat1& x, template * = nullptr, require_st_integral* = nullptr> -void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat1& x, +inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat1& x, const EigMat2& y) { using stan::math::var; using varmat = stan::math::var_value; @@ -613,7 +613,7 @@ void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat1& x, * @param y Value of second argument */ template -void expect_ad_matvar(const F& f, const EigMat1& x, const EigMat2& y) { +inline void expect_ad_matvar(const F& f, const EigMat1& x, const EigMat2& y) { ad_tolerances tols; expect_ad_matvar(tols, f, x, y); } @@ -632,7 +632,7 @@ void expect_ad_matvar(const F& f, const EigMat1& x, const EigMat2& y) { * @param z Value of third argument */ template -void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat1& x, +inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat1& x, const EigMat2& y, const EigMat3& z) { using stan::math::var; using varmat = stan::math::var_value; @@ -671,7 +671,7 @@ void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat1& x, * @param z Value of third argument */ template -void expect_ad_matvar(const F& f, const EigMat1& x, const EigMat2& y, +inline void expect_ad_matvar(const F& f, const EigMat1& x, const EigMat2& y, const EigMat3& z) { ad_tolerances tols; expect_ad_matvar(tols, f, x, y, z); @@ -694,7 +694,7 @@ void expect_ad_matvar(const F& f, const EigMat1& x, const EigMat2& y, */ template -void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat1& x, +inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat1& x, const EigMat2& y, const EigMat3& z, const EigMat4& q) { using stan::math::var; using varmat = stan::math::var_value; @@ -790,7 +790,7 @@ void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat1& x, */ template -void expect_ad_matvar(const F& f, const EigMat1& x, const EigMat2& y, +inline void expect_ad_matvar(const F& f, const EigMat1& x, const EigMat2& y, const EigMat3& z, const EigMat4& q) { ad_tolerances tols; expect_ad_matvar(tols, f, x, y, z, q); @@ -816,7 +816,7 @@ void expect_ad_matvar(const F& f, const EigMat1& x, const EigMat2& y, */ template * = nullptr> -void expect_ad_vector_matvar(const ad_tolerances& tols, const F& f, +inline void expect_ad_vector_matvar(const ad_tolerances& tols, const F& f, const EigVec& x) { Eigen::VectorXd v = x; Eigen::RowVectorXd r = x.transpose(); @@ -848,7 +848,7 @@ void expect_ad_vector_matvar(const ad_tolerances& tols, const F& f, */ template * = nullptr> -void expect_ad_vector_matvar(const F& f, const EigVec& x) { +inline void expect_ad_vector_matvar(const F& f, const EigVec& x) { ad_tolerances tols; expect_ad_vector_matvar(tols, f, x); } @@ -865,7 +865,7 @@ void expect_ad_vector_matvar(const F& f, const EigVec& x) { template * = nullptr, require_all_not_st_integral* = nullptr> -void expect_ad_vectorized_matvar(const ad_tolerances& tols, const F& f, +inline void expect_ad_vectorized_matvar(const ad_tolerances& tols, const F& f, const T1& x, const T2& y) { auto x_scal = x.coeff(0, 0); auto y_scal = y.coeff(0, 0); @@ -958,7 +958,7 @@ void expect_ad_vectorized_matvar(const ad_tolerances& tols, const F& f, template * = nullptr, require_eigen_t* = nullptr> -void expect_ad_vectorized_matvar(const ad_tolerances& tols, const F& f, +inline void expect_ad_vectorized_matvar(const ad_tolerances& tols, const F& f, const T1& x, const T2& y) { auto x_scal = x[0]; auto y_vec = y.col(0).eval(); @@ -996,7 +996,7 @@ void expect_ad_vectorized_matvar(const ad_tolerances& tols, const F& f, */ template * = nullptr, require_std_vector_vt* = nullptr> -void expect_ad_vectorized_matvar(const ad_tolerances& tols, const F& f, +inline void expect_ad_vectorized_matvar(const ad_tolerances& tols, const F& f, const T1& x, const T2& y) { auto g = [&f](const auto& x, const auto& y) { return f(y, x); }; expect_ad_vectorized_matvar(tols, g, y, x); @@ -1012,7 +1012,7 @@ void expect_ad_vectorized_matvar(const ad_tolerances& tols, const F& f, * @param x Test input */ template -void expect_ad_vectorized_matvar(const F& f, const T1& x, const T2& y) { +inline void expect_ad_vectorized_matvar(const F& f, const T1& x, const T2& y) { ad_tolerances tols; expect_ad_vectorized_matvar(tols, f, x, y); } diff --git a/test/unit/math/test_ad_test.cpp b/test/unit/math/test_ad_test.cpp index 8eb5f4210a6..b90f8d5edc8 100644 --- a/test/unit/math/test_ad_test.cpp +++ b/test/unit/math/test_ad_test.cpp @@ -43,10 +43,10 @@ TEST(test_unit_math_test_ad, expect_ad_vectorized) { // double overload matches template behavior and passes tests template -T f_match(const T& x) { +inline T f_match(const T& x) { return -2 * x; } -double f_match(const double& x) { return -2 * x; } +inline double f_match(const double& x) { return -2 * x; } TEST(test_ad, match) { double x = 3.2; auto g = [](const auto& u) { return f_match(u); }; @@ -57,10 +57,10 @@ TEST(test_ad, match) { // double overload does not match template behavior for value template -T f_mismatch(const T& x) { +inline T f_mismatch(const T& x) { return -2 * x; } -stan::math::var f_mismatch(const stan::math::var& x) { return 2 * x; } +inline stan::math::var f_mismatch(const stan::math::var& x) { return 2 * x; } TEST(test_ad, mismatch) { double x = 3.2; auto g = [](const auto& u) { return f_mismatch(u); }; @@ -72,10 +72,10 @@ TEST(test_ad, mismatch) { // double overload does not match template behavior for exceptions template -T f_misthrow(const T& x) { +inline T f_misthrow(const T& x) { return -2 * x; } -double f_misthrow(const double& x) { +inline double f_misthrow(const double& x) { throw std::runtime_error("f_misthrow(double) called"); return -2 * x; } @@ -234,33 +234,33 @@ int baz_complex = 0; int baz_complex_var = 0; int baz_complex_fvar = 0; -double baz(int x) { +inline double baz(int x) { ++baz_int; return x / 2.0; } -double baz(double x) { +inline double baz(double x) { ++baz_double; return x / 2.0; } -stan::math::var baz(const stan::math::var& x) { +inline stan::math::var baz(const stan::math::var& x) { ++baz_var; return x / 2.0; } -std::complex baz(std::complex x) { +inline std::complex baz(std::complex x) { ++baz_complex; return x / 2.0; } -std::complex baz(const std::complex& x) { +inline std::complex baz(const std::complex& x) { ++baz_complex_var; return x / 2.0; } template -stan::math::fvar baz(const stan::math::fvar& x) { +inline stan::math::fvar baz(const stan::math::fvar& x) { ++baz_fvar; return x / 2.0; } template -std::complex> baz( +inline std::complex> baz( const std::complex>& x) { ++baz_complex_fvar; return x / 2.0; diff --git a/test/unit/multiple_translation_units1.cpp b/test/unit/multiple_translation_units1.cpp index ec8ac22e5a8..c1f4f92125b 100644 --- a/test/unit/multiple_translation_units1.cpp +++ b/test/unit/multiple_translation_units1.cpp @@ -1,3 +1,3 @@ #include -stan::math::var function1() { return 0; } +inline stan::math::var function1() { return 0; } diff --git a/test/unit/multiple_translation_units2.cpp b/test/unit/multiple_translation_units2.cpp index 4d8d5083351..cb11d730165 100644 --- a/test/unit/multiple_translation_units2.cpp +++ b/test/unit/multiple_translation_units2.cpp @@ -1,3 +1,3 @@ #include -stan::math::var function2() { return 0; } +inline stan::math::var function2() { return 0; } From bf46263fc2e4a144465efdac73eac53ab5db4a03 Mon Sep 17 00:00:00 2001 From: Stan Jenkins Date: Fri, 3 Oct 2025 16:50:45 -0400 Subject: [PATCH 2/5] [Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1 --- stan/math/fwd/functor/gradient.hpp | 4 +- stan/math/fwd/functor/hessian.hpp | 6 +- stan/math/fwd/functor/jacobian.hpp | 4 +- .../math/mix/functor/hessian_times_vector.hpp | 6 +- stan/math/mix/functor/partial_derivative.hpp | 4 +- stan/math/opencl/indexing_rev.hpp | 2 +- .../opencl/kernel_generator/evaluate_into.hpp | 3 +- .../opencl/kernel_generator/holder_cl.hpp | 4 +- stan/math/opencl/prim/bernoulli_cdf.hpp | 2 +- stan/math/opencl/prim/bernoulli_lccdf.hpp | 2 +- stan/math/opencl/prim/bernoulli_lcdf.hpp | 2 +- .../math/opencl/prim/bernoulli_logit_lpmf.hpp | 2 +- stan/math/opencl/prim/bernoulli_lpmf.hpp | 2 +- stan/math/opencl/prim/binomial_logit_lpmf.hpp | 5 +- stan/math/opencl/prim/binomial_lpmf.hpp | 2 +- stan/math/opencl/prim/chi_square_lpdf.hpp | 2 +- stan/math/opencl/prim/exp_mod_normal_cdf.hpp | 6 +- stan/math/opencl/prim/exp_mod_normal_lcdf.hpp | 6 +- stan/math/opencl/prim/exp_mod_normal_lpdf.hpp | 6 +- stan/math/opencl/prim/gumbel_cdf.hpp | 5 +- stan/math/opencl/prim/inv_chi_square_lpdf.hpp | 2 +- stan/math/opencl/prim/pareto_type_2_cdf.hpp | 6 +- stan/math/opencl/prim/pareto_type_2_lccdf.hpp | 6 +- stan/math/opencl/prim/pareto_type_2_lcdf.hpp | 6 +- stan/math/opencl/prim/pareto_type_2_lpdf.hpp | 6 +- stan/math/opencl/prim/poisson_log_lpmf.hpp | 4 +- stan/math/opencl/prim/poisson_lpmf.hpp | 2 +- stan/math/opencl/prim/rayleigh_cdf.hpp | 2 +- stan/math/opencl/prim/rayleigh_lccdf.hpp | 4 +- stan/math/opencl/prim/rayleigh_lcdf.hpp | 4 +- stan/math/opencl/prim/rayleigh_lpdf.hpp | 4 +- stan/math/opencl/prim/uniform_cdf.hpp | 5 +- stan/math/opencl/prim/uniform_lcdf.hpp | 5 +- stan/math/opencl/qr_decomposition.hpp | 5 +- stan/math/opencl/rev/adjoint_results.hpp | 3 +- stan/math/opencl/symmetric_eigensolver.hpp | 4 +- .../math/prim/constraint/corr_matrix_free.hpp | 3 +- stan/math/prim/constraint/cov_matrix_free.hpp | 3 +- stan/math/prim/err/check_cholesky_factor.hpp | 2 +- .../prim/err/check_cholesky_factor_corr.hpp | 4 +- stan/math/prim/err/check_corr_matrix.hpp | 2 +- stan/math/prim/err/check_cov_matrix.hpp | 3 +- stan/math/prim/err/check_ordered.hpp | 9 +- stan/math/prim/err/check_positive_ordered.hpp | 4 +- stan/math/prim/err/check_simplex.hpp | 6 +- stan/math/prim/err/check_sorted.hpp | 5 +- .../math/prim/err/check_stochastic_column.hpp | 4 +- stan/math/prim/err/check_stochastic_row.hpp | 4 +- stan/math/prim/err/check_sum_to_zero.hpp | 6 +- stan/math/prim/err/check_unit_vector.hpp | 4 +- stan/math/prim/fun/autocorrelation.hpp | 7 +- stan/math/prim/fun/autocovariance.hpp | 7 +- stan/math/prim/fun/eigenvalues_sym.hpp | 3 +- stan/math/prim/fun/factor_cov_matrix.hpp | 3 +- stan/math/prim/fun/gp_dot_prod_cov.hpp | 10 +- stan/math/prim/fun/grad_2F1.hpp | 16 ++- stan/math/prim/fun/grad_F32.hpp | 6 +- stan/math/prim/fun/grad_reg_inc_beta.hpp | 4 +- stan/math/prim/fun/grad_reg_inc_gamma.hpp | 4 +- .../prim/fun/grad_reg_lower_inc_gamma.hpp | 4 +- stan/math/prim/fun/hypergeometric_2F2.hpp | 2 +- stan/math/prim/fun/hypergeometric_pFq.hpp | 2 +- stan/math/prim/fun/log_mix.hpp | 2 +- stan/math/prim/fun/matrix_exp_pade.hpp | 2 +- stan/math/prim/fun/pseudo_eigenvalues.hpp | 3 +- stan/math/prim/fun/qr.hpp | 5 +- stan/math/prim/fun/qr_thin.hpp | 5 +- stan/math/prim/fun/qr_thin_Q.hpp | 4 +- stan/math/prim/fun/qr_thin_R.hpp | 4 +- stan/math/prim/fun/read_corr_L.hpp | 10 +- stan/math/prim/fun/read_cov_L.hpp | 5 +- stan/math/prim/fun/resize.hpp | 3 +- stan/math/prim/fun/svd_U.hpp | 4 +- stan/math/prim/fun/svd_V.hpp | 4 +- .../prim/functor/finite_diff_gradient.hpp | 5 +- .../functor/finite_diff_gradient_auto.hpp | 2 +- stan/math/prim/functor/map_rect.hpp | 3 +- .../math/prim/functor/map_rect_concurrent.hpp | 3 +- stan/math/prim/functor/map_rect_mpi.hpp | 3 +- stan/math/prim/functor/ode_ckrk.hpp | 6 +- stan/math/prim/functor/ode_rk45.hpp | 6 +- stan/math/prim/functor/reduce_sum_static.hpp | 2 +- stan/math/prim/prob/bernoulli_ccdf_log.hpp | 3 +- stan/math/prim/prob/bernoulli_cdf_log.hpp | 3 +- stan/math/prim/prob/bernoulli_lccdf.hpp | 3 +- stan/math/prim/prob/bernoulli_logit_lpmf.hpp | 3 +- .../math/prim/prob/beta_binomial_ccdf_log.hpp | 6 +- stan/math/prim/prob/beta_binomial_cdf.hpp | 7 +- stan/math/prim/prob/beta_binomial_cdf_log.hpp | 6 +- stan/math/prim/prob/beta_binomial_lccdf.hpp | 5 +- stan/math/prim/prob/beta_binomial_lcdf.hpp | 7 +- stan/math/prim/prob/beta_binomial_lpmf.hpp | 14 +- .../prim/prob/beta_proportion_cdf_log.hpp | 5 +- stan/math/prim/prob/beta_proportion_lccdf.hpp | 5 +- stan/math/prim/prob/beta_proportion_lcdf.hpp | 5 +- stan/math/prim/prob/beta_proportion_lpdf.hpp | 5 +- stan/math/prim/prob/binomial_ccdf_log.hpp | 2 +- stan/math/prim/prob/binomial_cdf.hpp | 2 +- stan/math/prim/prob/binomial_cdf_log.hpp | 2 +- stan/math/prim/prob/binomial_lccdf.hpp | 2 +- stan/math/prim/prob/binomial_lcdf.hpp | 2 +- stan/math/prim/prob/binomial_logit_lpmf.hpp | 2 +- stan/math/prim/prob/binomial_lpmf.hpp | 2 +- .../math/prim/prob/categorical_logit_lpmf.hpp | 2 +- stan/math/prim/prob/categorical_lpmf.hpp | 2 +- stan/math/prim/prob/cauchy_ccdf_log.hpp | 5 +- stan/math/prim/prob/cauchy_cdf.hpp | 5 +- stan/math/prim/prob/cauchy_cdf_log.hpp | 5 +- stan/math/prim/prob/cauchy_lccdf.hpp | 5 +- stan/math/prim/prob/cauchy_lcdf.hpp | 5 +- stan/math/prim/prob/cauchy_lpdf.hpp | 5 +- stan/math/prim/prob/chi_square_ccdf_log.hpp | 3 +- stan/math/prim/prob/chi_square_cdf_log.hpp | 3 +- stan/math/prim/prob/chi_square_lccdf.hpp | 3 +- stan/math/prim/prob/chi_square_lcdf.hpp | 3 +- stan/math/prim/prob/chi_square_lpdf.hpp | 3 +- stan/math/prim/prob/dirichlet_lpdf.hpp | 8 +- .../prim/prob/discrete_range_ccdf_log.hpp | 2 +- stan/math/prim/prob/discrete_range_cdf.hpp | 2 +- .../math/prim/prob/discrete_range_cdf_log.hpp | 2 +- stan/math/prim/prob/discrete_range_lccdf.hpp | 2 +- stan/math/prim/prob/discrete_range_lcdf.hpp | 2 +- stan/math/prim/prob/discrete_range_lpmf.hpp | 2 +- stan/math/prim/prob/exponential_ccdf_log.hpp | 4 +- stan/math/prim/prob/exponential_cdf.hpp | 4 +- stan/math/prim/prob/exponential_cdf_log.hpp | 4 +- stan/math/prim/prob/exponential_lccdf.hpp | 4 +- stan/math/prim/prob/exponential_lcdf.hpp | 4 +- stan/math/prim/prob/exponential_lpdf.hpp | 4 +- stan/math/prim/prob/frechet_ccdf_log.hpp | 5 +- stan/math/prim/prob/frechet_cdf.hpp | 4 +- stan/math/prim/prob/frechet_cdf_log.hpp | 5 +- stan/math/prim/prob/frechet_lccdf.hpp | 5 +- stan/math/prim/prob/frechet_lcdf.hpp | 4 +- stan/math/prim/prob/frechet_lpdf.hpp | 4 +- stan/math/prim/prob/gamma_cdf.hpp | 5 +- stan/math/prim/prob/gamma_lccdf.hpp | 5 +- stan/math/prim/prob/gamma_lcdf.hpp | 5 +- stan/math/prim/prob/gamma_lpdf.hpp | 5 +- stan/math/prim/prob/gumbel_ccdf_log.hpp | 4 +- stan/math/prim/prob/gumbel_cdf.hpp | 5 +- stan/math/prim/prob/gumbel_cdf_log.hpp | 5 +- stan/math/prim/prob/gumbel_lccdf.hpp | 5 +- stan/math/prim/prob/gumbel_lcdf.hpp | 5 +- stan/math/prim/prob/gumbel_lpdf.hpp | 5 +- stan/math/prim/prob/hypergeometric_lpmf.hpp | 2 +- .../prim/prob/inv_chi_square_ccdf_log.hpp | 2 +- stan/math/prim/prob/inv_chi_square_cdf.hpp | 3 +- .../math/prim/prob/inv_chi_square_cdf_log.hpp | 2 +- stan/math/prim/prob/inv_chi_square_lccdf.hpp | 3 +- stan/math/prim/prob/inv_chi_square_lcdf.hpp | 3 +- stan/math/prim/prob/inv_chi_square_lpdf.hpp | 3 +- stan/math/prim/prob/inv_gamma_ccdf_log.hpp | 5 +- stan/math/prim/prob/inv_gamma_cdf.hpp | 4 +- stan/math/prim/prob/inv_gamma_cdf_log.hpp | 5 +- stan/math/prim/prob/inv_gamma_lccdf.hpp | 5 +- stan/math/prim/prob/inv_gamma_lcdf.hpp | 5 +- stan/math/prim/prob/inv_gamma_lpdf.hpp | 5 +- stan/math/prim/prob/inv_wishart_lpdf.hpp | 4 +- .../math/prim/prob/lkj_corr_cholesky_lpdf.hpp | 4 +- stan/math/prim/prob/lkj_corr_lpdf.hpp | 5 +- stan/math/prim/prob/lkj_cov_lpdf.hpp | 12 +- stan/math/prim/prob/logistic_ccdf_log.hpp | 5 +- stan/math/prim/prob/logistic_cdf.hpp | 5 +- stan/math/prim/prob/logistic_cdf_log.hpp | 5 +- stan/math/prim/prob/logistic_lccdf.hpp | 5 +- stan/math/prim/prob/logistic_lcdf.hpp | 5 +- stan/math/prim/prob/logistic_lpdf.hpp | 5 +- stan/math/prim/prob/loglogistic_cdf.hpp | 5 +- stan/math/prim/prob/loglogistic_lpdf.hpp | 5 +- stan/math/prim/prob/lognormal_ccdf_log.hpp | 5 +- stan/math/prim/prob/lognormal_cdf.hpp | 5 +- stan/math/prim/prob/lognormal_cdf_log.hpp | 5 +- stan/math/prim/prob/lognormal_lccdf.hpp | 5 +- stan/math/prim/prob/lognormal_lcdf.hpp | 5 +- stan/math/prim/prob/lognormal_lpdf.hpp | 5 +- .../math/prim/prob/multi_gp_cholesky_lpdf.hpp | 4 +- stan/math/prim/prob/multi_gp_lpdf.hpp | 4 +- stan/math/prim/prob/multi_normal_lpdf.hpp | 10 +- .../math/prim/prob/multinomial_logit_lpmf.hpp | 4 +- stan/math/prim/prob/multinomial_lpmf.hpp | 4 +- .../prim/prob/neg_binomial_2_log_glm_lpmf.hpp | 6 +- stan/math/prim/prob/neg_binomial_cdf.hpp | 5 +- stan/math/prim/prob/neg_binomial_lpmf.hpp | 5 +- stan/math/prim/prob/ordered_logistic_lpmf.hpp | 8 +- stan/math/prim/prob/ordered_probit_lpmf.hpp | 8 +- stan/math/prim/prob/pareto_ccdf_log.hpp | 5 +- stan/math/prim/prob/pareto_cdf.hpp | 4 +- stan/math/prim/prob/pareto_cdf_log.hpp | 5 +- stan/math/prim/prob/pareto_lccdf.hpp | 4 +- stan/math/prim/prob/pareto_lcdf.hpp | 4 +- stan/math/prim/prob/pareto_lpdf.hpp | 4 +- .../prim/prob/poisson_binomial_ccdf_log.hpp | 2 +- stan/math/prim/prob/poisson_binomial_cdf.hpp | 4 +- .../prim/prob/poisson_binomial_cdf_log.hpp | 2 +- .../math/prim/prob/poisson_binomial_lccdf.hpp | 4 +- stan/math/prim/prob/poisson_binomial_lcdf.hpp | 4 +- stan/math/prim/prob/poisson_binomial_lpmf.hpp | 4 +- stan/math/prim/prob/poisson_ccdf_log.hpp | 3 +- stan/math/prim/prob/poisson_cdf_log.hpp | 3 +- stan/math/prim/prob/poisson_log_glm_lpmf.hpp | 6 +- stan/math/prim/prob/poisson_log_lpmf.hpp | 2 +- stan/math/prim/prob/rayleigh_ccdf_log.hpp | 2 +- stan/math/prim/prob/rayleigh_cdf.hpp | 3 +- stan/math/prim/prob/rayleigh_cdf_log.hpp | 2 +- stan/math/prim/prob/rayleigh_lccdf.hpp | 3 +- stan/math/prim/prob/rayleigh_lcdf.hpp | 3 +- stan/math/prim/prob/rayleigh_lpdf.hpp | 3 +- .../prim/prob/scaled_inv_chi_square_cdf.hpp | 5 +- .../prim/prob/skew_double_exponential_cdf.hpp | 6 +- .../prob/skew_double_exponential_lccdf.hpp | 6 +- .../prob/skew_double_exponential_lcdf.hpp | 6 +- .../prob/skew_double_exponential_lpdf.hpp | 12 +- stan/math/prim/prob/student_t_cdf.hpp | 6 +- stan/math/prim/prob/student_t_lcdf.hpp | 6 +- stan/math/prim/prob/student_t_lpdf.hpp | 6 +- stan/math/prim/prob/uniform_ccdf_log.hpp | 4 +- stan/math/prim/prob/uniform_cdf.hpp | 5 +- stan/math/prim/prob/uniform_cdf_log.hpp | 4 +- stan/math/prim/prob/uniform_lccdf.hpp | 4 +- stan/math/prim/prob/uniform_lcdf.hpp | 5 +- stan/math/prim/prob/uniform_lpdf.hpp | 5 +- stan/math/prim/prob/von_mises_cdf.hpp | 9 +- stan/math/prim/prob/von_mises_lpdf.hpp | 5 +- stan/math/prim/prob/weibull_ccdf_log.hpp | 5 +- stan/math/prim/prob/weibull_cdf.hpp | 4 +- stan/math/prim/prob/weibull_cdf_log.hpp | 5 +- stan/math/prim/prob/weibull_lccdf.hpp | 5 +- stan/math/prim/prob/weibull_lcdf.hpp | 4 +- stan/math/prim/prob/weibull_lpdf.hpp | 4 +- stan/math/prim/prob/wishart_cholesky_lpdf.hpp | 5 +- stan/math/prim/prob/wishart_lpdf.hpp | 5 +- .../constraint/cholesky_corr_constrain.hpp | 4 +- .../constraint/cholesky_factor_constrain.hpp | 7 +- .../rev/constraint/corr_matrix_constrain.hpp | 8 +- .../rev/constraint/cov_matrix_constrain.hpp | 8 +- .../constraint/cov_matrix_constrain_lkj.hpp | 7 +- .../rev/constraint/sum_to_zero_constrain.hpp | 3 +- stan/math/rev/core/callback_vari.hpp | 4 +- stan/math/rev/fun/from_var_value.hpp | 4 +- stan/math/rev/fun/read_cov_matrix.hpp | 4 +- stan/math/rev/functor/algebra_system.hpp | 12 +- stan/math/rev/functor/dae.hpp | 9 +- .../rev/functor/finite_diff_hessian_auto.hpp | 6 +- .../finite_diff_hessian_times_vector_auto.hpp | 8 +- stan/math/rev/functor/gradient.hpp | 10 +- stan/math/rev/functor/jacobian.hpp | 7 +- stan/math/rev/functor/kinsol_solve.hpp | 17 +-- stan/math/rev/functor/map_rect_concurrent.hpp | 3 +- stan/math/rev/functor/ode_adams.hpp | 12 +- stan/math/rev/functor/ode_bdf.hpp | 12 +- stan/math/rev/functor/solve_newton.hpp | 30 +++-- stan/math/rev/functor/solve_powell.hpp | 22 ++-- test/expressions/expression_test_helpers.hpp | 19 +-- test/prob/generate_tests.cpp | 19 +-- test/prob/utility.hpp | 83 ++++++------ test/unit/math/expect_near_rel.hpp | 62 +++++---- test/unit/math/mix/fun/append_array_test.cpp | 2 +- .../math/mix/fun/diag_post_multiply_test.cpp | 2 +- .../math/mix/fun/diag_pre_multiply_test.cpp | 2 +- .../math/mix/fun/eigen_comparisons_test.cpp | 11 +- test/unit/math/mix/fun/log_mix_part2_test.cpp | 4 +- test/unit/math/mix/fun/sd_test.cpp | 2 +- test/unit/math/mix/fun/sort_test.cpp | 4 +- .../math/mix/fun/squared_distance_test.cpp | 6 +- .../finite_diff_grad_hessian_auto_test.cpp | 2 +- .../unit/math/mix/prob/higher_order_utils.hpp | 7 +- .../kernel_generator/reference_kernel.hpp | 2 +- test/unit/math/opencl/util.hpp | 32 ++--- .../prim/fun/linspaced_row_vector_test.cpp | 2 +- .../math/prim/fun/linspaced_vector_test.cpp | 2 +- test/unit/math/prim/fun/log_softmax_test.cpp | 3 +- ...multiply_lower_tri_self_transpose_test.cpp | 3 +- .../math/prim/fun/ternary_scalar_tester.hpp | 7 +- test/unit/math/prim/fun/to_matrix_test.cpp | 3 +- .../unit/math/prim/functor/hcubature_test.cpp | 7 +- .../prim/functor/integrate_1d_impl_test.cpp | 16 ++- .../math/prim/functor/integrate_1d_test.cpp | 20 +-- .../prim/meta/apply_template_permutations.hpp | 3 +- .../prim/prob/matrix_normal_prec_rng_test.cpp | 11 +- .../unit/math/prim/prob/neg_binomial_test.cpp | 2 +- .../math/prim/prob/ordered_logistic_test.cpp | 4 +- .../math/prim/prob/ordered_probit_test.cpp | 2 +- test/unit/math/prim/prob/util.hpp | 13 +- .../math/prim/prob/vector_rng_test_helper.hpp | 12 +- test/unit/math/rev/fun/lbeta_test.cpp | 4 +- test/unit/math/rev/fun/util.hpp | 3 +- .../functor/finite_diff_hessian_auto_test.cpp | 2 +- test/unit/math/rev/functor/gradient_test.cpp | 3 +- .../rev/functor/integrate_1d_impl_test.cpp | 10 +- .../math/rev/functor/integrate_1d_test.cpp | 10 +- .../map_rect_concurrent_threads_test.cpp | 6 +- .../math/rev/functor/util_algebra_solver.hpp | 5 +- test/unit/math/rev/prob/categorical2_test.cpp | 4 +- .../prob/categorical_logit_glm_lpmf_test.cpp | 6 +- test/unit/math/rev/prob/dirichlet2_test.cpp | 8 +- test/unit/math/rev/prob/expect_eq_diffs.hpp | 10 +- test/unit/math/rev/prob/inv_wishart2_test.cpp | 6 +- .../rev/prob/inv_wishart_cholesky_test.cpp | 7 +- test/unit/math/rev/prob/multi_gp2_test.cpp | 4 +- .../math/rev/prob/multi_gp_cholesky2_test.cpp | 6 +- .../unit/math/rev/prob/multi_normal2_test.cpp | 6 +- .../math/rev/prob/multi_normal_prec2_test.cpp | 7 +- .../math/rev/prob/multi_student_t2_test.cpp | 7 +- .../prob/multi_student_t_cholesky_test.cpp | 7 +- .../math/rev/prob/multinomial_logit_test.cpp | 8 +- test/unit/math/rev/prob/multinomial_test.cpp | 4 +- .../prob/ordered_logistic_glm_lpmf_test.cpp | 5 +- test/unit/math/rev/prob/test_gradients.hpp | 7 +- .../rev/prob/test_gradients_multi_normal.hpp | 11 +- .../prob/test_gradients_multi_student_t.hpp | 18 +-- ...est_gradients_multi_student_t_cholesky.hpp | 18 ++- .../math/rev/prob/wishart_cholesky_test.cpp | 7 +- test/unit/math/rev/prob/wishart_test.cpp | 3 +- test/unit/math/test_ad.hpp | 120 ++++++++++-------- test/unit/math/test_ad_matvar.hpp | 53 ++++---- test/unit/math/test_ad_test.cpp | 3 +- 317 files changed, 1040 insertions(+), 922 deletions(-) diff --git a/stan/math/fwd/functor/gradient.hpp b/stan/math/fwd/functor/gradient.hpp index b9756c4dce0..7ac311ca0f8 100644 --- a/stan/math/fwd/functor/gradient.hpp +++ b/stan/math/fwd/functor/gradient.hpp @@ -37,8 +37,8 @@ namespace math { * @param[out] grad_fx Gradient of function at argument */ template -inline void gradient(const F& f, const Eigen::Matrix& x, T& fx, - Eigen::Matrix& grad_fx) { +inline void gradient(const F& f, const Eigen::Matrix& x, + T& fx, Eigen::Matrix& grad_fx) { Eigen::Matrix, Eigen::Dynamic, 1> x_fvar(x.size()); grad_fx.resize(x.size()); for (int i = 0; i < x.size(); ++i) { diff --git a/stan/math/fwd/functor/hessian.hpp b/stan/math/fwd/functor/hessian.hpp index 2cc4cec5ba5..ab686b52dbf 100644 --- a/stan/math/fwd/functor/hessian.hpp +++ b/stan/math/fwd/functor/hessian.hpp @@ -38,9 +38,9 @@ namespace math { * @param[out] H Hessian of function at argument */ template -inline void hessian(const F& f, const Eigen::Matrix& x, T& fx, - Eigen::Matrix& grad, - Eigen::Matrix& H) { +inline void hessian(const F& f, const Eigen::Matrix& x, + T& fx, Eigen::Matrix& grad, + Eigen::Matrix& H) { H.resize(x.size(), x.size()); grad.resize(x.size()); // size 0 separate because nothing to loop over in main body diff --git a/stan/math/fwd/functor/jacobian.hpp b/stan/math/fwd/functor/jacobian.hpp index 18dfdba33a0..030e16c1749 100644 --- a/stan/math/fwd/functor/jacobian.hpp +++ b/stan/math/fwd/functor/jacobian.hpp @@ -9,8 +9,8 @@ namespace math { template inline void jacobian(const F& f, const Eigen::Matrix& x, - Eigen::Matrix& fx, - Eigen::Matrix& J) { + Eigen::Matrix& fx, + Eigen::Matrix& J) { using Eigen::Dynamic; using Eigen::Matrix; Matrix, Dynamic, 1> x_fvar(x.size()); diff --git a/stan/math/mix/functor/hessian_times_vector.hpp b/stan/math/mix/functor/hessian_times_vector.hpp index b90fa2bd17a..405ee2a9856 100644 --- a/stan/math/mix/functor/hessian_times_vector.hpp +++ b/stan/math/mix/functor/hessian_times_vector.hpp @@ -39,9 +39,9 @@ template * = nullptr, require_stan_scalar_t* = nullptr> inline void hessian_times_vector(const F& f, - const Eigen::Matrix& x, - const EigVec& v, T& fx, - Eigen::Matrix& Hv) { + const Eigen::Matrix& x, + const EigVec& v, T& fx, + Eigen::Matrix& Hv) { using Eigen::Matrix; Matrix grad; Matrix H; diff --git a/stan/math/mix/functor/partial_derivative.hpp b/stan/math/mix/functor/partial_derivative.hpp index 488f7525cc1..34245741c7e 100644 --- a/stan/math/mix/functor/partial_derivative.hpp +++ b/stan/math/mix/functor/partial_derivative.hpp @@ -23,8 +23,8 @@ namespace math { */ template inline void partial_derivative(const F& f, - const Eigen::Matrix& x, int n, - T& fx, T& dfx_dxn) { + const Eigen::Matrix& x, + int n, T& fx, T& dfx_dxn) { Eigen::Matrix, Eigen::Dynamic, 1> x_fvar(x.size()); for (int i = 0; i < x.size(); ++i) { x_fvar(i) = fvar(x(i), i == n); diff --git a/stan/math/opencl/indexing_rev.hpp b/stan/math/opencl/indexing_rev.hpp index 854aa6d85c4..c3cff5ecb76 100644 --- a/stan/math/opencl/indexing_rev.hpp +++ b/stan/math/opencl/indexing_rev.hpp @@ -20,7 +20,7 @@ namespace math { * @param res adjoint of the result of the indexing operation */ inline void indexing_rev(matrix_cl& adj, const matrix_cl& idx, - const matrix_cl& res) { + const matrix_cl& res) { int local_mem_size = opencl_context.device()[0].getInfo(); int preferred_work_groups diff --git a/stan/math/opencl/kernel_generator/evaluate_into.hpp b/stan/math/opencl/kernel_generator/evaluate_into.hpp index e224ddac9af..aaed90b8afb 100644 --- a/stan/math/opencl/kernel_generator/evaluate_into.hpp +++ b/stan/math/opencl/kernel_generator/evaluate_into.hpp @@ -18,7 +18,8 @@ namespace math { */ template template -inline void operation_cl::evaluate_into(T_lhs& lhs) const { +inline void operation_cl::evaluate_into( + T_lhs& lhs) const { static_assert( is_kernel_expression::value, "operation_cl::evaluate_into: left hand side is not a valid expression!"); diff --git a/stan/math/opencl/kernel_generator/holder_cl.hpp b/stan/math/opencl/kernel_generator/holder_cl.hpp index 5a74895fe2f..8257554f7f4 100644 --- a/stan/math/opencl/kernel_generator/holder_cl.hpp +++ b/stan/math/opencl/kernel_generator/holder_cl.hpp @@ -82,7 +82,7 @@ namespace internal { */ template inline auto make_holder_cl_impl_step2(T&& expr, std::index_sequence, - const std::tuple& ptrs) { + const std::tuple& ptrs) { return holder_cl(std::forward(expr), std::get(ptrs)...); } @@ -97,7 +97,7 @@ inline auto make_holder_cl_impl_step2(T&& expr, std::index_sequence, */ template inline auto make_holder_cl_impl_step1(const T& func, std::index_sequence, - Args&&... args) { + Args&&... args) { std::tuple*...> res; auto ptrs = std::tuple_cat( holder_handle_element(std::forward(args), std::get(res))...); diff --git a/stan/math/opencl/prim/bernoulli_cdf.hpp b/stan/math/opencl/prim/bernoulli_cdf.hpp index 8dc84b67198..c23a097a0c5 100644 --- a/stan/math/opencl/prim/bernoulli_cdf.hpp +++ b/stan/math/opencl/prim/bernoulli_cdf.hpp @@ -28,7 +28,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> inline return_type_t bernoulli_cdf(const T_n_cl& n, - const T_prob_cl& theta) { + const T_prob_cl& theta) { static constexpr const char* function = "bernoulli_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isnan; diff --git a/stan/math/opencl/prim/bernoulli_lccdf.hpp b/stan/math/opencl/prim/bernoulli_lccdf.hpp index c17134517c6..42a9f7cac6d 100644 --- a/stan/math/opencl/prim/bernoulli_lccdf.hpp +++ b/stan/math/opencl/prim/bernoulli_lccdf.hpp @@ -29,7 +29,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> inline return_type_t bernoulli_lccdf(const T_n_cl& n, - const T_prob_cl& theta) { + const T_prob_cl& theta) { static constexpr const char* function = "bernoulli_lccdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isnan; diff --git a/stan/math/opencl/prim/bernoulli_lcdf.hpp b/stan/math/opencl/prim/bernoulli_lcdf.hpp index a1e081c80f6..82259f44e61 100644 --- a/stan/math/opencl/prim/bernoulli_lcdf.hpp +++ b/stan/math/opencl/prim/bernoulli_lcdf.hpp @@ -29,7 +29,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> inline return_type_t bernoulli_lcdf(const T_n_cl& n, - const T_prob_cl& theta) { + const T_prob_cl& theta) { static constexpr const char* function = "bernoulli_lcdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isnan; diff --git a/stan/math/opencl/prim/bernoulli_logit_lpmf.hpp b/stan/math/opencl/prim/bernoulli_logit_lpmf.hpp index 394bbc830fb..282dbd08164 100644 --- a/stan/math/opencl/prim/bernoulli_logit_lpmf.hpp +++ b/stan/math/opencl/prim/bernoulli_logit_lpmf.hpp @@ -27,7 +27,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> inline return_type_t bernoulli_logit_lpmf(const T_n_cl& n, - const T_prob_cl& theta) { + const T_prob_cl& theta) { static constexpr const char* function = "bernoulli_logit_lpmf(OpenCL)"; using T_partials_return = partials_return_t; using std::isnan; diff --git a/stan/math/opencl/prim/bernoulli_lpmf.hpp b/stan/math/opencl/prim/bernoulli_lpmf.hpp index 940404d50dd..96e92a2ecc0 100644 --- a/stan/math/opencl/prim/bernoulli_lpmf.hpp +++ b/stan/math/opencl/prim/bernoulli_lpmf.hpp @@ -30,7 +30,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> inline return_type_t bernoulli_lpmf(const T_n_cl& n, - const T_prob_cl& theta) { + const T_prob_cl& theta) { static constexpr const char* function = "bernoulli_lpmf(OpenCL)"; using T_partials_return = partials_return_t; constexpr bool is_n_vector = !is_stan_scalar::value; diff --git a/stan/math/opencl/prim/binomial_logit_lpmf.hpp b/stan/math/opencl/prim/binomial_logit_lpmf.hpp index 1fd43c9c4f7..8b02d157c37 100644 --- a/stan/math/opencl/prim/binomial_logit_lpmf.hpp +++ b/stan/math/opencl/prim/binomial_logit_lpmf.hpp @@ -31,8 +31,9 @@ template * = nullptr, require_any_nonscalar_prim_or_rev_kernel_expression_t< T_n_cl, T_N_cl, T_prob_cl>* = nullptr> -inline return_type_t binomial_logit_lpmf(const T_n_cl& n, const T_N_cl N, - const T_prob_cl& alpha) { +inline return_type_t binomial_logit_lpmf(const T_n_cl& n, + const T_N_cl N, + const T_prob_cl& alpha) { 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 757d2349a32..5a6578227af 100644 --- a/stan/math/opencl/prim/binomial_lpmf.hpp +++ b/stan/math/opencl/prim/binomial_lpmf.hpp @@ -34,7 +34,7 @@ template * = nullptr> inline return_type_t binomial_lpmf(const T_n_cl& n, const T_N_cl N, - const T_prob_cl& theta) { + const T_prob_cl& theta) { 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/chi_square_lpdf.hpp b/stan/math/opencl/prim/chi_square_lpdf.hpp index caa8d838e2e..4c875021a30 100644 --- a/stan/math/opencl/prim/chi_square_lpdf.hpp +++ b/stan/math/opencl/prim/chi_square_lpdf.hpp @@ -36,7 +36,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> inline return_type_t chi_square_lpdf(const T_y_cl& y, - const T_dof_cl& nu) { + const T_dof_cl& nu) { 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/exp_mod_normal_cdf.hpp b/stan/math/opencl/prim/exp_mod_normal_cdf.hpp index 523de6055b4..9510340e2fa 100644 --- a/stan/math/opencl/prim/exp_mod_normal_cdf.hpp +++ b/stan/math/opencl/prim/exp_mod_normal_cdf.hpp @@ -33,9 +33,9 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -inline return_type_t 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) { +inline return_type_t +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 constexpr const char* function = "exp_mod_normal_cdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/exp_mod_normal_lcdf.hpp b/stan/math/opencl/prim/exp_mod_normal_lcdf.hpp index 6e6d94231a7..b1e34e4de3a 100644 --- a/stan/math/opencl/prim/exp_mod_normal_lcdf.hpp +++ b/stan/math/opencl/prim/exp_mod_normal_lcdf.hpp @@ -34,9 +34,9 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -inline return_type_t 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) { +inline return_type_t +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 constexpr const char* function = "exp_mod_normal_lcdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/exp_mod_normal_lpdf.hpp b/stan/math/opencl/prim/exp_mod_normal_lpdf.hpp index 044b2a47090..e00858c4518 100644 --- a/stan/math/opencl/prim/exp_mod_normal_lpdf.hpp +++ b/stan/math/opencl/prim/exp_mod_normal_lpdf.hpp @@ -36,9 +36,9 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -inline return_type_t 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) { +inline return_type_t +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 constexpr const char* function = "exp_mod_normal_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 cd66776b9ab..ebea01725f1 100644 --- a/stan/math/opencl/prim/gumbel_cdf.hpp +++ b/stan/math/opencl/prim/gumbel_cdf.hpp @@ -31,9 +31,8 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -inline return_type_t gumbel_cdf(const T_y_cl& y, - const T_loc_cl& mu, - const T_scale_cl& beta) { +inline return_type_t gumbel_cdf( + const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& beta) { static constexpr const char* function = "gumbel_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/inv_chi_square_lpdf.hpp b/stan/math/opencl/prim/inv_chi_square_lpdf.hpp index 8afd9292a54..f58d52891c6 100644 --- a/stan/math/opencl/prim/inv_chi_square_lpdf.hpp +++ b/stan/math/opencl/prim/inv_chi_square_lpdf.hpp @@ -42,7 +42,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> inline return_type_t inv_chi_square_lpdf(const T_y_cl& y, - const T_dof_cl& nu) { + const T_dof_cl& nu) { using std::isfinite; using std::isnan; static constexpr const char* function = "inv_chi_square_lpdf(OpenCL)"; diff --git a/stan/math/opencl/prim/pareto_type_2_cdf.hpp b/stan/math/opencl/prim/pareto_type_2_cdf.hpp index 20a6e61ce35..f04b8254eaa 100644 --- a/stan/math/opencl/prim/pareto_type_2_cdf.hpp +++ b/stan/math/opencl/prim/pareto_type_2_cdf.hpp @@ -33,9 +33,9 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -inline return_type_t pareto_type_2_cdf( - const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& lambda, - const T_shape_cl& alpha) { +inline return_type_t +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 constexpr const char* function = "pareto_type_2_cdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/pareto_type_2_lccdf.hpp b/stan/math/opencl/prim/pareto_type_2_lccdf.hpp index f0412db84f4..a2cd0de0d69 100644 --- a/stan/math/opencl/prim/pareto_type_2_lccdf.hpp +++ b/stan/math/opencl/prim/pareto_type_2_lccdf.hpp @@ -33,9 +33,9 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -inline return_type_t pareto_type_2_lccdf( - const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& lambda, - const T_shape_cl& alpha) { +inline return_type_t +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 constexpr const char* function = "pareto_type_2_lccdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/pareto_type_2_lcdf.hpp b/stan/math/opencl/prim/pareto_type_2_lcdf.hpp index b3205933ab1..e19bfdf214f 100644 --- a/stan/math/opencl/prim/pareto_type_2_lcdf.hpp +++ b/stan/math/opencl/prim/pareto_type_2_lcdf.hpp @@ -33,9 +33,9 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -inline return_type_t pareto_type_2_lcdf( - const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& lambda, - const T_shape_cl& alpha) { +inline return_type_t +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 constexpr const char* function = "pareto_type_2_lcdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/pareto_type_2_lpdf.hpp b/stan/math/opencl/prim/pareto_type_2_lpdf.hpp index 9f15409181a..ea887504b24 100644 --- a/stan/math/opencl/prim/pareto_type_2_lpdf.hpp +++ b/stan/math/opencl/prim/pareto_type_2_lpdf.hpp @@ -36,9 +36,9 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -inline return_type_t pareto_type_2_lpdf( - const T_y_cl& y, const T_loc_cl& mu, const T_scale_cl& lambda, - const T_shape_cl& alpha) { +inline return_type_t +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 constexpr const char* function = "pareto_type_2_lpdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/poisson_log_lpmf.hpp b/stan/math/opencl/prim/poisson_log_lpmf.hpp index 42713f5e6b2..d8315283b15 100644 --- a/stan/math/opencl/prim/poisson_log_lpmf.hpp +++ b/stan/math/opencl/prim/poisson_log_lpmf.hpp @@ -28,8 +28,8 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -inline return_type_t poisson_log_lpmf(const T_n_cl& n, - const T_log_rate_cl& alpha) { +inline return_type_t poisson_log_lpmf( + const T_n_cl& n, const T_log_rate_cl& alpha) { static constexpr const char* function = "poisson_log_lpmf(OpenCL)"; using T_partials_return = partials_return_t; using std::isinf; diff --git a/stan/math/opencl/prim/poisson_lpmf.hpp b/stan/math/opencl/prim/poisson_lpmf.hpp index 2f7953a794a..4d1644f1204 100644 --- a/stan/math/opencl/prim/poisson_lpmf.hpp +++ b/stan/math/opencl/prim/poisson_lpmf.hpp @@ -29,7 +29,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> inline return_type_t poisson_lpmf(const T_n_cl& n, - const T_rate_cl& lambda) { + const T_rate_cl& lambda) { static constexpr const char* function = "poisson_lpmf(OpenCL)"; using T_partials_return = partials_return_t; using std::isinf; diff --git a/stan/math/opencl/prim/rayleigh_cdf.hpp b/stan/math/opencl/prim/rayleigh_cdf.hpp index 7e9895176b0..7a91b7000e5 100644 --- a/stan/math/opencl/prim/rayleigh_cdf.hpp +++ b/stan/math/opencl/prim/rayleigh_cdf.hpp @@ -29,7 +29,7 @@ template < require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> inline return_type_t rayleigh_cdf(const T_y_cl& y, - const T_scale_cl& sigma) { + const T_scale_cl& sigma) { static constexpr const char* function = "rayleigh_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/rayleigh_lccdf.hpp b/stan/math/opencl/prim/rayleigh_lccdf.hpp index 77fd46da4d1..ace88bd71d5 100644 --- a/stan/math/opencl/prim/rayleigh_lccdf.hpp +++ b/stan/math/opencl/prim/rayleigh_lccdf.hpp @@ -28,8 +28,8 @@ template < typename T_y_cl, typename T_scale_cl, require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -inline return_type_t rayleigh_lccdf(const T_y_cl& y, - const T_scale_cl& sigma) { +inline return_type_t rayleigh_lccdf( + const T_y_cl& y, const T_scale_cl& sigma) { static constexpr const char* function = "rayleigh_lccdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/rayleigh_lcdf.hpp b/stan/math/opencl/prim/rayleigh_lcdf.hpp index 78bf253f51e..0d8f881fdcf 100644 --- a/stan/math/opencl/prim/rayleigh_lcdf.hpp +++ b/stan/math/opencl/prim/rayleigh_lcdf.hpp @@ -28,8 +28,8 @@ template < typename T_y_cl, typename T_scale_cl, require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -inline return_type_t rayleigh_lcdf(const T_y_cl& y, - const T_scale_cl& sigma) { +inline return_type_t rayleigh_lcdf( + const T_y_cl& y, const T_scale_cl& sigma) { static constexpr const char* function = "rayleigh_lcdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/rayleigh_lpdf.hpp b/stan/math/opencl/prim/rayleigh_lpdf.hpp index 370a07079f9..cea9523ff4c 100644 --- a/stan/math/opencl/prim/rayleigh_lpdf.hpp +++ b/stan/math/opencl/prim/rayleigh_lpdf.hpp @@ -28,8 +28,8 @@ template < bool propto, typename T_y_cl, typename T_scale_cl, require_all_prim_or_rev_kernel_expression_t* = nullptr, require_any_not_stan_scalar_t* = nullptr> -inline return_type_t rayleigh_lpdf(const T_y_cl& y, - const T_scale_cl& sigma) { +inline return_type_t rayleigh_lpdf( + const T_y_cl& y, const T_scale_cl& sigma) { static constexpr const char* function = "rayleigh_lpdf(OpenCL)"; using T_partials_return = partials_return_t; diff --git a/stan/math/opencl/prim/uniform_cdf.hpp b/stan/math/opencl/prim/uniform_cdf.hpp index b6e24075807..a5c99c28820 100644 --- a/stan/math/opencl/prim/uniform_cdf.hpp +++ b/stan/math/opencl/prim/uniform_cdf.hpp @@ -30,9 +30,8 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -inline return_type_t uniform_cdf(const T_y_cl& y, - const T_low_cl& alpha, - const T_high_cl& beta) { +inline return_type_t uniform_cdf( + const T_y_cl& y, const T_low_cl& alpha, const T_high_cl& beta) { static constexpr const char* function = "uniform_cdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/prim/uniform_lcdf.hpp b/stan/math/opencl/prim/uniform_lcdf.hpp index f3787e1e7ed..7dfc44ae79f 100644 --- a/stan/math/opencl/prim/uniform_lcdf.hpp +++ b/stan/math/opencl/prim/uniform_lcdf.hpp @@ -30,9 +30,8 @@ template * = nullptr, require_any_not_stan_scalar_t* = nullptr> -inline return_type_t uniform_lcdf(const T_y_cl& y, - const T_low_cl& alpha, - const T_high_cl& beta) { +inline return_type_t uniform_lcdf( + const T_y_cl& y, const T_low_cl& alpha, const T_high_cl& beta) { static constexpr const char* function = "uniform_lcdf(OpenCL)"; using T_partials_return = partials_return_t; using std::isfinite; diff --git a/stan/math/opencl/qr_decomposition.hpp b/stan/math/opencl/qr_decomposition.hpp index 2a32ef99e2e..fd68adb2e9f 100644 --- a/stan/math/opencl/qr_decomposition.hpp +++ b/stan/math/opencl/qr_decomposition.hpp @@ -31,8 +31,9 @@ namespace math { * @param r Block size. Optimal value depends on the hardware. */ template -inline void qr_decomposition_cl(const matrix_cl& A, matrix_cl& Q, - matrix_cl& R, int r = 100) { +inline void qr_decomposition_cl(const matrix_cl& A, + matrix_cl& Q, matrix_cl& R, + int r = 100) { using std::copysign; using std::sqrt; int rows = A.rows(); diff --git a/stan/math/opencl/rev/adjoint_results.hpp b/stan/math/opencl/rev/adjoint_results.hpp index 89b34ae6db4..bc42d21aac0 100644 --- a/stan/math/opencl/rev/adjoint_results.hpp +++ b/stan/math/opencl/rev/adjoint_results.hpp @@ -148,7 +148,8 @@ class adjoint_results_cl : protected results_cl { * @param results results that will be calculated. */ template -inline adjoint_results_cl adjoint_results(T_results&&... results) { +inline adjoint_results_cl adjoint_results( + T_results&&... results) { return adjoint_results_cl(std::forward(results)...); } diff --git a/stan/math/opencl/symmetric_eigensolver.hpp b/stan/math/opencl/symmetric_eigensolver.hpp index a13d6ce8df4..ea4d907412a 100644 --- a/stan/math/opencl/symmetric_eigensolver.hpp +++ b/stan/math/opencl/symmetric_eigensolver.hpp @@ -11,8 +11,8 @@ namespace math { template inline void symmetric_eigensolver(const matrix_cl& A, - matrix_cl& eigenvalues, - matrix_cl& eigenvectors) { + matrix_cl& eigenvalues, + matrix_cl& eigenvectors) { matrix_cl packed; if (A.rows() <= 2) { packed = A; diff --git a/stan/math/prim/constraint/corr_matrix_free.hpp b/stan/math/prim/constraint/corr_matrix_free.hpp index bf3ac24a6ff..6a44b3177bd 100644 --- a/stan/math/prim/constraint/corr_matrix_free.hpp +++ b/stan/math/prim/constraint/corr_matrix_free.hpp @@ -31,7 +31,8 @@ namespace math { * factor_cov_matrix() on log scale are unconstrained. */ template * = nullptr> -inline Eigen::Matrix, Eigen::Dynamic, 1> corr_matrix_free(const T& y) { +inline Eigen::Matrix, Eigen::Dynamic, 1> corr_matrix_free( + const T& y) { using Eigen::Array; using Eigen::Dynamic; diff --git a/stan/math/prim/constraint/cov_matrix_free.hpp b/stan/math/prim/constraint/cov_matrix_free.hpp index 153681a9494..4d71f179665 100644 --- a/stan/math/prim/constraint/cov_matrix_free.hpp +++ b/stan/math/prim/constraint/cov_matrix_free.hpp @@ -35,7 +35,8 @@ namespace math { * has zero dimensionality, or has a non-positive diagonal element. */ template * = nullptr> -inline Eigen::Matrix, Eigen::Dynamic, 1> cov_matrix_free(const T& y) { +inline Eigen::Matrix, Eigen::Dynamic, 1> cov_matrix_free( + const T& y) { const auto& y_ref = to_ref(y); check_square("cov_matrix_free", "y", y_ref); check_nonzero_size("cov_matrix_free", "y", y_ref); diff --git a/stan/math/prim/err/check_cholesky_factor.hpp b/stan/math/prim/err/check_cholesky_factor.hpp index a845e745748..099d2bc3986 100644 --- a/stan/math/prim/err/check_cholesky_factor.hpp +++ b/stan/math/prim/err/check_cholesky_factor.hpp @@ -59,7 +59,7 @@ inline void check_cholesky_factor(const char* function, const char* name, */ template * = nullptr> inline void check_cholesky_factor(const char* function, const char* name, - const StdVec& y) { + const StdVec& y) { for (size_t i = 0; i < y.size(); ++i) { check_cholesky_factor(function, internal::make_iter_name(name, i).c_str(), y[i]); diff --git a/stan/math/prim/err/check_cholesky_factor_corr.hpp b/stan/math/prim/err/check_cholesky_factor_corr.hpp index 28d59a00eed..4542b2ece42 100644 --- a/stan/math/prim/err/check_cholesky_factor_corr.hpp +++ b/stan/math/prim/err/check_cholesky_factor_corr.hpp @@ -35,7 +35,7 @@ namespace math { */ template * = nullptr> inline void check_cholesky_factor_corr(const char* function, const char* name, - const Mat& y) { + const Mat& y) { const auto& y_ref = to_ref(value_of_rec(y)); check_square(function, name, y_ref); check_lower_triangular(function, name, y_ref); @@ -67,7 +67,7 @@ inline void check_cholesky_factor_corr(const char* function, const char* name, */ template * = nullptr> inline void check_cholesky_factor_corr(const char* function, const char* name, - const StdVec& y) { + const StdVec& y) { for (size_t i = 0; i < y.size(); ++i) { check_cholesky_factor_corr(function, internal::make_iter_name(name, i).c_str(), y[i]); diff --git a/stan/math/prim/err/check_corr_matrix.hpp b/stan/math/prim/err/check_corr_matrix.hpp index 7be67bad471..36a9d81e40b 100644 --- a/stan/math/prim/err/check_corr_matrix.hpp +++ b/stan/math/prim/err/check_corr_matrix.hpp @@ -74,7 +74,7 @@ inline void check_corr_matrix(const char* function, const char* name, */ template * = nullptr> inline void check_corr_matrix(const char* function, const char* name, - const StdVec& y) { + const StdVec& y) { for (auto&& y_i : y) { check_corr_matrix(function, name, y_i); } diff --git a/stan/math/prim/err/check_cov_matrix.hpp b/stan/math/prim/err/check_cov_matrix.hpp index 17611949acf..ab1ab633f19 100644 --- a/stan/math/prim/err/check_cov_matrix.hpp +++ b/stan/math/prim/err/check_cov_matrix.hpp @@ -49,7 +49,8 @@ inline void check_cov_matrix(const char* function, const char* name, * not positive definite, or if any element of the matrix is `NaN` */ template * = nullptr> -inline void check_cov_matrix(const char* function, const char* name, const StdVec& y) { +inline void check_cov_matrix(const char* function, const char* name, + const StdVec& y) { for (auto&& y_i : y) { check_cov_matrix(function, name, y_i); } diff --git a/stan/math/prim/err/check_ordered.hpp b/stan/math/prim/err/check_ordered.hpp index 9ec4119a5c2..4b8f34c5b2c 100644 --- a/stan/math/prim/err/check_ordered.hpp +++ b/stan/math/prim/err/check_ordered.hpp @@ -27,7 +27,8 @@ namespace math { */ template * = nullptr, require_not_std_vector_t* = nullptr> -inline void check_ordered(const char* function, const char* name, const T_y& y) { +inline void check_ordered(const char* function, const char* name, + const T_y& y) { const auto& y_ref = to_ref(value_of_rec(y)); for (Eigen::Index n = 1; n < y_ref.size(); n++) { if (!(y_ref[n] > y_ref[n - 1])) { @@ -58,7 +59,8 @@ inline void check_ordered(const char* function, const char* name, const T_y& y) * are duplicated values, or if any element is `NaN` */ template * = nullptr> -inline void check_ordered(const char* function, const char* name, const T_y& y) { +inline void check_ordered(const char* function, const char* name, + const T_y& y) { for (size_t n = 1; n < y.size(); n++) { if (!(y[n] > y[n - 1])) { [&]() STAN_COLD_PATH { @@ -89,7 +91,8 @@ inline void check_ordered(const char* function, const char* name, const T_y& y) */ template * = nullptr, require_not_vt_stan_scalar* = nullptr> -inline void check_ordered(const char* function, const char* name, const T_y& y) { +inline void check_ordered(const char* function, const char* name, + const T_y& y) { for (size_t i = 0; i < y.size(); ++i) { check_ordered(function, internal::make_iter_name(name, i).c_str(), y[i]); } diff --git a/stan/math/prim/err/check_positive_ordered.hpp b/stan/math/prim/err/check_positive_ordered.hpp index deef6f63cd5..d38b513843e 100644 --- a/stan/math/prim/err/check_positive_ordered.hpp +++ b/stan/math/prim/err/check_positive_ordered.hpp @@ -29,7 +29,7 @@ namespace math { template * = nullptr, require_not_std_vector_t* = nullptr> inline void check_positive_ordered(const char* function, const char* name, - const Vec& y) { + const Vec& y) { if (y.size() == 0) { return; } @@ -61,7 +61,7 @@ inline void check_positive_ordered(const char* function, const char* name, */ template * = nullptr> inline void check_positive_ordered(const char* function, const char* name, - const StdVec& y) { + const StdVec& y) { for (size_t i = 0; i < y.size(); ++i) { check_positive_ordered(function, internal::make_iter_name(name, i).c_str(), y[i]); diff --git a/stan/math/prim/err/check_simplex.hpp b/stan/math/prim/err/check_simplex.hpp index ace9b1590eb..562687de7ee 100644 --- a/stan/math/prim/err/check_simplex.hpp +++ b/stan/math/prim/err/check_simplex.hpp @@ -31,7 +31,8 @@ namespace math { * is `NaN` */ template * = nullptr> -inline void check_simplex(const char* function, const char* name, const T& theta) { +inline void check_simplex(const char* function, const char* name, + const T& theta) { using std::fabs; check_nonzero_size(function, name, theta); auto&& theta_ref = to_ref(value_of_rec(theta)); @@ -78,7 +79,8 @@ inline void check_simplex(const char* function, const char* name, const T& theta * is `NaN` */ template * = nullptr> -inline void check_simplex(const char* function, const char* name, const T& theta) { +inline void check_simplex(const char* function, const char* name, + const T& theta) { for (size_t i = 0; i < theta.size(); ++i) { check_simplex(function, internal::make_iter_name(name, i).c_str(), theta[i]); diff --git a/stan/math/prim/err/check_sorted.hpp b/stan/math/prim/err/check_sorted.hpp index 63731827f18..8ef1f6a5dd2 100644 --- a/stan/math/prim/err/check_sorted.hpp +++ b/stan/math/prim/err/check_sorted.hpp @@ -23,7 +23,8 @@ namespace math { * not sorted, or if any element is NaN. */ template * = nullptr> -inline void check_sorted(const char* function, const char* name, const EigVec& y) { +inline void check_sorted(const char* function, const char* name, + const EigVec& y) { const auto& y_ref = to_ref(y); for (Eigen::Index n = 1; n < y_ref.size(); n++) { if (!(y_ref[n] >= y_ref[n - 1])) { @@ -54,7 +55,7 @@ inline void check_sorted(const char* function, const char* name, const EigVec& y */ template inline void check_sorted(const char* function, const char* name, - const std::vector& y) { + const std::vector& y) { for (size_t n = 1; n < y.size(); n++) { if (!(y[n] >= y[n - 1])) { std::ostringstream msg1; diff --git a/stan/math/prim/err/check_stochastic_column.hpp b/stan/math/prim/err/check_stochastic_column.hpp index e2116621f2f..33f2e040059 100644 --- a/stan/math/prim/err/check_stochastic_column.hpp +++ b/stan/math/prim/err/check_stochastic_column.hpp @@ -33,7 +33,7 @@ namespace math { */ template * = nullptr> inline void check_stochastic_column(const char* function, const char* name, - const T& theta) { + const T& theta) { using std::fabs; check_nonzero_size(function, name, theta); auto&& theta_ref = to_ref(value_of_rec(theta)); @@ -87,7 +87,7 @@ inline void check_stochastic_column(const char* function, const char* name, */ template * = nullptr> inline void check_stochastic_column(const char* function, const char* name, - const T& theta) { + const T& theta) { for (size_t i = 0; i < theta.size(); ++i) { check_stochastic_column(function, internal::make_iter_name(name, i).c_str(), theta[i]); diff --git a/stan/math/prim/err/check_stochastic_row.hpp b/stan/math/prim/err/check_stochastic_row.hpp index 6d705a1d3f2..55001bfb2ba 100644 --- a/stan/math/prim/err/check_stochastic_row.hpp +++ b/stan/math/prim/err/check_stochastic_row.hpp @@ -33,7 +33,7 @@ namespace math { */ template * = nullptr> inline void check_stochastic_row(const char* function, const char* name, - const T& theta) { + const T& theta) { using std::fabs; check_nonzero_size(function, name, theta); auto&& theta_ref = to_ref(value_of_rec(theta)); @@ -87,7 +87,7 @@ inline void check_stochastic_row(const char* function, const char* name, */ template * = nullptr> inline void check_stochastic_row(const char* function, const char* name, - const T& theta) { + const T& theta) { for (size_t i = 0; i < theta.size(); ++i) { check_stochastic_row(function, internal::make_iter_name(name, i).c_str(), theta[i]); diff --git a/stan/math/prim/err/check_sum_to_zero.hpp b/stan/math/prim/err/check_sum_to_zero.hpp index 0097fc4429f..3a5342235b8 100644 --- a/stan/math/prim/err/check_sum_to_zero.hpp +++ b/stan/math/prim/err/check_sum_to_zero.hpp @@ -28,7 +28,8 @@ namespace math { * @throw `std::domain_error` if the vector does not sum to zero */ template * = nullptr> -inline void check_sum_to_zero(const char* function, const char* name, const T& theta) { +inline void check_sum_to_zero(const char* function, const char* name, + const T& theta) { using std::fabs; // the size-zero case is technically a valid sum-to-zero vector, // but it cannot be unconstrained to anything @@ -60,7 +61,8 @@ inline void check_sum_to_zero(const char* function, const char* name, const T& t * @throw `std::domain_error` if the vector does not sum to zero */ template * = nullptr> -inline void check_sum_to_zero(const char* function, const char* name, const T& theta) { +inline void check_sum_to_zero(const char* function, const char* name, + const T& theta) { for (size_t i = 0; i < theta.size(); ++i) { check_sum_to_zero(function, internal::make_iter_name(name, i).c_str(), theta[i]); diff --git a/stan/math/prim/err/check_unit_vector.hpp b/stan/math/prim/err/check_unit_vector.hpp index 7781379e486..46b786bbaec 100644 --- a/stan/math/prim/err/check_unit_vector.hpp +++ b/stan/math/prim/err/check_unit_vector.hpp @@ -35,7 +35,7 @@ namespace math { template * = nullptr, require_not_std_vector_t* = nullptr> inline void check_unit_vector(const char* function, const char* name, - const Vec& theta) { + const Vec& theta) { check_nonzero_size(function, name, theta); using std::fabs; scalar_type_t ssq = value_of_rec(theta).squaredNorm(); @@ -65,7 +65,7 @@ inline void check_unit_vector(const char* function, const char* name, */ template * = nullptr> inline void check_unit_vector(const char* function, const char* name, - const StdVec& theta) { + const StdVec& theta) { for (size_t i = 0; i < theta.size(); ++i) { check_unit_vector(function, internal::make_iter_name(name, i).c_str(), theta[i]); diff --git a/stan/math/prim/fun/autocorrelation.hpp b/stan/math/prim/fun/autocorrelation.hpp index 5647d61de72..560509cea8a 100644 --- a/stan/math/prim/fun/autocorrelation.hpp +++ b/stan/math/prim/fun/autocorrelation.hpp @@ -60,7 +60,7 @@ inline size_t fft_next_good_size(size_t N) { */ template inline void autocorrelation(const std::vector& y, std::vector& ac, - Eigen::FFT& fft) { + Eigen::FFT& fft) { using std::complex; using std::vector; @@ -117,7 +117,8 @@ inline void autocorrelation(const std::vector& y, std::vector& ac, */ template inline void autocorrelation(const Eigen::MatrixBase& y, - Eigen::MatrixBase& ac, Eigen::FFT& fft) { + Eigen::MatrixBase& ac, + Eigen::FFT& fft) { size_t N = y.size(); size_t M = internal::fft_next_good_size(N); size_t Mt2 = 2 * M; @@ -189,7 +190,7 @@ inline void autocorrelation(const std::vector& y, std::vector& ac) { */ template inline void autocorrelation(const Eigen::MatrixBase& y, - Eigen::MatrixBase& ac) { + Eigen::MatrixBase& ac) { Eigen::FFT fft; autocorrelation(y, ac, fft); } diff --git a/stan/math/prim/fun/autocovariance.hpp b/stan/math/prim/fun/autocovariance.hpp index e4516c286ed..b0da20754a5 100644 --- a/stan/math/prim/fun/autocovariance.hpp +++ b/stan/math/prim/fun/autocovariance.hpp @@ -31,7 +31,7 @@ namespace math { */ template inline void autocovariance(const std::vector& y, std::vector& acov, - Eigen::FFT& fft) { + Eigen::FFT& fft) { autocorrelation(y, acov, fft); T var = variance(y) * (y.size() - 1) / y.size(); @@ -64,7 +64,8 @@ inline void autocovariance(const std::vector& y, std::vector& acov, */ template inline void autocovariance(const Eigen::MatrixBase& y, - Eigen::MatrixBase& acov, Eigen::FFT& fft) { + Eigen::MatrixBase& acov, + Eigen::FFT& fft) { autocorrelation(y, acov, fft); acov = acov.array() * (y.array() - y.mean()).square().sum() / y.size(); } @@ -116,7 +117,7 @@ inline void autocovariance(const std::vector& y, std::vector& acov) { */ template inline void autocovariance(const Eigen::MatrixBase& y, - Eigen::MatrixBase& acov) { + Eigen::MatrixBase& acov) { Eigen::FFT fft; autocovariance(y, acov, fft); } diff --git a/stan/math/prim/fun/eigenvalues_sym.hpp b/stan/math/prim/fun/eigenvalues_sym.hpp index 05edf91f282..766288832db 100644 --- a/stan/math/prim/fun/eigenvalues_sym.hpp +++ b/stan/math/prim/fun/eigenvalues_sym.hpp @@ -20,7 +20,8 @@ namespace math { */ template * = nullptr, require_not_st_var* = nullptr> -inline Eigen::Matrix, -1, 1> eigenvalues_sym(const EigMat& m) { +inline Eigen::Matrix, -1, 1> eigenvalues_sym( + const EigMat& m) { if (unlikely(m.size() == 0)) { return Eigen::Matrix, -1, 1>(0, 1); } diff --git a/stan/math/prim/fun/factor_cov_matrix.hpp b/stan/math/prim/fun/factor_cov_matrix.hpp index 68a4756cfb0..e02a650d9ce 100644 --- a/stan/math/prim/fun/factor_cov_matrix.hpp +++ b/stan/math/prim/fun/factor_cov_matrix.hpp @@ -25,7 +25,8 @@ template * = nullptr, require_all_eigen_vector_t* = nullptr, require_all_vt_same* = nullptr> -inline bool factor_cov_matrix(const T_Sigma& Sigma, T_CPCs&& CPCs, T_sds&& sds) { +inline bool factor_cov_matrix(const T_Sigma& Sigma, T_CPCs&& CPCs, + T_sds&& sds) { using T_scalar = value_type_t; size_t K = sds.rows(); const Eigen::Ref>& Sigma_ref = Sigma; diff --git a/stan/math/prim/fun/gp_dot_prod_cov.hpp b/stan/math/prim/fun/gp_dot_prod_cov.hpp index fdcf43bf4bf..14d0745634b 100644 --- a/stan/math/prim/fun/gp_dot_prod_cov.hpp +++ b/stan/math/prim/fun/gp_dot_prod_cov.hpp @@ -34,7 +34,8 @@ namespace math { * x is nan or infinite */ template -inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> +inline Eigen::Matrix, Eigen::Dynamic, + Eigen::Dynamic> gp_dot_prod_cov(const std::vector> &x, const T_sigma &sigma) { check_not_nan("gp_dot_prod_cov", "sigma", sigma); @@ -96,7 +97,8 @@ gp_dot_prod_cov(const std::vector> &x, * x is nan or infinite */ template -inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> +inline Eigen::Matrix, Eigen::Dynamic, + Eigen::Dynamic> gp_dot_prod_cov(const std::vector &x, const T_sigma &sigma) { check_nonnegative("gp_dot_prod_cov", "sigma", sigma); check_finite("gp_dot_prod_cov", "sigma", sigma); @@ -153,7 +155,7 @@ gp_dot_prod_cov(const std::vector &x, const T_sigma &sigma) { */ template inline Eigen::Matrix, Eigen::Dynamic, - Eigen::Dynamic> + Eigen::Dynamic> gp_dot_prod_cov(const std::vector> &x1, const std::vector> &x2, const T_sigma &sigma) { @@ -217,7 +219,7 @@ gp_dot_prod_cov(const std::vector> &x1, */ template inline Eigen::Matrix, Eigen::Dynamic, - Eigen::Dynamic> + Eigen::Dynamic> gp_dot_prod_cov(const std::vector &x1, const std::vector &x2, const T_sigma &sigma) { check_nonnegative("gp_dot_prod_cov", "sigma", sigma); diff --git a/stan/math/prim/fun/grad_2F1.hpp b/stan/math/prim/fun/grad_2F1.hpp index 401e6a835c7..42d5d2a50dd 100644 --- a/stan/math/prim/fun/grad_2F1.hpp +++ b/stan/math/prim/fun/grad_2F1.hpp @@ -49,8 +49,9 @@ template , typename TupleT = std::tuple> -inline TupleT grad_2F1_impl_ab(const T1& a1, const T2& a2, const T3& b1, const T_z& z, - double precision = 1e-14, int max_steps = 1e6) { +inline TupleT grad_2F1_impl_ab(const T1& a1, const T2& a2, const T3& b1, + const T_z& z, double precision = 1e-14, + int max_steps = 1e6) { TupleT grad_tuple = TupleT(0, 0, 0); if (z == 0) { @@ -167,8 +168,9 @@ template , typename TupleT = std::tuple> -inline TupleT grad_2F1_impl(const T1& a1, const T2& a2, const T3& b1, const T_z& z, - double precision = 1e-14, int max_steps = 1e6) { +inline TupleT grad_2F1_impl(const T1& a1, const T2& a2, const T3& b1, + const T_z& z, double precision = 1e-14, + int max_steps = 1e6) { bool euler_transform = false; try { check_2F1_converges("hypergeometric_2F1", a1, a2, b1, z); @@ -269,7 +271,7 @@ inline TupleT grad_2F1_impl(const T1& a1, const T2& a2, const T3& b1, const T_z& template >* = nullptr> inline auto grad_2F1(const T1& a1, const T2& a2, const T3& b1, const T_z& z, - double precision = 1e-14, int max_steps = 1e6) { + double precision = 1e-14, int max_steps = 1e6) { return internal::grad_2F1_impl, is_autodiff_v, is_autodiff_v, is_autodiff_v>( value_of(a1), value_of(a2), value_of(b1), value_of(z), precision, @@ -302,7 +304,7 @@ inline auto grad_2F1(const T1& a1, const T2& a2, const T3& b1, const T_z& z, template >* = nullptr> inline auto grad_2F1(const T1& a1, const T2& a2, const T3& b1, const T_z& z, - double precision = 1e-14, int max_steps = 1e6) { + double precision = 1e-14, int max_steps = 1e6) { return internal::grad_2F1_impl(a1, a2, b1, z, precision, max_steps); } @@ -327,7 +329,7 @@ inline auto grad_2F1(const T1& a1, const T2& a2, const T3& b1, const T_z& z, */ template inline auto grad_2F1(const T1& a1, const T2& a2, const T3& b1, const T_z& z, - double precision = 1e-14, int max_steps = 1e6) { + double precision = 1e-14, int max_steps = 1e6) { return grad_2F1(a1, a2, b1, z, precision, max_steps); } diff --git a/stan/math/prim/fun/grad_F32.hpp b/stan/math/prim/fun/grad_F32.hpp index 1df597f8636..c8f2d56d5f7 100644 --- a/stan/math/prim/fun/grad_F32.hpp +++ b/stan/math/prim/fun/grad_F32.hpp @@ -52,9 +52,9 @@ template -inline void grad_F32(T1* g, const T2& a1, const T3& a2, const T4& a3, const T5& b1, - const T6& b2, const T7& z, const T8& precision = 1e-6, - int max_steps = 1e5) { +inline void grad_F32(T1* g, const T2& a1, const T3& a2, const T4& a3, + const T5& b1, const T6& b2, const T7& z, + const T8& precision = 1e-6, int max_steps = 1e5) { check_3F2_converges("grad_F32", a1, a2, a3, b1, b2, z); for (int i = 0; i < 6; ++i) { diff --git a/stan/math/prim/fun/grad_reg_inc_beta.hpp b/stan/math/prim/fun/grad_reg_inc_beta.hpp index ad1f911e9a0..f4fa1b58178 100644 --- a/stan/math/prim/fun/grad_reg_inc_beta.hpp +++ b/stan/math/prim/fun/grad_reg_inc_beta.hpp @@ -33,8 +33,8 @@ namespace math { */ template inline void grad_reg_inc_beta(T& g1, T& g2, const T& a, const T& b, const T& z, - const T& digammaA, const T& digammaB, - const T& digammaSum, const T& betaAB) { + const T& digammaA, const T& digammaB, + const T& digammaSum, const T& betaAB) { using std::exp; T c1 = log(z); diff --git a/stan/math/prim/fun/grad_reg_inc_gamma.hpp b/stan/math/prim/fun/grad_reg_inc_gamma.hpp index 51a7c3da90d..79f47def83e 100644 --- a/stan/math/prim/fun/grad_reg_inc_gamma.hpp +++ b/stan/math/prim/fun/grad_reg_inc_gamma.hpp @@ -50,8 +50,8 @@ namespace math { */ template inline return_type_t grad_reg_inc_gamma(T1 a, T2 z, T1 g, T1 dig, - double precision = 1e-6, - int max_steps = 1e5) { + double precision = 1e-6, + int max_steps = 1e5) { using std::exp; using std::fabs; using std::log; diff --git a/stan/math/prim/fun/grad_reg_lower_inc_gamma.hpp b/stan/math/prim/fun/grad_reg_lower_inc_gamma.hpp index 8dba893f44c..9e70b33c0a0 100644 --- a/stan/math/prim/fun/grad_reg_lower_inc_gamma.hpp +++ b/stan/math/prim/fun/grad_reg_lower_inc_gamma.hpp @@ -108,8 +108,8 @@ namespace math { */ template inline return_type_t grad_reg_lower_inc_gamma(const T1& a, const T2& z, - double precision = 1e-10, - int max_steps = 1e5) { + double precision = 1e-10, + int max_steps = 1e5) { using std::exp; using std::log; using std::pow; diff --git a/stan/math/prim/fun/hypergeometric_2F2.hpp b/stan/math/prim/fun/hypergeometric_2F2.hpp index 321e55ebc91..7a25c777d0a 100644 --- a/stan/math/prim/fun/hypergeometric_2F2.hpp +++ b/stan/math/prim/fun/hypergeometric_2F2.hpp @@ -23,7 +23,7 @@ template * = nullptr, require_stan_scalar_t* = nullptr> inline return_type_t hypergeometric_2F2(const Ta& a, const Tb& b, - const Tz& z) { + const Tz& z) { if (a.size() != 2 || b.size() != 2) { std::stringstream msg; msg << "Inputs to hypergeometric 2F2 do not contain two values" diff --git a/stan/math/prim/fun/hypergeometric_pFq.hpp b/stan/math/prim/fun/hypergeometric_pFq.hpp index 2085306e55d..1ea870d170c 100644 --- a/stan/math/prim/fun/hypergeometric_pFq.hpp +++ b/stan/math/prim/fun/hypergeometric_pFq.hpp @@ -26,7 +26,7 @@ template * = nullptr, require_arithmetic_t* = nullptr> inline return_type_t hypergeometric_pFq(const Ta& a, const Tb& b, - const Tz& z) { + const Tz& z) { plain_type_t a_ref = a; plain_type_t b_ref = b; check_finite("hypergeometric_pFq", "a", a_ref); diff --git a/stan/math/prim/fun/log_mix.hpp b/stan/math/prim/fun/log_mix.hpp index d9a2e783a36..558dad2aa32 100644 --- a/stan/math/prim/fun/log_mix.hpp +++ b/stan/math/prim/fun/log_mix.hpp @@ -75,7 +75,7 @@ inline double log_mix(T_theta theta, T_lambda1 lambda1, T_lambda2 lambda2) { template * = nullptr> inline return_type_t log_mix(const T_theta& theta, - const T_lam& lambda) { + const T_lam& lambda) { static constexpr const char* function = "log_mix"; using T_partials_return = partials_return_t; using T_partials_vec = diff --git a/stan/math/prim/fun/matrix_exp_pade.hpp b/stan/math/prim/fun/matrix_exp_pade.hpp index d0ecb7ea2c2..f9ea082ac8e 100644 --- a/stan/math/prim/fun/matrix_exp_pade.hpp +++ b/stan/math/prim/fun/matrix_exp_pade.hpp @@ -19,7 +19,7 @@ namespace math { */ template * = nullptr> inline Eigen::Matrix, EigMat::RowsAtCompileTime, - EigMat::ColsAtCompileTime> + EigMat::ColsAtCompileTime> matrix_exp_pade(const EigMat& arg) { using MatrixType = Eigen::Matrix, EigMat::RowsAtCompileTime, diff --git a/stan/math/prim/fun/pseudo_eigenvalues.hpp b/stan/math/prim/fun/pseudo_eigenvalues.hpp index 7fe9eae25bc..7ad4d51cb2b 100644 --- a/stan/math/prim/fun/pseudo_eigenvalues.hpp +++ b/stan/math/prim/fun/pseudo_eigenvalues.hpp @@ -8,7 +8,8 @@ namespace stan { namespace math { template -inline Eigen::Matrix pseudo_eigenvalues(const Eigen::Matrix& m) { +inline Eigen::Matrix pseudo_eigenvalues( + const Eigen::Matrix& m) { check_nonzero_size("pseudo_eigenvalues", "m", m); check_square("pseudo_eigenvalues", "m", m); diff --git a/stan/math/prim/fun/qr.hpp b/stan/math/prim/fun/qr.hpp index 0e3a9906605..defc1d6570e 100644 --- a/stan/math/prim/fun/qr.hpp +++ b/stan/math/prim/fun/qr.hpp @@ -20,8 +20,9 @@ namespace math { * 2. Upper triangular matrix with maximal rows */ template * = nullptr> -inline std::tuple, Eigen::Dynamic, Eigen::Dynamic>, - Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>> +inline std::tuple< + Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>, + Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>> qr(const EigMat& m) { using matrix_t = Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>; diff --git a/stan/math/prim/fun/qr_thin.hpp b/stan/math/prim/fun/qr_thin.hpp index 98db68d5d37..44cdc28a916 100644 --- a/stan/math/prim/fun/qr_thin.hpp +++ b/stan/math/prim/fun/qr_thin.hpp @@ -20,8 +20,9 @@ namespace math { * 2. Upper triangular matrix with minimal rows */ template * = nullptr> -inline std::tuple, Eigen::Dynamic, Eigen::Dynamic>, - Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>> +inline std::tuple< + Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>, + Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>> qr_thin(const EigMat& m) { using matrix_t = Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>; diff --git a/stan/math/prim/fun/qr_thin_Q.hpp b/stan/math/prim/fun/qr_thin_Q.hpp index 7eba6df5bb3..644283c133e 100644 --- a/stan/math/prim/fun/qr_thin_Q.hpp +++ b/stan/math/prim/fun/qr_thin_Q.hpp @@ -16,8 +16,8 @@ namespace math { * @return Orthogonal matrix with minimal columns */ template * = nullptr> -inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> qr_thin_Q( - const EigMat& m) { +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> +qr_thin_Q(const EigMat& m) { using matrix_t = Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>; if (unlikely(m.size() == 0)) { diff --git a/stan/math/prim/fun/qr_thin_R.hpp b/stan/math/prim/fun/qr_thin_R.hpp index e19dbdca8ca..be2df3aaecd 100644 --- a/stan/math/prim/fun/qr_thin_R.hpp +++ b/stan/math/prim/fun/qr_thin_R.hpp @@ -16,8 +16,8 @@ namespace math { * @return Upper triangular matrix with minimal rows */ template * = nullptr> -inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> qr_thin_R( - const EigMat& m) { +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> +qr_thin_R(const EigMat& m) { using matrix_t = Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>; if (unlikely(m.size() == 0)) { diff --git a/stan/math/prim/fun/read_corr_L.hpp b/stan/math/prim/fun/read_corr_L.hpp index b9531e11f72..1315e2b2158 100644 --- a/stan/math/prim/fun/read_corr_L.hpp +++ b/stan/math/prim/fun/read_corr_L.hpp @@ -34,9 +34,9 @@ namespace math { * canonical partial correlations. */ template * = nullptr> -inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> read_corr_L( - const T& CPCs, // on (-1, 1) - size_t K) { +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> +read_corr_L(const T& CPCs, // on (-1, 1) + size_t K) { using T_scalar = value_type_t; if (K == 0) { return {}; @@ -101,8 +101,8 @@ inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> read_corr_ */ template * = nullptr, require_convertible_t, Lp>* = nullptr> -inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> read_corr_L( - const T& CPCs, size_t K, Lp& log_prob) { +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> +read_corr_L(const T& CPCs, size_t K, Lp& log_prob) { using T_scalar = value_type_t; if (K == 0) { return {}; diff --git a/stan/math/prim/fun/read_cov_L.hpp b/stan/math/prim/fun/read_cov_L.hpp index dc876213569..6d5c4049610 100644 --- a/stan/math/prim/fun/read_cov_L.hpp +++ b/stan/math/prim/fun/read_cov_L.hpp @@ -27,8 +27,9 @@ namespace math { template * = nullptr, require_vt_same* = nullptr> -inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> read_cov_L( - const T_CPCs& CPCs, const T_sds& sds, value_type_t& log_prob) { +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> +read_cov_L(const T_CPCs& CPCs, const T_sds& sds, + value_type_t& log_prob) { size_t K = sds.rows(); // adjust due to transformation from correlations to covariances log_prob += (sum(log(sds)) + LOG_TWO) * K; diff --git a/stan/math/prim/fun/resize.hpp b/stan/math/prim/fun/resize.hpp index 7a9b34eff66..00c9c0a7eed 100644 --- a/stan/math/prim/fun/resize.hpp +++ b/stan/math/prim/fun/resize.hpp @@ -8,7 +8,8 @@ namespace stan { namespace math { namespace internal { template -inline void resize(Eigen::Matrix& x, const std::vector& dims, int pos) { +inline void resize(Eigen::Matrix& x, const std::vector& dims, + int pos) { x.resize(dims[pos], dims[pos + 1]); } diff --git a/stan/math/prim/fun/svd_U.hpp b/stan/math/prim/fun/svd_U.hpp index 32f082a136a..b8127d557c8 100644 --- a/stan/math/prim/fun/svd_U.hpp +++ b/stan/math/prim/fun/svd_U.hpp @@ -16,8 +16,8 @@ namespace math { */ template * = nullptr, require_not_st_var* = nullptr> -inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> svd_U( - const EigMat& m) { +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> +svd_U(const EigMat& m) { using MatType = Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>; if (unlikely(m.size() == 0)) { diff --git a/stan/math/prim/fun/svd_V.hpp b/stan/math/prim/fun/svd_V.hpp index 36f3c836d40..1f42bd62d9f 100644 --- a/stan/math/prim/fun/svd_V.hpp +++ b/stan/math/prim/fun/svd_V.hpp @@ -16,8 +16,8 @@ namespace math { */ template * = nullptr, require_not_st_var* = nullptr> -inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> svd_V( - const EigMat& m) { +inline Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic> +svd_V(const EigMat& m) { using MatType = Eigen::Matrix, Eigen::Dynamic, Eigen::Dynamic>; if (unlikely(m.size() == 0)) { diff --git a/stan/math/prim/functor/finite_diff_gradient.hpp b/stan/math/prim/functor/finite_diff_gradient.hpp index a40d2ed1ed5..72237fd6c0e 100644 --- a/stan/math/prim/functor/finite_diff_gradient.hpp +++ b/stan/math/prim/functor/finite_diff_gradient.hpp @@ -40,8 +40,9 @@ namespace math { * @param[in] epsilon perturbation size */ template -inline void finite_diff_gradient(const F& f, const Eigen::VectorXd& x, double& fx, - Eigen::VectorXd& grad_fx, double epsilon = 1e-03) { +inline void finite_diff_gradient(const F& f, const Eigen::VectorXd& x, + double& fx, Eigen::VectorXd& grad_fx, + double epsilon = 1e-03) { Eigen::VectorXd x_temp(x); int d = x.size(); grad_fx.resize(d); diff --git a/stan/math/prim/functor/finite_diff_gradient_auto.hpp b/stan/math/prim/functor/finite_diff_gradient_auto.hpp index 5d6a33da0cc..8c9951ae37b 100644 --- a/stan/math/prim/functor/finite_diff_gradient_auto.hpp +++ b/stan/math/prim/functor/finite_diff_gradient_auto.hpp @@ -49,7 +49,7 @@ namespace math { template > inline void finite_diff_gradient_auto(const F& f, VectorT&& x, ScalarT& fx, - GradVectorT& grad_fx) { + GradVectorT& grad_fx) { using EigT = Eigen::Matrix; static constexpr int h_scale[6] = {3, 2, 1, -3, -2, -1}; static constexpr int mults[6] = {1, -9, 45, -1, 9, -45}; diff --git a/stan/math/prim/functor/map_rect.hpp b/stan/math/prim/functor/map_rect.hpp index c394264f7e2..540ad410521 100644 --- a/stan/math/prim/functor/map_rect.hpp +++ b/stan/math/prim/functor/map_rect.hpp @@ -123,7 +123,8 @@ namespace math { template * = nullptr> -inline Eigen::Matrix, Eigen::Dynamic, 1> +inline Eigen::Matrix, Eigen::Dynamic, + 1> map_rect(const T_shared_param& shared_params, const std::vector>& job_params, diff --git a/stan/math/prim/functor/map_rect_concurrent.hpp b/stan/math/prim/functor/map_rect_concurrent.hpp index c2996444ac0..31dd3398747 100644 --- a/stan/math/prim/functor/map_rect_concurrent.hpp +++ b/stan/math/prim/functor/map_rect_concurrent.hpp @@ -12,7 +12,8 @@ namespace internal { template * = nullptr> -inline Eigen::Matrix, Eigen::Dynamic, 1> +inline Eigen::Matrix, Eigen::Dynamic, + 1> map_rect_concurrent( const T_shared_param& shared_params, const std::vector>& diff --git a/stan/math/prim/functor/map_rect_mpi.hpp b/stan/math/prim/functor/map_rect_mpi.hpp index 6d2866d231c..3eba778b430 100644 --- a/stan/math/prim/functor/map_rect_mpi.hpp +++ b/stan/math/prim/functor/map_rect_mpi.hpp @@ -17,7 +17,8 @@ namespace internal { template -inline Eigen::Matrix, Eigen::Dynamic, 1> +inline Eigen::Matrix, Eigen::Dynamic, + 1> map_rect_mpi(const T_shared_param& shared_params, const std::vector>& job_params, diff --git a/stan/math/prim/functor/ode_ckrk.hpp b/stan/math/prim/functor/ode_ckrk.hpp index f3ff1f55508..8fc6f5cb62e 100644 --- a/stan/math/prim/functor/ode_ckrk.hpp +++ b/stan/math/prim/functor/ode_ckrk.hpp @@ -54,7 +54,7 @@ namespace math { template * = nullptr> inline std::vector, - Eigen::Dynamic, 1>> + Eigen::Dynamic, 1>> ode_ckrk_tol_impl(const char* function_name, const F& f, const T_y0& y0_arg, T_t0 t0, const std::vector& ts, double relative_tolerance, double absolute_tolerance, @@ -195,7 +195,7 @@ ode_ckrk_tol_impl(const char* function_name, const F& f, const T_y0& y0_arg, template * = nullptr> inline std::vector, - Eigen::Dynamic, 1>> + Eigen::Dynamic, 1>> ode_ckrk_tol(const F& f, const T_y0& y0_arg, T_t0 t0, const std::vector& ts, double relative_tolerance, double absolute_tolerance, @@ -241,7 +241,7 @@ ode_ckrk_tol(const F& f, const T_y0& y0_arg, T_t0 t0, template * = nullptr> inline std::vector, - Eigen::Dynamic, 1>> + Eigen::Dynamic, 1>> ode_ckrk(const F& f, const T_y0& y0, T_t0 t0, const std::vector& ts, std::ostream* msgs, const Args&... args) { double relative_tolerance = 1e-6; diff --git a/stan/math/prim/functor/ode_rk45.hpp b/stan/math/prim/functor/ode_rk45.hpp index 4066d0d9420..ab329c35556 100644 --- a/stan/math/prim/functor/ode_rk45.hpp +++ b/stan/math/prim/functor/ode_rk45.hpp @@ -55,7 +55,7 @@ namespace math { template * = nullptr> inline std::vector, - Eigen::Dynamic, 1>> + Eigen::Dynamic, 1>> ode_rk45_tol_impl(const char* function_name, const F& f, const T_y0& y0_arg, T_t0 t0, const std::vector& ts, double relative_tolerance, double absolute_tolerance, @@ -197,7 +197,7 @@ ode_rk45_tol_impl(const char* function_name, const F& f, const T_y0& y0_arg, template * = nullptr> inline std::vector, - Eigen::Dynamic, 1>> + Eigen::Dynamic, 1>> ode_rk45_tol(const F& f, const T_y0& y0_arg, T_t0 t0, const std::vector& ts, double relative_tolerance, double absolute_tolerance, @@ -243,7 +243,7 @@ ode_rk45_tol(const F& f, const T_y0& y0_arg, T_t0 t0, template * = nullptr> inline std::vector, - Eigen::Dynamic, 1>> + Eigen::Dynamic, 1>> ode_rk45(const F& f, const T_y0& y0, T_t0 t0, const std::vector& ts, std::ostream* msgs, const Args&... args) { double relative_tolerance = 1e-6; diff --git a/stan/math/prim/functor/reduce_sum_static.hpp b/stan/math/prim/functor/reduce_sum_static.hpp index e1c8f1f9d42..7ad8648aad8 100644 --- a/stan/math/prim/functor/reduce_sum_static.hpp +++ b/stan/math/prim/functor/reduce_sum_static.hpp @@ -43,7 +43,7 @@ namespace math { template , typename... Args> inline auto reduce_sum_static(Vec&& vmapped, int grainsize, std::ostream* msgs, - Args&&... args) { + Args&&... args) { using return_type = return_type_t; check_positive("reduce_sum", "grainsize", grainsize); diff --git a/stan/math/prim/prob/bernoulli_ccdf_log.hpp b/stan/math/prim/prob/bernoulli_ccdf_log.hpp index 62a20a853a6..9b1bb7f5afa 100644 --- a/stan/math/prim/prob/bernoulli_ccdf_log.hpp +++ b/stan/math/prim/prob/bernoulli_ccdf_log.hpp @@ -11,7 +11,8 @@ namespace math { * @deprecated use bernoulli_lccdf */ template -inline return_type_t bernoulli_ccdf_log(const T_n& n, const T_prob& theta) { +inline return_type_t bernoulli_ccdf_log(const T_n& n, + const T_prob& theta) { return bernoulli_lccdf(n, theta); } } // namespace math diff --git a/stan/math/prim/prob/bernoulli_cdf_log.hpp b/stan/math/prim/prob/bernoulli_cdf_log.hpp index 41798f3fc51..43cfdcb1e9d 100644 --- a/stan/math/prim/prob/bernoulli_cdf_log.hpp +++ b/stan/math/prim/prob/bernoulli_cdf_log.hpp @@ -11,7 +11,8 @@ namespace math { * @deprecated use bernoulli_lcdf */ template -inline return_type_t bernoulli_cdf_log(const T_n& n, const T_prob& theta) { +inline return_type_t bernoulli_cdf_log(const T_n& n, + const T_prob& theta) { return bernoulli_lcdf(n, theta); } diff --git a/stan/math/prim/prob/bernoulli_lccdf.hpp b/stan/math/prim/prob/bernoulli_lccdf.hpp index 9e556398d4c..e8e8b4dce30 100644 --- a/stan/math/prim/prob/bernoulli_lccdf.hpp +++ b/stan/math/prim/prob/bernoulli_lccdf.hpp @@ -29,7 +29,8 @@ namespace math { template * = nullptr> -inline return_type_t bernoulli_lccdf(const T_n& n, const T_prob& theta) { +inline return_type_t bernoulli_lccdf(const T_n& n, + const T_prob& theta) { using T_theta_ref = ref_type_t; static constexpr const char* function = "bernoulli_lccdf"; check_consistent_sizes(function, "Random variable", n, diff --git a/stan/math/prim/prob/bernoulli_logit_lpmf.hpp b/stan/math/prim/prob/bernoulli_logit_lpmf.hpp index 5714f94d359..ce31adca20f 100644 --- a/stan/math/prim/prob/bernoulli_logit_lpmf.hpp +++ b/stan/math/prim/prob/bernoulli_logit_lpmf.hpp @@ -33,7 +33,8 @@ namespace math { template * = nullptr> -inline return_type_t bernoulli_logit_lpmf(const T_n& n, const T_prob& theta) { +inline return_type_t bernoulli_logit_lpmf(const T_n& n, + const T_prob& theta) { using T_partials_return = partials_return_t; using T_partials_array = Eigen::Array; using std::exp; diff --git a/stan/math/prim/prob/beta_binomial_ccdf_log.hpp b/stan/math/prim/prob/beta_binomial_ccdf_log.hpp index 99b32ee1c63..c039ebd9168 100644 --- a/stan/math/prim/prob/beta_binomial_ccdf_log.hpp +++ b/stan/math/prim/prob/beta_binomial_ccdf_log.hpp @@ -11,10 +11,8 @@ namespace math { * @deprecated use beta_binomial_lccdf */ template -inline return_type_t beta_binomial_ccdf_log(const T_n& n, - const T_N& N, - const T_size1& alpha, - const T_size2& beta) { +inline return_type_t beta_binomial_ccdf_log( + const T_n& n, const T_N& N, const T_size1& alpha, const T_size2& beta) { return beta_binomial_lccdf(n, N, alpha, beta); } diff --git a/stan/math/prim/prob/beta_binomial_cdf.hpp b/stan/math/prim/prob/beta_binomial_cdf.hpp index f68a7ad9742..7d90678d154 100644 --- a/stan/math/prim/prob/beta_binomial_cdf.hpp +++ b/stan/math/prim/prob/beta_binomial_cdf.hpp @@ -40,9 +40,10 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -inline return_type_t beta_binomial_cdf(const T_n& n, const T_N& N, - const T_size1& alpha, - const T_size2& beta) { +inline return_type_t beta_binomial_cdf(const T_n& n, + const T_N& N, + const T_size1& alpha, + const T_size2& beta) { using T_partials_return = partials_return_t; using std::exp; using T_N_ref = ref_type_t; diff --git a/stan/math/prim/prob/beta_binomial_cdf_log.hpp b/stan/math/prim/prob/beta_binomial_cdf_log.hpp index 117fdd9188c..83e91971e6f 100644 --- a/stan/math/prim/prob/beta_binomial_cdf_log.hpp +++ b/stan/math/prim/prob/beta_binomial_cdf_log.hpp @@ -11,10 +11,8 @@ namespace math { * @deprecated use beta_binomial_lcdf */ template -inline return_type_t beta_binomial_cdf_log(const T_n& n, - const T_N& N, - const T_size1& alpha, - const T_size2& beta) { +inline return_type_t beta_binomial_cdf_log( + const T_n& n, const T_N& N, const T_size1& alpha, const T_size2& beta) { return beta_binomial_lcdf(n, N, alpha, beta); } diff --git a/stan/math/prim/prob/beta_binomial_lccdf.hpp b/stan/math/prim/prob/beta_binomial_lccdf.hpp index 4fe81ecdc09..d611d23b700 100644 --- a/stan/math/prim/prob/beta_binomial_lccdf.hpp +++ b/stan/math/prim/prob/beta_binomial_lccdf.hpp @@ -41,9 +41,8 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -inline return_type_t beta_binomial_lccdf(const T_n& n, const T_N& N, - const T_size1& alpha, - const T_size2& beta) { +inline return_type_t beta_binomial_lccdf( + const T_n& n, const T_N& N, const T_size1& alpha, const T_size2& beta) { using T_partials_return = partials_return_t; using std::exp; using std::log; diff --git a/stan/math/prim/prob/beta_binomial_lcdf.hpp b/stan/math/prim/prob/beta_binomial_lcdf.hpp index db7d91127b7..eea4ceb5e1e 100644 --- a/stan/math/prim/prob/beta_binomial_lcdf.hpp +++ b/stan/math/prim/prob/beta_binomial_lcdf.hpp @@ -41,9 +41,10 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -inline return_type_t beta_binomial_lcdf(const T_n& n, const T_N& N, - const T_size1& alpha, - const T_size2& beta) { +inline return_type_t beta_binomial_lcdf(const T_n& n, + const T_N& N, + const T_size1& alpha, + const T_size2& beta) { using T_partials_return = partials_return_t; using std::exp; using std::log; diff --git a/stan/math/prim/prob/beta_binomial_lpmf.hpp b/stan/math/prim/prob/beta_binomial_lpmf.hpp index f538657f603..12065ce56aa 100644 --- a/stan/math/prim/prob/beta_binomial_lpmf.hpp +++ b/stan/math/prim/prob/beta_binomial_lpmf.hpp @@ -40,9 +40,10 @@ template * = nullptr> -inline return_type_t beta_binomial_lpmf(const T_n& n, const T_N& N, - const T_size1& alpha, - const T_size2& beta) { +inline return_type_t beta_binomial_lpmf(const T_n& n, + const T_N& N, + const T_size1& alpha, + const T_size2& beta) { using T_partials_return = partials_return_t; using T_N_ref = ref_type_t; using T_alpha_ref = ref_type_t; @@ -165,9 +166,10 @@ inline return_type_t beta_binomial_lpmf(const T_n& n, const T_ } template -inline return_type_t beta_binomial_lpmf(const T_n& n, const T_N& N, - const T_size1& alpha, - const T_size2& beta) { +inline return_type_t beta_binomial_lpmf(const T_n& n, + const T_N& N, + const T_size1& alpha, + const T_size2& beta) { return beta_binomial_lpmf(n, N, alpha, beta); } diff --git a/stan/math/prim/prob/beta_proportion_cdf_log.hpp b/stan/math/prim/prob/beta_proportion_cdf_log.hpp index 7c702d8b060..e504b522604 100644 --- a/stan/math/prim/prob/beta_proportion_cdf_log.hpp +++ b/stan/math/prim/prob/beta_proportion_cdf_log.hpp @@ -11,9 +11,8 @@ namespace math { * @deprecated use beta_proportion_lcdf */ template -inline return_type_t beta_proportion_cdf_log(const T_y& y, - const T_loc& mu, - const T_prec& kappa) { +inline return_type_t beta_proportion_cdf_log( + const T_y& y, const T_loc& mu, const T_prec& kappa) { return beta_proportion_lcdf(y, mu, kappa); } diff --git a/stan/math/prim/prob/beta_proportion_lccdf.hpp b/stan/math/prim/prob/beta_proportion_lccdf.hpp index 833fa0f9645..c615d23b0df 100644 --- a/stan/math/prim/prob/beta_proportion_lccdf.hpp +++ b/stan/math/prim/prob/beta_proportion_lccdf.hpp @@ -41,9 +41,8 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -inline return_type_t beta_proportion_lccdf(const T_y& y, - const T_loc& mu, - const T_prec& kappa) { +inline return_type_t beta_proportion_lccdf( + const T_y& y, const T_loc& mu, const T_prec& kappa) { using T_partials_return = partials_return_t; using std::exp; using std::log; diff --git a/stan/math/prim/prob/beta_proportion_lcdf.hpp b/stan/math/prim/prob/beta_proportion_lcdf.hpp index 0d11249e447..5566b8e5fe2 100644 --- a/stan/math/prim/prob/beta_proportion_lcdf.hpp +++ b/stan/math/prim/prob/beta_proportion_lcdf.hpp @@ -42,9 +42,8 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -inline return_type_t beta_proportion_lcdf(const T_y& y, - const T_loc& mu, - const T_prec& kappa) { +inline return_type_t beta_proportion_lcdf( + const T_y& y, const T_loc& mu, const T_prec& kappa) { using T_partials_return = partials_return_t; using std::exp; using std::log; diff --git a/stan/math/prim/prob/beta_proportion_lpdf.hpp b/stan/math/prim/prob/beta_proportion_lpdf.hpp index 9c9a3713745..1e60bf521a2 100644 --- a/stan/math/prim/prob/beta_proportion_lpdf.hpp +++ b/stan/math/prim/prob/beta_proportion_lpdf.hpp @@ -48,9 +48,8 @@ namespace math { template * = nullptr> -inline return_type_t beta_proportion_lpdf(const T_y& y, - const T_loc& mu, - const T_prec& kappa) { +inline return_type_t beta_proportion_lpdf( + const T_y& y, const T_loc& mu, const T_prec& kappa) { using T_partials_return = partials_return_t; using std::log; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/binomial_ccdf_log.hpp b/stan/math/prim/prob/binomial_ccdf_log.hpp index b67ca850337..10d7ce46ea9 100644 --- a/stan/math/prim/prob/binomial_ccdf_log.hpp +++ b/stan/math/prim/prob/binomial_ccdf_log.hpp @@ -12,7 +12,7 @@ namespace math { */ template inline return_type_t binomial_ccdf_log(const T_n& n, const T_N& N, - const T_prob& theta) { + const T_prob& theta) { return binomial_lccdf(n, N, theta); } diff --git a/stan/math/prim/prob/binomial_cdf.hpp b/stan/math/prim/prob/binomial_cdf.hpp index 0672494b0d4..b713a87f0f0 100644 --- a/stan/math/prim/prob/binomial_cdf.hpp +++ b/stan/math/prim/prob/binomial_cdf.hpp @@ -34,7 +34,7 @@ namespace math { */ template inline return_type_t binomial_cdf(const T_n& n, const T_N& N, - const T_prob& theta) { + const T_prob& theta) { using T_partials_return = partials_return_t; using T_n_ref = ref_type_t; using T_N_ref = ref_type_t; diff --git a/stan/math/prim/prob/binomial_cdf_log.hpp b/stan/math/prim/prob/binomial_cdf_log.hpp index 3961cbfca63..b42a7fccd8e 100644 --- a/stan/math/prim/prob/binomial_cdf_log.hpp +++ b/stan/math/prim/prob/binomial_cdf_log.hpp @@ -12,7 +12,7 @@ namespace math { */ template inline return_type_t binomial_cdf_log(const T_n& n, const T_N& N, - const T_prob& theta) { + const T_prob& theta) { return binomial_lcdf(n, N, theta); } diff --git a/stan/math/prim/prob/binomial_lccdf.hpp b/stan/math/prim/prob/binomial_lccdf.hpp index 9cb13f0cec6..5fe97006126 100644 --- a/stan/math/prim/prob/binomial_lccdf.hpp +++ b/stan/math/prim/prob/binomial_lccdf.hpp @@ -36,7 +36,7 @@ namespace math { */ template inline return_type_t binomial_lccdf(const T_n& n, const T_N& N, - const T_prob& theta) { + const T_prob& theta) { using T_partials_return = partials_return_t; using T_n_ref = ref_type_t; using T_N_ref = ref_type_t; diff --git a/stan/math/prim/prob/binomial_lcdf.hpp b/stan/math/prim/prob/binomial_lcdf.hpp index 518338debb9..bd0a4d882a6 100644 --- a/stan/math/prim/prob/binomial_lcdf.hpp +++ b/stan/math/prim/prob/binomial_lcdf.hpp @@ -36,7 +36,7 @@ namespace math { */ template inline return_type_t binomial_lcdf(const T_n& n, const T_N& N, - const T_prob& theta) { + const T_prob& theta) { using T_partials_return = partials_return_t; using T_n_ref = ref_type_t; using T_N_ref = ref_type_t; diff --git a/stan/math/prim/prob/binomial_logit_lpmf.hpp b/stan/math/prim/prob/binomial_logit_lpmf.hpp index 2f6c49f8209..d441c1ec0dc 100644 --- a/stan/math/prim/prob/binomial_logit_lpmf.hpp +++ b/stan/math/prim/prob/binomial_logit_lpmf.hpp @@ -35,7 +35,7 @@ template * = nullptr> inline return_type_t binomial_logit_lpmf(const T_n& n, const T_N& N, - const T_prob& alpha) { + const T_prob& alpha) { using T_partials_return = partials_return_t; using T_n_ref = ref_type_if_not_constant_t; using T_N_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/binomial_lpmf.hpp b/stan/math/prim/prob/binomial_lpmf.hpp index 4e612d66ed2..c694df2abe4 100644 --- a/stan/math/prim/prob/binomial_lpmf.hpp +++ b/stan/math/prim/prob/binomial_lpmf.hpp @@ -37,7 +37,7 @@ template * = nullptr> inline return_type_t binomial_lpmf(const T_n& n, const T_N& N, - const T_prob& theta) { + const T_prob& theta) { using T_partials_return = partials_return_t; using T_n_ref = ref_type_t; using T_N_ref = ref_type_t; diff --git a/stan/math/prim/prob/categorical_logit_lpmf.hpp b/stan/math/prim/prob/categorical_logit_lpmf.hpp index 425d0091a97..849764a58ea 100644 --- a/stan/math/prim/prob/categorical_logit_lpmf.hpp +++ b/stan/math/prim/prob/categorical_logit_lpmf.hpp @@ -32,7 +32,7 @@ inline return_type_t categorical_logit_lpmf(int n, const T_prob& beta) { template * = nullptr> inline return_type_t categorical_logit_lpmf(const std::vector& ns, - const T_prob& beta) { + const T_prob& beta) { static constexpr const char* function = "categorical_logit_lpmf"; check_bounded(function, "categorical outcome out of support", ns, 1, diff --git a/stan/math/prim/prob/categorical_lpmf.hpp b/stan/math/prim/prob/categorical_lpmf.hpp index d99661e4a14..637db0f1d04 100644 --- a/stan/math/prim/prob/categorical_lpmf.hpp +++ b/stan/math/prim/prob/categorical_lpmf.hpp @@ -31,7 +31,7 @@ inline return_type_t categorical_lpmf(int n, const T_prob& theta) { template * = nullptr> inline return_type_t categorical_lpmf(const std::vector& ns, - const T_prob& theta) { + const T_prob& theta) { static constexpr const char* function = "categorical_lpmf"; check_bounded(function, "element of outcome array", ns, 1, theta.size()); diff --git a/stan/math/prim/prob/cauchy_ccdf_log.hpp b/stan/math/prim/prob/cauchy_ccdf_log.hpp index 0af495fde9a..cbc7a185afd 100644 --- a/stan/math/prim/prob/cauchy_ccdf_log.hpp +++ b/stan/math/prim/prob/cauchy_ccdf_log.hpp @@ -11,9 +11,8 @@ namespace math { * @deprecated use cauchy_lccdf */ template -inline return_type_t cauchy_ccdf_log(const T_y& y, - const T_loc& mu, - const T_scale& sigma) { +inline return_type_t cauchy_ccdf_log( + const T_y& y, const T_loc& mu, const T_scale& sigma) { return cauchy_lccdf(y, mu, sigma); } diff --git a/stan/math/prim/prob/cauchy_cdf.hpp b/stan/math/prim/prob/cauchy_cdf.hpp index 2b24afb8d58..2bcff3fadfd 100644 --- a/stan/math/prim/prob/cauchy_cdf.hpp +++ b/stan/math/prim/prob/cauchy_cdf.hpp @@ -32,8 +32,9 @@ namespace math { template * = nullptr> -inline return_type_t cauchy_cdf(const T_y& y, const T_loc& mu, - const T_scale& sigma) { +inline return_type_t cauchy_cdf(const T_y& y, + const T_loc& mu, + const T_scale& sigma) { using T_partials_return = partials_return_t; using std::atan; using T_y_ref = ref_type_t; diff --git a/stan/math/prim/prob/cauchy_cdf_log.hpp b/stan/math/prim/prob/cauchy_cdf_log.hpp index 6f441c98d04..3f14da9091e 100644 --- a/stan/math/prim/prob/cauchy_cdf_log.hpp +++ b/stan/math/prim/prob/cauchy_cdf_log.hpp @@ -11,8 +11,9 @@ namespace math { * @deprecated use cauchy_lcdf */ template -inline return_type_t cauchy_cdf_log(const T_y& y, const T_loc& mu, - const T_scale& sigma) { +inline return_type_t cauchy_cdf_log(const T_y& y, + const T_loc& mu, + const T_scale& sigma) { return cauchy_lcdf(y, mu, sigma); } diff --git a/stan/math/prim/prob/cauchy_lccdf.hpp b/stan/math/prim/prob/cauchy_lccdf.hpp index 0d3af6c91de..a5274780421 100644 --- a/stan/math/prim/prob/cauchy_lccdf.hpp +++ b/stan/math/prim/prob/cauchy_lccdf.hpp @@ -34,8 +34,9 @@ namespace math { template * = nullptr> -inline return_type_t cauchy_lccdf(const T_y& y, const T_loc& mu, - const T_scale& sigma) { +inline return_type_t cauchy_lccdf(const T_y& y, + const T_loc& mu, + const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_t; using T_mu_ref = ref_type_t; diff --git a/stan/math/prim/prob/cauchy_lcdf.hpp b/stan/math/prim/prob/cauchy_lcdf.hpp index 44f42758cd3..7bf11474eda 100644 --- a/stan/math/prim/prob/cauchy_lcdf.hpp +++ b/stan/math/prim/prob/cauchy_lcdf.hpp @@ -34,8 +34,9 @@ namespace math { template * = nullptr> -inline return_type_t cauchy_lcdf(const T_y& y, const T_loc& mu, - const T_scale& sigma) { +inline return_type_t cauchy_lcdf(const T_y& y, + const T_loc& mu, + const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_t; using T_mu_ref = ref_type_t; diff --git a/stan/math/prim/prob/cauchy_lpdf.hpp b/stan/math/prim/prob/cauchy_lpdf.hpp index 25b4a377462..703939adf9f 100644 --- a/stan/math/prim/prob/cauchy_lpdf.hpp +++ b/stan/math/prim/prob/cauchy_lpdf.hpp @@ -40,8 +40,9 @@ namespace math { template * = nullptr> -inline return_type_t cauchy_lpdf(const T_y& y, const T_loc& mu, - const T_scale& sigma) { +inline return_type_t cauchy_lpdf(const T_y& y, + const T_loc& mu, + const T_scale& sigma) { using T_partials_return = partials_return_t; using std::log; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/chi_square_ccdf_log.hpp b/stan/math/prim/prob/chi_square_ccdf_log.hpp index c148700cfdf..11d87ca812e 100644 --- a/stan/math/prim/prob/chi_square_ccdf_log.hpp +++ b/stan/math/prim/prob/chi_square_ccdf_log.hpp @@ -11,7 +11,8 @@ namespace math { * @deprecated use chi_square_lccdf */ template -inline return_type_t chi_square_ccdf_log(const T_y& y, const T_dof& nu) { +inline return_type_t chi_square_ccdf_log(const T_y& y, + const T_dof& nu) { return chi_square_lccdf(y, nu); } diff --git a/stan/math/prim/prob/chi_square_cdf_log.hpp b/stan/math/prim/prob/chi_square_cdf_log.hpp index 15b44b45c1b..a026477de99 100644 --- a/stan/math/prim/prob/chi_square_cdf_log.hpp +++ b/stan/math/prim/prob/chi_square_cdf_log.hpp @@ -11,7 +11,8 @@ namespace math { * @deprecated use chi_square_lcdf */ template -inline return_type_t chi_square_cdf_log(const T_y& y, const T_dof& nu) { +inline return_type_t chi_square_cdf_log(const T_y& y, + const T_dof& nu) { return chi_square_lcdf(y, nu); } diff --git a/stan/math/prim/prob/chi_square_lccdf.hpp b/stan/math/prim/prob/chi_square_lccdf.hpp index 8851b28fd4e..29da6302dc0 100644 --- a/stan/math/prim/prob/chi_square_lccdf.hpp +++ b/stan/math/prim/prob/chi_square_lccdf.hpp @@ -35,7 +35,8 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -inline return_type_t chi_square_lccdf(const T_y& y, const T_dof& nu) { +inline return_type_t chi_square_lccdf(const T_y& y, + const T_dof& nu) { using T_partials_return = partials_return_t; using std::exp; using std::log; diff --git a/stan/math/prim/prob/chi_square_lcdf.hpp b/stan/math/prim/prob/chi_square_lcdf.hpp index 3f8841110d2..c75e14f8b14 100644 --- a/stan/math/prim/prob/chi_square_lcdf.hpp +++ b/stan/math/prim/prob/chi_square_lcdf.hpp @@ -35,7 +35,8 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -inline return_type_t chi_square_lcdf(const T_y& y, const T_dof& nu) { +inline return_type_t chi_square_lcdf(const T_y& y, + const T_dof& nu) { using T_partials_return = partials_return_t; using std::exp; using std::log; diff --git a/stan/math/prim/prob/chi_square_lpdf.hpp b/stan/math/prim/prob/chi_square_lpdf.hpp index eff88df21e0..0750e87d0d6 100644 --- a/stan/math/prim/prob/chi_square_lpdf.hpp +++ b/stan/math/prim/prob/chi_square_lpdf.hpp @@ -43,7 +43,8 @@ namespace math { template * = nullptr> -inline return_type_t chi_square_lpdf(const T_y& y, const T_dof& nu) { +inline 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; diff --git a/stan/math/prim/prob/dirichlet_lpdf.hpp b/stan/math/prim/prob/dirichlet_lpdf.hpp index 7765a864663..57d61668141 100644 --- a/stan/math/prim/prob/dirichlet_lpdf.hpp +++ b/stan/math/prim/prob/dirichlet_lpdf.hpp @@ -56,8 +56,8 @@ namespace math { template * = nullptr> -inline return_type_t dirichlet_lpdf(const T_prob& theta, - const T_prior_size& alpha) { +inline return_type_t dirichlet_lpdf( + const T_prob& theta, const T_prior_size& alpha) { using T_partials_return = partials_return_t; using T_partials_array = typename Eigen::Array; using T_theta_ref = ref_type_t; @@ -125,8 +125,8 @@ inline return_type_t dirichlet_lpdf(const T_prob& theta, } template -inline return_type_t dirichlet_lpdf(const T_prob& theta, - const T_prior_size& alpha) { +inline return_type_t dirichlet_lpdf( + const T_prob& theta, const T_prior_size& alpha) { return dirichlet_lpdf(theta, alpha); } diff --git a/stan/math/prim/prob/discrete_range_ccdf_log.hpp b/stan/math/prim/prob/discrete_range_ccdf_log.hpp index 767befb1c8a..1cca4e7072a 100644 --- a/stan/math/prim/prob/discrete_range_ccdf_log.hpp +++ b/stan/math/prim/prob/discrete_range_ccdf_log.hpp @@ -11,7 +11,7 @@ namespace math { */ template inline double discrete_range_ccdf_log(const T_y& y, const T_lower& lower, - const T_upper& upper) { + const T_upper& upper) { return discrete_range_lccdf(y, lower, upper); } diff --git a/stan/math/prim/prob/discrete_range_cdf.hpp b/stan/math/prim/prob/discrete_range_cdf.hpp index f9a07d90adc..777e3f21769 100644 --- a/stan/math/prim/prob/discrete_range_cdf.hpp +++ b/stan/math/prim/prob/discrete_range_cdf.hpp @@ -36,7 +36,7 @@ namespace math { */ template inline double discrete_range_cdf(const T_y& y, const T_lower& lower, - const T_upper& upper) { + const T_upper& upper) { static constexpr const char* function = "discrete_range_cdf"; check_consistent_sizes(function, "Lower bound parameter", lower, "Upper bound parameter", upper); diff --git a/stan/math/prim/prob/discrete_range_cdf_log.hpp b/stan/math/prim/prob/discrete_range_cdf_log.hpp index d75ed1318b7..da08c1c6f40 100644 --- a/stan/math/prim/prob/discrete_range_cdf_log.hpp +++ b/stan/math/prim/prob/discrete_range_cdf_log.hpp @@ -11,7 +11,7 @@ namespace math { */ template inline double discrete_range_cdf_log(const T_y& y, const T_lower& lower, - const T_upper& upper) { + const T_upper& upper) { return discrete_range_lcdf(y, lower, upper); } diff --git a/stan/math/prim/prob/discrete_range_lccdf.hpp b/stan/math/prim/prob/discrete_range_lccdf.hpp index ea27506f8b2..54e82deb0de 100644 --- a/stan/math/prim/prob/discrete_range_lccdf.hpp +++ b/stan/math/prim/prob/discrete_range_lccdf.hpp @@ -36,7 +36,7 @@ namespace math { */ template inline double discrete_range_lccdf(const T_y& y, const T_lower& lower, - const T_upper& upper) { + const T_upper& upper) { static constexpr const char* function = "discrete_range_lccdf"; check_consistent_sizes(function, "Lower bound parameter", lower, "Upper bound parameter", upper); diff --git a/stan/math/prim/prob/discrete_range_lcdf.hpp b/stan/math/prim/prob/discrete_range_lcdf.hpp index ca45637b808..5d73f051949 100644 --- a/stan/math/prim/prob/discrete_range_lcdf.hpp +++ b/stan/math/prim/prob/discrete_range_lcdf.hpp @@ -36,7 +36,7 @@ namespace math { */ template inline double discrete_range_lcdf(const T_y& y, const T_lower& lower, - const T_upper& upper) { + const T_upper& upper) { static constexpr const char* function = "discrete_range_lcdf"; check_consistent_sizes(function, "Lower bound parameter", lower, "Upper bound parameter", upper); diff --git a/stan/math/prim/prob/discrete_range_lpmf.hpp b/stan/math/prim/prob/discrete_range_lpmf.hpp index f5c100404a2..f847eb95396 100644 --- a/stan/math/prim/prob/discrete_range_lpmf.hpp +++ b/stan/math/prim/prob/discrete_range_lpmf.hpp @@ -44,7 +44,7 @@ namespace math { */ template inline double discrete_range_lpmf(const T_y& y, const T_lower& lower, - const T_upper& upper) { + const T_upper& upper) { using std::log; static constexpr const char* function = "discrete_range_lpmf"; check_not_nan(function, "Random variable", y); diff --git a/stan/math/prim/prob/exponential_ccdf_log.hpp b/stan/math/prim/prob/exponential_ccdf_log.hpp index 53d0378eb0a..61047d3aa5c 100644 --- a/stan/math/prim/prob/exponential_ccdf_log.hpp +++ b/stan/math/prim/prob/exponential_ccdf_log.hpp @@ -11,8 +11,8 @@ namespace math { * @deprecated use exponential_lccdf */ template -inline return_type_t exponential_ccdf_log(const T_y& y, - const T_inv_scale& beta) { +inline return_type_t exponential_ccdf_log( + const T_y& y, const T_inv_scale& beta) { return exponential_lccdf(y, beta); } diff --git a/stan/math/prim/prob/exponential_cdf.hpp b/stan/math/prim/prob/exponential_cdf.hpp index 48545c73645..e17fa05be48 100644 --- a/stan/math/prim/prob/exponential_cdf.hpp +++ b/stan/math/prim/prob/exponential_cdf.hpp @@ -32,8 +32,8 @@ namespace math { template * = nullptr> -inline return_type_t exponential_cdf(const T_y& y, - const T_inv_scale& beta) { +inline return_type_t exponential_cdf( + const T_y& y, const T_inv_scale& beta) { using T_partials_return = partials_return_t; using T_partials_array = Eigen::Array; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/exponential_cdf_log.hpp b/stan/math/prim/prob/exponential_cdf_log.hpp index eab8bd60849..b2e53909d29 100644 --- a/stan/math/prim/prob/exponential_cdf_log.hpp +++ b/stan/math/prim/prob/exponential_cdf_log.hpp @@ -11,8 +11,8 @@ namespace math { * @deprecated use exponential_lcdf */ template -inline return_type_t exponential_cdf_log(const T_y& y, - const T_inv_scale& beta) { +inline return_type_t exponential_cdf_log( + const T_y& y, const T_inv_scale& beta) { return exponential_lcdf(y, beta); } diff --git a/stan/math/prim/prob/exponential_lccdf.hpp b/stan/math/prim/prob/exponential_lccdf.hpp index 3af821a39f2..62451733613 100644 --- a/stan/math/prim/prob/exponential_lccdf.hpp +++ b/stan/math/prim/prob/exponential_lccdf.hpp @@ -17,8 +17,8 @@ namespace math { template * = nullptr> -inline return_type_t exponential_lccdf(const T_y& y, - const T_inv_scale& beta) { +inline return_type_t exponential_lccdf( + const T_y& y, const T_inv_scale& beta) { using T_partials_return = partials_return_t; using T_partials_array = Eigen::Array; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/exponential_lcdf.hpp b/stan/math/prim/prob/exponential_lcdf.hpp index b20bbaa2122..5236fc1a9e8 100644 --- a/stan/math/prim/prob/exponential_lcdf.hpp +++ b/stan/math/prim/prob/exponential_lcdf.hpp @@ -21,8 +21,8 @@ namespace math { template * = nullptr> -inline return_type_t exponential_lcdf(const T_y& y, - const T_inv_scale& beta) { +inline return_type_t exponential_lcdf( + const T_y& y, const T_inv_scale& beta) { 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; diff --git a/stan/math/prim/prob/exponential_lpdf.hpp b/stan/math/prim/prob/exponential_lpdf.hpp index 60daefc37cf..9ee04091d08 100644 --- a/stan/math/prim/prob/exponential_lpdf.hpp +++ b/stan/math/prim/prob/exponential_lpdf.hpp @@ -49,8 +49,8 @@ namespace math { template * = nullptr> -inline return_type_t exponential_lpdf(const T_y& y, - const T_inv_scale& beta) { +inline return_type_t exponential_lpdf( + const T_y& y, const T_inv_scale& beta) { using T_partials_return = partials_return_t; using T_partials_array = Eigen::Array; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/frechet_ccdf_log.hpp b/stan/math/prim/prob/frechet_ccdf_log.hpp index c05449de3c3..8ba109a2dc9 100644 --- a/stan/math/prim/prob/frechet_ccdf_log.hpp +++ b/stan/math/prim/prob/frechet_ccdf_log.hpp @@ -11,9 +11,8 @@ namespace math { * @deprecated use frechet_lccdf */ template -inline return_type_t frechet_ccdf_log(const T_y& y, - const T_shape& alpha, - const T_scale& sigma) { +inline return_type_t frechet_ccdf_log( + const T_y& y, const T_shape& alpha, const T_scale& sigma) { return frechet_lccdf(y, alpha, sigma); } diff --git a/stan/math/prim/prob/frechet_cdf.hpp b/stan/math/prim/prob/frechet_cdf.hpp index 9a20382d400..e57a90f0bb0 100644 --- a/stan/math/prim/prob/frechet_cdf.hpp +++ b/stan/math/prim/prob/frechet_cdf.hpp @@ -26,8 +26,8 @@ template * = nullptr> inline return_type_t frechet_cdf(const T_y& y, - const T_shape& alpha, - const T_scale& sigma) { + const T_shape& alpha, + const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_t; using T_alpha_ref = ref_type_t; diff --git a/stan/math/prim/prob/frechet_cdf_log.hpp b/stan/math/prim/prob/frechet_cdf_log.hpp index 0b41ebc4520..53b9f0beec3 100644 --- a/stan/math/prim/prob/frechet_cdf_log.hpp +++ b/stan/math/prim/prob/frechet_cdf_log.hpp @@ -11,9 +11,8 @@ namespace math { * @deprecated use frechet_lcdf */ template -inline return_type_t frechet_cdf_log(const T_y& y, - const T_shape& alpha, - const T_scale& sigma) { +inline return_type_t frechet_cdf_log( + const T_y& y, const T_shape& alpha, const T_scale& sigma) { return frechet_lcdf(y, alpha, sigma); } diff --git a/stan/math/prim/prob/frechet_lccdf.hpp b/stan/math/prim/prob/frechet_lccdf.hpp index eb2cc3ecf00..6226d64c92d 100644 --- a/stan/math/prim/prob/frechet_lccdf.hpp +++ b/stan/math/prim/prob/frechet_lccdf.hpp @@ -25,9 +25,8 @@ namespace math { template * = nullptr> -inline return_type_t frechet_lccdf(const T_y& y, - const T_shape& alpha, - const T_scale& sigma) { +inline return_type_t frechet_lccdf( + const T_y& y, const T_shape& alpha, const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_t; using T_alpha_ref = ref_type_t; diff --git a/stan/math/prim/prob/frechet_lcdf.hpp b/stan/math/prim/prob/frechet_lcdf.hpp index 7d91821cd18..4770deaa202 100644 --- a/stan/math/prim/prob/frechet_lcdf.hpp +++ b/stan/math/prim/prob/frechet_lcdf.hpp @@ -24,8 +24,8 @@ template * = nullptr> inline return_type_t frechet_lcdf(const T_y& y, - const T_shape& alpha, - const T_scale& sigma) { + const T_shape& alpha, + const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_t; using T_alpha_ref = ref_type_t; diff --git a/stan/math/prim/prob/frechet_lpdf.hpp b/stan/math/prim/prob/frechet_lpdf.hpp index 46963ce0662..3dba3f3ffd9 100644 --- a/stan/math/prim/prob/frechet_lpdf.hpp +++ b/stan/math/prim/prob/frechet_lpdf.hpp @@ -29,8 +29,8 @@ template * = nullptr> inline return_type_t frechet_lpdf(const T_y& y, - const T_shape& alpha, - const T_scale& sigma) { + const T_shape& alpha, + const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_t; using T_alpha_ref = ref_type_t; diff --git a/stan/math/prim/prob/gamma_cdf.hpp b/stan/math/prim/prob/gamma_cdf.hpp index 8319257534c..4112a61ac39 100644 --- a/stan/math/prim/prob/gamma_cdf.hpp +++ b/stan/math/prim/prob/gamma_cdf.hpp @@ -38,9 +38,8 @@ namespace math { * @throw std::domain_error if y is not greater than or equal to 0. */ template -inline return_type_t gamma_cdf(const T_y& y, - const T_shape& alpha, - const T_inv_scale& beta) { +inline return_type_t gamma_cdf( + const T_y& y, const T_shape& alpha, const T_inv_scale& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_t; using T_alpha_ref = ref_type_t; diff --git a/stan/math/prim/prob/gamma_lccdf.hpp b/stan/math/prim/prob/gamma_lccdf.hpp index 0b04e002888..a670cefcecf 100644 --- a/stan/math/prim/prob/gamma_lccdf.hpp +++ b/stan/math/prim/prob/gamma_lccdf.hpp @@ -22,9 +22,8 @@ namespace stan { namespace math { template -inline return_type_t gamma_lccdf(const T_y& y, - const T_shape& alpha, - const T_inv_scale& beta) { +inline return_type_t gamma_lccdf( + const T_y& y, const T_shape& alpha, const T_inv_scale& beta) { using T_partials_return = partials_return_t; using std::exp; using std::log; diff --git a/stan/math/prim/prob/gamma_lcdf.hpp b/stan/math/prim/prob/gamma_lcdf.hpp index 18b2a203be7..acac32bf92f 100644 --- a/stan/math/prim/prob/gamma_lcdf.hpp +++ b/stan/math/prim/prob/gamma_lcdf.hpp @@ -22,9 +22,8 @@ namespace stan { namespace math { template -inline return_type_t gamma_lcdf(const T_y& y, - const T_shape& alpha, - const T_inv_scale& beta) { +inline return_type_t gamma_lcdf( + const T_y& y, const T_shape& alpha, const T_inv_scale& beta) { using T_partials_return = partials_return_t; using std::exp; using std::log; diff --git a/stan/math/prim/prob/gamma_lpdf.hpp b/stan/math/prim/prob/gamma_lpdf.hpp index 9c056d215a6..4c377665f46 100644 --- a/stan/math/prim/prob/gamma_lpdf.hpp +++ b/stan/math/prim/prob/gamma_lpdf.hpp @@ -49,9 +49,8 @@ namespace math { template * = nullptr> -inline return_type_t gamma_lpdf(const T_y& y, - const T_shape& alpha, - const T_inv_scale& beta) { +inline return_type_t gamma_lpdf( + const T_y& y, const T_shape& alpha, const T_inv_scale& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/gumbel_ccdf_log.hpp b/stan/math/prim/prob/gumbel_ccdf_log.hpp index 320ffd56c71..10300189bde 100644 --- a/stan/math/prim/prob/gumbel_ccdf_log.hpp +++ b/stan/math/prim/prob/gumbel_ccdf_log.hpp @@ -12,8 +12,8 @@ namespace math { */ template inline return_type_t gumbel_ccdf_log(const T_y& y, - const T_loc& mu, - const T_scale& beta) { + const T_loc& mu, + const T_scale& beta) { return gumbel_lccdf(y, mu, beta); } diff --git a/stan/math/prim/prob/gumbel_cdf.hpp b/stan/math/prim/prob/gumbel_cdf.hpp index 3510a83ccd3..889c1062000 100644 --- a/stan/math/prim/prob/gumbel_cdf.hpp +++ b/stan/math/prim/prob/gumbel_cdf.hpp @@ -36,8 +36,9 @@ namespace math { template * = nullptr> -inline return_type_t gumbel_cdf(const T_y& y, const T_loc& mu, - const T_scale& beta) { +inline return_type_t gumbel_cdf(const T_y& y, + const T_loc& mu, + const T_scale& beta) { using T_partials_return = partials_return_t; using T_partials_array = Eigen::Array; using T_y_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/gumbel_cdf_log.hpp b/stan/math/prim/prob/gumbel_cdf_log.hpp index ab5ebc98c48..ceccfb62d69 100644 --- a/stan/math/prim/prob/gumbel_cdf_log.hpp +++ b/stan/math/prim/prob/gumbel_cdf_log.hpp @@ -11,8 +11,9 @@ namespace math { * @deprecated use gumbel_lcdf */ template -inline return_type_t gumbel_cdf_log(const T_y& y, const T_loc& mu, - const T_scale& beta) { +inline return_type_t gumbel_cdf_log(const T_y& y, + const T_loc& mu, + const T_scale& beta) { return gumbel_lcdf(y, mu, beta); } diff --git a/stan/math/prim/prob/gumbel_lccdf.hpp b/stan/math/prim/prob/gumbel_lccdf.hpp index 1cc6cda8c47..52da2565307 100644 --- a/stan/math/prim/prob/gumbel_lccdf.hpp +++ b/stan/math/prim/prob/gumbel_lccdf.hpp @@ -36,8 +36,9 @@ namespace math { template * = nullptr> -inline return_type_t gumbel_lccdf(const T_y& y, const T_loc& mu, - const T_scale& beta) { +inline return_type_t gumbel_lccdf(const T_y& y, + const T_loc& mu, + const T_scale& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/gumbel_lcdf.hpp b/stan/math/prim/prob/gumbel_lcdf.hpp index 4722c83d898..91b710f18a5 100644 --- a/stan/math/prim/prob/gumbel_lcdf.hpp +++ b/stan/math/prim/prob/gumbel_lcdf.hpp @@ -35,8 +35,9 @@ namespace math { template * = nullptr> -inline return_type_t gumbel_lcdf(const T_y& y, const T_loc& mu, - const T_scale& beta) { +inline return_type_t gumbel_lcdf(const T_y& y, + const T_loc& mu, + const T_scale& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/gumbel_lpdf.hpp b/stan/math/prim/prob/gumbel_lpdf.hpp index 1cac94f70fd..e84f9dfecc8 100644 --- a/stan/math/prim/prob/gumbel_lpdf.hpp +++ b/stan/math/prim/prob/gumbel_lpdf.hpp @@ -37,8 +37,9 @@ namespace math { template * = nullptr> -inline return_type_t gumbel_lpdf(const T_y& y, const T_loc& mu, - const T_scale& beta) { +inline return_type_t gumbel_lpdf(const T_y& y, + const T_loc& mu, + const T_scale& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/hypergeometric_lpmf.hpp b/stan/math/prim/prob/hypergeometric_lpmf.hpp index 69d11b4194f..123bde81bc8 100644 --- a/stan/math/prim/prob/hypergeometric_lpmf.hpp +++ b/stan/math/prim/prob/hypergeometric_lpmf.hpp @@ -16,7 +16,7 @@ namespace math { // a: #white balls; b: #black balls template inline double hypergeometric_lpmf(const T_n& n, const T_N& N, const T_a& a, - const T_b& b) { + const T_b& b) { 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", diff --git a/stan/math/prim/prob/inv_chi_square_ccdf_log.hpp b/stan/math/prim/prob/inv_chi_square_ccdf_log.hpp index f07eaef24d3..75adf669605 100644 --- a/stan/math/prim/prob/inv_chi_square_ccdf_log.hpp +++ b/stan/math/prim/prob/inv_chi_square_ccdf_log.hpp @@ -12,7 +12,7 @@ namespace math { */ template inline return_type_t inv_chi_square_ccdf_log(const T_y& y, - const T_dof& nu) { + const T_dof& nu) { return inv_chi_square_lccdf(y, nu); } diff --git a/stan/math/prim/prob/inv_chi_square_cdf.hpp b/stan/math/prim/prob/inv_chi_square_cdf.hpp index c02d09f1a5e..d017fc1390f 100644 --- a/stan/math/prim/prob/inv_chi_square_cdf.hpp +++ b/stan/math/prim/prob/inv_chi_square_cdf.hpp @@ -34,7 +34,8 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -inline return_type_t inv_chi_square_cdf(const T_y& y, const T_dof& nu) { +inline return_type_t inv_chi_square_cdf(const T_y& y, + const T_dof& nu) { using T_partials_return = partials_return_t; using std::exp; using std::pow; diff --git a/stan/math/prim/prob/inv_chi_square_cdf_log.hpp b/stan/math/prim/prob/inv_chi_square_cdf_log.hpp index 176ba481003..49900c93737 100644 --- a/stan/math/prim/prob/inv_chi_square_cdf_log.hpp +++ b/stan/math/prim/prob/inv_chi_square_cdf_log.hpp @@ -12,7 +12,7 @@ namespace math { */ template inline return_type_t inv_chi_square_cdf_log(const T_y& y, - const T_dof& nu) { + const T_dof& nu) { return inv_chi_square_lcdf(y, nu); } diff --git a/stan/math/prim/prob/inv_chi_square_lccdf.hpp b/stan/math/prim/prob/inv_chi_square_lccdf.hpp index 484bab336c6..27f73e38512 100644 --- a/stan/math/prim/prob/inv_chi_square_lccdf.hpp +++ b/stan/math/prim/prob/inv_chi_square_lccdf.hpp @@ -35,7 +35,8 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -inline return_type_t inv_chi_square_lccdf(const T_y& y, const T_dof& nu) { +inline return_type_t inv_chi_square_lccdf(const T_y& y, + const T_dof& nu) { using T_partials_return = partials_return_t; using std::exp; using std::log; diff --git a/stan/math/prim/prob/inv_chi_square_lcdf.hpp b/stan/math/prim/prob/inv_chi_square_lcdf.hpp index 90fc5ef2b00..86280b86ad2 100644 --- a/stan/math/prim/prob/inv_chi_square_lcdf.hpp +++ b/stan/math/prim/prob/inv_chi_square_lcdf.hpp @@ -35,7 +35,8 @@ namespace math { * @throw std::invalid_argument if container sizes mismatch */ template -inline return_type_t inv_chi_square_lcdf(const T_y& y, const T_dof& nu) { +inline return_type_t inv_chi_square_lcdf(const T_y& y, + const T_dof& nu) { using T_partials_return = partials_return_t; using std::exp; using std::log; diff --git a/stan/math/prim/prob/inv_chi_square_lpdf.hpp b/stan/math/prim/prob/inv_chi_square_lpdf.hpp index a74c4ed8814..91cced06de6 100644 --- a/stan/math/prim/prob/inv_chi_square_lpdf.hpp +++ b/stan/math/prim/prob/inv_chi_square_lpdf.hpp @@ -46,7 +46,8 @@ namespace math { template * = nullptr> -inline return_type_t inv_chi_square_lpdf(const T_y& y, const T_dof& nu) { +inline 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; diff --git a/stan/math/prim/prob/inv_gamma_ccdf_log.hpp b/stan/math/prim/prob/inv_gamma_ccdf_log.hpp index 3bfbe77cbb9..41a02319708 100644 --- a/stan/math/prim/prob/inv_gamma_ccdf_log.hpp +++ b/stan/math/prim/prob/inv_gamma_ccdf_log.hpp @@ -11,9 +11,8 @@ namespace math { * @deprecated use inv_gamma_lccdf */ template -inline return_type_t inv_gamma_ccdf_log(const T_y& y, - const T_shape& alpha, - const T_scale& beta) { +inline return_type_t inv_gamma_ccdf_log( + const T_y& y, const T_shape& alpha, const T_scale& beta) { return inv_gamma_lccdf(y, alpha, beta); } diff --git a/stan/math/prim/prob/inv_gamma_cdf.hpp b/stan/math/prim/prob/inv_gamma_cdf.hpp index b28e66043b4..9c801521d03 100644 --- a/stan/math/prim/prob/inv_gamma_cdf.hpp +++ b/stan/math/prim/prob/inv_gamma_cdf.hpp @@ -38,8 +38,8 @@ namespace math { template inline return_type_t inv_gamma_cdf(const T_y& y, - const T_shape& alpha, - const T_scale& beta) { + const T_shape& alpha, + const T_scale& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_t; using T_alpha_ref = ref_type_t; diff --git a/stan/math/prim/prob/inv_gamma_cdf_log.hpp b/stan/math/prim/prob/inv_gamma_cdf_log.hpp index c9aa5b3ff86..2863e2af9e7 100644 --- a/stan/math/prim/prob/inv_gamma_cdf_log.hpp +++ b/stan/math/prim/prob/inv_gamma_cdf_log.hpp @@ -11,9 +11,8 @@ namespace math { * @deprecated use inv_gamma_lcdf */ template -inline return_type_t inv_gamma_cdf_log(const T_y& y, - const T_shape& alpha, - const T_scale& beta) { +inline return_type_t inv_gamma_cdf_log( + const T_y& y, const T_shape& alpha, const T_scale& beta) { return inv_gamma_lcdf(y, alpha, beta); } diff --git a/stan/math/prim/prob/inv_gamma_lccdf.hpp b/stan/math/prim/prob/inv_gamma_lccdf.hpp index e2af203ca02..55d4485c8eb 100644 --- a/stan/math/prim/prob/inv_gamma_lccdf.hpp +++ b/stan/math/prim/prob/inv_gamma_lccdf.hpp @@ -22,9 +22,8 @@ namespace stan { namespace math { template -inline return_type_t inv_gamma_lccdf(const T_y& y, - const T_shape& alpha, - const T_scale& beta) { +inline return_type_t inv_gamma_lccdf( + const T_y& y, const T_shape& alpha, const T_scale& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_t; using T_alpha_ref = ref_type_t; diff --git a/stan/math/prim/prob/inv_gamma_lcdf.hpp b/stan/math/prim/prob/inv_gamma_lcdf.hpp index 9ba2529b2e4..5e0a78c192d 100644 --- a/stan/math/prim/prob/inv_gamma_lcdf.hpp +++ b/stan/math/prim/prob/inv_gamma_lcdf.hpp @@ -22,9 +22,8 @@ namespace stan { namespace math { template -inline return_type_t inv_gamma_lcdf(const T_y& y, - const T_shape& alpha, - const T_scale& beta) { +inline return_type_t inv_gamma_lcdf( + const T_y& y, const T_shape& alpha, const T_scale& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_t; using T_alpha_ref = ref_type_t; diff --git a/stan/math/prim/prob/inv_gamma_lpdf.hpp b/stan/math/prim/prob/inv_gamma_lpdf.hpp index be9e0547b3e..504a341da35 100644 --- a/stan/math/prim/prob/inv_gamma_lpdf.hpp +++ b/stan/math/prim/prob/inv_gamma_lpdf.hpp @@ -41,9 +41,8 @@ namespace math { template * = nullptr> -inline return_type_t inv_gamma_lpdf(const T_y& y, - const T_shape& alpha, - const T_scale& beta) { +inline return_type_t inv_gamma_lpdf( + const T_y& y, const T_shape& alpha, const T_scale& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/inv_wishart_lpdf.hpp b/stan/math/prim/prob/inv_wishart_lpdf.hpp index a52c513c937..6fff68d7c6c 100644 --- a/stan/math/prim/prob/inv_wishart_lpdf.hpp +++ b/stan/math/prim/prob/inv_wishart_lpdf.hpp @@ -43,8 +43,8 @@ namespace math { */ template inline return_type_t inv_wishart_lpdf(const T_y& W, - const T_dof& nu, - const T_scale& S) { + const T_dof& nu, + const T_scale& S) { using Eigen::Dynamic; using Eigen::Matrix; using T_W_ref = ref_type_t; diff --git a/stan/math/prim/prob/lkj_corr_cholesky_lpdf.hpp b/stan/math/prim/prob/lkj_corr_cholesky_lpdf.hpp index 30f8b700191..a675f42d4e1 100644 --- a/stan/math/prim/prob/lkj_corr_cholesky_lpdf.hpp +++ b/stan/math/prim/prob/lkj_corr_cholesky_lpdf.hpp @@ -15,8 +15,8 @@ namespace math { // LKJ_Corr(L|eta) [ L Cholesky factor of correlation matrix // eta > 0; eta == 1 <-> uniform] template -inline return_type_t lkj_corr_cholesky_lpdf(const T_covar& L, - const T_shape& eta) { +inline return_type_t lkj_corr_cholesky_lpdf( + const T_covar& L, const T_shape& eta) { using lp_ret = return_type_t; static constexpr const char* function = "lkj_corr_cholesky_lpdf"; check_positive(function, "Shape parameter", eta); diff --git a/stan/math/prim/prob/lkj_corr_lpdf.hpp b/stan/math/prim/prob/lkj_corr_lpdf.hpp index 66e59edd3f7..f10d55ba204 100644 --- a/stan/math/prim/prob/lkj_corr_lpdf.hpp +++ b/stan/math/prim/prob/lkj_corr_lpdf.hpp @@ -14,7 +14,7 @@ namespace math { template inline return_type_t do_lkj_constant(const T_shape& eta, - const unsigned int& K) { + const unsigned int& K) { // Lewandowski, Kurowicka, and Joe (2009) theorem 5 return_type_t constant; const int Km1 = K - 1; @@ -46,7 +46,8 @@ inline return_type_t do_lkj_constant(const T_shape& eta, // LKJ_Corr(y|eta) [ y correlation matrix (not covariance matrix) // eta > 0; eta == 1 <-> uniform] template -inline return_type_t lkj_corr_lpdf(const T_y& y, const T_shape& eta) { +inline return_type_t lkj_corr_lpdf(const T_y& y, + const T_shape& eta) { static constexpr const char* function = "lkj_corr_lpdf"; return_type_t lp(0.0); diff --git a/stan/math/prim/prob/lkj_cov_lpdf.hpp b/stan/math/prim/prob/lkj_cov_lpdf.hpp index 1755b11283f..8172f0ff62e 100644 --- a/stan/math/prim/prob/lkj_cov_lpdf.hpp +++ b/stan/math/prim/prob/lkj_cov_lpdf.hpp @@ -18,10 +18,8 @@ namespace math { template * = nullptr, require_all_eigen_col_vector_t* = nullptr> -inline return_type_t lkj_cov_lpdf(const T_y& y, - const T_loc& mu, - const T_scale& sigma, - const T_shape& eta) { +inline return_type_t lkj_cov_lpdf( + const T_y& y, const T_loc& mu, const T_scale& sigma, const T_shape& eta) { static constexpr const char* function = "lkj_cov_lpdf"; check_size_match(function, "Rows of location parameter", mu.rows(), "columns of scale parameter", sigma.rows()); @@ -65,10 +63,8 @@ inline return_type_t lkj_cov_lpdf(const T_y& y, template * = nullptr, require_all_stan_scalar_t* = nullptr> -inline return_type_t lkj_cov_lpdf(const T_y& y, - const T_loc& mu, - const T_scale& sigma, - const T_shape& eta) { +inline return_type_t lkj_cov_lpdf( + const T_y& y, const T_loc& mu, const T_scale& sigma, const T_shape& eta) { static constexpr const char* function = "lkj_cov_lpdf"; check_positive(function, "Shape parameter", eta); check_finite(function, "Location parameter", mu); diff --git a/stan/math/prim/prob/logistic_ccdf_log.hpp b/stan/math/prim/prob/logistic_ccdf_log.hpp index b5c7f8297db..01fb5a7038a 100644 --- a/stan/math/prim/prob/logistic_ccdf_log.hpp +++ b/stan/math/prim/prob/logistic_ccdf_log.hpp @@ -11,9 +11,8 @@ namespace math { * @deprecated use logistic_lccdf */ template -inline return_type_t logistic_ccdf_log(const T_y& y, - const T_loc& mu, - const T_scale& sigma) { +inline return_type_t logistic_ccdf_log( + const T_y& y, const T_loc& mu, const T_scale& sigma) { return logistic_lccdf(y, mu, sigma); } diff --git a/stan/math/prim/prob/logistic_cdf.hpp b/stan/math/prim/prob/logistic_cdf.hpp index 61da9efe20d..3465e44eae6 100644 --- a/stan/math/prim/prob/logistic_cdf.hpp +++ b/stan/math/prim/prob/logistic_cdf.hpp @@ -22,8 +22,9 @@ namespace math { template * = nullptr> -inline return_type_t logistic_cdf(const T_y& y, const T_loc& mu, - const T_scale& sigma) { +inline return_type_t logistic_cdf(const T_y& y, + const T_loc& mu, + const T_scale& sigma) { using T_partials_return = partials_return_t; using std::exp; using T_y_ref = ref_type_t; diff --git a/stan/math/prim/prob/logistic_cdf_log.hpp b/stan/math/prim/prob/logistic_cdf_log.hpp index 55f50890f35..bdde192e5ff 100644 --- a/stan/math/prim/prob/logistic_cdf_log.hpp +++ b/stan/math/prim/prob/logistic_cdf_log.hpp @@ -11,9 +11,8 @@ namespace math { * @deprecated use logistic_lcdf */ template -inline return_type_t logistic_cdf_log(const T_y& y, - const T_loc& mu, - const T_scale& sigma) { +inline return_type_t logistic_cdf_log( + const T_y& y, const T_loc& mu, const T_scale& sigma) { return logistic_lcdf(y, mu, sigma); } diff --git a/stan/math/prim/prob/logistic_lccdf.hpp b/stan/math/prim/prob/logistic_lccdf.hpp index d37d2b1bb0f..016da2da39d 100644 --- a/stan/math/prim/prob/logistic_lccdf.hpp +++ b/stan/math/prim/prob/logistic_lccdf.hpp @@ -22,8 +22,9 @@ namespace math { template * = nullptr> -inline return_type_t logistic_lccdf(const T_y& y, const T_loc& mu, - const T_scale& sigma) { +inline return_type_t logistic_lccdf(const T_y& y, + const T_loc& mu, + const T_scale& sigma) { using T_partials_return = partials_return_t; using std::exp; using std::log; diff --git a/stan/math/prim/prob/logistic_lcdf.hpp b/stan/math/prim/prob/logistic_lcdf.hpp index dabfc0beaa2..10b9be9e78c 100644 --- a/stan/math/prim/prob/logistic_lcdf.hpp +++ b/stan/math/prim/prob/logistic_lcdf.hpp @@ -22,8 +22,9 @@ namespace math { template * = nullptr> -inline return_type_t logistic_lcdf(const T_y& y, const T_loc& mu, - const T_scale& sigma) { +inline return_type_t logistic_lcdf(const T_y& y, + const T_loc& mu, + const T_scale& sigma) { using T_partials_return = partials_return_t; using std::exp; using std::log; diff --git a/stan/math/prim/prob/logistic_lpdf.hpp b/stan/math/prim/prob/logistic_lpdf.hpp index c73c2a36e1d..181ce1c5650 100644 --- a/stan/math/prim/prob/logistic_lpdf.hpp +++ b/stan/math/prim/prob/logistic_lpdf.hpp @@ -25,8 +25,9 @@ namespace math { template * = nullptr> -inline return_type_t logistic_lpdf(const T_y& y, const T_loc& mu, - const T_scale& sigma) { +inline return_type_t logistic_lpdf(const T_y& y, + const T_loc& mu, + const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/loglogistic_cdf.hpp b/stan/math/prim/prob/loglogistic_cdf.hpp index 72c27f37b31..da7f8a950a0 100644 --- a/stan/math/prim/prob/loglogistic_cdf.hpp +++ b/stan/math/prim/prob/loglogistic_cdf.hpp @@ -43,9 +43,8 @@ namespace math { template * = nullptr> -inline return_type_t loglogistic_cdf(const T_y& y, - const T_scale& alpha, - const T_shape& beta) { +inline return_type_t loglogistic_cdf( + const T_y& y, const T_scale& alpha, const T_shape& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_t; using T_alpha_ref = ref_type_t; diff --git a/stan/math/prim/prob/loglogistic_lpdf.hpp b/stan/math/prim/prob/loglogistic_lpdf.hpp index 24cb18bbcd1..047f35a414a 100644 --- a/stan/math/prim/prob/loglogistic_lpdf.hpp +++ b/stan/math/prim/prob/loglogistic_lpdf.hpp @@ -42,9 +42,8 @@ namespace math { template * = nullptr> -inline return_type_t loglogistic_lpdf(const T_y& y, - const T_scale& alpha, - const T_shape& beta) { +inline return_type_t loglogistic_lpdf( + const T_y& y, const T_scale& alpha, const T_shape& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_scale_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/lognormal_ccdf_log.hpp b/stan/math/prim/prob/lognormal_ccdf_log.hpp index e282d2e961d..04288340b21 100644 --- a/stan/math/prim/prob/lognormal_ccdf_log.hpp +++ b/stan/math/prim/prob/lognormal_ccdf_log.hpp @@ -11,9 +11,8 @@ namespace math { * @deprecated use lognormal_lccdf */ template -inline return_type_t lognormal_ccdf_log(const T_y& y, - const T_loc& mu, - const T_scale& sigma) { +inline return_type_t lognormal_ccdf_log( + const T_y& y, const T_loc& mu, const T_scale& sigma) { return lognormal_lccdf(y, mu, sigma); } diff --git a/stan/math/prim/prob/lognormal_cdf.hpp b/stan/math/prim/prob/lognormal_cdf.hpp index 75f27962bc6..f739cc98acb 100644 --- a/stan/math/prim/prob/lognormal_cdf.hpp +++ b/stan/math/prim/prob/lognormal_cdf.hpp @@ -25,8 +25,9 @@ namespace math { template * = nullptr> -inline return_type_t lognormal_cdf(const T_y& y, const T_loc& mu, - const T_scale& sigma) { +inline return_type_t lognormal_cdf(const T_y& y, + const T_loc& mu, + const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/lognormal_cdf_log.hpp b/stan/math/prim/prob/lognormal_cdf_log.hpp index 511b50efdf1..effbc38c8ec 100644 --- a/stan/math/prim/prob/lognormal_cdf_log.hpp +++ b/stan/math/prim/prob/lognormal_cdf_log.hpp @@ -11,9 +11,8 @@ namespace math { * @deprecated use lognormal_lcdf */ template -inline return_type_t lognormal_cdf_log(const T_y& y, - const T_loc& mu, - const T_scale& sigma) { +inline return_type_t lognormal_cdf_log( + const T_y& y, const T_loc& mu, const T_scale& sigma) { return lognormal_lcdf(y, mu, sigma); } diff --git a/stan/math/prim/prob/lognormal_lccdf.hpp b/stan/math/prim/prob/lognormal_lccdf.hpp index b399165be45..39391bedb0f 100644 --- a/stan/math/prim/prob/lognormal_lccdf.hpp +++ b/stan/math/prim/prob/lognormal_lccdf.hpp @@ -25,9 +25,8 @@ namespace math { template * = nullptr> -inline return_type_t lognormal_lccdf(const T_y& y, - const T_loc& mu, - const T_scale& sigma) { +inline return_type_t lognormal_lccdf( + const T_y& y, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/lognormal_lcdf.hpp b/stan/math/prim/prob/lognormal_lcdf.hpp index 540542980e3..482f79885bd 100644 --- a/stan/math/prim/prob/lognormal_lcdf.hpp +++ b/stan/math/prim/prob/lognormal_lcdf.hpp @@ -25,8 +25,9 @@ namespace math { template * = nullptr> -inline return_type_t lognormal_lcdf(const T_y& y, const T_loc& mu, - const T_scale& sigma) { +inline return_type_t lognormal_lcdf(const T_y& y, + const T_loc& mu, + const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/lognormal_lpdf.hpp b/stan/math/prim/prob/lognormal_lpdf.hpp index 25a710ca8a1..e9052070e31 100644 --- a/stan/math/prim/prob/lognormal_lpdf.hpp +++ b/stan/math/prim/prob/lognormal_lpdf.hpp @@ -25,8 +25,9 @@ namespace math { template * = nullptr> -inline return_type_t lognormal_lpdf(const T_y& y, const T_loc& mu, - const T_scale& sigma) { +inline return_type_t lognormal_lpdf(const T_y& y, + const T_loc& mu, + const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/multi_gp_cholesky_lpdf.hpp b/stan/math/prim/prob/multi_gp_cholesky_lpdf.hpp index 64088e7e690..09c6fd58597 100644 --- a/stan/math/prim/prob/multi_gp_cholesky_lpdf.hpp +++ b/stan/math/prim/prob/multi_gp_cholesky_lpdf.hpp @@ -39,8 +39,8 @@ template * = nullptr, require_eigen_col_vector_t* = nullptr> inline return_type_t multi_gp_cholesky_lpdf(const T_y& y, - const T_covar& L, - const T_w& w) { + const T_covar& L, + const T_w& w) { using T_lp = return_type_t; static constexpr const char* function = "multi_gp_cholesky_lpdf"; check_size_match(function, "Size of random variable (rows y)", y.rows(), diff --git a/stan/math/prim/prob/multi_gp_lpdf.hpp b/stan/math/prim/prob/multi_gp_lpdf.hpp index 2ea9c88d700..16364be328f 100644 --- a/stan/math/prim/prob/multi_gp_lpdf.hpp +++ b/stan/math/prim/prob/multi_gp_lpdf.hpp @@ -34,8 +34,8 @@ template * = nullptr, require_col_vector_t* = nullptr> inline return_type_t multi_gp_lpdf(const T_y& y, - const T_covar& Sigma, - const T_w& w) { + const T_covar& Sigma, + const T_w& w) { using T_lp = return_type_t; static constexpr const char* function = "multi_gp_lpdf"; check_size_match(function, "Size of random variable (rows y)", y.rows(), diff --git a/stan/math/prim/prob/multi_normal_lpdf.hpp b/stan/math/prim/prob/multi_normal_lpdf.hpp index 84a90d78750..297e1e918d7 100644 --- a/stan/math/prim/prob/multi_normal_lpdf.hpp +++ b/stan/math/prim/prob/multi_normal_lpdf.hpp @@ -25,9 +25,8 @@ template * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_covar>* = nullptr> -inline return_type_t multi_normal_lpdf(const T_y& y, - const T_loc& mu, - const T_covar& Sigma) { +inline return_type_t multi_normal_lpdf( + const T_y& y, const T_loc& mu, const T_covar& Sigma) { using T_covar_elem = typename scalar_type::type; using T_return = return_type_t; using T_partials_return = partials_return_t; @@ -159,9 +158,8 @@ template * = nullptr, require_all_not_nonscalar_prim_or_rev_kernel_expression_t< T_y, T_loc, T_covar>* = nullptr> -inline return_type_t multi_normal_lpdf(const T_y& y, - const T_loc& mu, - const T_covar& Sigma) { +inline return_type_t multi_normal_lpdf( + const T_y& y, const T_loc& mu, const T_covar& Sigma) { 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/multinomial_logit_lpmf.hpp b/stan/math/prim/prob/multinomial_logit_lpmf.hpp index e6c0996fe01..b4d10e1195e 100644 --- a/stan/math/prim/prob/multinomial_logit_lpmf.hpp +++ b/stan/math/prim/prob/multinomial_logit_lpmf.hpp @@ -23,7 +23,7 @@ namespace math { template , require_eigen_col_vector_t* = nullptr> inline return_type_t multinomial_logit_lpmf(const std::vector& ns, - const T_beta& beta) { + const T_beta& beta) { 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()); @@ -53,7 +53,7 @@ inline return_type_t multinomial_logit_lpmf(const std::vector& ns, template * = nullptr> inline return_type_t multinomial_logit_lpmf(const std::vector& ns, - const T_beta& beta) { + const T_beta& beta) { return multinomial_logit_lpmf(ns, beta); } diff --git a/stan/math/prim/prob/multinomial_lpmf.hpp b/stan/math/prim/prob/multinomial_lpmf.hpp index 051e8f9c03a..c941118f60f 100644 --- a/stan/math/prim/prob/multinomial_lpmf.hpp +++ b/stan/math/prim/prob/multinomial_lpmf.hpp @@ -15,7 +15,7 @@ namespace math { template * = nullptr> inline return_type_t multinomial_lpmf(const std::vector& ns, - const T_prob& theta) { + const T_prob& theta) { 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()); @@ -43,7 +43,7 @@ inline return_type_t multinomial_lpmf(const std::vector& ns, template inline return_type_t multinomial_lpmf(const std::vector& ns, - const T_prob& theta) { + const T_prob& theta) { return multinomial_lpmf(ns, theta); } 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 b9999ab2ec4..14ccff41169 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 @@ -64,9 +64,9 @@ namespace math { template * = nullptr> -inline return_type_t neg_binomial_2_log_glm_lpmf( - const T_y& y, const T_x& x, const T_alpha& alpha, const T_beta& beta, - const T_precision& phi) { +inline return_type_t +neg_binomial_2_log_glm_lpmf(const T_y& y, const T_x& x, const T_alpha& alpha, + const T_beta& beta, const T_precision& phi) { using Eigen::Array; using Eigen::Dynamic; using Eigen::exp; diff --git a/stan/math/prim/prob/neg_binomial_cdf.hpp b/stan/math/prim/prob/neg_binomial_cdf.hpp index ebcc5b57107..31163102be1 100644 --- a/stan/math/prim/prob/neg_binomial_cdf.hpp +++ b/stan/math/prim/prob/neg_binomial_cdf.hpp @@ -22,9 +22,8 @@ namespace stan { namespace math { template -inline return_type_t neg_binomial_cdf(const T_n& n, - const T_shape& alpha, - const T_inv_scale& beta) { +inline return_type_t neg_binomial_cdf( + const T_n& n, const T_shape& alpha, const T_inv_scale& beta) { using T_partials_return = partials_return_t; using T_n_ref = ref_type_t; using T_alpha_ref = ref_type_t; diff --git a/stan/math/prim/prob/neg_binomial_lpmf.hpp b/stan/math/prim/prob/neg_binomial_lpmf.hpp index c06760a7bd2..61c88160c6b 100644 --- a/stan/math/prim/prob/neg_binomial_lpmf.hpp +++ b/stan/math/prim/prob/neg_binomial_lpmf.hpp @@ -30,9 +30,8 @@ constexpr double neg_binomial_alpha_cutoff = 1e10; template * = nullptr> -inline return_type_t neg_binomial_lpmf(const T_n& n, - const T_shape& alpha, - const T_inv_scale& beta) { +inline return_type_t neg_binomial_lpmf( + const T_n& n, const T_shape& alpha, const T_inv_scale& beta) { using T_partials_return = partials_return_t; using std::log; using T_n_ref = ref_type_t; diff --git a/stan/math/prim/prob/ordered_logistic_lpmf.hpp b/stan/math/prim/prob/ordered_logistic_lpmf.hpp index 31fa9ace8ef..dfc550ed883 100644 --- a/stan/math/prim/prob/ordered_logistic_lpmf.hpp +++ b/stan/math/prim/prob/ordered_logistic_lpmf.hpp @@ -73,8 +73,8 @@ template * = nullptr> inline return_type_t ordered_logistic_lpmf(const T_y& y, - const T_loc& lambda, - const T_cut& c) { + const T_loc& lambda, + const T_cut& c) { using T_partials_return = partials_return_t; using T_cuts_val = partials_return_t; using T_y_ref = ref_type_t; @@ -205,8 +205,8 @@ inline return_type_t ordered_logistic_lpmf(const T_y& y, template inline return_type_t ordered_logistic_lpmf(const T_y& y, - const T_loc& lambda, - const T_cut& c) { + const T_loc& lambda, + const T_cut& c) { return ordered_logistic_lpmf(y, lambda, c); } diff --git a/stan/math/prim/prob/ordered_probit_lpmf.hpp b/stan/math/prim/prob/ordered_probit_lpmf.hpp index d0943c51637..8cf027f2baf 100644 --- a/stan/math/prim/prob/ordered_probit_lpmf.hpp +++ b/stan/math/prim/prob/ordered_probit_lpmf.hpp @@ -46,8 +46,8 @@ namespace math { */ template inline return_type_t ordered_probit_lpmf(const T_y& y, - const T_loc& lambda, - const T_cut& c) { + const T_loc& lambda, + const T_cut& c) { using std::exp; using std::log; using T_lambda_ref = ref_type_t; @@ -102,8 +102,8 @@ inline return_type_t ordered_probit_lpmf(const T_y& y, template inline return_type_t ordered_probit_lpmf(const T_y& y, - const T_loc& lambda, - const T_cut& c) { + const T_loc& lambda, + const T_cut& c) { return ordered_probit_lpmf(y, lambda, c); } } // namespace math diff --git a/stan/math/prim/prob/pareto_ccdf_log.hpp b/stan/math/prim/prob/pareto_ccdf_log.hpp index 7262966c9ce..0fe2a270f71 100644 --- a/stan/math/prim/prob/pareto_ccdf_log.hpp +++ b/stan/math/prim/prob/pareto_ccdf_log.hpp @@ -11,9 +11,8 @@ namespace math { * @deprecated use pareto_lccdf */ template -inline return_type_t pareto_ccdf_log(const T_y& y, - const T_scale& y_min, - const T_shape& alpha) { +inline return_type_t pareto_ccdf_log( + const T_y& y, const T_scale& y_min, const T_shape& alpha) { return pareto_lccdf(y, y_min, alpha); } diff --git a/stan/math/prim/prob/pareto_cdf.hpp b/stan/math/prim/prob/pareto_cdf.hpp index 0fc4ddb5d86..37d850a6138 100644 --- a/stan/math/prim/prob/pareto_cdf.hpp +++ b/stan/math/prim/prob/pareto_cdf.hpp @@ -21,8 +21,8 @@ template * = nullptr> inline return_type_t pareto_cdf(const T_y& y, - const T_scale& y_min, - const T_shape& alpha) { + const T_scale& y_min, + const T_shape& alpha) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_t; using T_y_min_ref = ref_type_t; diff --git a/stan/math/prim/prob/pareto_cdf_log.hpp b/stan/math/prim/prob/pareto_cdf_log.hpp index 7dbae9d856b..d256b721345 100644 --- a/stan/math/prim/prob/pareto_cdf_log.hpp +++ b/stan/math/prim/prob/pareto_cdf_log.hpp @@ -11,9 +11,8 @@ namespace math { * @deprecated use pareto_lcdf */ template -inline return_type_t pareto_cdf_log(const T_y& y, - const T_scale& y_min, - const T_shape& alpha) { +inline return_type_t pareto_cdf_log( + const T_y& y, const T_scale& y_min, const T_shape& alpha) { return pareto_lcdf(y, y_min, alpha); } diff --git a/stan/math/prim/prob/pareto_lccdf.hpp b/stan/math/prim/prob/pareto_lccdf.hpp index 49971688545..f723027b87e 100644 --- a/stan/math/prim/prob/pareto_lccdf.hpp +++ b/stan/math/prim/prob/pareto_lccdf.hpp @@ -25,8 +25,8 @@ template * = nullptr> inline return_type_t pareto_lccdf(const T_y& y, - const T_scale& y_min, - const T_shape& alpha) { + const T_scale& y_min, + const T_shape& alpha) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_y_min_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/pareto_lcdf.hpp b/stan/math/prim/prob/pareto_lcdf.hpp index 9117d2c9958..6313c6778c6 100644 --- a/stan/math/prim/prob/pareto_lcdf.hpp +++ b/stan/math/prim/prob/pareto_lcdf.hpp @@ -25,8 +25,8 @@ template * = nullptr> inline return_type_t pareto_lcdf(const T_y& y, - const T_scale& y_min, - const T_shape& alpha) { + const T_scale& y_min, + const T_shape& alpha) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_y_min_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/pareto_lpdf.hpp b/stan/math/prim/prob/pareto_lpdf.hpp index d3408f6387a..1bb2cdab1b4 100644 --- a/stan/math/prim/prob/pareto_lpdf.hpp +++ b/stan/math/prim/prob/pareto_lpdf.hpp @@ -25,8 +25,8 @@ template * = nullptr> inline return_type_t pareto_lpdf(const T_y& y, - const T_scale& y_min, - const T_shape& alpha) { + const T_scale& y_min, + const T_shape& alpha) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_y_min_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/poisson_binomial_ccdf_log.hpp b/stan/math/prim/prob/poisson_binomial_ccdf_log.hpp index e4392b31fa7..bca8a5ab76e 100644 --- a/stan/math/prim/prob/poisson_binomial_ccdf_log.hpp +++ b/stan/math/prim/prob/poisson_binomial_ccdf_log.hpp @@ -12,7 +12,7 @@ namespace math { */ template inline return_type_t poisson_binomial_ccdf_log(const T_y& y, - const T_theta& theta) { + const T_theta& theta) { return poisson_binomial_lccdf(y, theta); } diff --git a/stan/math/prim/prob/poisson_binomial_cdf.hpp b/stan/math/prim/prob/poisson_binomial_cdf.hpp index aadfa3ae907..e11c9d57bd7 100644 --- a/stan/math/prim/prob/poisson_binomial_cdf.hpp +++ b/stan/math/prim/prob/poisson_binomial_cdf.hpp @@ -34,7 +34,7 @@ namespace math { */ template inline return_type_t poisson_binomial_cdf(const T_y& y, - const T_theta& theta) { + const T_theta& theta) { static constexpr const char* function = "poisson_binomial_cdf"; auto size_theta = size_mvt(theta); @@ -64,7 +64,7 @@ inline return_type_t poisson_binomial_cdf(const T_y& y, template inline return_type_t poisson_binomial_cdf(const T_y& y, - const T_theta& theta) { + const T_theta& theta) { return poisson_binomial_cdf(y, theta); } diff --git a/stan/math/prim/prob/poisson_binomial_cdf_log.hpp b/stan/math/prim/prob/poisson_binomial_cdf_log.hpp index e6fb9c0655d..068563956f0 100644 --- a/stan/math/prim/prob/poisson_binomial_cdf_log.hpp +++ b/stan/math/prim/prob/poisson_binomial_cdf_log.hpp @@ -12,7 +12,7 @@ namespace math { */ template inline return_type_t poisson_binomial_cdf_log(const T_y& y, - const T_theta& theta) { + const T_theta& theta) { return poisson_binomial_lcdf(y, theta); } diff --git a/stan/math/prim/prob/poisson_binomial_lccdf.hpp b/stan/math/prim/prob/poisson_binomial_lccdf.hpp index 79de8853754..aa2787951a3 100644 --- a/stan/math/prim/prob/poisson_binomial_lccdf.hpp +++ b/stan/math/prim/prob/poisson_binomial_lccdf.hpp @@ -35,7 +35,7 @@ namespace math { */ template inline return_type_t poisson_binomial_lccdf(const T_y& y, - const T_theta& theta) { + const T_theta& theta) { static constexpr const char* function = "poisson_binomial_lccdf"; auto size_theta = size_mvt(theta); @@ -75,7 +75,7 @@ inline return_type_t poisson_binomial_lccdf(const T_y& y, template inline return_type_t poisson_binomial_lccdf(const T_y& y, - const T_theta& theta) { + const T_theta& theta) { return poisson_binomial_lccdf(y, theta); } diff --git a/stan/math/prim/prob/poisson_binomial_lcdf.hpp b/stan/math/prim/prob/poisson_binomial_lcdf.hpp index 5a5c30befab..116c01144c1 100644 --- a/stan/math/prim/prob/poisson_binomial_lcdf.hpp +++ b/stan/math/prim/prob/poisson_binomial_lcdf.hpp @@ -34,7 +34,7 @@ namespace math { */ template inline return_type_t poisson_binomial_lcdf(const T_y& y, - const T_theta& theta) { + const T_theta& theta) { static constexpr const char* function = "poisson_binomial_lcdf"; auto size_theta = size_mvt(theta); @@ -65,7 +65,7 @@ inline return_type_t poisson_binomial_lcdf(const T_y& y, template inline return_type_t poisson_binomial_lcdf(const T_y& y, - const T_theta& theta) { + const T_theta& theta) { return poisson_binomial_lcdf(y, theta); } diff --git a/stan/math/prim/prob/poisson_binomial_lpmf.hpp b/stan/math/prim/prob/poisson_binomial_lpmf.hpp index 6e2342c1020..f672823f859 100644 --- a/stan/math/prim/prob/poisson_binomial_lpmf.hpp +++ b/stan/math/prim/prob/poisson_binomial_lpmf.hpp @@ -26,7 +26,7 @@ namespace math { */ template inline return_type_t poisson_binomial_lpmf(const T_y& y, - const T_theta& theta) { + const T_theta& theta) { static constexpr const char* function = "poisson_binomial_lpmf"; auto size_theta = size_mvt(theta); @@ -58,7 +58,7 @@ inline return_type_t poisson_binomial_lpmf(const T_y& y, template inline return_type_t poisson_binomial_lpmf(const T_y& y, - const T_theta& theta) { + const T_theta& theta) { return poisson_binomial_lpmf(y, theta); } diff --git a/stan/math/prim/prob/poisson_ccdf_log.hpp b/stan/math/prim/prob/poisson_ccdf_log.hpp index dfff61cb62f..cc478a34131 100644 --- a/stan/math/prim/prob/poisson_ccdf_log.hpp +++ b/stan/math/prim/prob/poisson_ccdf_log.hpp @@ -11,7 +11,8 @@ namespace math { * @deprecated use poisson_lccdf */ template -inline return_type_t poisson_ccdf_log(const T_n& n, const T_rate& lambda) { +inline return_type_t poisson_ccdf_log(const T_n& n, + const T_rate& lambda) { return poisson_lccdf(n, lambda); } diff --git a/stan/math/prim/prob/poisson_cdf_log.hpp b/stan/math/prim/prob/poisson_cdf_log.hpp index 94dfe55421c..d7ec5be6f1d 100644 --- a/stan/math/prim/prob/poisson_cdf_log.hpp +++ b/stan/math/prim/prob/poisson_cdf_log.hpp @@ -11,7 +11,8 @@ namespace math { * @deprecated use poisson_lcdf */ template -inline return_type_t poisson_cdf_log(const T_n& n, const T_rate& lambda) { +inline return_type_t poisson_cdf_log(const T_n& n, + const T_rate& lambda) { return poisson_lcdf(n, lambda); } diff --git a/stan/math/prim/prob/poisson_log_glm_lpmf.hpp b/stan/math/prim/prob/poisson_log_glm_lpmf.hpp index 4cd518257b3..dc68d1bd7ce 100644 --- a/stan/math/prim/prob/poisson_log_glm_lpmf.hpp +++ b/stan/math/prim/prob/poisson_log_glm_lpmf.hpp @@ -50,10 +50,8 @@ namespace math { */ template * = nullptr> -inline return_type_t poisson_log_glm_lpmf(const T_y& y, - const T_x& x, - const T_alpha& alpha, - const T_beta& beta) { +inline return_type_t poisson_log_glm_lpmf( + const T_y& y, const T_x& x, const T_alpha& alpha, const T_beta& beta) { using Eigen::Array; using Eigen::Dynamic; using Eigen::Matrix; diff --git a/stan/math/prim/prob/poisson_log_lpmf.hpp b/stan/math/prim/prob/poisson_log_lpmf.hpp index c1b4645dae4..0a169647e92 100644 --- a/stan/math/prim/prob/poisson_log_lpmf.hpp +++ b/stan/math/prim/prob/poisson_log_lpmf.hpp @@ -27,7 +27,7 @@ template * = nullptr> inline return_type_t poisson_log_lpmf(const T_n& n, - const T_log_rate& alpha) { + const T_log_rate& alpha) { using T_partials_return = partials_return_t; using T_n_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/rayleigh_ccdf_log.hpp b/stan/math/prim/prob/rayleigh_ccdf_log.hpp index c5e20450d94..b74373bff23 100644 --- a/stan/math/prim/prob/rayleigh_ccdf_log.hpp +++ b/stan/math/prim/prob/rayleigh_ccdf_log.hpp @@ -12,7 +12,7 @@ namespace math { */ template inline return_type_t rayleigh_ccdf_log(const T_y& y, - const T_scale& sigma) { + const T_scale& sigma) { return rayleigh_lccdf(y, sigma); } diff --git a/stan/math/prim/prob/rayleigh_cdf.hpp b/stan/math/prim/prob/rayleigh_cdf.hpp index b2b66bf08da..84a17050667 100644 --- a/stan/math/prim/prob/rayleigh_cdf.hpp +++ b/stan/math/prim/prob/rayleigh_cdf.hpp @@ -22,7 +22,8 @@ namespace math { template * = nullptr> -inline return_type_t rayleigh_cdf(const T_y& y, const T_scale& sigma) { +inline 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; diff --git a/stan/math/prim/prob/rayleigh_cdf_log.hpp b/stan/math/prim/prob/rayleigh_cdf_log.hpp index 7530aff4399..1e5643a5633 100644 --- a/stan/math/prim/prob/rayleigh_cdf_log.hpp +++ b/stan/math/prim/prob/rayleigh_cdf_log.hpp @@ -12,7 +12,7 @@ namespace math { */ template inline return_type_t rayleigh_cdf_log(const T_y& y, - const T_scale& sigma) { + const T_scale& sigma) { return rayleigh_lcdf(y, sigma); } diff --git a/stan/math/prim/prob/rayleigh_lccdf.hpp b/stan/math/prim/prob/rayleigh_lccdf.hpp index cd85d1c2f38..082f72a2522 100644 --- a/stan/math/prim/prob/rayleigh_lccdf.hpp +++ b/stan/math/prim/prob/rayleigh_lccdf.hpp @@ -20,7 +20,8 @@ namespace math { template * = nullptr> -inline return_type_t rayleigh_lccdf(const T_y& y, const T_scale& sigma) { +inline 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; diff --git a/stan/math/prim/prob/rayleigh_lcdf.hpp b/stan/math/prim/prob/rayleigh_lcdf.hpp index ac51c4da7c8..a3e66b71ff3 100644 --- a/stan/math/prim/prob/rayleigh_lcdf.hpp +++ b/stan/math/prim/prob/rayleigh_lcdf.hpp @@ -22,7 +22,8 @@ namespace math { template * = nullptr> -inline return_type_t rayleigh_lcdf(const T_y& y, const T_scale& sigma) { +inline 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; diff --git a/stan/math/prim/prob/rayleigh_lpdf.hpp b/stan/math/prim/prob/rayleigh_lpdf.hpp index d69f57fae56..2ac376d4179 100644 --- a/stan/math/prim/prob/rayleigh_lpdf.hpp +++ b/stan/math/prim/prob/rayleigh_lpdf.hpp @@ -22,7 +22,8 @@ namespace math { template * = nullptr> -inline return_type_t rayleigh_lpdf(const T_y& y, const T_scale& sigma) { +inline 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; 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 8f7734cabed..1ba20033d68 100644 --- a/stan/math/prim/prob/scaled_inv_chi_square_cdf.hpp +++ b/stan/math/prim/prob/scaled_inv_chi_square_cdf.hpp @@ -35,9 +35,8 @@ namespace math { * @throw std::domain_error if y is not greater than 0. */ template -inline return_type_t scaled_inv_chi_square_cdf(const T_y& y, - const T_dof& nu, - const T_scale& s) { +inline return_type_t scaled_inv_chi_square_cdf( + const T_y& y, const T_dof& nu, const T_scale& s) { using T_partials_return = partials_return_t; using std::exp; using std::pow; diff --git a/stan/math/prim/prob/skew_double_exponential_cdf.hpp b/stan/math/prim/prob/skew_double_exponential_cdf.hpp index c10f27c33ce..8a96fc901a1 100644 --- a/stan/math/prim/prob/skew_double_exponential_cdf.hpp +++ b/stan/math/prim/prob/skew_double_exponential_cdf.hpp @@ -38,9 +38,9 @@ namespace math { template * = nullptr> -inline return_type_t skew_double_exponential_cdf( - const T_y& y, const T_loc& mu, const T_scale& sigma, - const T_skewness& tau) { +inline 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 constexpr const char* function = "skew_double_exponential_lcdf"; check_consistent_sizes(function, "Random variable", y, "Location parameter", diff --git a/stan/math/prim/prob/skew_double_exponential_lccdf.hpp b/stan/math/prim/prob/skew_double_exponential_lccdf.hpp index 45160027641..abcf1b76c35 100644 --- a/stan/math/prim/prob/skew_double_exponential_lccdf.hpp +++ b/stan/math/prim/prob/skew_double_exponential_lccdf.hpp @@ -37,9 +37,9 @@ namespace math { template * = nullptr> -inline return_type_t skew_double_exponential_lccdf( - const T_y& y, const T_loc& mu, const T_scale& sigma, - const T_skewness& tau) { +inline return_type_t +skew_double_exponential_lccdf(const T_y& y, const T_loc& mu, + const T_scale& sigma, const T_skewness& tau) { 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", diff --git a/stan/math/prim/prob/skew_double_exponential_lcdf.hpp b/stan/math/prim/prob/skew_double_exponential_lcdf.hpp index a7846725f0c..a84ac2ca2b2 100644 --- a/stan/math/prim/prob/skew_double_exponential_lcdf.hpp +++ b/stan/math/prim/prob/skew_double_exponential_lcdf.hpp @@ -38,9 +38,9 @@ namespace math { template * = nullptr> -inline return_type_t skew_double_exponential_lcdf( - const T_y& y, const T_loc& mu, const T_scale& sigma, - const T_skewness& tau) { +inline return_type_t +skew_double_exponential_lcdf(const T_y& y, const T_loc& mu, + const T_scale& sigma, const T_skewness& tau) { using std::exp; using std::log; using T_partials_return = partials_return_t; diff --git a/stan/math/prim/prob/skew_double_exponential_lpdf.hpp b/stan/math/prim/prob/skew_double_exponential_lpdf.hpp index f5b6efd98f9..b83753f7168 100644 --- a/stan/math/prim/prob/skew_double_exponential_lpdf.hpp +++ b/stan/math/prim/prob/skew_double_exponential_lpdf.hpp @@ -40,9 +40,9 @@ template * = nullptr> -inline return_type_t skew_double_exponential_lpdf( - const T_y& y, const T_loc& mu, const T_scale& sigma, - const T_skewness& tau) { +inline return_type_t +skew_double_exponential_lpdf(const T_y& y, const T_loc& mu, + const T_scale& sigma, const T_skewness& tau) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; @@ -126,9 +126,9 @@ inline return_type_t skew_double_exponential_lp } template -inline return_type_t skew_double_exponential_lpdf( - const T_y& y, const T_loc& mu, const T_scale& sigma, - const T_skewness& tau) { +inline return_type_t +skew_double_exponential_lpdf(const T_y& y, const T_loc& mu, + const T_scale& sigma, const T_skewness& tau) { return skew_double_exponential_lpdf(y, mu, sigma, tau); } diff --git a/stan/math/prim/prob/student_t_cdf.hpp b/stan/math/prim/prob/student_t_cdf.hpp index a247b0baddb..f9720c61209 100644 --- a/stan/math/prim/prob/student_t_cdf.hpp +++ b/stan/math/prim/prob/student_t_cdf.hpp @@ -20,10 +20,8 @@ namespace stan { namespace math { template -inline return_type_t student_t_cdf(const T_y& y, - const T_dof& nu, - const T_loc& mu, - const T_scale& sigma) { +inline return_type_t student_t_cdf( + const T_y& y, const T_dof& nu, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_t; using T_nu_ref = ref_type_t; diff --git a/stan/math/prim/prob/student_t_lcdf.hpp b/stan/math/prim/prob/student_t_lcdf.hpp index 420b030aad0..793b23273ed 100644 --- a/stan/math/prim/prob/student_t_lcdf.hpp +++ b/stan/math/prim/prob/student_t_lcdf.hpp @@ -21,10 +21,8 @@ namespace stan { namespace math { template -inline return_type_t student_t_lcdf(const T_y& y, - const T_dof& nu, - const T_loc& mu, - const T_scale& sigma) { +inline return_type_t student_t_lcdf( + const T_y& y, const T_dof& nu, const T_loc& mu, const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_t; using T_nu_ref = ref_type_t; diff --git a/stan/math/prim/prob/student_t_lpdf.hpp b/stan/math/prim/prob/student_t_lpdf.hpp index d20df94191f..b2c625840b9 100644 --- a/stan/math/prim/prob/student_t_lpdf.hpp +++ b/stan/math/prim/prob/student_t_lpdf.hpp @@ -56,10 +56,8 @@ template * = nullptr> -inline return_type_t student_t_lpdf(const T_y& y, - const T_dof& nu, - const T_loc& mu, - const T_scale& sigma) { +inline return_type_t student_t_lpdf( + const T_y& y, const T_dof& nu, const T_loc& mu, const T_scale& sigma) { 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; diff --git a/stan/math/prim/prob/uniform_ccdf_log.hpp b/stan/math/prim/prob/uniform_ccdf_log.hpp index 8a87e750f2e..d492743bb50 100644 --- a/stan/math/prim/prob/uniform_ccdf_log.hpp +++ b/stan/math/prim/prob/uniform_ccdf_log.hpp @@ -12,8 +12,8 @@ namespace math { */ template inline return_type_t uniform_ccdf_log(const T_y& y, - const T_low& alpha, - const T_high& beta) { + const T_low& alpha, + const T_high& beta) { return uniform_lccdf(y, alpha, beta); } diff --git a/stan/math/prim/prob/uniform_cdf.hpp b/stan/math/prim/prob/uniform_cdf.hpp index 72dc8370acc..52c2660ec1f 100644 --- a/stan/math/prim/prob/uniform_cdf.hpp +++ b/stan/math/prim/prob/uniform_cdf.hpp @@ -20,8 +20,9 @@ namespace math { template * = nullptr> -inline return_type_t uniform_cdf(const T_y& y, const T_low& alpha, - const T_high& beta) { +inline return_type_t uniform_cdf(const T_y& y, + const T_low& alpha, + const T_high& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/uniform_cdf_log.hpp b/stan/math/prim/prob/uniform_cdf_log.hpp index 1d88f70dc32..10e9f30fe09 100644 --- a/stan/math/prim/prob/uniform_cdf_log.hpp +++ b/stan/math/prim/prob/uniform_cdf_log.hpp @@ -12,8 +12,8 @@ namespace math { */ template inline return_type_t uniform_cdf_log(const T_y& y, - const T_low& alpha, - const T_high& beta) { + const T_low& alpha, + const T_high& beta) { return uniform_lcdf(y, alpha, beta); } diff --git a/stan/math/prim/prob/uniform_lccdf.hpp b/stan/math/prim/prob/uniform_lccdf.hpp index da206a113e9..0dd1f8c0b57 100644 --- a/stan/math/prim/prob/uniform_lccdf.hpp +++ b/stan/math/prim/prob/uniform_lccdf.hpp @@ -23,8 +23,8 @@ template * = nullptr> inline return_type_t uniform_lccdf(const T_y& y, - const T_low& alpha, - const T_high& beta) { + const T_low& alpha, + const T_high& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/uniform_lcdf.hpp b/stan/math/prim/prob/uniform_lcdf.hpp index 7c65c52a2d5..883d71bafea 100644 --- a/stan/math/prim/prob/uniform_lcdf.hpp +++ b/stan/math/prim/prob/uniform_lcdf.hpp @@ -22,8 +22,9 @@ namespace math { template * = nullptr> -inline return_type_t uniform_lcdf(const T_y& y, const T_low& alpha, - const T_high& beta) { +inline return_type_t uniform_lcdf(const T_y& y, + const T_low& alpha, + const T_high& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/uniform_lpdf.hpp b/stan/math/prim/prob/uniform_lpdf.hpp index 22a702e3270..a681c3db40b 100644 --- a/stan/math/prim/prob/uniform_lpdf.hpp +++ b/stan/math/prim/prob/uniform_lpdf.hpp @@ -44,8 +44,9 @@ namespace math { template * = nullptr> -inline return_type_t uniform_lpdf(const T_y& y, const T_low& alpha, - const T_high& beta) { +inline return_type_t uniform_lpdf(const T_y& y, + const T_low& alpha, + const T_high& beta) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/von_mises_cdf.hpp b/stan/math/prim/prob/von_mises_cdf.hpp index dcc5ffc7fb6..c1c34a2c21b 100644 --- a/stan/math/prim/prob/von_mises_cdf.hpp +++ b/stan/math/prim/prob/von_mises_cdf.hpp @@ -20,7 +20,8 @@ namespace internal { * scipy. */ template -inline return_type_t von_mises_cdf_series(const T_x& x, const T_k& k) { +inline return_type_t von_mises_cdf_series(const T_x& x, + const T_k& k) { const double pi = stan::math::pi(); int p = value_of_rec(28 + 0.5 * k - 100 / (k + 5) + 1); auto s = sin(x); @@ -49,7 +50,8 @@ inline return_type_t von_mises_cdf_series(const T_x& x, const T_k& k) * is well-approximated by a normal distribution. */ template -inline return_type_t von_mises_cdf_normalapprox(const T_x& x, const T_k& k) { +inline return_type_t von_mises_cdf_normalapprox(const T_x& x, + const T_k& k) { using std::exp; using std::sqrt; @@ -68,7 +70,8 @@ inline return_type_t von_mises_cdf_normalapprox(const T_x& x, const T_ * the cdf with a Gaussian. Otherwise, use the expansion from scipy. */ template -inline return_type_t von_mises_cdf_centered(const T_x& x, const T_k& k) { +inline return_type_t von_mises_cdf_centered(const T_x& x, + const T_k& k) { using return_t = return_type_t; return_t f; if (k < 49) { diff --git a/stan/math/prim/prob/von_mises_lpdf.hpp b/stan/math/prim/prob/von_mises_lpdf.hpp index b80c2869b78..b8d5a1ab63b 100644 --- a/stan/math/prim/prob/von_mises_lpdf.hpp +++ b/stan/math/prim/prob/von_mises_lpdf.hpp @@ -23,8 +23,9 @@ namespace stan { namespace math { template -inline return_type_t von_mises_lpdf(T_y const& y, T_loc const& mu, - T_scale const& kappa) { +inline return_type_t von_mises_lpdf(T_y const& y, + T_loc const& mu, + T_scale const& kappa) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_mu_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/weibull_ccdf_log.hpp b/stan/math/prim/prob/weibull_ccdf_log.hpp index e59ddbec7d4..d9dc7bdb0c7 100644 --- a/stan/math/prim/prob/weibull_ccdf_log.hpp +++ b/stan/math/prim/prob/weibull_ccdf_log.hpp @@ -11,9 +11,8 @@ namespace math { * @deprecated use weibull_lccdf */ template -inline return_type_t weibull_ccdf_log(const T_y& y, - const T_shape& alpha, - const T_scale& sigma) { +inline return_type_t weibull_ccdf_log( + const T_y& y, const T_shape& alpha, const T_scale& sigma) { return weibull_lccdf(y, alpha, sigma); } diff --git a/stan/math/prim/prob/weibull_cdf.hpp b/stan/math/prim/prob/weibull_cdf.hpp index 8c2750be1a9..6c6be0bdb78 100644 --- a/stan/math/prim/prob/weibull_cdf.hpp +++ b/stan/math/prim/prob/weibull_cdf.hpp @@ -37,8 +37,8 @@ template * = nullptr> inline return_type_t weibull_cdf(const T_y& y, - const T_shape& alpha, - const T_scale& sigma) { + const T_shape& alpha, + const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/weibull_cdf_log.hpp b/stan/math/prim/prob/weibull_cdf_log.hpp index b72ffc9bbc3..66a02f20f20 100644 --- a/stan/math/prim/prob/weibull_cdf_log.hpp +++ b/stan/math/prim/prob/weibull_cdf_log.hpp @@ -11,9 +11,8 @@ namespace math { * @deprecated use weibull_lcdf */ template -inline return_type_t weibull_cdf_log(const T_y& y, - const T_shape& alpha, - const T_scale& sigma) { +inline return_type_t weibull_cdf_log( + const T_y& y, const T_shape& alpha, const T_scale& sigma) { return weibull_lcdf(y, alpha, sigma); } diff --git a/stan/math/prim/prob/weibull_lccdf.hpp b/stan/math/prim/prob/weibull_lccdf.hpp index 792d6085bc2..9fa25a575ea 100644 --- a/stan/math/prim/prob/weibull_lccdf.hpp +++ b/stan/math/prim/prob/weibull_lccdf.hpp @@ -34,9 +34,8 @@ namespace math { template * = nullptr> -inline return_type_t weibull_lccdf(const T_y& y, - const T_shape& alpha, - const T_scale& sigma) { +inline return_type_t weibull_lccdf( + const T_y& y, const T_shape& alpha, const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/weibull_lcdf.hpp b/stan/math/prim/prob/weibull_lcdf.hpp index 943d7e9539d..12b70cf76e6 100644 --- a/stan/math/prim/prob/weibull_lcdf.hpp +++ b/stan/math/prim/prob/weibull_lcdf.hpp @@ -37,8 +37,8 @@ template * = nullptr> inline return_type_t weibull_lcdf(const T_y& y, - const T_shape& alpha, - const T_scale& sigma) { + const T_shape& alpha, + const T_scale& sigma) { using T_y_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; using T_sigma_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/weibull_lpdf.hpp b/stan/math/prim/prob/weibull_lpdf.hpp index 84729f1599d..e5313765f13 100644 --- a/stan/math/prim/prob/weibull_lpdf.hpp +++ b/stan/math/prim/prob/weibull_lpdf.hpp @@ -38,8 +38,8 @@ template * = nullptr> inline return_type_t weibull_lpdf(const T_y& y, - const T_shape& alpha, - const T_scale& sigma) { + const T_shape& alpha, + const T_scale& sigma) { using T_partials_return = partials_return_t; using T_y_ref = ref_type_if_not_constant_t; using T_alpha_ref = ref_type_if_not_constant_t; diff --git a/stan/math/prim/prob/wishart_cholesky_lpdf.hpp b/stan/math/prim/prob/wishart_cholesky_lpdf.hpp index 57f9b803aad..794e45c67ac 100644 --- a/stan/math/prim/prob/wishart_cholesky_lpdf.hpp +++ b/stan/math/prim/prob/wishart_cholesky_lpdf.hpp @@ -39,9 +39,8 @@ namespace math { template * = nullptr, require_all_matrix_t* = nullptr> -inline return_type_t wishart_cholesky_lpdf(const T_y& L_Y, - const T_dof& nu, - const T_scale& L_S) { +inline return_type_t wishart_cholesky_lpdf( + const T_y& L_Y, const T_dof& nu, const T_scale& L_S) { using Eigen::Lower; using T_L_Y_ref = ref_type_t; using T_nu_ref = ref_type_t; diff --git a/stan/math/prim/prob/wishart_lpdf.hpp b/stan/math/prim/prob/wishart_lpdf.hpp index 9a87f59a4fc..4f37d579b99 100644 --- a/stan/math/prim/prob/wishart_lpdf.hpp +++ b/stan/math/prim/prob/wishart_lpdf.hpp @@ -46,8 +46,9 @@ namespace math { template * = nullptr, require_all_matrix_t* = nullptr> -inline return_type_t wishart_lpdf(const T_y& W, const T_dof& nu, - const T_scale& S) { +inline return_type_t wishart_lpdf(const T_y& W, + const T_dof& nu, + const T_scale& S) { using Eigen::Dynamic; using Eigen::Lower; using Eigen::Matrix; diff --git a/stan/math/rev/constraint/cholesky_corr_constrain.hpp b/stan/math/rev/constraint/cholesky_corr_constrain.hpp index d61df1ae7cb..2adc688263c 100644 --- a/stan/math/rev/constraint/cholesky_corr_constrain.hpp +++ b/stan/math/rev/constraint/cholesky_corr_constrain.hpp @@ -89,8 +89,8 @@ inline var_value cholesky_corr_constrain(const T& y, int K) { * @return Cholesky factor of correlation matrix */ template * = nullptr> -inline var_value cholesky_corr_constrain(const T& y, int K, - scalar_type_t& lp) { +inline var_value cholesky_corr_constrain( + const T& y, int K, scalar_type_t& lp) { using Eigen::Dynamic; using Eigen::Matrix; using std::sqrt; diff --git a/stan/math/rev/constraint/cholesky_factor_constrain.hpp b/stan/math/rev/constraint/cholesky_factor_constrain.hpp index 54c79640e4e..fcf26477fb5 100644 --- a/stan/math/rev/constraint/cholesky_factor_constrain.hpp +++ b/stan/math/rev/constraint/cholesky_factor_constrain.hpp @@ -27,7 +27,8 @@ namespace math { * @return Cholesky factor */ template * = nullptr> -inline var_value cholesky_factor_constrain(const T& x, int M, int N) { +inline var_value cholesky_factor_constrain(const T& x, int M, + int N) { using std::exp; check_greater_or_equal("cholesky_factor_constrain", "num rows (must be greater or equal to num cols)", M, @@ -86,8 +87,8 @@ inline var_value cholesky_factor_constrain(const T& x, int M, i * @return Cholesky factor */ template * = nullptr> -inline var_value cholesky_factor_constrain(const T& x, int M, int N, - scalar_type_t& lp) { +inline var_value cholesky_factor_constrain( + const T& x, int M, int N, scalar_type_t& lp) { check_size_match("cholesky_factor_constrain", "x.size()", x.size(), "((N * (N + 1)) / 2 + (M - N) * N)", ((N * (N + 1)) / 2 + (M - N) * N)); diff --git a/stan/math/rev/constraint/corr_matrix_constrain.hpp b/stan/math/rev/constraint/corr_matrix_constrain.hpp index 1e6d1885db5..8b8a028c9a5 100644 --- a/stan/math/rev/constraint/corr_matrix_constrain.hpp +++ b/stan/math/rev/constraint/corr_matrix_constrain.hpp @@ -38,7 +38,8 @@ namespace math { * matrix. */ template * = nullptr> -inline var_value corr_matrix_constrain(const T& x, Eigen::Index k) { +inline var_value corr_matrix_constrain(const T& x, + Eigen::Index k) { Eigen::Index k_choose_2 = (k * (k - 1)) / 2; check_size_match("cov_matrix_constrain", "x.size()", x.size(), "k_choose_2", k_choose_2); @@ -66,8 +67,9 @@ inline var_value corr_matrix_constrain(const T& x, Eigen::Index * @param lp Log probability reference to increment. */ template * = nullptr> -inline var_value corr_matrix_constrain(const T& x, Eigen::Index k, - scalar_type_t& lp) { +inline var_value corr_matrix_constrain(const T& x, + Eigen::Index k, + scalar_type_t& lp) { Eigen::Index k_choose_2 = (k * (k - 1)) / 2; check_size_match("cov_matrix_constrain", "x.size()", x.size(), "k_choose_2", k_choose_2); diff --git a/stan/math/rev/constraint/cov_matrix_constrain.hpp b/stan/math/rev/constraint/cov_matrix_constrain.hpp index bb74ba3a274..b71913f2d8a 100644 --- a/stan/math/rev/constraint/cov_matrix_constrain.hpp +++ b/stan/math/rev/constraint/cov_matrix_constrain.hpp @@ -29,7 +29,8 @@ namespace math { * @throws std::invalid_argument if (x.size() != K + (K choose 2)). */ template * = nullptr> -inline var_value cov_matrix_constrain(const T& x, Eigen::Index K) { +inline var_value cov_matrix_constrain(const T& x, + Eigen::Index K) { using std::exp; check_size_match("cov_matrix_constrain", "x.size()", x.size(), @@ -74,8 +75,9 @@ inline var_value cov_matrix_constrain(const T& x, Eigen::Index * @throws std::domain_error if (x.size() != K + (K choose 2)). */ template * = nullptr> -inline var_value cov_matrix_constrain(const T& x, Eigen::Index K, - scalar_type_t& lp) { +inline var_value cov_matrix_constrain(const T& x, + Eigen::Index K, + scalar_type_t& lp) { using std::exp; using std::log; diff --git a/stan/math/rev/constraint/cov_matrix_constrain_lkj.hpp b/stan/math/rev/constraint/cov_matrix_constrain_lkj.hpp index 3fc0d63e6cf..115a396cf6c 100644 --- a/stan/math/rev/constraint/cov_matrix_constrain_lkj.hpp +++ b/stan/math/rev/constraint/cov_matrix_constrain_lkj.hpp @@ -32,7 +32,8 @@ namespace math { * correlations and deviations. */ template * = nullptr> -inline var_value cov_matrix_constrain_lkj(const T& x, size_t k) { +inline var_value cov_matrix_constrain_lkj(const T& x, + size_t k) { size_t k_choose_2 = (k * (k - 1)) / 2; return read_cov_matrix(corr_constrain(x.head(k_choose_2)), positive_constrain(x.tail(k))); @@ -64,8 +65,8 @@ inline var_value cov_matrix_constrain_lkj(const T& x, size_t k) * correlations and deviations. */ template * = nullptr> -inline var_value cov_matrix_constrain_lkj(const T& x, size_t k, - scalar_type_t& lp) { +inline var_value cov_matrix_constrain_lkj( + const T& x, size_t k, scalar_type_t& lp) { size_t k_choose_2 = (k * (k - 1)) / 2; return read_cov_matrix(corr_constrain(x.head(k_choose_2)), positive_constrain(x.tail(k)), lp); diff --git a/stan/math/rev/constraint/sum_to_zero_constrain.hpp b/stan/math/rev/constraint/sum_to_zero_constrain.hpp index 23ac3eefc41..c8004319ada 100644 --- a/stan/math/rev/constraint/sum_to_zero_constrain.hpp +++ b/stan/math/rev/constraint/sum_to_zero_constrain.hpp @@ -25,7 +25,8 @@ namespace internal { * @param z_adj The adjoint of the zero-sum vector (size N + 1) */ template -inline void sum_to_zero_vector_backprop(T&& y_adj, const Eigen::VectorXd& z_adj) { +inline void sum_to_zero_vector_backprop(T&& y_adj, + const Eigen::VectorXd& z_adj) { const auto N = y_adj.size(); double sum_u_adj = 0; diff --git a/stan/math/rev/core/callback_vari.hpp b/stan/math/rev/core/callback_vari.hpp index f3d7a114d72..04b29bf23c1 100644 --- a/stan/math/rev/core/callback_vari.hpp +++ b/stan/math/rev/core/callback_vari.hpp @@ -38,8 +38,8 @@ struct callback_vari : public vari_value { * @param functor functor or other callable to call in the reverse pass */ template -inline internal::callback_vari, F>* make_callback_vari(T&& value, - F&& functor) { +inline internal::callback_vari, F>* make_callback_vari( + T&& value, F&& functor) { return new internal::callback_vari, F>( std::move(value), std::forward(functor)); } diff --git a/stan/math/rev/fun/from_var_value.hpp b/stan/math/rev/fun/from_var_value.hpp index c3bbd2529b3..9f7b5483c79 100644 --- a/stan/math/rev/fun/from_var_value.hpp +++ b/stan/math/rev/fun/from_var_value.hpp @@ -17,8 +17,8 @@ namespace math { * @param a matrix to convert */ template * = nullptr> -inline Eigen::Matrix from_var_value( - const T& a) { +inline Eigen::Matrix +from_var_value(const T& a) { arena_matrix> res(a.val()); reverse_pass_callback([res, a]() mutable { a.vi_->adj_ += res.adj(); }); diff --git a/stan/math/rev/fun/read_cov_matrix.hpp b/stan/math/rev/fun/read_cov_matrix.hpp index 65362850543..5a57b65cb87 100644 --- a/stan/math/rev/fun/read_cov_matrix.hpp +++ b/stan/math/rev/fun/read_cov_matrix.hpp @@ -27,8 +27,8 @@ namespace math { */ template * = nullptr> -inline var_value read_cov_matrix(const T_CPCs& CPCs, const T_sds& sds, - scalar_type_t& log_prob) { +inline var_value read_cov_matrix( + const T_CPCs& CPCs, const T_sds& sds, scalar_type_t& log_prob) { return multiply_lower_tri_self_transpose(read_cov_L(CPCs, sds, log_prob)); } diff --git a/stan/math/rev/functor/algebra_system.hpp b/stan/math/rev/functor/algebra_system.hpp index 559fb537079..988e6d1e8a8 100644 --- a/stan/math/rev/functor/algebra_system.hpp +++ b/stan/math/rev/functor/algebra_system.hpp @@ -98,12 +98,12 @@ struct hybrj_functor_solver : nlo_functor { // TODO(jgaeb): Remove this when the chain method of the fixed point solver is // updated. template -inline void algebra_solver_check(const Eigen::Matrix& x, - const Eigen::Matrix y, - const std::vector& dat, - const std::vector& dat_int, - double function_tolerance, - long int max_num_steps) { // NOLINT(runtime/int) +inline void algebra_solver_check( + const Eigen::Matrix& x, + const Eigen::Matrix y, + const std::vector& dat, const std::vector& dat_int, + double function_tolerance, + long int max_num_steps) { // NOLINT(runtime/int) check_nonzero_size("algebra_solver", "initial guess", x); check_finite("algebra_solver", "initial guess", x); check_finite("algebra_solver", "parameter vector", y); diff --git a/stan/math/rev/functor/dae.hpp b/stan/math/rev/functor/dae.hpp index c574b02924b..a7432307301 100644 --- a/stan/math/rev/functor/dae.hpp +++ b/stan/math/rev/functor/dae.hpp @@ -49,7 +49,8 @@ namespace math { */ template * = nullptr> -inline std::vector, -1, 1>> +inline std::vector< + Eigen::Matrix, -1, 1>> dae_tol_impl(const char* func, const F& f, const T_yy& yy0, const T_yp& yp0, double t0, const std::vector& ts, double rtol, double atol, int64_t max_num_steps, std::ostream* msgs, const T_Args&... args) { @@ -121,7 +122,8 @@ dae_tol_impl(const char* func, const F& f, const T_yy& yy0, const T_yp& yp0, */ template * = nullptr> -inline std::vector, -1, 1>> +inline std::vector< + Eigen::Matrix, -1, 1>> dae_tol(const F& f, const T_yy& yy0, const T_yp& yp0, double t0, const std::vector& ts, double rtol, double atol, int64_t max_num_steps, std::ostream* msgs, const T_Args&... args) { @@ -163,7 +165,8 @@ dae_tol(const F& f, const T_yy& yy0, const T_yp& yp0, double t0, */ template * = nullptr> -inline std::vector, -1, 1>> +inline std::vector< + Eigen::Matrix, -1, 1>> dae(const F& f, const T_yy& yy0, const T_yp& yp0, double t0, const std::vector& ts, std::ostream* msgs, const T_Args&... args) { return dae_tol_impl("dae", f, yy0, yp0, t0, ts, 1.e-10, 1.e-10, 1e8, msgs, diff --git a/stan/math/rev/functor/finite_diff_hessian_auto.hpp b/stan/math/rev/functor/finite_diff_hessian_auto.hpp index e0ac6ae427c..fad9fc0659d 100644 --- a/stan/math/rev/functor/finite_diff_hessian_auto.hpp +++ b/stan/math/rev/functor/finite_diff_hessian_auto.hpp @@ -40,9 +40,9 @@ namespace internal { * @param[out] hess_fx Hessian of function at argument */ template -inline void finite_diff_hessian_auto(const F& f, const Eigen::VectorXd& x, double& fx, - Eigen::VectorXd& grad_fx, - Eigen::MatrixXd& hess_fx) { +inline void finite_diff_hessian_auto(const F& f, const Eigen::VectorXd& x, + double& fx, Eigen::VectorXd& grad_fx, + Eigen::MatrixXd& hess_fx) { int d = x.size(); Eigen::VectorXd x_temp(x); diff --git a/stan/math/rev/functor/finite_diff_hessian_times_vector_auto.hpp b/stan/math/rev/functor/finite_diff_hessian_times_vector_auto.hpp index 5ed0af87d25..eed1ff4d882 100644 --- a/stan/math/rev/functor/finite_diff_hessian_times_vector_auto.hpp +++ b/stan/math/rev/functor/finite_diff_hessian_times_vector_auto.hpp @@ -41,9 +41,11 @@ namespace internal { * @param[out] hvp Product of Hessian and vector at argument */ template -inline void finite_diff_hessian_times_vector_auto(const F& f, const Eigen::VectorXd& x, - const Eigen::VectorXd& v, double& fx, - Eigen::VectorXd& hvp) { +inline void finite_diff_hessian_times_vector_auto(const F& f, + const Eigen::VectorXd& x, + const Eigen::VectorXd& v, + double& fx, + Eigen::VectorXd& hvp) { fx = f(x); double epsilon = std::sqrt(EPSILON) * (1 + x.norm()) / v.norm(); diff --git a/stan/math/rev/functor/gradient.hpp b/stan/math/rev/functor/gradient.hpp index db7f1588b0b..0d35456f9e7 100644 --- a/stan/math/rev/functor/gradient.hpp +++ b/stan/math/rev/functor/gradient.hpp @@ -43,8 +43,10 @@ namespace math { * @param[out] grad_fx Gradient of function at argument */ template -inline void gradient(const F& f, const Eigen::Matrix& x, - double& fx, Eigen::Matrix& grad_fx) { +inline void gradient(const F& f, + const Eigen::Matrix& x, + double& fx, + Eigen::Matrix& grad_fx) { nested_rev_autodiff nested; Eigen::Matrix x_var(x); @@ -99,8 +101,8 @@ inline void gradient(const F& f, const Eigen::Matrix& */ template * = nullptr> -inline void gradient(const F& f, const EigVec& x, double& fx, InputIt first_grad_fx, - InputIt last_grad_fx) { +inline void gradient(const F& f, const EigVec& x, double& fx, + InputIt first_grad_fx, InputIt last_grad_fx) { nested_rev_autodiff nested; if (last_grad_fx - first_grad_fx != x.size()) { diff --git a/stan/math/rev/functor/jacobian.hpp b/stan/math/rev/functor/jacobian.hpp index 0f070da560a..48351511833 100644 --- a/stan/math/rev/functor/jacobian.hpp +++ b/stan/math/rev/functor/jacobian.hpp @@ -11,9 +11,10 @@ namespace stan { namespace math { template -inline void jacobian(const F& f, const Eigen::Matrix& x, - Eigen::Matrix& fx, - Eigen::Matrix& J) { +inline void jacobian(const F& f, + const Eigen::Matrix& x, + Eigen::Matrix& fx, + Eigen::Matrix& J) { using Eigen::Dynamic; using Eigen::Matrix; // Run nested autodiff in this scope diff --git a/stan/math/rev/functor/kinsol_solve.hpp b/stan/math/rev/functor/kinsol_solve.hpp index fdbecf392ce..51b4fef4d57 100644 --- a/stan/math/rev/functor/kinsol_solve.hpp +++ b/stan/math/rev/functor/kinsol_solve.hpp @@ -58,14 +58,15 @@ namespace math { * negative flag that is not due to hitting max_num_steps. */ template -inline Eigen::VectorXd kinsol_solve(const F1& f, const Eigen::VectorXd& x, - const double scaling_step_tol, // = 1e-3 - const double function_tolerance, // = 1e-6 - const int64_t max_num_steps, // = 200 - const bool custom_jacobian, // = 1 - const int steps_eval_jacobian, // = 10 - const int global_line_search, // = KIN_LINESEARCH - std::ostream* const msgs, const Args&... args) { +inline Eigen::VectorXd kinsol_solve( + const F1& f, const Eigen::VectorXd& x, + const double scaling_step_tol, // = 1e-3 + const double function_tolerance, // = 1e-6 + const int64_t max_num_steps, // = 200 + const bool custom_jacobian, // = 1 + const int steps_eval_jacobian, // = 10 + const int global_line_search, // = KIN_LINESEARCH + std::ostream* const msgs, const Args&... args) { int N = x.size(); typedef kinsol_system_data system_data; system_data kinsol_data(f, x, msgs, args...); diff --git a/stan/math/rev/functor/map_rect_concurrent.hpp b/stan/math/rev/functor/map_rect_concurrent.hpp index a56bd13c320..878261056fb 100644 --- a/stan/math/rev/functor/map_rect_concurrent.hpp +++ b/stan/math/rev/functor/map_rect_concurrent.hpp @@ -20,7 +20,8 @@ namespace internal { template *> -inline Eigen::Matrix, Eigen::Dynamic, 1> +inline Eigen::Matrix, Eigen::Dynamic, + 1> map_rect_concurrent( const T_shared_param& shared_params, const std::vector>& diff --git a/stan/math/rev/functor/ode_adams.hpp b/stan/math/rev/functor/ode_adams.hpp index 01837a4fb33..15cd9813c25 100644 --- a/stan/math/rev/functor/ode_adams.hpp +++ b/stan/math/rev/functor/ode_adams.hpp @@ -47,8 +47,8 @@ namespace math { */ template * = nullptr> -inline std::vector, - Eigen::Dynamic, 1>> +inline std::vector, Eigen::Dynamic, 1>> ode_adams_tol_impl(const char* function_name, const F& f, const T_y0& y0, const T_t0& t0, const std::vector& ts, double relative_tolerance, double absolute_tolerance, @@ -101,8 +101,8 @@ ode_adams_tol_impl(const char* function_name, const F& f, const T_y0& y0, */ template * = nullptr> -inline std::vector, - Eigen::Dynamic, 1>> +inline std::vector, Eigen::Dynamic, 1>> ode_adams_tol(const F& f, const T_y0& y0, const T_t0& t0, const std::vector& ts, double relative_tolerance, double absolute_tolerance, @@ -144,8 +144,8 @@ ode_adams_tol(const F& f, const T_y0& y0, const T_t0& t0, */ template * = nullptr> -inline std::vector, - Eigen::Dynamic, 1>> +inline std::vector, Eigen::Dynamic, 1>> ode_adams(const F& f, const T_y0& y0, const T_t0& t0, const std::vector& ts, std::ostream* msgs, const T_Args&... args) { diff --git a/stan/math/rev/functor/ode_bdf.hpp b/stan/math/rev/functor/ode_bdf.hpp index 9bb2058e136..98df8616873 100644 --- a/stan/math/rev/functor/ode_bdf.hpp +++ b/stan/math/rev/functor/ode_bdf.hpp @@ -48,8 +48,8 @@ namespace math { */ template * = nullptr> -inline std::vector, - Eigen::Dynamic, 1>> +inline std::vector, Eigen::Dynamic, 1>> ode_bdf_tol_impl(const char* function_name, const F& f, const T_y0& y0, const T_t0& t0, const std::vector& ts, double relative_tolerance, double absolute_tolerance, @@ -102,8 +102,8 @@ ode_bdf_tol_impl(const char* function_name, const F& f, const T_y0& y0, */ template * = nullptr> -inline std::vector, - Eigen::Dynamic, 1>> +inline std::vector, Eigen::Dynamic, 1>> ode_bdf_tol(const F& f, const T_y0& y0, const T_t0& t0, const std::vector& ts, double relative_tolerance, double absolute_tolerance, @@ -145,8 +145,8 @@ ode_bdf_tol(const F& f, const T_y0& y0, const T_t0& t0, */ template * = nullptr> -inline std::vector, - Eigen::Dynamic, 1>> +inline std::vector, Eigen::Dynamic, 1>> ode_bdf(const F& f, const T_y0& y0, const T_t0& t0, const std::vector& ts, std::ostream* msgs, const T_Args&... args) { double relative_tolerance = 1e-10; diff --git a/stan/math/rev/functor/solve_newton.hpp b/stan/math/rev/functor/solve_newton.hpp index 9459df3bba4..e0a8ceffe19 100644 --- a/stan/math/rev/functor/solve_newton.hpp +++ b/stan/math/rev/functor/solve_newton.hpp @@ -57,11 +57,11 @@ template * = nullptr, require_all_st_arithmetic* = nullptr> inline Eigen::VectorXd solve_newton_tol(const F& f, const T& x, - const double scaling_step_size, - const double function_tolerance, - const int64_t max_num_steps, - std::ostream* const msgs, - const Args&... args) { + const double scaling_step_size, + const double function_tolerance, + const int64_t max_num_steps, + std::ostream* const msgs, + const Args&... args) { const auto& x_ref = to_ref(value_of(x)); check_nonzero_size("solve_newton", "initial guess", x_ref); @@ -236,8 +236,9 @@ inline Eigen::Matrix solve_newton_tol( */ template * = nullptr> -inline Eigen::Matrix, Eigen::Dynamic, 1> solve_newton( - const F& f, const T& x, std::ostream* const msgs, const T_Args&... args) { +inline Eigen::Matrix, Eigen::Dynamic, 1> +solve_newton(const F& f, const T& x, std::ostream* const msgs, + const T_Args&... args) { double scaling_step_size = 1e-3; double function_tolerance = 1e-6; int64_t max_num_steps = 200; @@ -292,12 +293,15 @@ inline Eigen::Matrix, Eigen::Dynamic, 1> solve_ne */ template * = nullptr> -inline Eigen::Matrix, Eigen::Dynamic, 1> algebra_solver_newton( - const F& f, const T1& x, const T2& y, const std::vector& dat, - const std::vector& dat_int, std::ostream* const msgs = nullptr, - const double scaling_step_size = 1e-3, - const double function_tolerance = 1e-6, - const long int max_num_steps = 200) { // NOLINT(runtime/int) +inline Eigen::Matrix, Eigen::Dynamic, 1> +algebra_solver_newton(const F& f, const T1& x, const T2& y, + const std::vector& dat, + const std::vector& dat_int, + std::ostream* const msgs = nullptr, + const double scaling_step_size = 1e-3, + const double function_tolerance = 1e-6, + const long int max_num_steps + = 200) { // NOLINT(runtime/int) return solve_newton_tol(algebra_solver_adapter(f), x, scaling_step_size, function_tolerance, max_num_steps, msgs, y, dat, dat_int); diff --git a/stan/math/rev/functor/solve_powell.hpp b/stan/math/rev/functor/solve_powell.hpp index 52f974b19e1..2696ff1d69d 100644 --- a/stan/math/rev/functor/solve_powell.hpp +++ b/stan/math/rev/functor/solve_powell.hpp @@ -46,9 +46,10 @@ namespace math { template * = nullptr> inline T& solve_powell_call_solver(const F& f, T& x, std::ostream* const msgs, - const double relative_tolerance, - const double function_tolerance, - const int64_t max_num_steps, const Args&... args) { + const double relative_tolerance, + const double function_tolerance, + const int64_t max_num_steps, + const Args&... args) { // Construct the solver hybrj_functor_solver hfs(f); Eigen::HybridNonLinearSolver> solver(hfs); @@ -126,11 +127,11 @@ template * = nullptr, require_all_st_arithmetic* = nullptr> inline Eigen::VectorXd solve_powell_tol(const F& f, const T& x, - const double relative_tolerance, - const double function_tolerance, - const int64_t max_num_steps, - std::ostream* const msgs, - const Args&... args) { + const double relative_tolerance, + const double function_tolerance, + const int64_t max_num_steps, + std::ostream* const msgs, + const Args&... args) { auto x_ref = eval(value_of(x)); auto args_vals_tuple = std::make_tuple(to_ref(args)...); @@ -185,8 +186,9 @@ inline Eigen::VectorXd solve_powell_tol(const F& f, const T& x, */ template * = nullptr> -inline Eigen::Matrix, Eigen::Dynamic, 1> solve_powell( - const F& f, const T& x, std::ostream* const msgs, const T_Args&... args) { +inline Eigen::Matrix, Eigen::Dynamic, 1> +solve_powell(const F& f, const T& x, std::ostream* const msgs, + const T_Args&... args) { double relative_tolerance = 1e-10; double function_tolerance = 1e-6; int64_t max_num_steps = 200; diff --git a/test/expressions/expression_test_helpers.hpp b/test/expressions/expression_test_helpers.hpp index db953a50e84..96a09540a9d 100644 --- a/test/expressions/expression_test_helpers.hpp +++ b/test/expressions/expression_test_helpers.hpp @@ -134,14 +134,14 @@ inline void expect_eq(std::complex a, std::complex b, const char* msg) { } inline void expect_eq(std::complex a, std::complex b, - const char* msg) { + const char* msg) { expect_eq(a.real(), b.real(), msg); expect_eq(a.imag(), b.imag(), msg); } template * = nullptr> -inline void expect_eq(std::complex> a, std::complex> b, - const char* msg) { +inline void expect_eq(std::complex> a, + std::complex> b, const char* msg) { expect_eq(a.real(), b.real(), msg); expect_eq(a.imag(), b.imag(), msg); } @@ -162,7 +162,7 @@ inline void expect_eq(const T1& a, const T2& b, const char* msg) { template inline void expect_eq(const std::vector& a, const std::vector& b, - const char* msg) { + const char* msg) { EXPECT_EQ(a.size(), b.size()); for (int i = 0; i < a.size(); i++) { expect_eq(a[i], b[i], msg); @@ -176,15 +176,18 @@ inline void expect_eq(const T& t1, const T& t2, const char* msg) { } template * = nullptr> -inline void expect_adj_eq(const T& a, const T& b, const char* msg = "expect_ad_eq") {} +inline void expect_adj_eq(const T& a, const T& b, + const char* msg = "expect_ad_eq") {} -inline void expect_adj_eq(math::var a, math::var b, const char* msg = "expect_ad_eq") { +inline void expect_adj_eq(math::var a, math::var b, + const char* msg = "expect_ad_eq") { EXPECT_EQ(a.adj(), b.adj()) << msg; } template * = nullptr, require_vt_same* = nullptr> -inline void expect_adj_eq(const T1& a, const T2& b, const char* msg = "expect_ad_eq") { +inline void expect_adj_eq(const T1& a, const T2& b, + const char* msg = "expect_ad_eq") { EXPECT_EQ(a.rows(), b.rows()) << msg; EXPECT_EQ(a.cols(), b.cols()) << msg; const auto& a_ref = math::to_ref(a); @@ -198,7 +201,7 @@ inline void expect_adj_eq(const T1& a, const T2& b, const char* msg = "expect_ad template inline void expect_adj_eq(const std::vector& a, const std::vector& b, - const char* msg = "expect_ad_eq") { + const char* msg = "expect_ad_eq") { EXPECT_EQ(a.size(), b.size()) << msg; for (int i = 0; i < a.size(); i++) { expect_adj_eq(a[i], b[i], msg); diff --git a/test/prob/generate_tests.cpp b/test/prob/generate_tests.cpp index 2371944c1a7..d54f377721d 100644 --- a/test/prob/generate_tests.cpp +++ b/test/prob/generate_tests.cpp @@ -181,7 +181,7 @@ pair read_test_name_from_file(const string& file) { } inline vector > build_argument_sequence(const string& arguments, - const int& ind) { + const int& ind) { vector argument_list = tokenize_arguments(arguments); vector > argument_sequence; for (size_t n = 0; n < argument_list.size(); n++) @@ -244,10 +244,11 @@ int num_ints(string arguments) { return num; } -inline void write_types_typedef(vector& outs, string base, size_t& N, - vector > argument_sequence, - const size_t depth, const int& index, - const int& N_TESTS) { +inline void write_types_typedef(vector& outs, string base, + size_t& N, + vector > argument_sequence, + const size_t depth, const int& index, + const int& N_TESTS) { vector args = argument_sequence.front(); argument_sequence.erase(argument_sequence.begin()); if (argument_sequence.size() > 0) { @@ -301,8 +302,8 @@ size_t write_types(vector& outs, } inline void write_test(vector& outs, const string& test_name, - const string& fixture_name, const size_t N, const int& index, - const int& N_TESTS) { + const string& fixture_name, const size_t N, + const int& index, const int& N_TESTS) { for (size_t n = 0; n < N; n++) { std::ostream* out = outs[int(n / N_TESTS)]; if (index == 1) @@ -360,8 +361,8 @@ inline void write_test(vector& outs, const string& test_name, } inline void write_test_cases(vector& outs, const string& file, - const vector >& argument_sequence, - const int& index, const int& N_TESTS) { + const vector >& argument_sequence, + const int& index, const int& N_TESTS) { pair name = read_test_name_from_file(file); string test_name = name.first; string fixture_name = name.second; diff --git a/test/prob/utility.hpp b/test/prob/utility.hpp index 4fe50048e12..0a6a7ee0857 100644 --- a/test/prob/utility.hpp +++ b/test/prob/utility.hpp @@ -70,7 +70,7 @@ empty get_param(const vector& /*params*/, const size_t /*n*/) { template <> inline fvar get_param>(const vector& params, - const size_t n) { + const size_t n) { fvar param = 0; if (n < params.size()) { param = params[n]; @@ -79,7 +79,8 @@ inline fvar get_param>(const vector& params, return param; } template <> -inline fvar get_param>(const vector& params, const size_t n) { +inline fvar get_param>(const vector& params, + const size_t n) { fvar param = 0; if (n < params.size()) { param = params[n]; @@ -88,8 +89,8 @@ inline fvar get_param>(const vector& params, const size_t return param; } template <> -inline fvar> get_param>>(const vector& params, - const size_t n) { +inline fvar> get_param>>( + const vector& params, const size_t n) { fvar> param = 0; if (n < params.size()) { param = params[n]; @@ -99,7 +100,7 @@ inline fvar> get_param>>(const vector& pa } template <> inline fvar> get_param>>(const vector& params, - const size_t n) { + const size_t n) { fvar> param = 0; if (n < params.size()) { param = params[n]; @@ -139,22 +140,23 @@ empty get_params(const vector>& /*parameters*/, // handle scalars template <> inline double get_params(const vector>& parameters, - const size_t p) { + const size_t p) { double param(0); if (p < parameters[0].size()) param = parameters[0][p]; return param; } template <> -inline var get_params(const vector>& parameters, const size_t p) { +inline var get_params(const vector>& parameters, + const size_t p) { var param(0); if (p < parameters[0].size()) param = parameters[0][p]; return param; } template <> -inline fvar get_params>(const vector>& parameters, - const size_t p) { +inline fvar get_params>( + const vector>& parameters, const size_t p) { fvar param(0); if (p < parameters[0].size()) { param = parameters[0][p]; @@ -164,7 +166,7 @@ inline fvar get_params>(const vector>& param } template <> inline fvar get_params>(const vector>& parameters, - const size_t p) { + const size_t p) { fvar param(0); if (p < parameters[0].size()) { param = parameters[0][p]; @@ -201,8 +203,8 @@ int get_params(const vector>& parameters, const size_t p) { } // handle vectors template <> -inline vector get_params>(const vector>& parameters, - const size_t p) { +inline vector get_params>( + const vector>& parameters, const size_t p) { vector param(parameters.size()); for (size_t n = 0; n < parameters.size(); n++) if (p < parameters[0].size()) @@ -219,8 +221,8 @@ vector get_params>( return param; } template <> -inline vector get_params>(const vector>& parameters, - const size_t p) { +inline vector get_params>( + const vector>& parameters, const size_t p) { vector param(parameters.size()); for (size_t n = 0; n < parameters.size(); n++) if (p < parameters[0].size()) @@ -276,8 +278,8 @@ vector>> get_params>>>( // default template handles Eigen::Matrix template * = nullptr> -inline T get_params(const vector>& parameters, const size_t /*n*/, - const size_t p) { +inline T get_params(const vector>& parameters, + const size_t /*n*/, const size_t p) { T param(parameters.size()); for (size_t i = 0; i < parameters.size(); i++) if (p < parameters[0].size()) @@ -287,8 +289,8 @@ inline T get_params(const vector>& parameters, const size_t /*n*/ // handle `var_value` where T is an Eigen type template * = nullptr> -inline T get_params(const vector>& parameters, const size_t /*n*/, - const size_t p) { +inline T get_params(const vector>& parameters, + const size_t /*n*/, const size_t p) { typename T::value_type param(parameters.size()); for (size_t i = 0; i < parameters.size(); i++) if (p < parameters[0].size()) @@ -305,23 +307,23 @@ empty get_params(const vector>& /*parameters*/, // handle scalars template <> inline double get_params(const vector>& parameters, - const size_t n, const size_t p) { + const size_t n, const size_t p) { double param(0); if (p < parameters[0].size()) param = parameters[n][p]; return param; } template <> -inline var get_params(const vector>& parameters, const size_t n, - const size_t p) { +inline var get_params(const vector>& parameters, + const size_t n, const size_t p) { var param(0); if (p < parameters[0].size()) param = parameters[n][p]; return param; } template <> -inline fvar get_params>(const vector>& parameters, - const size_t n, const size_t p) { +inline fvar get_params>( + const vector>& parameters, const size_t n, const size_t p) { fvar param(0); if (p < parameters[0].size()) { param = parameters[n][p]; @@ -331,7 +333,7 @@ inline fvar get_params>(const vector>& param } template <> inline fvar get_params>(const vector>& parameters, - const size_t n, const size_t p) { + const size_t n, const size_t p) { fvar param(0); if (p < parameters[0].size()) { param = parameters[n][p]; @@ -369,8 +371,9 @@ int get_params(const vector>& parameters, const size_t n, } // handle vectors template <> -inline vector get_params>(const vector>& parameters, - const size_t /*n*/, const size_t p) { +inline vector get_params>( + const vector>& parameters, const size_t /*n*/, + const size_t p) { vector param(parameters.size()); for (size_t i = 0; i < parameters.size(); i++) if (p < parameters[0].size()) @@ -388,8 +391,9 @@ vector get_params>( return param; } template <> -inline vector get_params>(const vector>& parameters, - const size_t /*n*/, const size_t p) { +inline vector get_params>( + const vector>& parameters, const size_t /*n*/, + const size_t p) { vector param(parameters.size()); for (size_t i = 0; i < parameters.size(); i++) if (p < parameters[0].size()) @@ -449,7 +453,7 @@ vector>> get_params>>>( // default template handles Eigen::Matrix template * = nullptr> inline T get_repeated_params(const vector& parameters, const size_t p, - const size_t N_REPEAT) { + const size_t N_REPEAT) { T params(N_REPEAT); stan::value_type_t param; @@ -468,7 +472,7 @@ inline T get_repeated_params(const vector& parameters, const size_t p, // handle `var_value` where T is an Eigen type template * = nullptr> inline T get_repeated_params(const vector& parameters, const size_t p, - const size_t N_REPEAT) { + const size_t N_REPEAT) { typename T::value_type params(N_REPEAT); double param; @@ -487,7 +491,7 @@ inline T get_repeated_params(const vector& parameters, const size_t p, // handle `std::vector` template * = nullptr> inline T get_repeated_params(const vector& parameters, const size_t p, - const size_t N_REPEAT) { + const size_t N_REPEAT) { T params(N_REPEAT); stan::value_type_t param; @@ -506,14 +510,15 @@ inline T get_repeated_params(const vector& parameters, const size_t p, // handle empty template ::value>* = nullptr> -inline T get_repeated_params(const vector&, const size_t, const size_t) { +inline T get_repeated_params(const vector&, const size_t, + const size_t) { return T(); } // handle scalars template * = nullptr> inline T get_repeated_params(const vector& parameters, const size_t p, - const size_t /*N_REPEAT*/) { + const size_t /*N_REPEAT*/) { if (p < parameters.size()) return get_param(parameters, p); else @@ -633,7 +638,8 @@ inline void add_adjoints>(vector& x, fvar& p) { } template <> -inline void add_adjoints>>(vector& x, vector>& p) { +inline void add_adjoints>>(vector& x, + vector>& p) { for (size_t n = 0; n < p.size(); n++) x.push_back(p[n].val_.adj()); } @@ -653,13 +659,14 @@ inline void add_adjoints, Eigen::Dynamic, 1>>( } template <> -inline void add_adjoints>>(vector& x, fvar>& p) { +inline void add_adjoints>>(vector& x, + fvar>& p) { x.push_back(p.val_.val_.adj()); } template <> inline void add_adjoints>>>(vector& x, - vector>>& p) { + vector>>& p) { for (size_t n = 0; n < p.size(); n++) x.push_back(p[n].val_.val_.adj()); } @@ -680,8 +687,8 @@ inline void add_adjoints>, Eigen::Dynamic, 1>>( template -inline void add_adjoints(vector& x, T0& p0, T1& p1, T2& p2, T3& p3, T4& p4, - T5& p5) { +inline void add_adjoints(vector& x, T0& p0, T1& p1, T2& p2, T3& p3, + T4& p4, T5& p5) { if (!is_constant_all::value) add_adjoints(x, p0); if (!is_constant_all::value) diff --git a/test/unit/math/expect_near_rel.hpp b/test/unit/math/expect_near_rel.hpp index e6c9d03df90..229b3fc66c2 100644 --- a/test/unit/math/expect_near_rel.hpp +++ b/test/unit/math/expect_near_rel.hpp @@ -26,10 +26,12 @@ namespace internal { * @param tol relative tolerance */ template ...> -inline void expect_near_rel_finite(const std::string& msg, const T1& x1, const T2& x2, - const relative_tolerance tol = relative_tolerance(), - const char* x1_name = "x1", - const char* x2_name = "x2") { +inline void expect_near_rel_finite(const std::string& msg, const T1& x1, + const T2& x2, + const relative_tolerance tol + = relative_tolerance(), + const char* x1_name = "x1", + const char* x2_name = "x2") { double tol_val = tol.inexact(x1, x2); EXPECT_NEAR(x1, x2, tol_val) << "expect_near_rel_finite in: " << msg << " for " << x1_name << " vs " @@ -39,8 +41,9 @@ inline void expect_near_rel_finite(const std::string& msg, const T1& x1, const T template ...> inline void expect_near_rel_finite(const std::string& msg, const EigMat1& x1, - const EigMat2& x2, const char* x1_name = "x1", - const char* x2_name = "x2") { + const EigMat2& x2, + const char* x1_name = "x1", + const char* x2_name = "x2") { EXPECT_EQ(x1.rows(), x2.rows()); EXPECT_EQ(x1.cols(), x2.cols()); auto x1_eval = x1.eval(); @@ -51,10 +54,11 @@ inline void expect_near_rel_finite(const std::string& msg, const EigMat1& x1, } template -inline void expect_near_rel_finite(const std::string& msg, const std::vector& x1, - const std::vector& x2, - const char* x1_name = "x1", - const char* x2_name = "x2") { +inline void expect_near_rel_finite(const std::string& msg, + const std::vector& x1, + const std::vector& x2, + const char* x1_name = "x1", + const char* x2_name = "x2") { EXPECT_EQ(x1.size(), x2.size()); for (size_t i = 0; i < x1.size(); ++i) { expect_near_rel_finite(x1[i], x2[i], x1_name, x2_name); @@ -79,8 +83,9 @@ inline void expect_near_rel_finite(const std::string& msg, const std::vector */ template ...> inline void expect_near_rel(const std::string& msg, const T1& x1, const T2& x2, - relative_tolerance tol = relative_tolerance(), - const char* x1_name = "x1", const char* x2_name = "x2") { + relative_tolerance tol = relative_tolerance(), + const char* x1_name = "x1", + const char* x2_name = "x2") { if (stan::math::is_nan(x1) || stan::math::is_nan(x2)) { EXPECT_TRUE(stan::math::is_nan(x1) && stan::math::is_nan(x2)) << "expect_near_rel(" << x1 << ", " << x2 << ")" << std::endl @@ -113,8 +118,9 @@ inline void expect_near_rel(const std::string& msg, const T1& x1, const T2& x2, template ...> inline void expect_near_rel(const std::string& msg, EigMat1&& x1, EigMat2&& x2, - relative_tolerance tol = relative_tolerance(), - const char* x1_name = "x1", const char* x2_name = "x2") { + relative_tolerance tol = relative_tolerance(), + const char* x1_name = "x1", + const char* x2_name = "x2") { EXPECT_EQ(x1.rows(), x2.rows()) << "expect_near_rel (Eigen::Matrix)" << " rows must be same size." << x1_name << ".rows() = " << x1.rows() @@ -168,9 +174,10 @@ inline void expect_near_rel(const std::string& msg, EigMat1&& x1, EigMat2&& x2, */ template inline void expect_near_rel(const std::string& msg, const std::vector& x1, - const std::vector& x2, - relative_tolerance tol = relative_tolerance(), - const char* x1_name = "x1", const char* x2_name = "x2") { + const std::vector& x2, + relative_tolerance tol = relative_tolerance(), + const char* x1_name = "x1", + const char* x2_name = "x2") { EXPECT_EQ(x1.size(), x2.size()) << "expect_near_rel (std::vector):" << " vectors must be same size. " << x1_name << ".size() = " << x1.size() @@ -196,9 +203,10 @@ inline void expect_near_rel(const std::string& msg, const std::vector& x1, */ template inline void expect_near_rel(const std::string& msg, const std::complex& z1, - const std::complex& z2, - relative_tolerance tol = relative_tolerance(), - const char* x1_name = "x1", const char* x2_name = "x2") { + const std::complex& z2, + relative_tolerance tol = relative_tolerance(), + const char* x1_name = "x1", + const char* x2_name = "x2") { expect_near_rel(msg, z1.real(), z2.real(), tol, x1_name, x2_name); expect_near_rel(msg, z1.imag(), z2.imag(), tol, x1_name, x2_name); } @@ -218,9 +226,10 @@ inline void expect_near_rel(const std::string& msg, const std::complex& z1, */ template inline void expect_near_rel(const std::string& msg, const T1& x1, - const std::complex& z2, - relative_tolerance tol = relative_tolerance(), - const char* x1_name = "x1", const char* x2_name = "x2") { + const std::complex& z2, + relative_tolerance tol = relative_tolerance(), + const char* x1_name = "x1", + const char* x2_name = "x2") { expect_near_rel(msg, x1, z2.real(), tol, x1_name, x2_name); expect_near_rel(msg, 0, z2.imag(), tol, x1_name, x2_name); } @@ -240,9 +249,10 @@ inline void expect_near_rel(const std::string& msg, const T1& x1, */ template inline void expect_near_rel(const std::string& msg, const std::complex& z1, - const T2& x2, - relative_tolerance tol = relative_tolerance(), - const char* x1_name = "x1", const char* x2_name = "x2") { + const T2& x2, + relative_tolerance tol = relative_tolerance(), + const char* x1_name = "x1", + const char* x2_name = "x2") { expect_near_rel(msg, z1.real(), x2, tol, x1_name, x2_name); expect_near_rel(msg, z1.imag(), 0, tol, x1_name, x2_name); } diff --git a/test/unit/math/mix/fun/append_array_test.cpp b/test/unit/math/mix/fun/append_array_test.cpp index d6965d4b968..d570e4f4d6f 100644 --- a/test/unit/math/mix/fun/append_array_test.cpp +++ b/test/unit/math/mix/fun/append_array_test.cpp @@ -191,7 +191,7 @@ inline void check_eq(const int& z1, const int& z2) { */ template inline void check_eq(const Eigen::Matrix& z1, - const Eigen::Matrix& z2) { + const Eigen::Matrix& z2) { EXPECT_EQ(z1.rows(), z2.rows()); EXPECT_EQ(z1.cols(), z2.cols()); diff --git a/test/unit/math/mix/fun/diag_post_multiply_test.cpp b/test/unit/math/mix/fun/diag_post_multiply_test.cpp index 19d874fcd05..4c2dffe94d6 100644 --- a/test/unit/math/mix/fun/diag_post_multiply_test.cpp +++ b/test/unit/math/mix/fun/diag_post_multiply_test.cpp @@ -1,7 +1,7 @@ #include inline void expect_diag_post_multiply(const Eigen::MatrixXd& a, - const Eigen::VectorXd& v) { + const Eigen::VectorXd& v) { auto f = [](const auto& x, const auto& y) { return stan::math::diag_post_multiply(x, y); }; diff --git a/test/unit/math/mix/fun/diag_pre_multiply_test.cpp b/test/unit/math/mix/fun/diag_pre_multiply_test.cpp index 915a67d0ef8..b874607edce 100644 --- a/test/unit/math/mix/fun/diag_pre_multiply_test.cpp +++ b/test/unit/math/mix/fun/diag_pre_multiply_test.cpp @@ -2,7 +2,7 @@ #include inline void expect_diag_pre_multiply(const Eigen::VectorXd& v, - const Eigen::MatrixXd& a) { + const Eigen::MatrixXd& a) { auto f = [](const auto& x, const auto& y) { return stan::math::diag_pre_multiply(x, y); }; diff --git a/test/unit/math/mix/fun/eigen_comparisons_test.cpp b/test/unit/math/mix/fun/eigen_comparisons_test.cpp index 18124aa4073..84fa44b6bee 100644 --- a/test/unit/math/mix/fun/eigen_comparisons_test.cpp +++ b/test/unit/math/mix/fun/eigen_comparisons_test.cpp @@ -4,8 +4,9 @@ template -inline void test_comparison(Op operation, const Container1Plain& container1_plain, - const Container2Plain& container2_plain) { +inline void test_comparison(Op operation, + const Container1Plain& container1_plain, + const Container2Plain& container2_plain) { EXPECT_MATRIX_EQ( operation(container1_plain, container2_plain), operation(ContainerT1(container1_plain), ContainerT2(container2_plain))); @@ -17,9 +18,9 @@ inline void test_comparison(Op operation, const Container1Plain& container1_plai template -inline void test_comparison_combinations(Op operation, - const ContainerPlain& container1_plain, - const ContainerPlain& container2_plain) { +inline void test_comparison_combinations( + Op operation, const ContainerPlain& container1_plain, + const ContainerPlain& container2_plain) { test_comparison(operation, container1_plain, container2_plain); test_comparison( diff --git a/test/unit/math/mix/fun/log_mix_part2_test.cpp b/test/unit/math/mix/fun/log_mix_part2_test.cpp index 73c7e3689aa..f23883d360f 100644 --- a/test/unit/math/mix/fun/log_mix_part2_test.cpp +++ b/test/unit/math/mix/fun/log_mix_part2_test.cpp @@ -3,7 +3,7 @@ #include inline void expect_log_mix(const std::vector& p, - const std::vector& d) { + const std::vector& d) { auto f = [](const auto& x, const auto& y) { return stan::math::log_mix(x, y); }; stan::test::ad_tolerances tols; @@ -42,7 +42,7 @@ inline std::vector to_row_vectors( } inline void expect_log_mix(const std::vector& p, - const std::vector>& ds) { + const std::vector>& ds) { auto f = [](const auto& x, const auto& y) { return stan::math::log_mix(x, y); }; stan::test::ad_tolerances tols; diff --git a/test/unit/math/mix/fun/sd_test.cpp b/test/unit/math/mix/fun/sd_test.cpp index e9f4538ee1b..7160953b6d4 100644 --- a/test/unit/math/mix/fun/sd_test.cpp +++ b/test/unit/math/mix/fun/sd_test.cpp @@ -2,7 +2,7 @@ template inline void expect_sd(const T& m, const stan::test::ad_tolerances& tols - = stan::test::ad_tolerances()) { + = stan::test::ad_tolerances()) { auto f = [](const auto& x) { return stan::math::sd(x); }; Eigen::VectorXd v(m.size()); Eigen::RowVectorXd rv(m.size()); diff --git a/test/unit/math/mix/fun/sort_test.cpp b/test/unit/math/mix/fun/sort_test.cpp index a41292c6f77..dcea470c9cf 100644 --- a/test/unit/math/mix/fun/sort_test.cpp +++ b/test/unit/math/mix/fun/sort_test.cpp @@ -3,8 +3,8 @@ #include inline void expect_sort(const std::vector& sv, - const stan::test::ad_tolerances& tols - = stan::test::ad_tolerances()) { + const stan::test::ad_tolerances& tols + = stan::test::ad_tolerances()) { auto f_asc = [](const auto& x) { return stan::math::sort_asc(x); }; auto f_desc = [](const auto& x) { return stan::math::sort_desc(x); }; diff --git a/test/unit/math/mix/fun/squared_distance_test.cpp b/test/unit/math/mix/fun/squared_distance_test.cpp index 2c71f963731..956c795ecbc 100644 --- a/test/unit/math/mix/fun/squared_distance_test.cpp +++ b/test/unit/math/mix/fun/squared_distance_test.cpp @@ -17,9 +17,9 @@ TEST(mathMixScalFun, squaredDistance) { stan::test::expect_ad(f, nan, nan); } inline void expect_squared_distance(const std::vector& sv1, - const std::vector& sv2, - const stan::test::ad_tolerances& tols - = stan::test::ad_tolerances()) { + const std::vector& sv2, + const stan::test::ad_tolerances& tols + = stan::test::ad_tolerances()) { auto f = [](const auto& x, const auto& y) { return stan::math::squared_distance(x, y); }; diff --git a/test/unit/math/mix/functor/finite_diff_grad_hessian_auto_test.cpp b/test/unit/math/mix/functor/finite_diff_grad_hessian_auto_test.cpp index 4cae04c02d2..d5946aac4f5 100644 --- a/test/unit/math/mix/functor/finite_diff_grad_hessian_auto_test.cpp +++ b/test/unit/math/mix/functor/finite_diff_grad_hessian_auto_test.cpp @@ -6,7 +6,7 @@ template inline void test_grad_hessian_finite_diff(const std::string& msg, const F& f, - Eigen::VectorXd& x) { + Eigen::VectorXd& x) { double fx; Eigen::VectorXd grad_fx; Eigen::MatrixXd hess_fx; diff --git a/test/unit/math/mix/prob/higher_order_utils.hpp b/test/unit/math/mix/prob/higher_order_utils.hpp index 0905fc5b90f..7285c6bf15d 100644 --- a/test/unit/math/mix/prob/higher_order_utils.hpp +++ b/test/unit/math/mix/prob/higher_order_utils.hpp @@ -5,15 +5,16 @@ #include inline void test_hess_eq(Eigen::Matrix hess_1, - Eigen::Matrix hess_2) { + Eigen::Matrix hess_2) { for (int i = 0; i < hess_1.size(); ++i) { double tolerance = 1e-6 * fmax(fabs(hess_1(i)), fabs(hess_2(i))) + 1e-10; EXPECT_NEAR(hess_1(i), hess_2(i), tolerance); } } -inline void test_grad_hess_eq(std::vector > g_hess_1, - std::vector > g_hess_2) { +inline void test_grad_hess_eq( + std::vector > g_hess_1, + std::vector > g_hess_2) { for (size_t m = 0; m < g_hess_1.size(); ++m) for (int i = 0; i < g_hess_1[m].size(); ++i) { double tolerance diff --git a/test/unit/math/opencl/kernel_generator/reference_kernel.hpp b/test/unit/math/opencl/kernel_generator/reference_kernel.hpp index e486fa8526c..54b5fc6c2f7 100644 --- a/test/unit/math/opencl/kernel_generator/reference_kernel.hpp +++ b/test/unit/math/opencl/kernel_generator/reference_kernel.hpp @@ -32,7 +32,7 @@ inline std::string load_reference_kernel(const std::string& filename) { * @throw ios_base::failure File could not be opened or written. */ inline void store_reference_kernel_if_needed(const std::string& filename, - const std::string& kernel) { + const std::string& kernel) { #ifdef STAN_TEST_KERNEL_GENERATOR_STORE_REFERENCE_KERNELS std::string path = "test/unit/math/opencl/kernel_generator/reference_kernels/" + filename; diff --git a/test/unit/math/opencl/util.hpp b/test/unit/math/opencl/util.hpp index 8cc2fb7eae2..de712ee6279 100644 --- a/test/unit/math/opencl/util.hpp +++ b/test/unit/math/opencl/util.hpp @@ -73,7 +73,7 @@ inline void expect_eq(const T1& a, const T2& b, const char* msg) { } template inline void expect_eq(const std::vector& a, const std::vector& b, - const char* msg) { + const char* msg) { EXPECT_EQ(a.size(), b.size()); for (int i = 0; i < a.size(); i++) { expect_eq(a[i], b[i], msg); @@ -119,7 +119,7 @@ inline void expect_adj_near(const T1& a, const T2& b, const char* msg) { } template inline void expect_adj_near(const std::vector& a, const std::vector& b, - const char* msg) { + const char* msg) { EXPECT_EQ(a.size(), b.size()) << msg; for (int i = 0; i < a.size(); i++) { expect_adj_near(a[i], b[i], msg); @@ -132,7 +132,7 @@ inline void prim_rev_argument_combinations(Functor f) { } template inline void prim_rev_argument_combinations(const Functor& f, const Arg0& arg0, - const Args&... args) { + const Args&... args) { prim_rev_argument_combinations( [&f, &arg0](const auto& args1, const auto& args2) { constexpr size_t Size @@ -157,8 +157,8 @@ inline void prim_rev_argument_combinations(const Functor& f, const Arg0& arg0, template inline void compare_cpu_opencl_prim_rev_impl(const Functor& functor, - std::index_sequence, - const Args&... args) { + std::index_sequence, + const Args&... args) { prim_rev_argument_combinations( [&functor](const auto& args_for_cpu, const auto& args_for_opencl) { std::string signature = type_name().data(); @@ -193,9 +193,9 @@ inline void compare_cpu_opencl_prim_rev_impl(const Functor& functor, template inline void compare_cpu_opencl_prim_rev_impl(const FunctorCPU& functorCPU, - const FunctorCL& functorCL, - std::index_sequence, - const Args&... args) { + const FunctorCL& functorCL, + std::index_sequence, + const Args&... args) { prim_rev_argument_combinations( [&functorCPU, &functorCL](const auto& args_for_cpu, const auto& args_for_opencl) { @@ -243,8 +243,8 @@ int64_t rows(const T& x) { template inline void test_opencl_broadcasting_prim_rev_impl(const Functor& functor, - std::index_sequence, - const Args&... args) { + std::index_sequence, + const Args&... args) { prim_rev_argument_combinations( [&functor, N = std::max({rows(args)...})](const auto& args_broadcast, const auto& args_vector) { @@ -304,7 +304,8 @@ inline void test_opencl_broadcasting_prim_rev_impl(const Functor& functor, * in CPU memory (no vars, no arguments on the OpenCL device). */ template -inline void compare_cpu_opencl_prim(const Functor& functor, const Args&... args) { +inline void compare_cpu_opencl_prim(const Functor& functor, + const Args&... args) { auto res_cpu = eval(functor(args...)); auto res_opencl = eval(functor(internal::opencl_argument(args)...)); internal::expect_eq(res_cpu, res_opencl, @@ -328,7 +329,8 @@ inline void compare_cpu_opencl_prim(const Functor& functor, const Args&... args) * in CPU memory (no vars, no arguments on the OpenCL device). */ template -inline void compare_cpu_opencl_prim_rev(const Functor& functor, const Args&... args) { +inline void compare_cpu_opencl_prim_rev(const Functor& functor, + const Args&... args) { internal::compare_cpu_opencl_prim_rev_impl( functor, std::make_index_sequence{}, args...); recover_memory(); @@ -353,8 +355,8 @@ inline void compare_cpu_opencl_prim_rev(const Functor& functor, const Args&... a */ template inline void compare_cpu_opencl_prim_rev_separate(const FunctorCPU& functorCPU, - const FunctorCL& fucntorCL, - const Args&... args) { + const FunctorCL& fucntorCL, + const Args&... args) { internal::compare_cpu_opencl_prim_rev_impl( functorCPU, fucntorCL, std::make_index_sequence{}, args...); @@ -385,7 +387,7 @@ template >>* = nullptr> inline void test_opencl_broadcasting_prim_rev(const Functor& functor, - const Args&... args) { + const Args&... args) { internal::test_opencl_broadcasting_prim_rev_impl( functor, std::make_index_sequence{}, args...); recover_memory(); diff --git a/test/unit/math/prim/fun/linspaced_row_vector_test.cpp b/test/unit/math/prim/fun/linspaced_row_vector_test.cpp index 2719decdb08..4718a99363c 100644 --- a/test/unit/math/prim/fun/linspaced_row_vector_test.cpp +++ b/test/unit/math/prim/fun/linspaced_row_vector_test.cpp @@ -4,7 +4,7 @@ #include inline void expect_linspaced_row_vector(int K, double low, double high, - const Eigen::RowVectorXd& expected) { + const Eigen::RowVectorXd& expected) { Eigen::RowVectorXd found = stan::math::linspaced_row_vector(K, low, high); EXPECT_MATRIX_FLOAT_EQ(expected, found); } diff --git a/test/unit/math/prim/fun/linspaced_vector_test.cpp b/test/unit/math/prim/fun/linspaced_vector_test.cpp index 7520f0a35c3..f8ebc5bc9be 100644 --- a/test/unit/math/prim/fun/linspaced_vector_test.cpp +++ b/test/unit/math/prim/fun/linspaced_vector_test.cpp @@ -4,7 +4,7 @@ #include inline void expect_linspaced_vector(int K, double low, double high, - const Eigen::VectorXd& expected) { + const Eigen::VectorXd& expected) { Eigen::VectorXd found = stan::math::linspaced_vector(K, low, high); EXPECT_MATRIX_FLOAT_EQ(expected, found); } diff --git a/test/unit/math/prim/fun/log_softmax_test.cpp b/test/unit/math/prim/fun/log_softmax_test.cpp index 0b84292fd1e..27f682a17ff 100644 --- a/test/unit/math/prim/fun/log_softmax_test.cpp +++ b/test/unit/math/prim/fun/log_softmax_test.cpp @@ -2,7 +2,8 @@ #include #include -inline void test_log_softmax(const Eigen::Matrix& theta) { +inline void test_log_softmax( + const Eigen::Matrix& theta) { using Eigen::Dynamic; using Eigen::Matrix; using stan::math::log_softmax; diff --git a/test/unit/math/prim/fun/multiply_lower_tri_self_transpose_test.cpp b/test/unit/math/prim/fun/multiply_lower_tri_self_transpose_test.cpp index 4c7a9289b1d..da5231f2030 100644 --- a/test/unit/math/prim/fun/multiply_lower_tri_self_transpose_test.cpp +++ b/test/unit/math/prim/fun/multiply_lower_tri_self_transpose_test.cpp @@ -15,7 +15,8 @@ inline stan::math::matrix_d generate_large_L_tri_mat() { return x; } -inline void test_multiply_lower_tri_self_transpose(const stan::math::matrix_d& x) { +inline void test_multiply_lower_tri_self_transpose( + const stan::math::matrix_d& x) { using stan::math::multiply_lower_tri_self_transpose; stan::math::matrix_d y = multiply_lower_tri_self_transpose(x); stan::math::matrix_d xp = x; diff --git a/test/unit/math/prim/fun/ternary_scalar_tester.hpp b/test/unit/math/prim/fun/ternary_scalar_tester.hpp index c509f278e4a..6d31ef6a3fe 100644 --- a/test/unit/math/prim/fun/ternary_scalar_tester.hpp +++ b/test/unit/math/prim/fun/ternary_scalar_tester.hpp @@ -25,7 +25,7 @@ namespace test { template * = nullptr> inline void ternary_scalar_tester_impl(const F& f, const T1& x, const T2& y, - const T3& z) { + const T3& z) { auto mat_mat_mat = math::eval(f(x, y, z)); auto mat_mat_scal = math::eval(f(x, y, z(0))); auto mat_scal_scal = math::eval(f(x, y(0), z(0))); @@ -147,7 +147,7 @@ inline void ternary_scalar_tester_impl(const F& f, const T1& x, const T2& y, template * = nullptr> inline void ternary_scalar_tester_impl(const F& f, const T1& x, const T2& y, - const T3& z) { + const T3& z) { auto mat_mat_mat = math::eval(f(x, y, z)); auto mat_mat_scal = math::eval(f(x, y, z[0])); auto mat_scal_scal = math::eval(f(x, y[0], z[0])); @@ -266,7 +266,8 @@ inline void ternary_scalar_tester_impl(const F& f, const T1& x, const T2& y, */ template * = nullptr> -inline void ternary_scalar_tester(const F& f, const T1& x, const T2& y, const T3& z) { +inline void ternary_scalar_tester(const F& f, const T1& x, const T2& y, + const T3& z) { ternary_scalar_tester_impl(f, x, y, z); ternary_scalar_tester_impl(f, x.transpose().eval(), y.transpose().eval(), z.transpose().eval()); diff --git a/test/unit/math/prim/fun/to_matrix_test.cpp b/test/unit/math/prim/fun/to_matrix_test.cpp index 5862c0a4afa..936636d0a72 100644 --- a/test/unit/math/prim/fun/to_matrix_test.cpp +++ b/test/unit/math/prim/fun/to_matrix_test.cpp @@ -71,7 +71,8 @@ TEST(ToMatrixMatrix, answers) { } // Matrix -> Matrix (with reshape) -inline void test_to_matrix_matrix_reshape_answers(int m1, int n1, int m2, int n2) { +inline void test_to_matrix_matrix_reshape_answers(int m1, int n1, int m2, + int n2) { using stan::math::to_matrix; Eigen::MatrixXd a(m1, n1); Eigen::MatrixXd b(m2, n2); diff --git a/test/unit/math/prim/functor/hcubature_test.cpp b/test/unit/math/prim/functor/hcubature_test.cpp index 0669d7a9086..006decbbf75 100644 --- a/test/unit/math/prim/functor/hcubature_test.cpp +++ b/test/unit/math/prim/functor/hcubature_test.cpp @@ -101,9 +101,10 @@ inline auto f7(const T_x& x, double a) { template -inline void test_integration(const F& f, const ArgsTupleT& pars, int dim, const T_a& a, - const T_b& b, int maxEval, double reqAbsError, - const T_relerr& reqRelError, double val) { +inline void test_integration(const F& f, const ArgsTupleT& pars, int dim, + const T_a& a, const T_b& b, int maxEval, + double reqAbsError, const T_relerr& reqRelError, + double val) { using stan::math::hcubature; for (auto tolerance : reqRelError) { diff --git a/test/unit/math/prim/functor/integrate_1d_impl_test.cpp b/test/unit/math/prim/functor/integrate_1d_impl_test.cpp index 9ca35d7123d..50b94969a66 100644 --- a/test/unit/math/prim/functor/integrate_1d_impl_test.cpp +++ b/test/unit/math/prim/functor/integrate_1d_impl_test.cpp @@ -151,7 +151,7 @@ struct f16 { }; inline double lbaX_pdf(double X, double t, double A, double v, double s, - std::ostream *pstream__) { + std::ostream *pstream__) { double b_A_tv_ts; double b_tv_ts; double term_1; @@ -167,7 +167,7 @@ inline double lbaX_pdf(double X, double t, double A, double v, double s, } inline double lbaX_cdf(double X, double t, double A, double v, double s, - std::ostream *pstream__) { + std::ostream *pstream__) { double b_A_tv; double b_tv; double ts; @@ -192,9 +192,11 @@ inline double lbaX_cdf(double X, double t, double A, double v, double s, return cdf; } -inline double rank_density(double x, double xc, const std::vector &theta, - const std::vector &x_r, const std::vector &x_i, - std::ostream *pstream__) { +inline double rank_density(double x, double xc, + const std::vector &theta, + const std::vector &x_r, + const std::vector &x_i, + std::ostream *pstream__) { double t = theta[0]; double A = theta[1]; double v1 = theta[2]; @@ -215,7 +217,7 @@ struct rank_density_functor__ { }; inline double order(double down, double up, const std::vector &theta, - const std::vector &x_r, std::ostream *pstream__) { + const std::vector &x_r, std::ostream *pstream__) { std::vector x_i; double v; @@ -253,7 +255,7 @@ inline double order(double down, double up, const std::vector &theta, */ template inline void test_integration(const F &f, double a, double b, double val, - const Args &... args) { + const Args &... args) { using stan::math::integrate_1d_impl; std::vector tolerances = {1e-4, 1e-6, 1e-8}; diff --git a/test/unit/math/prim/functor/integrate_1d_test.cpp b/test/unit/math/prim/functor/integrate_1d_test.cpp index c9c90383f37..75d65d5916f 100644 --- a/test/unit/math/prim/functor/integrate_1d_test.cpp +++ b/test/unit/math/prim/functor/integrate_1d_test.cpp @@ -215,7 +215,7 @@ struct f17 { }; inline double lbaX_pdf(double X, double t, double A, double v, double s, - std::ostream *pstream__) { + std::ostream *pstream__) { double b_A_tv_ts; double b_tv_ts; double term_1; @@ -231,7 +231,7 @@ inline double lbaX_pdf(double X, double t, double A, double v, double s, } inline double lbaX_cdf(double X, double t, double A, double v, double s, - std::ostream *pstream__) { + std::ostream *pstream__) { double b_A_tv; double b_tv; double ts; @@ -256,9 +256,11 @@ inline double lbaX_cdf(double X, double t, double A, double v, double s, return cdf; } -inline double rank_density(double x, double xc, const std::vector &theta, - const std::vector &x_r, const std::vector &x_i, - std::ostream *pstream__) { +inline double rank_density(double x, double xc, + const std::vector &theta, + const std::vector &x_r, + const std::vector &x_i, + std::ostream *pstream__) { double t = theta[0]; double A = theta[1]; double v1 = theta[2]; @@ -278,7 +280,7 @@ struct rank_density_functor__ { }; inline double order(double down, double up, const std::vector &theta, - const std::vector &x_r, std::ostream *pstream__) { + const std::vector &x_r, std::ostream *pstream__) { std::vector x_i; double v; @@ -316,9 +318,9 @@ inline double order(double down, double up, const std::vector &theta, */ template inline void test_integration(const F &f, double a, double b, - std::vector thetas, - const std::vector &x_r, - const std::vector &x_i, double val) { + std::vector thetas, + const std::vector &x_r, + const std::vector &x_i, double val) { using stan::math::integrate_1d; std::vector tolerances = {1e-4, 1e-6, 1e-8}; diff --git a/test/unit/math/prim/meta/apply_template_permutations.hpp b/test/unit/math/prim/meta/apply_template_permutations.hpp index 2dc804c0711..1680c0d3d56 100644 --- a/test/unit/math/prim/meta/apply_template_permutations.hpp +++ b/test/unit/math/prim/meta/apply_template_permutations.hpp @@ -132,7 +132,8 @@ struct apply_template_permutations_helper -inline void apply_template_permutations(const T_functor& func, const T_param& param) { +inline void apply_template_permutations(const T_functor& func, + const T_param& param) { apply_template_permutations_helper::value - 1, diff --git a/test/unit/math/prim/prob/matrix_normal_prec_rng_test.cpp b/test/unit/math/prim/prob/matrix_normal_prec_rng_test.cpp index 0d3b4f7cc9f..18fad92196e 100644 --- a/test/unit/math/prim/prob/matrix_normal_prec_rng_test.cpp +++ b/test/unit/math/prim/prob/matrix_normal_prec_rng_test.cpp @@ -131,9 +131,9 @@ TEST(ProbDistributionsMatrixNormalPrecRng, ErrorSize) { * Assert that the samples come from the normal distribution with this * mean and variance. */ -inline void assert_matches_normal_distribution(const double mean, - const double variance, - const std::vector &samples) { +inline void assert_matches_normal_distribution( + const double mean, const double variance, + const std::vector &samples) { using Eigen::MatrixXd; using stan::math::matrix_normal_prec_rng; int N = samples.size(); @@ -146,8 +146,9 @@ inline void assert_matches_normal_distribution(const double mean, assert_matches_quantiles(samples, quantiles, 1e-6); } -inline std::vector extract_entry(const unsigned int r, const unsigned int c, - const std::vector &samples) { +inline std::vector extract_entry( + const unsigned int r, const unsigned int c, + const std::vector &samples) { using Eigen::MatrixXd; using stan::math::matrix_normal_prec_rng; std::vector univariate_samples; diff --git a/test/unit/math/prim/prob/neg_binomial_test.cpp b/test/unit/math/prim/prob/neg_binomial_test.cpp index 8a18143f618..7d1240ccd85 100644 --- a/test/unit/math/prim/prob/neg_binomial_test.cpp +++ b/test/unit/math/prim/prob/neg_binomial_test.cpp @@ -72,7 +72,7 @@ TEST(ProbDistributionsNegBinomial, error_check) { } inline void expected_bin_sizes(double* expect, const int K, const int N, - const double alpha, const double beta) { + const double alpha, const double beta) { long double p = 0; for (int i = 0; i < K; i++) { expect[i] = N * std::exp(stan::math::neg_binomial_lpmf(i, alpha, beta)); diff --git a/test/unit/math/prim/prob/ordered_logistic_test.cpp b/test/unit/math/prim/prob/ordered_logistic_test.cpp index e87a14734f6..423d211ea6a 100644 --- a/test/unit/math/prim/prob/ordered_logistic_test.cpp +++ b/test/unit/math/prim/prob/ordered_logistic_test.cpp @@ -5,8 +5,8 @@ #include #include -inline stan::math::vector_d get_simplex_inv_logit(double lambda, - const stan::math::vector_d& c) { +inline stan::math::vector_d get_simplex_inv_logit( + double lambda, const stan::math::vector_d& c) { using stan::math::inv_logit; int K = c.size() + 1; stan::math::vector_d theta(K); diff --git a/test/unit/math/prim/prob/ordered_probit_test.cpp b/test/unit/math/prim/prob/ordered_probit_test.cpp index eb6978aaa92..c9c5094afcc 100644 --- a/test/unit/math/prim/prob/ordered_probit_test.cpp +++ b/test/unit/math/prim/prob/ordered_probit_test.cpp @@ -5,7 +5,7 @@ #include inline stan::math::vector_d get_simplex_Phi(double lambda, - const stan::math::vector_d& c) { + const stan::math::vector_d& c) { using stan::math::Phi; int K = c.size() + 1; stan::math::vector_d theta(K); diff --git a/test/unit/math/prim/prob/util.hpp b/test/unit/math/prim/prob/util.hpp index eac4d589747..553d3749fe6 100644 --- a/test/unit/math/prim/prob/util.hpp +++ b/test/unit/math/prim/prob/util.hpp @@ -11,7 +11,8 @@ * is consistent with a vector of expected counts. Useful for testing RNGs. */ inline void assert_chi_squared(const std::vector& counts, - const std::vector& expected, double tolerance) { + const std::vector& expected, + double tolerance) { int bins = counts.size(); EXPECT_EQ(bins, expected.size()); @@ -34,9 +35,9 @@ inline void assert_chi_squared(const std::vector& counts, * test. bin_boundaries is assumed sorted in increasing order. **/ inline void assert_matches_bins(const std::vector& samples, - const std::vector& bin_boundaries, - const std::vector& proportions, - double tolerance) { + const std::vector& bin_boundaries, + const std::vector& proportions, + double tolerance) { ASSERT_GT(samples.size(), 0); int N = samples.size(); std::vector mysamples = samples; @@ -72,8 +73,8 @@ inline void assert_matches_bins(const std::vector& samples, * upper bounds are given in quantiles in increasing order. */ inline void assert_matches_quantiles(const std::vector& samples, - const std::vector& quantiles, - double tolerance) { + const std::vector& quantiles, + double tolerance) { int K = quantiles.size(); std::vector proportions; for (int i = 0; i < K; ++i) diff --git a/test/unit/math/prim/prob/vector_rng_test_helper.hpp b/test/unit/math/prim/prob/vector_rng_test_helper.hpp index 6abe303971b..717ae8a7ec0 100644 --- a/test/unit/math/prim/prob/vector_rng_test_helper.hpp +++ b/test/unit/math/prim/prob/vector_rng_test_helper.hpp @@ -40,7 +40,7 @@ using ArgumentTypes */ template inline void assign_parameter_values(T_param& params, - const std::vector& values) { + const std::vector& values) { if (values.size() == 0) return; @@ -59,7 +59,7 @@ inline void assign_parameter_values(T_param& params, * @param params Values to copy into params */ inline void assign_parameter_values(std::vector& params, - const std::vector& values) { + const std::vector& values) { if (values.size() == 0) return; @@ -78,7 +78,7 @@ inline void assign_parameter_values(std::vector& params, * @param params Values to copy into params */ inline void assign_parameter_values(std::vector& params, - const std::vector& values) { + const std::vector& values) { if (values.size() == 0) return; @@ -93,7 +93,8 @@ inline void assign_parameter_values(std::vector& params, * @param param Output parameter to write value to * @param params Vector with value to copy into param */ -inline void assign_parameter_values(double& param, const std::vector& values) { +inline void assign_parameter_values(double& param, + const std::vector& values) { if (values.size() == 0) return; @@ -106,7 +107,8 @@ inline void assign_parameter_values(double& param, const std::vector& va * @param param Output parameter to write value to * @param params Vector with value to copy into param */ -inline void assign_parameter_values(int& param, const std::vector& values) { +inline void assign_parameter_values(int& param, + const std::vector& values) { if (values.size() == 0) return; diff --git a/test/unit/math/rev/fun/lbeta_test.cpp b/test/unit/math/rev/fun/lbeta_test.cpp index 93f5afcb565..27615d23fb4 100644 --- a/test/unit/math/rev/fun/lbeta_test.cpp +++ b/test/unit/math/rev/fun/lbeta_test.cpp @@ -21,8 +21,8 @@ struct identity_tolerances { template inline void expect_identity(const std::string& msg, - const identity_tolerances& tolerances, const F1 lh, - const F2 rh, double x_dbl, double y_dbl) { + const identity_tolerances& tolerances, const F1 lh, + const F2 rh, double x_dbl, double y_dbl) { using stan::math::var; using stan::test::expect_near_rel; diff --git a/test/unit/math/rev/fun/util.hpp b/test/unit/math/rev/fun/util.hpp index 7dcccdbf09c..7fdca697ef7 100644 --- a/test/unit/math/rev/fun/util.hpp +++ b/test/unit/math/rev/fun/util.hpp @@ -9,7 +9,8 @@ // vector; Fills the matrix column-wise template -inline void fill(const std::vector& contents, Eigen::Matrix& M) { +inline void fill(const std::vector& contents, + Eigen::Matrix& M) { size_t ij = 0; for (int j = 0; j < C; ++j) for (int i = 0; i < R; ++i) diff --git a/test/unit/math/rev/functor/finite_diff_hessian_auto_test.cpp b/test/unit/math/rev/functor/finite_diff_hessian_auto_test.cpp index 07e25e7f5ca..2115f867074 100644 --- a/test/unit/math/rev/functor/finite_diff_hessian_auto_test.cpp +++ b/test/unit/math/rev/functor/finite_diff_hessian_auto_test.cpp @@ -66,7 +66,7 @@ struct one_arg { template inline void test_hessian_finite_diff(const std::string& msg, const F& f, - Eigen::VectorXd& x) { + Eigen::VectorXd& x) { double fx; Eigen::VectorXd grad_fx; Eigen::MatrixXd hess_fx; diff --git a/test/unit/math/rev/functor/gradient_test.cpp b/test/unit/math/rev/functor/gradient_test.cpp index 7e0ab1f5574..b5f81ff9b0b 100644 --- a/test/unit/math/rev/functor/gradient_test.cpp +++ b/test/unit/math/rev/functor/gradient_test.cpp @@ -391,7 +391,8 @@ TEST(RevFunctor, gradient_array_threaded_tbb) { } #endif -inline stan::math::var sum_and_throw(const Matrix& x) { +inline stan::math::var sum_and_throw( + const Matrix& x) { stan::math::var y = 0; for (int i = 0; i < x.size(); ++i) y += x(i); diff --git a/test/unit/math/rev/functor/integrate_1d_impl_test.cpp b/test/unit/math/rev/functor/integrate_1d_impl_test.cpp index a1b21391893..a6418c21a57 100644 --- a/test/unit/math/rev/functor/integrate_1d_impl_test.cpp +++ b/test/unit/math/rev/functor/integrate_1d_impl_test.cpp @@ -198,11 +198,11 @@ inline double get_adjoint_if_var(double v) { */ template inline void test_derivatives(const F &f, double a, double b, - std::vector thetas, - const std::vector &x_r, - const std::vector &x_i, double val, - std::vector grad, double d_a = 0.0, - double d_b = 0.0) { + std::vector thetas, + const std::vector &x_r, + const std::vector &x_i, double val, + std::vector grad, double d_a = 0.0, + double d_b = 0.0) { using stan::math::value_of; using stan::math::var; diff --git a/test/unit/math/rev/functor/integrate_1d_test.cpp b/test/unit/math/rev/functor/integrate_1d_test.cpp index 7c82b158af2..23f51ef5721 100644 --- a/test/unit/math/rev/functor/integrate_1d_test.cpp +++ b/test/unit/math/rev/functor/integrate_1d_test.cpp @@ -198,11 +198,11 @@ inline double get_adjoint_if_var(double v) { */ template inline void test_derivatives(const F &f, double a, double b, - std::vector thetas, - const std::vector &x_r, - const std::vector &x_i, double val, - std::vector grad, double d_a = 0.0, - double d_b = 0.0) { + std::vector thetas, + const std::vector &x_r, + const std::vector &x_i, double val, + std::vector grad, double d_a = 0.0, + double d_b = 0.0) { using stan::math::value_of; using stan::math::var; diff --git a/test/unit/math/rev/functor/map_rect_concurrent_threads_test.cpp b/test/unit/math/rev/functor/map_rect_concurrent_threads_test.cpp index fbc3e55f4f3..4e6afaa89d8 100644 --- a/test/unit/math/rev/functor/map_rect_concurrent_threads_test.cpp +++ b/test/unit/math/rev/functor/map_rect_concurrent_threads_test.cpp @@ -22,9 +22,9 @@ STAN_REGISTER_MAP_RECT(0, hard_work) STAN_REGISTER_MAP_RECT(1, hard_work) inline void setup_job(int N, Eigen::VectorXd& shared_params_d, - std::vector& job_params_d, - std::vector >& x_r, - std::vector >& x_i) { + std::vector& job_params_d, + std::vector >& x_r, + std::vector >& x_i) { shared_params_d.resize(2); shared_params_d << 2, 0; diff --git a/test/unit/math/rev/functor/util_algebra_solver.hpp b/test/unit/math/rev/functor/util_algebra_solver.hpp index 6a3aaecead2..7a023a7b4d2 100644 --- a/test/unit/math/rev/functor/util_algebra_solver.hpp +++ b/test/unit/math/rev/functor/util_algebra_solver.hpp @@ -457,7 +457,7 @@ inline void error_conditions_test(const F& f, template inline void inline unsolvable_test(Eigen::Matrix& y, - int solver_type = 0, bool use_tol = false) { + int solver_type = 0, bool use_tol = false) { Eigen::VectorXd x(2); x << 1, 1; std::vector dat; @@ -483,7 +483,8 @@ inline void inline unsolvable_test(Eigen::Matrix& y, template inline void inline unsolvable_flag_test(Eigen::Matrix& y, - int solver_type = 0, bool use_tol = false) { + int solver_type = 0, + bool use_tol = false) { Eigen::VectorXd x(2); x << 1, 1; std::vector dat; diff --git a/test/unit/math/rev/prob/categorical2_test.cpp b/test/unit/math/rev/prob/categorical2_test.cpp index d612fce0956..c799aebbd9e 100644 --- a/test/unit/math/rev/prob/categorical2_test.cpp +++ b/test/unit/math/rev/prob/categorical2_test.cpp @@ -5,8 +5,8 @@ template inline void expect_propto_categorical_lpmf(unsigned int n1, T_prob theta1, - unsigned int n2, T_prob theta2, - std::string message) { + unsigned int n2, T_prob theta2, + std::string message) { expect_eq_diffs(stan::math::categorical_lpmf(n1, theta1), stan::math::categorical_lpmf(n2, theta2), stan::math::categorical_lpmf(n1, theta1), diff --git a/test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp b/test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp index 3eb04673f88..fdfc2f892dd 100644 --- a/test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp +++ b/test/unit/math/rev/prob/categorical_logit_glm_lpmf_test.cpp @@ -6,9 +6,9 @@ #include template -inline stan::return_type_t categorical_logit_glm_simple_lpmf( - const std::vector& y, const T_x& x, const T_alpha& alpha, - const T_beta& beta) { +inline stan::return_type_t +categorical_logit_glm_simple_lpmf(const std::vector& y, const T_x& x, + const T_alpha& alpha, const T_beta& beta) { using T_return = stan::return_type_t; const size_t N_instances = x.rows(); diff --git a/test/unit/math/rev/prob/dirichlet2_test.cpp b/test/unit/math/rev/prob/dirichlet2_test.cpp index 4d0b0724b18..8953f180ffd 100644 --- a/test/unit/math/rev/prob/dirichlet2_test.cpp +++ b/test/unit/math/rev/prob/dirichlet2_test.cpp @@ -4,9 +4,11 @@ #include template -inline void expect_propto_dirichlet_lpdf(T_prob theta, T_prior_sample_size alpha, - T_prob theta2, T_prior_sample_size alpha2, - std::string message) { +inline void expect_propto_dirichlet_lpdf(T_prob theta, + T_prior_sample_size alpha, + T_prob theta2, + T_prior_sample_size alpha2, + std::string message) { expect_eq_diffs(stan::math::dirichlet_lpdf(theta, alpha), stan::math::dirichlet_lpdf(theta2, alpha2), stan::math::dirichlet_lpdf(theta, alpha), diff --git a/test/unit/math/rev/prob/expect_eq_diffs.hpp b/test/unit/math/rev/prob/expect_eq_diffs.hpp index 2db47db915a..b652f73aef9 100644 --- a/test/unit/math/rev/prob/expect_eq_diffs.hpp +++ b/test/unit/math/rev/prob/expect_eq_diffs.hpp @@ -6,16 +6,18 @@ #include inline void expect_eq_diffs(double x1, double x2, double y1, double y2, - std::string message = "") { + std::string message = "") { if (std::isnan(x1 - x2)) EXPECT_TRUE(std::isnan(y1 - y2)) << message; else EXPECT_FLOAT_EQ(x1 - x2, y1 - y2) << message; } -inline void expect_eq_diffs(const stan::math::var& x1, const stan::math::var& x2, - const stan::math::var& y1, const stan::math::var& y2, - std::string message = "") { +inline void expect_eq_diffs(const stan::math::var& x1, + const stan::math::var& x2, + const stan::math::var& y1, + const stan::math::var& y2, + std::string message = "") { expect_eq_diffs(x1.val(), x2.val(), y1.val(), y2.val(), message); } diff --git a/test/unit/math/rev/prob/inv_wishart2_test.cpp b/test/unit/math/rev/prob/inv_wishart2_test.cpp index 005cc9cefad..dd51246d169 100644 --- a/test/unit/math/rev/prob/inv_wishart2_test.cpp +++ b/test/unit/math/rev/prob/inv_wishart2_test.cpp @@ -5,9 +5,9 @@ #include template -inline void expect_propto_inv_wishart_lpdf(T_y W1, T_dof nu1, T_scale S1, T_y W2, - T_dof nu2, T_scale S2, - std::string message) { +inline void expect_propto_inv_wishart_lpdf(T_y W1, T_dof nu1, T_scale S1, + T_y W2, T_dof nu2, T_scale S2, + std::string message) { expect_eq_diffs(stan::math::inv_wishart_lpdf(W1, nu1, S1), stan::math::inv_wishart_lpdf(W2, nu2, S2), stan::math::inv_wishart_lpdf(W1, nu1, S1), diff --git a/test/unit/math/rev/prob/inv_wishart_cholesky_test.cpp b/test/unit/math/rev/prob/inv_wishart_cholesky_test.cpp index 180c968ee17..00c21826110 100644 --- a/test/unit/math/rev/prob/inv_wishart_cholesky_test.cpp +++ b/test/unit/math/rev/prob/inv_wishart_cholesky_test.cpp @@ -5,9 +5,10 @@ #include template -inline void expect_propto_inv_wishart_cholesky_lpdf(T_y L_Y1, T_dof nu1, T_scale L_S1, - T_y L_Y2, T_dof nu2, T_scale L_S2, - std::string message) { +inline void expect_propto_inv_wishart_cholesky_lpdf(T_y L_Y1, T_dof nu1, + T_scale L_S1, T_y L_Y2, + T_dof nu2, T_scale L_S2, + std::string message) { expect_eq_diffs(stan::math::inv_wishart_cholesky_lpdf(L_Y1, nu1, L_S1), stan::math::inv_wishart_cholesky_lpdf(L_Y2, nu2, L_S2), stan::math::inv_wishart_cholesky_lpdf(L_Y1, nu1, L_S1), diff --git a/test/unit/math/rev/prob/multi_gp2_test.cpp b/test/unit/math/rev/prob/multi_gp2_test.cpp index c0b06738641..cb10dce05c3 100644 --- a/test/unit/math/rev/prob/multi_gp2_test.cpp +++ b/test/unit/math/rev/prob/multi_gp2_test.cpp @@ -8,8 +8,8 @@ #include template -inline void expect_propto(T_y y1, T_scale sigma1, T_w w1, T_y y2, T_scale sigma2, - T_w w2, std::string message = "") { +inline void expect_propto(T_y y1, T_scale sigma1, T_w w1, T_y y2, + T_scale sigma2, T_w w2, std::string message = "") { expect_eq_diffs(stan::math::multi_gp_lpdf(y1, sigma1, w1), stan::math::multi_gp_lpdf(y2, sigma2, w2), stan::math::multi_gp_lpdf(y1, sigma1, w1), diff --git a/test/unit/math/rev/prob/multi_gp_cholesky2_test.cpp b/test/unit/math/rev/prob/multi_gp_cholesky2_test.cpp index 088928fa79e..bda7f3538dd 100644 --- a/test/unit/math/rev/prob/multi_gp_cholesky2_test.cpp +++ b/test/unit/math/rev/prob/multi_gp_cholesky2_test.cpp @@ -8,9 +8,9 @@ #include template -inline void expect_propto_multi_gp_cholesky_lpdf(T_y y1, T_scale L1, T_w w1, T_y y2, - T_scale L2, T_w w2, - std::string message = "") { +inline void expect_propto_multi_gp_cholesky_lpdf(T_y y1, T_scale L1, T_w w1, + T_y y2, T_scale L2, T_w w2, + std::string message = "") { expect_eq_diffs(stan::math::multi_gp_cholesky_lpdf(y1, L1, w1), stan::math::multi_gp_cholesky_lpdf(y2, L2, w2), stan::math::multi_gp_cholesky_lpdf(y1, L1, w1), diff --git a/test/unit/math/rev/prob/multi_normal2_test.cpp b/test/unit/math/rev/prob/multi_normal2_test.cpp index a190434ac62..007897e867f 100644 --- a/test/unit/math/rev/prob/multi_normal2_test.cpp +++ b/test/unit/math/rev/prob/multi_normal2_test.cpp @@ -9,9 +9,9 @@ #include template -inline void expect_propto_multi_normal_lpdf(T_y y1, T_loc mu1, T_scale sigma1, T_y y2, - T_loc mu2, T_scale sigma2, - std::string message = "") { +inline void expect_propto_multi_normal_lpdf(T_y y1, T_loc mu1, T_scale sigma1, + T_y y2, T_loc mu2, T_scale sigma2, + std::string message = "") { expect_eq_diffs(stan::math::multi_normal_lpdf(y1, mu1, sigma1), stan::math::multi_normal_lpdf(y2, mu2, sigma2), stan::math::multi_normal_lpdf(y1, mu1, sigma1), diff --git a/test/unit/math/rev/prob/multi_normal_prec2_test.cpp b/test/unit/math/rev/prob/multi_normal_prec2_test.cpp index e94f750f445..9b9ffc0ffe1 100644 --- a/test/unit/math/rev/prob/multi_normal_prec2_test.cpp +++ b/test/unit/math/rev/prob/multi_normal_prec2_test.cpp @@ -9,9 +9,10 @@ #include template -inline void expect_propto_multi_normal_prec_lpdf(T_y y1, T_loc mu1, T_scale sigma1, - T_y y2, T_loc mu2, T_scale sigma2, - std::string message = "") { +inline void expect_propto_multi_normal_prec_lpdf(T_y y1, T_loc mu1, + T_scale sigma1, T_y y2, + T_loc mu2, T_scale sigma2, + std::string message = "") { expect_eq_diffs(stan::math::multi_normal_prec_lpdf(y1, mu1, sigma1), stan::math::multi_normal_prec_lpdf(y2, mu2, sigma2), stan::math::multi_normal_prec_lpdf(y1, mu1, sigma1), diff --git a/test/unit/math/rev/prob/multi_student_t2_test.cpp b/test/unit/math/rev/prob/multi_student_t2_test.cpp index 324a6a1d3cb..340ac5e5c18 100644 --- a/test/unit/math/rev/prob/multi_student_t2_test.cpp +++ b/test/unit/math/rev/prob/multi_student_t2_test.cpp @@ -11,9 +11,10 @@ template inline void expect_propto_multi_student_t_lpdf(T_y y1, T_dof nu1, T_loc mu1, - T_scale sigma1, T_y y2, T_dof nu2, - T_loc mu2, T_scale sigma2, - std::string message = "") { + T_scale sigma1, T_y y2, + T_dof nu2, T_loc mu2, + T_scale sigma2, + std::string message = "") { expect_eq_diffs(stan::math::multi_student_t_lpdf(y1, nu1, mu1, sigma1), stan::math::multi_student_t_lpdf(y2, nu2, mu2, sigma2), stan::math::multi_student_t_lpdf(y1, nu1, mu1, sigma1), diff --git a/test/unit/math/rev/prob/multi_student_t_cholesky_test.cpp b/test/unit/math/rev/prob/multi_student_t_cholesky_test.cpp index 5d268357f7f..caeca2fcc0d 100644 --- a/test/unit/math/rev/prob/multi_student_t_cholesky_test.cpp +++ b/test/unit/math/rev/prob/multi_student_t_cholesky_test.cpp @@ -10,10 +10,9 @@ #include template -inline void expect_propto_multi_student_t_cholesky_lpdf(T_y y1, T_dof nu1, T_loc mu1, - T_scale L1, T_y y2, T_dof nu2, - T_loc mu2, T_scale L2, - std::string message = "") { +inline void expect_propto_multi_student_t_cholesky_lpdf( + T_y y1, T_dof nu1, T_loc mu1, T_scale L1, T_y y2, T_dof nu2, T_loc mu2, + T_scale L2, std::string message = "") { expect_eq_diffs( stan::math::multi_student_t_cholesky_lpdf(y1, nu1, mu1, L1), stan::math::multi_student_t_cholesky_lpdf(y2, nu2, mu2, L2), diff --git a/test/unit/math/rev/prob/multinomial_logit_test.cpp b/test/unit/math/rev/prob/multinomial_logit_test.cpp index a5ea4720cd8..3c261eea90f 100644 --- a/test/unit/math/rev/prob/multinomial_logit_test.cpp +++ b/test/unit/math/rev/prob/multinomial_logit_test.cpp @@ -6,9 +6,11 @@ #include template -inline void expect_propto_multinomial_logit_lpmf(std::vector& ns1, T_prob beta1, - std::vector& ns2, T_prob beta2, - std::string message) { +inline void expect_propto_multinomial_logit_lpmf(std::vector& ns1, + T_prob beta1, + std::vector& ns2, + T_prob beta2, + std::string message) { expect_eq_diffs(stan::math::multinomial_logit_lpmf(ns1, beta1), stan::math::multinomial_logit_lpmf(ns2, beta2), stan::math::multinomial_logit_lpmf(ns1, beta1), diff --git a/test/unit/math/rev/prob/multinomial_test.cpp b/test/unit/math/rev/prob/multinomial_test.cpp index 8cf11dce795..33de0f4e727 100644 --- a/test/unit/math/rev/prob/multinomial_test.cpp +++ b/test/unit/math/rev/prob/multinomial_test.cpp @@ -7,8 +7,8 @@ template inline void expect_propto_multinomial(std::vector& ns1, T_prob theta1, - std::vector& ns2, T_prob theta2, - std::string message) { + std::vector& ns2, T_prob theta2, + std::string message) { expect_eq_diffs(stan::math::multinomial_lpmf(ns1, theta1), stan::math::multinomial_lpmf(ns2, theta2), stan::math::multinomial_lpmf(ns1, theta1), diff --git a/test/unit/math/rev/prob/ordered_logistic_glm_lpmf_test.cpp b/test/unit/math/rev/prob/ordered_logistic_glm_lpmf_test.cpp index 6bc23f19985..b261fb86192 100644 --- a/test/unit/math/rev/prob/ordered_logistic_glm_lpmf_test.cpp +++ b/test/unit/math/rev/prob/ordered_logistic_glm_lpmf_test.cpp @@ -5,8 +5,9 @@ #include template -inline stan::return_type_t ordered_logistic_glm_simple_lpmf( - const std::vector& y, T_x&& x, T_beta&& beta, T_cuts&& cuts) { +inline stan::return_type_t +ordered_logistic_glm_simple_lpmf(const std::vector& y, T_x&& x, + T_beta&& beta, T_cuts&& cuts) { using stan::math::as_column_vector_or_scalar; auto&& beta_col = as_column_vector_or_scalar(beta); auto location = stan::math::multiply(x, beta_col); diff --git a/test/unit/math/rev/prob/test_gradients.hpp b/test/unit/math/rev/prob/test_gradients.hpp index 00fa6fe13c8..660bad43c18 100644 --- a/test/unit/math/rev/prob/test_gradients.hpp +++ b/test/unit/math/rev/prob/test_gradients.hpp @@ -6,15 +6,16 @@ #include inline void test_grad_eq(Eigen::Matrix grad_1, - Eigen::Matrix grad_2) { + Eigen::Matrix grad_2) { ASSERT_EQ(grad_1.size(), grad_2.size()); for (int i = 0; i < grad_1.size(); ++i) EXPECT_FLOAT_EQ(grad_1(i), grad_2(i)); } template -inline std::vector finite_diffs(const F& fun, const std::vector& args, - double epsilon = 1e-6) { +inline std::vector finite_diffs(const F& fun, + const std::vector& args, + double epsilon = 1e-6) { std::vector diffs(args.size()); std::vector args_plus = args; std::vector args_minus = args; diff --git a/test/unit/math/rev/prob/test_gradients_multi_normal.hpp b/test/unit/math/rev/prob/test_gradients_multi_normal.hpp index 06ade9afe82..b52ba885d9f 100644 --- a/test/unit/math/rev/prob/test_gradients_multi_normal.hpp +++ b/test/unit/math/rev/prob/test_gradients_multi_normal.hpp @@ -64,10 +64,9 @@ inline std::vector finite_diffs_multi_normal( } template -inline std::vector grad_multi_normal(const F& fun, - const std::vector& vec_y, - const std::vector& vec_mu, - const std::vector& vec_sigma) { +inline std::vector grad_multi_normal( + const F& fun, const std::vector& vec_y, + const std::vector& vec_mu, const std::vector& vec_sigma) { stan::math::var fx = fun(vec_y, vec_mu, vec_sigma); std::vector grad; std::vector vec_vars; @@ -89,8 +88,8 @@ inline std::vector grad_multi_normal(const F& fun, template inline void test_grad_multi_normal(const F& fun, const std::vector& vec_y, - const std::vector& vec_mu, - const std::vector& vec_sigma) { + const std::vector& vec_mu, + const std::vector& vec_sigma) { using std::fabs; std::vector diffs_finite = finite_diffs_multi_normal(fun, vec_y, vec_mu, vec_sigma); diff --git a/test/unit/math/rev/prob/test_gradients_multi_student_t.hpp b/test/unit/math/rev/prob/test_gradients_multi_student_t.hpp index ebe4dde4f48..2d058c33b74 100644 --- a/test/unit/math/rev/prob/test_gradients_multi_student_t.hpp +++ b/test/unit/math/rev/prob/test_gradients_multi_student_t.hpp @@ -79,11 +79,10 @@ inline std::vector finite_diffs_multi_normal3( template -inline std::vector grad_multi_normal3(const F& fun, - const std::vector& vec_y, - const std::vector& vec_mu, - const std::vector& vec_sigma, - const T_nu& nu) { +inline std::vector grad_multi_normal3( + const F& fun, const std::vector& vec_y, + const std::vector& vec_mu, const std::vector& vec_sigma, + const T_nu& nu) { stan::math::var fx = fun(vec_y, vec_mu, vec_sigma, nu); std::vector grad; std::vector vec_vars; @@ -108,10 +107,11 @@ inline std::vector grad_multi_normal3(const F& fun, template -inline void test_grad_multi_student_t(const F& fun, const std::vector& vec_y, - const std::vector& vec_mu, - const std::vector& vec_sigma, - const T_nu& nu) { +inline void test_grad_multi_student_t(const F& fun, + const std::vector& vec_y, + const std::vector& vec_mu, + const std::vector& vec_sigma, + const T_nu& nu) { using std::fabs; std::vector diffs_finite = finite_diffs_multi_normal3(fun, vec_y, vec_mu, vec_sigma, nu); diff --git a/test/unit/math/rev/prob/test_gradients_multi_student_t_cholesky.hpp b/test/unit/math/rev/prob/test_gradients_multi_student_t_cholesky.hpp index 1963a7a09fe..c048b7fa10e 100644 --- a/test/unit/math/rev/prob/test_gradients_multi_student_t_cholesky.hpp +++ b/test/unit/math/rev/prob/test_gradients_multi_student_t_cholesky.hpp @@ -79,11 +79,10 @@ inline std::vector finite_diffs_multi_normal2( template -inline std::vector grad_multi_normal2(const F& fun, - const std::vector& vec_y, - const std::vector& vec_mu, - const std::vector& vec_sigma, - const T_nu& nu) { +inline std::vector grad_multi_normal2( + const F& fun, const std::vector& vec_y, + const std::vector& vec_mu, const std::vector& vec_sigma, + const T_nu& nu) { stan::math::var fx = fun(vec_y, vec_mu, vec_sigma, nu); std::vector grad; std::vector vec_vars; @@ -108,11 +107,10 @@ inline std::vector grad_multi_normal2(const F& fun, template -inline void test_grad_multi_student_t_cholesky(const F& fun, - const std::vector& vec_y, - const std::vector& vec_mu, - const std::vector& vec_sigma, - const T_nu& nu) { +inline void test_grad_multi_student_t_cholesky( + const F& fun, const std::vector& vec_y, + const std::vector& vec_mu, const std::vector& vec_sigma, + const T_nu& nu) { using std::fabs; std::vector diffs_finite = finite_diffs_multi_normal2(fun, vec_y, vec_mu, vec_sigma, nu); diff --git a/test/unit/math/rev/prob/wishart_cholesky_test.cpp b/test/unit/math/rev/prob/wishart_cholesky_test.cpp index a74e0d78611..8428d2160e9 100644 --- a/test/unit/math/rev/prob/wishart_cholesky_test.cpp +++ b/test/unit/math/rev/prob/wishart_cholesky_test.cpp @@ -5,9 +5,10 @@ #include template -inline void expect_propto_wishart_cholesky_lpdf(T_y L_Y1, T_dof nu1, T_scale L_S1, - T_y L_Y2, T_dof nu2, T_scale L_S2, - std::string message) { +inline void expect_propto_wishart_cholesky_lpdf(T_y L_Y1, T_dof nu1, + T_scale L_S1, T_y L_Y2, + T_dof nu2, T_scale L_S2, + std::string message) { expect_eq_diffs(stan::math::wishart_cholesky_lpdf(L_Y1, nu1, L_S1), stan::math::wishart_cholesky_lpdf(L_Y2, nu2, L_S2), stan::math::wishart_cholesky_lpdf(L_Y1, nu1, L_S1), diff --git a/test/unit/math/rev/prob/wishart_test.cpp b/test/unit/math/rev/prob/wishart_test.cpp index 8f497bfd621..898eb7544c3 100644 --- a/test/unit/math/rev/prob/wishart_test.cpp +++ b/test/unit/math/rev/prob/wishart_test.cpp @@ -6,7 +6,8 @@ template inline void expect_propto_wishart_lpdf(T_y W1, T_dof nu1, T_scale S1, T_y W2, - T_dof nu2, T_scale S2, std::string message) { + T_dof nu2, T_scale S2, + std::string message) { expect_eq_diffs(stan::math::wishart_lpdf(W1, nu1, S1), stan::math::wishart_lpdf(W2, nu2, S2), stan::math::wishart_lpdf(W1, nu1, S1), diff --git a/test/unit/math/test_ad.hpp b/test/unit/math/test_ad.hpp index 7d5f61dce3d..6336f1b03d0 100644 --- a/test/unit/math/test_ad.hpp +++ b/test/unit/math/test_ad.hpp @@ -124,8 +124,8 @@ auto eval(const std::vector& x) { */ template inline void test_gradient(const ad_tolerances& tols, const F& f, - const Eigen::VectorXd& x, double fx, - bool test_derivs = true) { + const Eigen::VectorXd& x, double fx, + bool test_derivs = true) { Eigen::VectorXd grad_ad; double fx_ad = fx; stan::math::gradient(f, x, fx_ad, grad_ad); @@ -166,8 +166,8 @@ inline void test_gradient(const ad_tolerances& tols, const F& f, */ template inline void test_gradient_fvar(const ad_tolerances& tols, const F& f, - const Eigen::VectorXd& x, double fx, - bool test_derivs = true) { + const Eigen::VectorXd& x, double fx, + bool test_derivs = true) { Eigen::VectorXd grad_ad; double fx_ad = fx; stan::math::gradient(f, x, fx_ad, grad_ad); @@ -207,8 +207,8 @@ inline void test_gradient_fvar(const ad_tolerances& tols, const F& f, */ template inline void test_hessian_fvar(const ad_tolerances& tols, const F& f, - const Eigen::VectorXd& x, double fx, - bool test_derivs = true) { + const Eigen::VectorXd& x, double fx, + bool test_derivs = true) { double fx_ad; Eigen::VectorXd grad_ad; Eigen::MatrixXd H_ad; @@ -253,8 +253,8 @@ inline void test_hessian_fvar(const ad_tolerances& tols, const F& f, */ template inline void test_hessian(const ad_tolerances& tols, const F& f, - const Eigen::VectorXd& x, double fx, - bool test_derivs = true) { + const Eigen::VectorXd& x, double fx, + bool test_derivs = true) { double fx_ad; Eigen::VectorXd grad_ad; Eigen::MatrixXd H_ad; @@ -298,8 +298,8 @@ inline void test_hessian(const ad_tolerances& tols, const F& f, */ template inline void test_grad_hessian(const ad_tolerances& tols, const F& f, - const Eigen::VectorXd& x, double fx, - bool test_derivs = true) { + const Eigen::VectorXd& x, double fx, + bool test_derivs = true) { double fx_ad; Eigen::MatrixXd H_ad; std::vector grad_H_ad; @@ -341,7 +341,7 @@ inline void test_grad_hessian(const ad_tolerances& tols, const F& f, */ template inline void expect_ad_derivatives(const ad_tolerances& tols, const G& g, - const Eigen::VectorXd& x) { + const Eigen::VectorXd& x) { double gx = g(x); test_gradient(tols, g, x, gx); if constexpr (!ReverseOnly) { @@ -368,7 +368,7 @@ inline void expect_ad_derivatives(const ad_tolerances& tols, const G& g, */ template inline void expect_throw(const F& f, const Eigen::VectorXd& x, - const std::string& name_of_T) { + const std::string& name_of_T) { Eigen::Matrix x_t(x.rows()); for (int i = 0; i < x.rows(); ++i) x_t(i) = x(i); @@ -482,7 +482,7 @@ inline void expect_all_throw(const F& f, double x1, double x2, double x3) { */ template inline void expect_ad_helper(const ad_tolerances& tols, const F& f, const G& g, - const Eigen::VectorXd& x, Ts... xs) { + const Eigen::VectorXd& x, Ts... xs) { using stan::math::serialize; auto h = [&](const int i) { return [&g, i](const auto& v) { return g(v)[i]; }; }; @@ -578,7 +578,7 @@ inline void expect_ad_v(const ad_tolerances& tols, const F& f, int x) { */ template inline void expect_ad_vv(const ad_tolerances& tols, const F& f, const T1& x1, - const T2& x2) { + const T2& x2) { using stan::math::serialize_args; using stan::math::serialize_return; using stan::math::to_deserializer; @@ -612,7 +612,8 @@ inline void expect_ad_vv(const ad_tolerances& tols, const F& f, const T1& x1, } template -inline void expect_ad_vv(const ad_tolerances& tols, const F& f, int x1, const T2& x2) { +inline void expect_ad_vv(const ad_tolerances& tols, const F& f, int x1, + const T2& x2) { try { f(x1, x2); } catch (...) { @@ -634,7 +635,8 @@ inline void expect_ad_vv(const ad_tolerances& tols, const F& f, int x1, const T2 } template -inline void expect_ad_vv(const ad_tolerances& tols, const F& f, const T1& x1, int x2) { +inline void expect_ad_vv(const ad_tolerances& tols, const F& f, const T1& x1, + int x2) { try { f(x1, x2); } catch (...) { @@ -656,7 +658,8 @@ inline void expect_ad_vv(const ad_tolerances& tols, const F& f, const T1& x1, in } template -inline void expect_ad_vv(const ad_tolerances& tols, const F& f, int x1, int x2) { +inline void expect_ad_vv(const ad_tolerances& tols, const F& f, int x1, + int x2) { // this one needs throw test because it's not handled by recursion try { f(x1, x2); @@ -697,7 +700,7 @@ inline void expect_ad_vv(const ad_tolerances& tols, const F& f, int x1, int x2) template inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, - const T2& x2, const T3& x3) { + const T2& x2, const T3& x3) { using stan::math::serialize_args; using stan::math::serialize_return; using stan::math::to_deserializer; @@ -772,7 +775,7 @@ inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, template inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, int x1, int x2, - const T3& x3) { + const T3& x3) { try { f(x1, x2, x3); } catch (...) { @@ -800,8 +803,8 @@ inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, int x1, int x2, } template -inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, int x1, const T2& x2, - const T3& x3) { +inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, int x1, + const T2& x2, const T3& x3) { try { f(x1, x2, x3); } catch (...) { @@ -824,8 +827,8 @@ inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, int x1, const T } template -inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, int x2, - const T3& x3) { +inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, + int x2, const T3& x3) { try { f(x1, x2, x3); } catch (...) { @@ -849,7 +852,7 @@ inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, i template inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, - const T2& x2, int x3) { + const T2& x2, int x3) { try { f(x1, x2, x3); } catch (...) { @@ -872,8 +875,8 @@ inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, } template -inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, int x1, const T2& x2, - int x3) { +inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, int x1, + const T2& x2, int x3) { try { f(x1, x2, x3); } catch (...) { @@ -901,8 +904,8 @@ inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, int x1, const T } template -inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, int x2, - int x3) { +inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, + int x2, int x3) { try { f(x1, x2, x3); } catch (...) { @@ -931,7 +934,7 @@ inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, const T1& x1, i template inline void expect_ad_vvv(const ad_tolerances& tols, const F& f, int x1, int x2, - int x3) { + int x3) { // test exception behavior; other exception cases tested recursively try { f(x1, x2, x3); @@ -1203,7 +1206,7 @@ inline void expect_ad(const F& f, const T& x) { */ template inline void expect_ad(const ad_tolerances& tols, const F& f, const T1& x1, - const T2& x2) { + const T2& x2) { internal::expect_ad_vv(tols, f, x1, x2); } @@ -1244,7 +1247,7 @@ inline void expect_ad(const F& f, const T1& x1, const T2& x2) { template inline void expect_ad(const ad_tolerances& tols, const F& f, const T1& x1, - const T2& x2, const T3& x3) { + const T2& x2, const T3& x3) { internal::expect_ad_vvv(tols, f, x1, x2, x3); } @@ -1296,7 +1299,8 @@ template < ScalarSupport ComplexSupport = ScalarSupport::Real, typename F, typename T1, stan::require_t< stan::bool_constant>* = nullptr> -inline void expect_ad_vectorized(const ad_tolerances& tols, const F& f, const T1& x1) { +inline void expect_ad_vectorized(const ad_tolerances& tols, const F& f, + const T1& x1) { using Scalar = std::conditional_t::value, double, T1>; using matrix_t = Eigen::Matrix; using vector_t = Eigen::Matrix; @@ -1348,7 +1352,8 @@ inline void expect_ad_vectorized(const ad_tolerances& tols, const F& f, const T1 template >* = nullptr> -inline void expect_ad_vectorized(const ad_tolerances& tols, const F& f, const T1& x1) { +inline void expect_ad_vectorized(const ad_tolerances& tols, const F& f, + const T1& x1) { using Scalar = std::conditional_t::value, double, T1>; using matrix_t = Eigen::Matrix; using vector_t = Eigen::Matrix; @@ -1433,7 +1438,8 @@ inline void expect_ad_vectorized(const ad_tolerances& tols, const F& f, const T1 template >* = nullptr> -inline void expect_ad_vectorized(const ad_tolerances& tols, const F& f, const T1& x1) { +inline void expect_ad_vectorized(const ad_tolerances& tols, const F& f, + const T1& x1) { using Scalar = std::conditional_t::value, double, T1>; using complex_t = std::complex; using complex_matrix_t = Eigen::Matrix; @@ -1514,8 +1520,9 @@ inline void expect_ad_vectorized(const F& f, const T& x) { */ template * = nullptr> -inline void expect_ad_vectorized_binary_impl(const ad_tolerances& tols, const F& f, - const T1& x, const T2& y) { +inline void expect_ad_vectorized_binary_impl(const ad_tolerances& tols, + const F& f, const T1& x, + const T2& y) { std::vector nest_x{x, x}; std::vector nest_y{y, y}; std::vector> nest_nest_x{nest_x, nest_x}; @@ -1547,8 +1554,9 @@ inline void expect_ad_vectorized_binary_impl(const ad_tolerances& tols, const F& * @param z argument to test */ template -inline void expect_ad_vectorized_ternary_impl(const ad_tolerances& tols, const F& f, - const T1& x, const T2& y, const T3& z) { +inline void expect_ad_vectorized_ternary_impl(const ad_tolerances& tols, + const F& f, const T1& x, + const T2& y, const T3& z) { std::vector nest_x{x}; std::vector nest_y{y}; std::vector nest_z{z}; @@ -1581,8 +1589,9 @@ inline void expect_ad_vectorized_ternary_impl(const ad_tolerances& tols, const F */ template * = nullptr> -inline void expect_ad_vectorized_binary_impl(const ad_tolerances& tols, const F& f, - const T1& x, const T2& y) { +inline void expect_ad_vectorized_binary_impl(const ad_tolerances& tols, + const F& f, const T1& x, + const T2& y) { auto f_bind = [&](const auto& x) { return [=](const auto& y) { return f(x, y); }; }; std::vector nest_x{x, x}; @@ -1610,8 +1619,9 @@ inline void expect_ad_vectorized_binary_impl(const ad_tolerances& tols, const F& */ template * = nullptr> -inline void expect_ad_vectorized_binary_impl(const ad_tolerances& tols, const F& f, - const T1& x, const T2& y) { +inline void expect_ad_vectorized_binary_impl(const ad_tolerances& tols, + const F& f, const T1& x, + const T2& y) { auto f_bind = [&](const auto& y) { return [=](const auto& x) { return f(x, y); }; }; std::vector nest_x{x, x}; @@ -1640,7 +1650,7 @@ inline void expect_ad_vectorized_binary_impl(const ad_tolerances& tols, const F& template * = nullptr> inline void expect_ad_vectorized_binary(const ad_tolerances& tols, const F& f, - const T1& x, const T2& y) { + const T1& x, const T2& y) { expect_ad_vectorized_binary_impl(tols, f, x, y); expect_ad_vectorized_binary_impl(tols, f, math::to_array_1d(x), math::to_array_1d(y)); @@ -1665,7 +1675,8 @@ inline void expect_ad_vectorized_binary(const ad_tolerances& tols, const F& f, template * = nullptr> inline void expect_ad_vectorized_ternary(const ad_tolerances& tols, const F& f, - const T1& x, const T2& y, const T3& z) { + const T1& x, const T2& y, + const T3& z) { expect_ad_vectorized_ternary_impl(tols, f, x, y, z); expect_ad_vectorized_ternary_impl(tols, f, math::to_array_1d(x), math::to_array_1d(y), math::to_array_1d(z)); @@ -1688,7 +1699,7 @@ inline void expect_ad_vectorized_ternary(const ad_tolerances& tols, const F& f, template * = nullptr> inline void expect_ad_vectorized_binary(const ad_tolerances& tols, const F& f, - const T1& x, const T2& y) { + const T1& x, const T2& y) { expect_ad_vectorized_binary_impl(tols, f, x, y); } @@ -1711,7 +1722,8 @@ inline void expect_ad_vectorized_binary(const ad_tolerances& tols, const F& f, template * = nullptr> inline void expect_ad_vectorized_ternary(const ad_tolerances& tols, const F& f, - const T1& x, const T2& y, const T3& z) { + const T1& x, const T2& y, + const T3& z) { expect_ad_vectorized_ternary_impl(tols, f, x, y, z); } @@ -1749,7 +1761,7 @@ inline void expect_ad_vectorized_binary(const F& f, const T1& x, const T2& y) { */ template inline void expect_ad_vectorized_ternary(const F& f, const T1& x, const T2& y, - const T3& z) { + const T3& z) { constexpr ad_tolerances tols; expect_ad_vectorized_ternary(tols, f, x, y, z); } @@ -1814,7 +1826,8 @@ inline void expect_common_nonzero_unary(const F& f) { * for second argments */ template -inline void expect_common_nonzero_binary(const F& f, bool disable_lhs_int = false) { +inline void expect_common_nonzero_binary(const F& f, + bool disable_lhs_int = false) { auto args = internal::common_nonzero_args(); auto int_args = internal::common_nonzero_int_args(); for (double x1 : args) @@ -1933,7 +1946,7 @@ inline void expect_complex_common_binary(const F& f) { template inline void expect_complex_compare(const F& f, const std::complex& z1, - const std::complex& z2) { + const std::complex& z2) { using c_t = std::complex; c_t cz1{z1}; c_t cz2{z2}; @@ -1952,8 +1965,9 @@ inline void expect_complex_compare(const F& f, const std::complex& z1, } template -inline void expect_complex_comparison(const F& f, const std::complex& z1, - const std::complex& z2) { +inline void expect_complex_comparison(const F& f, + const std::complex& z1, + const std::complex& z2) { using stan::math::fvar; using stan::math::var; using std::complex; @@ -2092,7 +2106,7 @@ inline void expect_unary_vectorized(const ad_tolerances& tols, const F& f) {} template inline void expect_unary_vectorized(const ad_tolerances& tols, const F& f, T x, - Ts... xs) { + Ts... xs) { expect_ad_vectorized(tols, f, x); expect_unary_vectorized(tols, f, xs...); } @@ -2280,7 +2294,7 @@ inline void expect_common_prim(const F1& f1, const F2& f2) { * with specified autocorrelation */ inline std::vector ar_test_cov_matrices(int N_min, int N_max, - double rho) { + double rho) { std::vector ys; for (int n = N_min; n <= N_max; ++n) { Eigen::MatrixXd y(n, n); diff --git a/test/unit/math/test_ad_matvar.hpp b/test/unit/math/test_ad_matvar.hpp index 83d4ecbd78b..ea14b264a1a 100644 --- a/test/unit/math/test_ad_matvar.hpp +++ b/test/unit/math/test_ad_matvar.hpp @@ -36,7 +36,7 @@ template < require_all_not_std_vector_t, value_type_t>* = nullptr, require_all_std_vector_st* = nullptr> inline void expect_near_rel_matvar(const std::string& message, T1&& x, T2&& y, - const ad_tolerances& tols) { + const ad_tolerances& tols) { stan::math::check_size_match("expect_near_rel_var", "x", x.size(), "y", y.size()); for (size_t i = 0; i < x.size(); ++i) { @@ -53,7 +53,7 @@ template * = nullptr, require_all_std_vector_st* = nullptr> inline void expect_near_rel_matvar(const std::string& message, T1&& x, T2&& y, - const ad_tolerances& tols) { + const ad_tolerances& tols) { stan::math::check_size_match("expect_near_rel_var", "x", x.size(), "y", y.size()); for (size_t i = 0; i < x.size(); ++i) { @@ -76,7 +76,7 @@ inline void expect_near_rel_matvar(const std::string& message, T1&& x, T2&& y, template * = nullptr, require_all_not_std_vector_t* = nullptr> inline void expect_near_rel_matvar(const std::string& message, T1&& x, T2&& y, - const ad_tolerances& tols) { + const ad_tolerances& tols) { expect_near_rel(message + std::string(" values"), x.val(), y.val(), tols.gradient_val_); expect_near_rel(message + std::string(" adjoints"), x.adj(), y.adj(), @@ -97,7 +97,7 @@ inline void expect_near_rel_matvar(const std::string& message, T1&& x, T2&& y, template * = nullptr> inline void expect_near_rel_matvar(const std::string& message, T1&& x, T2&& y, - const ad_tolerances& tols) { + const ad_tolerances& tols) { expect_near_rel(message + std::string(" doubles"), stan::math::value_of(x), stan::math::value_of(y), tols.gradient_val_); } @@ -122,9 +122,9 @@ inline constexpr auto make_tuple_seq(std::index_sequence idxs) { */ template inline void expect_near_rel_matvar(const std::string& message, - const std::tuple& x, - const std::tuple& y, - const ad_tolerances& tols) { + const std::tuple& x, + const std::tuple& y, + const ad_tolerances& tols) { if (!(sizeof...(T1) == sizeof...(T2))) { FAIL() << "The number of arguments in each tuple must match"; } @@ -417,7 +417,7 @@ auto make_varmat_compatible(const std::vector>& x) { */ template inline void expect_ad_matvar_impl(const ad_tolerances& tols, const F& f, - const EigMats&... x) { + const EigMats&... x) { using stan::is_eigen; using stan::is_var; using stan::is_var_matrix; @@ -534,7 +534,8 @@ inline void expect_ad_matvar_impl(const ad_tolerances& tols, const F& f, * @param x Value of argument */ template -inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat& x) { +inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, + const EigMat& x) { using varmat = stan::math::var_value; expect_ad_matvar_impl(tols, f, x); @@ -568,8 +569,8 @@ inline void expect_ad_matvar(const F& f, const EigMat& x) { */ template * = nullptr> -inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat1& x, - const EigMat2& y) { +inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, + const EigMat1& x, const EigMat2& y) { using stan::math::var; using varmat = stan::math::var_value; @@ -583,8 +584,8 @@ inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat template * = nullptr, require_not_st_integral* = nullptr> -inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat1& x, - const EigMat2& y) { +inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, + const EigMat1& x, const EigMat2& y) { using stan::math::var; using varmat = stan::math::var_value; @@ -594,8 +595,8 @@ inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat template * = nullptr, require_st_integral* = nullptr> -inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat1& x, - const EigMat2& y) { +inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, + const EigMat1& x, const EigMat2& y) { using stan::math::var; using varmat = stan::math::var_value; @@ -632,8 +633,9 @@ inline void expect_ad_matvar(const F& f, const EigMat1& x, const EigMat2& y) { * @param z Value of third argument */ template -inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat1& x, - const EigMat2& y, const EigMat3& z) { +inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, + const EigMat1& x, const EigMat2& y, + const EigMat3& z) { using stan::math::var; using varmat = stan::math::var_value; @@ -672,7 +674,7 @@ inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat */ template inline void expect_ad_matvar(const F& f, const EigMat1& x, const EigMat2& y, - const EigMat3& z) { + const EigMat3& z) { ad_tolerances tols; expect_ad_matvar(tols, f, x, y, z); } @@ -694,8 +696,9 @@ inline void expect_ad_matvar(const F& f, const EigMat1& x, const EigMat2& y, */ template -inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat1& x, - const EigMat2& y, const EigMat3& z, const EigMat4& q) { +inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, + const EigMat1& x, const EigMat2& y, + const EigMat3& z, const EigMat4& q) { using stan::math::var; using varmat = stan::math::var_value; @@ -791,7 +794,7 @@ inline void expect_ad_matvar(const ad_tolerances& tols, const F& f, const EigMat template inline void expect_ad_matvar(const F& f, const EigMat1& x, const EigMat2& y, - const EigMat3& z, const EigMat4& q) { + const EigMat3& z, const EigMat4& q) { ad_tolerances tols; expect_ad_matvar(tols, f, x, y, z, q); } @@ -817,7 +820,7 @@ inline void expect_ad_matvar(const F& f, const EigMat1& x, const EigMat2& y, template * = nullptr> inline void expect_ad_vector_matvar(const ad_tolerances& tols, const F& f, - const EigVec& x) { + const EigVec& x) { Eigen::VectorXd v = x; Eigen::RowVectorXd r = x.transpose(); Eigen::MatrixXd m(x.size(), 2); @@ -866,7 +869,7 @@ template * = nullptr, require_all_not_st_integral* = nullptr> inline void expect_ad_vectorized_matvar(const ad_tolerances& tols, const F& f, - const T1& x, const T2& y) { + const T1& x, const T2& y) { auto x_scal = x.coeff(0, 0); auto y_scal = y.coeff(0, 0); auto x_vec = x.col(0).eval(); @@ -959,7 +962,7 @@ template * = nullptr, require_eigen_t* = nullptr> inline void expect_ad_vectorized_matvar(const ad_tolerances& tols, const F& f, - const T1& x, const T2& y) { + const T1& x, const T2& y) { auto x_scal = x[0]; auto y_vec = y.col(0).eval(); @@ -997,7 +1000,7 @@ inline void expect_ad_vectorized_matvar(const ad_tolerances& tols, const F& f, template * = nullptr, require_std_vector_vt* = nullptr> inline void expect_ad_vectorized_matvar(const ad_tolerances& tols, const F& f, - const T1& x, const T2& y) { + const T1& x, const T2& y) { auto g = [&f](const auto& x, const auto& y) { return f(y, x); }; expect_ad_vectorized_matvar(tols, g, y, x); } diff --git a/test/unit/math/test_ad_test.cpp b/test/unit/math/test_ad_test.cpp index b90f8d5edc8..72ed89ae9be 100644 --- a/test/unit/math/test_ad_test.cpp +++ b/test/unit/math/test_ad_test.cpp @@ -250,7 +250,8 @@ inline std::complex baz(std::complex x) { ++baz_complex; return x / 2.0; } -inline std::complex baz(const std::complex& x) { +inline std::complex baz( + const std::complex& x) { ++baz_complex_var; return x / 2.0; } From d4c03d88b632850d6b66f4d58e377a8f6689140d Mon Sep 17 00:00:00 2001 From: Steve Bronder Date: Mon, 6 Oct 2025 14:25:25 -0400 Subject: [PATCH 3/5] fix cpplint --- stan/math/rev/functor/solve_newton.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stan/math/rev/functor/solve_newton.hpp b/stan/math/rev/functor/solve_newton.hpp index e0a8ceffe19..5ecb8febd0a 100644 --- a/stan/math/rev/functor/solve_newton.hpp +++ b/stan/math/rev/functor/solve_newton.hpp @@ -300,8 +300,7 @@ algebra_solver_newton(const F& f, const T1& x, const T2& y, std::ostream* const msgs = nullptr, const double scaling_step_size = 1e-3, const double function_tolerance = 1e-6, - const long int max_num_steps - = 200) { // NOLINT(runtime/int) + const long int max_num_steps = 200) { // NOLINT(runtime/int) return solve_newton_tol(algebra_solver_adapter(f), x, scaling_step_size, function_tolerance, max_num_steps, msgs, y, dat, dat_int); From a8a0014e321ab939d586fec389f79ae44fc08701 Mon Sep 17 00:00:00 2001 From: Stan Jenkins Date: Mon, 6 Oct 2025 14:26:24 -0400 Subject: [PATCH 4/5] [Jenkins] auto-formatting by clang-format version 10.0.0-4ubuntu1 --- stan/math/rev/functor/solve_newton.hpp | 3 ++- test/unit/math/rev/functor/util_algebra_solver.hpp | 5 ++--- test/unit/math/test_ad_matvar.hpp | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/stan/math/rev/functor/solve_newton.hpp b/stan/math/rev/functor/solve_newton.hpp index 5ecb8febd0a..e0a8ceffe19 100644 --- a/stan/math/rev/functor/solve_newton.hpp +++ b/stan/math/rev/functor/solve_newton.hpp @@ -300,7 +300,8 @@ algebra_solver_newton(const F& f, const T1& x, const T2& y, std::ostream* const msgs = nullptr, const double scaling_step_size = 1e-3, const double function_tolerance = 1e-6, - const long int max_num_steps = 200) { // NOLINT(runtime/int) + const long int max_num_steps + = 200) { // NOLINT(runtime/int) return solve_newton_tol(algebra_solver_adapter(f), x, scaling_step_size, function_tolerance, max_num_steps, msgs, y, dat, dat_int); diff --git a/test/unit/math/rev/functor/util_algebra_solver.hpp b/test/unit/math/rev/functor/util_algebra_solver.hpp index 3e617d6092a..facf2c3c1f2 100644 --- a/test/unit/math/rev/functor/util_algebra_solver.hpp +++ b/test/unit/math/rev/functor/util_algebra_solver.hpp @@ -457,7 +457,7 @@ inline void error_conditions_test(const F& f, template inline void unsolvable_test(Eigen::Matrix& y, - int solver_type = 0, bool use_tol = false) { + int solver_type = 0, bool use_tol = false) { Eigen::VectorXd x(2); x << 1, 1; std::vector dat; @@ -483,8 +483,7 @@ inline void unsolvable_test(Eigen::Matrix& y, template inline void unsolvable_flag_test(Eigen::Matrix& y, - int solver_type = 0, - bool use_tol = false) { + int solver_type = 0, bool use_tol = false) { Eigen::VectorXd x(2); x << 1, 1; std::vector dat; diff --git a/test/unit/math/test_ad_matvar.hpp b/test/unit/math/test_ad_matvar.hpp index 42dc42df5dd..2470bd8f214 100644 --- a/test/unit/math/test_ad_matvar.hpp +++ b/test/unit/math/test_ad_matvar.hpp @@ -122,9 +122,9 @@ inline constexpr auto make_tuple_seq(std::index_sequence idxs) { */ template inline void expect_near_rel_matvar(const std::string& message, - const std::tuple& x, - const std::tuple& y, - const ad_tolerances& tols) { + const std::tuple& x, + const std::tuple& y, + const ad_tolerances& tols) { if constexpr (!(sizeof...(T1) == sizeof...(T2))) { FAIL() << "The number of arguments in each tuple must match"; } From 021bac4cc0a497da684a710a9b3e01160442e3b0 Mon Sep 17 00:00:00 2001 From: Steve Bronder Date: Mon, 6 Oct 2025 14:55:49 -0400 Subject: [PATCH 5/5] fix cpplint --- stan/math/rev/functor/solve_newton.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stan/math/rev/functor/solve_newton.hpp b/stan/math/rev/functor/solve_newton.hpp index e0a8ceffe19..af7be472323 100644 --- a/stan/math/rev/functor/solve_newton.hpp +++ b/stan/math/rev/functor/solve_newton.hpp @@ -300,7 +300,7 @@ algebra_solver_newton(const F& f, const T1& x, const T2& y, std::ostream* const msgs = nullptr, const double scaling_step_size = 1e-3, const double function_tolerance = 1e-6, - const long int max_num_steps + const int64_t max_num_steps = 200) { // NOLINT(runtime/int) return solve_newton_tol(algebra_solver_adapter(f), x, scaling_step_size, function_tolerance, max_num_steps, msgs, y, dat,