diff --git a/doxygen/contributor_help_pages/distribution_tests.md b/doxygen/contributor_help_pages/distribution_tests.md index 8421def91b2..f747cb2c412 100644 --- a/doxygen/contributor_help_pages/distribution_tests.md +++ b/doxygen/contributor_help_pages/distribution_tests.md @@ -140,7 +140,7 @@ Details: The types of arguments that are valid are: `Int`, `Double`, `Ints`, and `Doubles`. The first two indicate that the argument is not vectorized and only takes single, scalar values. The last two plural versions indicate that the argument types are vectorized. 3. The next lines are includes. Most of the files will have: ``` -\#include +\#include \#include ``` diff --git a/runChecks.py b/runChecks.py index c0c2445b936..61691e29c4a 100755 --- a/runChecks.py +++ b/runChecks.py @@ -175,35 +175,7 @@ def main(): }, ] errors.extend(grep_patterns("rev", "stan/math/rev", rev_checks)) - - # Check for files inside stan/math/*/scal that contain stan/math/*/arr or stan/math/*/mat - scal_checks = [ - { - "pattern": "", "message": "File includes an std::vector header."}, - {"pattern": "std::vector", "message": "File uses std::vector."}, - { - "pattern": " +#include #include #include #include -#include -#include -#include +#include #include #include diff --git a/stan/math/fwd/core/fvar.hpp b/stan/math/fwd/core/fvar.hpp index 22a5e53c835..785a24974aa 100644 --- a/stan/math/fwd/core/fvar.hpp +++ b/stan/math/fwd/core/fvar.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_FWD_CORE_FVAR_HPP #include -#include +#include #include #include diff --git a/stan/math/fwd/fun/Eigen_NumTraits.hpp b/stan/math/fwd/fun/Eigen_NumTraits.hpp index 672152062c4..df54b3345d0 100644 --- a/stan/math/fwd/fun/Eigen_NumTraits.hpp +++ b/stan/math/fwd/fun/Eigen_NumTraits.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace Eigen { diff --git a/stan/math/fwd/fun/Phi.hpp b/stan/math/fwd/fun/Phi.hpp index 67b8278702c..5fe92943ef1 100644 --- a/stan/math/fwd/fun/Phi.hpp +++ b/stan/math/fwd/fun/Phi.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/Phi_approx.hpp b/stan/math/fwd/fun/Phi_approx.hpp index fa7ce4ea677..582a9113d3a 100644 --- a/stan/math/fwd/fun/Phi_approx.hpp +++ b/stan/math/fwd/fun/Phi_approx.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/abs.hpp b/stan/math/fwd/fun/abs.hpp index 44482e235f9..f52c49482da 100644 --- a/stan/math/fwd/fun/abs.hpp +++ b/stan/math/fwd/fun/abs.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/acos.hpp b/stan/math/fwd/fun/acos.hpp index eeba52e770c..b6f9bfbd683 100644 --- a/stan/math/fwd/fun/acos.hpp +++ b/stan/math/fwd/fun/acos.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/acosh.hpp b/stan/math/fwd/fun/acosh.hpp index 17c9772b6fd..948e7fe226c 100644 --- a/stan/math/fwd/fun/acosh.hpp +++ b/stan/math/fwd/fun/acosh.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/asin.hpp b/stan/math/fwd/fun/asin.hpp index ce09c0b9f94..a4d4e4de0c8 100644 --- a/stan/math/fwd/fun/asin.hpp +++ b/stan/math/fwd/fun/asin.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/asinh.hpp b/stan/math/fwd/fun/asinh.hpp index 69493e3c2d9..7a4b0df5693 100644 --- a/stan/math/fwd/fun/asinh.hpp +++ b/stan/math/fwd/fun/asinh.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/atan.hpp b/stan/math/fwd/fun/atan.hpp index 474e7591a6c..5ded2b132f4 100644 --- a/stan/math/fwd/fun/atan.hpp +++ b/stan/math/fwd/fun/atan.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/atan2.hpp b/stan/math/fwd/fun/atan2.hpp index cb0837e7034..9af5e37ca68 100644 --- a/stan/math/fwd/fun/atan2.hpp +++ b/stan/math/fwd/fun/atan2.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/atanh.hpp b/stan/math/fwd/fun/atanh.hpp index e8f0b5c7523..bd1154d281c 100644 --- a/stan/math/fwd/fun/atanh.hpp +++ b/stan/math/fwd/fun/atanh.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/bessel_first_kind.hpp b/stan/math/fwd/fun/bessel_first_kind.hpp index 28c4719872d..f9b0725d795 100644 --- a/stan/math/fwd/fun/bessel_first_kind.hpp +++ b/stan/math/fwd/fun/bessel_first_kind.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/bessel_second_kind.hpp b/stan/math/fwd/fun/bessel_second_kind.hpp index 7394031ee4f..d4ce9e25ffd 100644 --- a/stan/math/fwd/fun/bessel_second_kind.hpp +++ b/stan/math/fwd/fun/bessel_second_kind.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/beta.hpp b/stan/math/fwd/fun/beta.hpp index a2d6f95a212..b8ba5e7d10c 100644 --- a/stan/math/fwd/fun/beta.hpp +++ b/stan/math/fwd/fun/beta.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/binary_log_loss.hpp b/stan/math/fwd/fun/binary_log_loss.hpp index 71fda43d9ec..6864507f5c1 100644 --- a/stan/math/fwd/fun/binary_log_loss.hpp +++ b/stan/math/fwd/fun/binary_log_loss.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/cbrt.hpp b/stan/math/fwd/fun/cbrt.hpp index 392cb3289da..a584eb8a710 100644 --- a/stan/math/fwd/fun/cbrt.hpp +++ b/stan/math/fwd/fun/cbrt.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/columns_dot_product.hpp b/stan/math/fwd/fun/columns_dot_product.hpp index a562c94af6a..6e23cb757b4 100644 --- a/stan/math/fwd/fun/columns_dot_product.hpp +++ b/stan/math/fwd/fun/columns_dot_product.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_FWD_FUN_COLUMNS_DOT_PRODUCT_HPP #include -#include +#include #include #include diff --git a/stan/math/fwd/fun/columns_dot_self.hpp b/stan/math/fwd/fun/columns_dot_self.hpp index ff63246c09a..9013a59205e 100644 --- a/stan/math/fwd/fun/columns_dot_self.hpp +++ b/stan/math/fwd/fun/columns_dot_self.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_FWD_FUN_COLUMNS_DOT_SELF_HPP #define STAN_MATH_FWD_FUN_COLUMNS_DOT_SELF_HPP -#include +#include #include #include diff --git a/stan/math/fwd/fun/crossprod.hpp b/stan/math/fwd/fun/crossprod.hpp index d696f6b3244..4ad88c50a5a 100644 --- a/stan/math/fwd/fun/crossprod.hpp +++ b/stan/math/fwd/fun/crossprod.hpp @@ -1,9 +1,9 @@ #ifndef STAN_MATH_FWD_FUN_CROSSPROD_HPP #define STAN_MATH_FWD_FUN_CROSSPROD_HPP -#include +#include +#include #include -#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/determinant.hpp b/stan/math/fwd/fun/determinant.hpp index 0dd27aa3ee8..7e7102a10ed 100644 --- a/stan/math/fwd/fun/determinant.hpp +++ b/stan/math/fwd/fun/determinant.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_FWD_FUN_DETERMINANT_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/digamma.hpp b/stan/math/fwd/fun/digamma.hpp index d1de7dee57e..3ab0cbb5fb8 100644 --- a/stan/math/fwd/fun/digamma.hpp +++ b/stan/math/fwd/fun/digamma.hpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/divide.hpp b/stan/math/fwd/fun/divide.hpp index 3d5b091c340..f9cdf15e751 100644 --- a/stan/math/fwd/fun/divide.hpp +++ b/stan/math/fwd/fun/divide.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_FWD_FUN_DIVIDE_HPP #define STAN_MATH_FWD_FUN_DIVIDE_HPP -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/dot_product.hpp b/stan/math/fwd/fun/dot_product.hpp index a4a97c29172..5e6e773eaf0 100644 --- a/stan/math/fwd/fun/dot_product.hpp +++ b/stan/math/fwd/fun/dot_product.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_FWD_FUN_DOT_PRODUCT_HPP #include -#include +#include #include #include diff --git a/stan/math/fwd/fun/dot_self.hpp b/stan/math/fwd/fun/dot_self.hpp index 5d545e0a969..5dfd59d9824 100644 --- a/stan/math/fwd/fun/dot_self.hpp +++ b/stan/math/fwd/fun/dot_self.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_FWD_FUN_DOT_SELF_HPP #include -#include +#include #include #include diff --git a/stan/math/fwd/fun/erf.hpp b/stan/math/fwd/fun/erf.hpp index 17e940e92d8..6e88c092c0a 100644 --- a/stan/math/fwd/fun/erf.hpp +++ b/stan/math/fwd/fun/erf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/erfc.hpp b/stan/math/fwd/fun/erfc.hpp index f9833b255ac..458013f5a7b 100644 --- a/stan/math/fwd/fun/erfc.hpp +++ b/stan/math/fwd/fun/erfc.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/exp2.hpp b/stan/math/fwd/fun/exp2.hpp index 43351eaea13..52e6ed65c44 100644 --- a/stan/math/fwd/fun/exp2.hpp +++ b/stan/math/fwd/fun/exp2.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/expm1.hpp b/stan/math/fwd/fun/expm1.hpp index ae92bffc157..72c388fadfb 100644 --- a/stan/math/fwd/fun/expm1.hpp +++ b/stan/math/fwd/fun/expm1.hpp @@ -1,8 +1,8 @@ #ifndef STAN_MATH_FWD_FUN_EXPM1_HPP #define STAN_MATH_FWD_FUN_EXPM1_HPP +#include #include -#include #include #include diff --git a/stan/math/fwd/fun/fabs.hpp b/stan/math/fwd/fun/fabs.hpp index b6a1c3139f5..47af374b153 100644 --- a/stan/math/fwd/fun/fabs.hpp +++ b/stan/math/fwd/fun/fabs.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/falling_factorial.hpp b/stan/math/fwd/fun/falling_factorial.hpp index df62cc4169d..e62796c7a1a 100644 --- a/stan/math/fwd/fun/falling_factorial.hpp +++ b/stan/math/fwd/fun/falling_factorial.hpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/fdim.hpp b/stan/math/fwd/fun/fdim.hpp index 1ae7a70cd8b..a2d1026e8bf 100644 --- a/stan/math/fwd/fun/fdim.hpp +++ b/stan/math/fwd/fun/fdim.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/fma.hpp b/stan/math/fwd/fun/fma.hpp index b3655c8642f..de5ea3255a5 100644 --- a/stan/math/fwd/fun/fma.hpp +++ b/stan/math/fwd/fun/fma.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/fmax.hpp b/stan/math/fwd/fun/fmax.hpp index e29f523cdd5..ce1d7115d3d 100644 --- a/stan/math/fwd/fun/fmax.hpp +++ b/stan/math/fwd/fun/fmax.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/fmin.hpp b/stan/math/fwd/fun/fmin.hpp index ebdcf75013f..32f6eea9f90 100644 --- a/stan/math/fwd/fun/fmin.hpp +++ b/stan/math/fwd/fun/fmin.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/fmod.hpp b/stan/math/fwd/fun/fmod.hpp index 4e523de722c..ed1ff1857f6 100644 --- a/stan/math/fwd/fun/fmod.hpp +++ b/stan/math/fwd/fun/fmod.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/gamma_p.hpp b/stan/math/fwd/fun/gamma_p.hpp index 1cc02fc2bd7..f3f84cc7b04 100644 --- a/stan/math/fwd/fun/gamma_p.hpp +++ b/stan/math/fwd/fun/gamma_p.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/gamma_q.hpp b/stan/math/fwd/fun/gamma_q.hpp index 4baa1d056c1..b2ba8d41255 100644 --- a/stan/math/fwd/fun/gamma_q.hpp +++ b/stan/math/fwd/fun/gamma_q.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/grad_inc_beta.hpp b/stan/math/fwd/fun/grad_inc_beta.hpp index e62d2fc25ba..194d747072f 100644 --- a/stan/math/fwd/fun/grad_inc_beta.hpp +++ b/stan/math/fwd/fun/grad_inc_beta.hpp @@ -1,8 +1,8 @@ #ifndef STAN_MATH_FWD_FUN_GRAD_INC_BETA_HPP #define STAN_MATH_FWD_FUN_GRAD_INC_BETA_HPP -#include -#include +#include +#include #include #include #include diff --git a/stan/math/fwd/fun/hypot.hpp b/stan/math/fwd/fun/hypot.hpp index d6dd88cbe75..07def1797e4 100644 --- a/stan/math/fwd/fun/hypot.hpp +++ b/stan/math/fwd/fun/hypot.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/inc_beta.hpp b/stan/math/fwd/fun/inc_beta.hpp index ac8cb941e91..8f964d365ea 100644 --- a/stan/math/fwd/fun/inc_beta.hpp +++ b/stan/math/fwd/fun/inc_beta.hpp @@ -1,9 +1,9 @@ #ifndef STAN_MATH_FWD_FUN_INC_BETA_HPP #define STAN_MATH_FWD_FUN_INC_BETA_HPP -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/stan/math/fwd/fun/inv.hpp b/stan/math/fwd/fun/inv.hpp index d95fd2ff5b7..b5b2531f4fe 100644 --- a/stan/math/fwd/fun/inv.hpp +++ b/stan/math/fwd/fun/inv.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/inv_Phi.hpp b/stan/math/fwd/fun/inv_Phi.hpp index c889931f975..bfff53da0e2 100644 --- a/stan/math/fwd/fun/inv_Phi.hpp +++ b/stan/math/fwd/fun/inv_Phi.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/inv_cloglog.hpp b/stan/math/fwd/fun/inv_cloglog.hpp index 0204200c05f..d0e7a0f4c34 100644 --- a/stan/math/fwd/fun/inv_cloglog.hpp +++ b/stan/math/fwd/fun/inv_cloglog.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/inv_logit.hpp b/stan/math/fwd/fun/inv_logit.hpp index 6aa70e00819..8a6bd96d438 100644 --- a/stan/math/fwd/fun/inv_logit.hpp +++ b/stan/math/fwd/fun/inv_logit.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/inv_square.hpp b/stan/math/fwd/fun/inv_square.hpp index bea1bce9e50..016ed9e9294 100644 --- a/stan/math/fwd/fun/inv_square.hpp +++ b/stan/math/fwd/fun/inv_square.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/inverse.hpp b/stan/math/fwd/fun/inverse.hpp index f257188bf4d..34a93f65d7f 100644 --- a/stan/math/fwd/fun/inverse.hpp +++ b/stan/math/fwd/fun/inverse.hpp @@ -2,9 +2,9 @@ #define STAN_MATH_FWD_FUN_INVERSE_HPP #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/stan/math/fwd/fun/is_inf.hpp b/stan/math/fwd/fun/is_inf.hpp index a8dcb4a3193..69e39c99356 100644 --- a/stan/math/fwd/fun/is_inf.hpp +++ b/stan/math/fwd/fun/is_inf.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/is_nan.hpp b/stan/math/fwd/fun/is_nan.hpp index fa43faaf0e6..65577b3a5fa 100644 --- a/stan/math/fwd/fun/is_nan.hpp +++ b/stan/math/fwd/fun/is_nan.hpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/lbeta.hpp b/stan/math/fwd/fun/lbeta.hpp index 73efd2ce7cc..b1f55bc483d 100644 --- a/stan/math/fwd/fun/lbeta.hpp +++ b/stan/math/fwd/fun/lbeta.hpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/ldexp.hpp b/stan/math/fwd/fun/ldexp.hpp index 4a03d547cde..dfe6251f250 100644 --- a/stan/math/fwd/fun/ldexp.hpp +++ b/stan/math/fwd/fun/ldexp.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_FWD_FUN_LDEXP_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/lgamma.hpp b/stan/math/fwd/fun/lgamma.hpp index d5e033537b5..864d6dda152 100644 --- a/stan/math/fwd/fun/lgamma.hpp +++ b/stan/math/fwd/fun/lgamma.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/lmgamma.hpp b/stan/math/fwd/fun/lmgamma.hpp index 85628c7d20f..99ac74779db 100644 --- a/stan/math/fwd/fun/lmgamma.hpp +++ b/stan/math/fwd/fun/lmgamma.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/log.hpp b/stan/math/fwd/fun/log.hpp index cbb7f3d9f49..f1d5d1d96c7 100644 --- a/stan/math/fwd/fun/log.hpp +++ b/stan/math/fwd/fun/log.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/log10.hpp b/stan/math/fwd/fun/log10.hpp index 7bbe91a1a41..189f55e9a29 100644 --- a/stan/math/fwd/fun/log10.hpp +++ b/stan/math/fwd/fun/log10.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/log1m.hpp b/stan/math/fwd/fun/log1m.hpp index aa5ae8fec59..c6eccc472a7 100644 --- a/stan/math/fwd/fun/log1m.hpp +++ b/stan/math/fwd/fun/log1m.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/log1m_exp.hpp b/stan/math/fwd/fun/log1m_exp.hpp index 56ae77871a0..9ce2211d07d 100644 --- a/stan/math/fwd/fun/log1m_exp.hpp +++ b/stan/math/fwd/fun/log1m_exp.hpp @@ -4,9 +4,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/log1m_inv_logit.hpp b/stan/math/fwd/fun/log1m_inv_logit.hpp index b214ab124d3..7d0b0f81850 100644 --- a/stan/math/fwd/fun/log1m_inv_logit.hpp +++ b/stan/math/fwd/fun/log1m_inv_logit.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/log1p.hpp b/stan/math/fwd/fun/log1p.hpp index 99d3531b3ed..c19e7dc0787 100644 --- a/stan/math/fwd/fun/log1p.hpp +++ b/stan/math/fwd/fun/log1p.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/log1p_exp.hpp b/stan/math/fwd/fun/log1p_exp.hpp index dca44dfb9d1..6e046827564 100644 --- a/stan/math/fwd/fun/log1p_exp.hpp +++ b/stan/math/fwd/fun/log1p_exp.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/log2.hpp b/stan/math/fwd/fun/log2.hpp index 64b79745aee..4b71f94b918 100644 --- a/stan/math/fwd/fun/log2.hpp +++ b/stan/math/fwd/fun/log2.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/log_determinant.hpp b/stan/math/fwd/fun/log_determinant.hpp index 7711d758618..a18b4b9f5f3 100644 --- a/stan/math/fwd/fun/log_determinant.hpp +++ b/stan/math/fwd/fun/log_determinant.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_FWD_FUN_LOG_DETERMINANT_HPP #include -#include +#include #include #include #include diff --git a/stan/math/fwd/fun/log_diff_exp.hpp b/stan/math/fwd/fun/log_diff_exp.hpp index 4247f1f5034..6bb1c536cc7 100644 --- a/stan/math/fwd/fun/log_diff_exp.hpp +++ b/stan/math/fwd/fun/log_diff_exp.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/log_falling_factorial.hpp b/stan/math/fwd/fun/log_falling_factorial.hpp index 22b53e41007..4a879b02649 100644 --- a/stan/math/fwd/fun/log_falling_factorial.hpp +++ b/stan/math/fwd/fun/log_falling_factorial.hpp @@ -4,8 +4,8 @@ #include #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/log_inv_logit.hpp b/stan/math/fwd/fun/log_inv_logit.hpp index ce9712452e5..7ea16657474 100644 --- a/stan/math/fwd/fun/log_inv_logit.hpp +++ b/stan/math/fwd/fun/log_inv_logit.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/log_inv_logit_diff.hpp b/stan/math/fwd/fun/log_inv_logit_diff.hpp index e091af35d5b..05df12dd376 100644 --- a/stan/math/fwd/fun/log_inv_logit_diff.hpp +++ b/stan/math/fwd/fun/log_inv_logit_diff.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/log_mix.hpp b/stan/math/fwd/fun/log_mix.hpp index c4c17101520..14ad459e1ba 100644 --- a/stan/math/fwd/fun/log_mix.hpp +++ b/stan/math/fwd/fun/log_mix.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/stan/math/fwd/fun/log_rising_factorial.hpp b/stan/math/fwd/fun/log_rising_factorial.hpp index 972401b7eee..399f13d1cb3 100644 --- a/stan/math/fwd/fun/log_rising_factorial.hpp +++ b/stan/math/fwd/fun/log_rising_factorial.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/log_softmax.hpp b/stan/math/fwd/fun/log_softmax.hpp index b7f366a543e..b59bffa6165 100644 --- a/stan/math/fwd/fun/log_softmax.hpp +++ b/stan/math/fwd/fun/log_softmax.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/log_sum_exp.hpp b/stan/math/fwd/fun/log_sum_exp.hpp index 4c8ad3df687..87d8534fe1b 100644 --- a/stan/math/fwd/fun/log_sum_exp.hpp +++ b/stan/math/fwd/fun/log_sum_exp.hpp @@ -3,11 +3,9 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include #include #include diff --git a/stan/math/fwd/fun/logit.hpp b/stan/math/fwd/fun/logit.hpp index ed11300e9d4..c5572814bf5 100644 --- a/stan/math/fwd/fun/logit.hpp +++ b/stan/math/fwd/fun/logit.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/mdivide_left.hpp b/stan/math/fwd/fun/mdivide_left.hpp index 84083ff306d..319f9eb72d1 100644 --- a/stan/math/fwd/fun/mdivide_left.hpp +++ b/stan/math/fwd/fun/mdivide_left.hpp @@ -2,10 +2,10 @@ #define STAN_MATH_FWD_FUN_MDIVIDE_LEFT_HPP #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include diff --git a/stan/math/fwd/fun/mdivide_left_ldlt.hpp b/stan/math/fwd/fun/mdivide_left_ldlt.hpp index c7a910da45a..881c0616ae5 100644 --- a/stan/math/fwd/fun/mdivide_left_ldlt.hpp +++ b/stan/math/fwd/fun/mdivide_left_ldlt.hpp @@ -2,9 +2,9 @@ #define STAN_MATH_FWD_FUN_MDIVIDE_LEFT_LDLT_HPP #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/mdivide_left_tri_low.hpp b/stan/math/fwd/fun/mdivide_left_tri_low.hpp index 261c9a4c801..c66d256af7a 100644 --- a/stan/math/fwd/fun/mdivide_left_tri_low.hpp +++ b/stan/math/fwd/fun/mdivide_left_tri_low.hpp @@ -2,8 +2,8 @@ #define STAN_MATH_FWD_FUN_MDIVIDE_LEFT_TRI_LOW_HPP #include -#include -#include +#include +#include #include #include #include diff --git a/stan/math/fwd/fun/mdivide_right.hpp b/stan/math/fwd/fun/mdivide_right.hpp index a4e16023b64..5aea6c53b5d 100644 --- a/stan/math/fwd/fun/mdivide_right.hpp +++ b/stan/math/fwd/fun/mdivide_right.hpp @@ -2,9 +2,9 @@ #define STAN_MATH_FWD_FUN_MDIVIDE_RIGHT_HPP #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/stan/math/fwd/fun/mdivide_right_tri_low.hpp b/stan/math/fwd/fun/mdivide_right_tri_low.hpp index f282bc78bed..d1cca4d3836 100644 --- a/stan/math/fwd/fun/mdivide_right_tri_low.hpp +++ b/stan/math/fwd/fun/mdivide_right_tri_low.hpp @@ -2,8 +2,8 @@ #define STAN_MATH_FWD_FUN_MDIVIDE_RIGHT_TRI_LOW_HPP #include -#include -#include +#include +#include #include #include #include diff --git a/stan/math/fwd/fun/modified_bessel_first_kind.hpp b/stan/math/fwd/fun/modified_bessel_first_kind.hpp index 6f8b34a21e4..13d68ac3f94 100644 --- a/stan/math/fwd/fun/modified_bessel_first_kind.hpp +++ b/stan/math/fwd/fun/modified_bessel_first_kind.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/modified_bessel_second_kind.hpp b/stan/math/fwd/fun/modified_bessel_second_kind.hpp index b81a46b5d1b..25ccd22e951 100644 --- a/stan/math/fwd/fun/modified_bessel_second_kind.hpp +++ b/stan/math/fwd/fun/modified_bessel_second_kind.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/multiply.hpp b/stan/math/fwd/fun/multiply.hpp index 592e1dd8c5a..107c82b0304 100644 --- a/stan/math/fwd/fun/multiply.hpp +++ b/stan/math/fwd/fun/multiply.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_FWD_FUN_MULTIPLY_HPP #include -#include +#include #include #include #include diff --git a/stan/math/fwd/fun/multiply_log.hpp b/stan/math/fwd/fun/multiply_log.hpp index fbad394399c..32eea41173f 100644 --- a/stan/math/fwd/fun/multiply_log.hpp +++ b/stan/math/fwd/fun/multiply_log.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/multiply_lower_tri_self_transpose.hpp b/stan/math/fwd/fun/multiply_lower_tri_self_transpose.hpp index 271194ddb04..de334ae6c31 100644 --- a/stan/math/fwd/fun/multiply_lower_tri_self_transpose.hpp +++ b/stan/math/fwd/fun/multiply_lower_tri_self_transpose.hpp @@ -1,8 +1,8 @@ #ifndef STAN_MATH_FWD_FUN_MULTIPLY_LOWER_TRI_SELF_TRANSPOSE_HPP #define STAN_MATH_FWD_FUN_MULTIPLY_LOWER_TRI_SELF_TRANSPOSE_HPP -#include -#include +#include +#include #include #include diff --git a/stan/math/fwd/fun/owens_t.hpp b/stan/math/fwd/fun/owens_t.hpp index 47ac6366a2c..42c5898ed15 100644 --- a/stan/math/fwd/fun/owens_t.hpp +++ b/stan/math/fwd/fun/owens_t.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/primitive_value.hpp b/stan/math/fwd/fun/primitive_value.hpp index 4939b5a1453..87c6a4d4f09 100644 --- a/stan/math/fwd/fun/primitive_value.hpp +++ b/stan/math/fwd/fun/primitive_value.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/qr_Q.hpp b/stan/math/fwd/fun/qr_Q.hpp index 11ee57f6e32..f7d75fc3d03 100644 --- a/stan/math/fwd/fun/qr_Q.hpp +++ b/stan/math/fwd/fun/qr_Q.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_FWD_FUN_QR_Q_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/qr_R.hpp b/stan/math/fwd/fun/qr_R.hpp index abcceeb9162..71de4b903e9 100644 --- a/stan/math/fwd/fun/qr_R.hpp +++ b/stan/math/fwd/fun/qr_R.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_FWD_FUN_QR_R_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/rising_factorial.hpp b/stan/math/fwd/fun/rising_factorial.hpp index efee979909f..461665edce1 100644 --- a/stan/math/fwd/fun/rising_factorial.hpp +++ b/stan/math/fwd/fun/rising_factorial.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/round.hpp b/stan/math/fwd/fun/round.hpp index 98154e891e6..31d0108263e 100644 --- a/stan/math/fwd/fun/round.hpp +++ b/stan/math/fwd/fun/round.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/rows_dot_product.hpp b/stan/math/fwd/fun/rows_dot_product.hpp index c8a9e7667ea..1de15ae2fe9 100644 --- a/stan/math/fwd/fun/rows_dot_product.hpp +++ b/stan/math/fwd/fun/rows_dot_product.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_FWD_FUN_ROWS_DOT_PRODUCT_HPP #include -#include +#include #include #include diff --git a/stan/math/fwd/fun/rows_dot_self.hpp b/stan/math/fwd/fun/rows_dot_self.hpp index b0d089558d7..6a1f4f9ec1c 100644 --- a/stan/math/fwd/fun/rows_dot_self.hpp +++ b/stan/math/fwd/fun/rows_dot_self.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_FWD_FUN_ROWS_DOT_SELF_HPP #define STAN_MATH_FWD_FUN_ROWS_DOT_SELF_HPP -#include +#include #include #include diff --git a/stan/math/fwd/fun/softmax.hpp b/stan/math/fwd/fun/softmax.hpp index a10c05e78ff..e30165f3cac 100644 --- a/stan/math/fwd/fun/softmax.hpp +++ b/stan/math/fwd/fun/softmax.hpp @@ -2,8 +2,8 @@ #define STAN_MATH_FWD_FUN_SOFTMAX_HPP #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/sqrt.hpp b/stan/math/fwd/fun/sqrt.hpp index 0182d5d2c62..92b712cf6f6 100644 --- a/stan/math/fwd/fun/sqrt.hpp +++ b/stan/math/fwd/fun/sqrt.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/square.hpp b/stan/math/fwd/fun/square.hpp index 7b2280e8655..a7cf25c6498 100644 --- a/stan/math/fwd/fun/square.hpp +++ b/stan/math/fwd/fun/square.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/squared_distance.hpp b/stan/math/fwd/fun/squared_distance.hpp index f091b697fe3..9c20f4ada0f 100644 --- a/stan/math/fwd/fun/squared_distance.hpp +++ b/stan/math/fwd/fun/squared_distance.hpp @@ -2,8 +2,8 @@ #define STAN_MATH_FWD_FUN_SQUARED_DISTANCE_HPP #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/sum.hpp b/stan/math/fwd/fun/sum.hpp index 3c843394f00..9299f82f80d 100644 --- a/stan/math/fwd/fun/sum.hpp +++ b/stan/math/fwd/fun/sum.hpp @@ -2,9 +2,8 @@ #define STAN_MATH_FWD_FUN_SUM_HPP #include -#include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/tcrossprod.hpp b/stan/math/fwd/fun/tcrossprod.hpp index aa93bc5754c..b33118e8763 100644 --- a/stan/math/fwd/fun/tcrossprod.hpp +++ b/stan/math/fwd/fun/tcrossprod.hpp @@ -1,8 +1,8 @@ #ifndef STAN_MATH_FWD_FUN_TCROSSPROD_HPP #define STAN_MATH_FWD_FUN_TCROSSPROD_HPP -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/tgamma.hpp b/stan/math/fwd/fun/tgamma.hpp index caa17e2a55f..ef9d2f0b173 100644 --- a/stan/math/fwd/fun/tgamma.hpp +++ b/stan/math/fwd/fun/tgamma.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/to_fvar.hpp b/stan/math/fwd/fun/to_fvar.hpp index 52dc6ff9be3..8b35963f4ea 100644 --- a/stan/math/fwd/fun/to_fvar.hpp +++ b/stan/math/fwd/fun/to_fvar.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_FWD_FUN_TO_FVAR_HPP #include -#include +#include #include #include #include diff --git a/stan/math/fwd/fun/trace_quad_form.hpp b/stan/math/fwd/fun/trace_quad_form.hpp index 8497094f28e..b4662bfb3d4 100644 --- a/stan/math/fwd/fun/trace_quad_form.hpp +++ b/stan/math/fwd/fun/trace_quad_form.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/trigamma.hpp b/stan/math/fwd/fun/trigamma.hpp index f5e5158e3f3..3f60c14a9f5 100644 --- a/stan/math/fwd/fun/trigamma.hpp +++ b/stan/math/fwd/fun/trigamma.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/trunc.hpp b/stan/math/fwd/fun/trunc.hpp index 71ac6b098ad..9552dc8281a 100644 --- a/stan/math/fwd/fun/trunc.hpp +++ b/stan/math/fwd/fun/trunc.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/fun/typedefs.hpp b/stan/math/fwd/fun/typedefs.hpp index d6aadc19ddb..bd8ab2d84e4 100644 --- a/stan/math/fwd/fun/typedefs.hpp +++ b/stan/math/fwd/fun/typedefs.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_FWD_FUN_TYPEDEFS_HPP #define STAN_MATH_FWD_FUN_TYPEDEFS_HPP -#include +#include #include #include diff --git a/stan/math/fwd/fun/unit_vector_constrain.hpp b/stan/math/fwd/fun/unit_vector_constrain.hpp index 8a206264fcc..2a1e2792af9 100644 --- a/stan/math/fwd/fun/unit_vector_constrain.hpp +++ b/stan/math/fwd/fun/unit_vector_constrain.hpp @@ -6,11 +6,11 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/fwd/fun/value_of_rec.hpp b/stan/math/fwd/fun/value_of_rec.hpp index 69341728d8a..811836c57ff 100644 --- a/stan/math/fwd/fun/value_of_rec.hpp +++ b/stan/math/fwd/fun/value_of_rec.hpp @@ -1,8 +1,8 @@ #ifndef STAN_MATH_FWD_FUN_VALUE_OF_REC_HPP #define STAN_MATH_FWD_FUN_VALUE_OF_REC_HPP +#include #include -#include #include namespace stan { diff --git a/stan/math/fwd/functor/gradient.hpp b/stan/math/fwd/functor/gradient.hpp index 18660854705..e31e542e874 100644 --- a/stan/math/fwd/functor/gradient.hpp +++ b/stan/math/fwd/functor/gradient.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_FWD_FUNCTOR_GRADIENT_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/functor/hessian.hpp b/stan/math/fwd/functor/hessian.hpp index 5ec00197d00..ba75e8007f2 100644 --- a/stan/math/fwd/functor/hessian.hpp +++ b/stan/math/fwd/functor/hessian.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_FWD_FUNCTOR_HESSIAN_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/functor/jacobian.hpp b/stan/math/fwd/functor/jacobian.hpp index 043e127210a..283a2f71e5c 100644 --- a/stan/math/fwd/functor/jacobian.hpp +++ b/stan/math/fwd/functor/jacobian.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_FWD_FUNCTOR_JACOBIAN_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/fwd/meta/operands_and_partials.hpp b/stan/math/fwd/meta/operands_and_partials.hpp index 54bcb518754..47eec6c04db 100644 --- a/stan/math/fwd/meta/operands_and_partials.hpp +++ b/stan/math/fwd/meta/operands_and_partials.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_FWD_META_OPERANDS_AND_PARTIALS_HPP #define STAN_MATH_FWD_META_OPERANDS_AND_PARTIALS_HPP -#include +#include #include #include #include diff --git a/stan/math/mix.hpp b/stan/math/mix.hpp index 4fbced374e1..b2814caa769 100644 --- a/stan/math/mix.hpp +++ b/stan/math/mix.hpp @@ -3,9 +3,7 @@ #include -#include -#include -#include +#include #include #include #include diff --git a/stan/math/mix/fun/typedefs.hpp b/stan/math/mix/fun/typedefs.hpp index c83e1fd3efb..ddf7ea5d793 100644 --- a/stan/math/mix/fun/typedefs.hpp +++ b/stan/math/mix/fun/typedefs.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_MIX_MAT_FUN_TYPEDEFS_HPP #define STAN_MATH_MIX_MAT_FUN_TYPEDEFS_HPP -#include +#include #include #include #include diff --git a/stan/math/mix/functor/derivative.hpp b/stan/math/mix/functor/derivative.hpp index 4e9a295646f..868d1591716 100644 --- a/stan/math/mix/functor/derivative.hpp +++ b/stan/math/mix/functor/derivative.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_MIX_FUNCTOR_DERIVATIVE_HPP #include -#include +#include #include #include diff --git a/stan/math/mix/functor/finite_diff_grad_hessian.hpp b/stan/math/mix/functor/finite_diff_grad_hessian.hpp index 97b694c4671..95bab8427e3 100644 --- a/stan/math/mix/functor/finite_diff_grad_hessian.hpp +++ b/stan/math/mix/functor/finite_diff_grad_hessian.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_MIX_FUNCTOR_FINITE_DIFF_GRAD_HESSIAN_HPP #define STAN_MATH_MIX_FUNCTOR_FINITE_DIFF_GRAD_HESSIAN_HPP -#include +#include #include #include #include diff --git a/stan/math/mix/functor/finite_diff_grad_hessian_auto.hpp b/stan/math/mix/functor/finite_diff_grad_hessian_auto.hpp index b744d91e812..108b059149c 100644 --- a/stan/math/mix/functor/finite_diff_grad_hessian_auto.hpp +++ b/stan/math/mix/functor/finite_diff_grad_hessian_auto.hpp @@ -1,9 +1,9 @@ #ifndef STAN_MATH_MIX_FUNCTOR_FINITE_DIFF_GRAD_HESSIAN_AUTO_HPP #define STAN_MATH_MIX_FUNCTOR_FINITE_DIFF_GRAD_HESSIAN_AUTO_HPP -#include -#include +#include #include +#include #include #include diff --git a/stan/math/mix/functor/grad_hessian.hpp b/stan/math/mix/functor/grad_hessian.hpp index 9a84075e233..5f68eb7952a 100644 --- a/stan/math/mix/functor/grad_hessian.hpp +++ b/stan/math/mix/functor/grad_hessian.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_MIX_FUNCTOR_GRAD_HESSIAN_HPP #include -#include +#include #include #include #include diff --git a/stan/math/mix/functor/grad_tr_mat_times_hessian.hpp b/stan/math/mix/functor/grad_tr_mat_times_hessian.hpp index 81d4714f0cc..415260e7145 100644 --- a/stan/math/mix/functor/grad_tr_mat_times_hessian.hpp +++ b/stan/math/mix/functor/grad_tr_mat_times_hessian.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_MIX_FUNCTOR_GRAD_TR_MAT_TIMES_HESSIAN_HPP #include -#include +#include #include #include #include diff --git a/stan/math/mix/functor/gradient_dot_vector.hpp b/stan/math/mix/functor/gradient_dot_vector.hpp index 334fce51e08..99124607053 100644 --- a/stan/math/mix/functor/gradient_dot_vector.hpp +++ b/stan/math/mix/functor/gradient_dot_vector.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_MIX_FUNCTOR_GRADIENT_DOT_VECTOR_HPP #include -#include +#include #include #include diff --git a/stan/math/mix/functor/hessian.hpp b/stan/math/mix/functor/hessian.hpp index bb72dfeec73..1b8c04a5af4 100644 --- a/stan/math/mix/functor/hessian.hpp +++ b/stan/math/mix/functor/hessian.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_MIX_FUNCTOR_HESSIAN_HPP #include -#include +#include #include #include diff --git a/stan/math/mix/functor/hessian_times_vector.hpp b/stan/math/mix/functor/hessian_times_vector.hpp index d6e54d201ff..c3f44041f1f 100644 --- a/stan/math/mix/functor/hessian_times_vector.hpp +++ b/stan/math/mix/functor/hessian_times_vector.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_MIX_FUNCTOR_HESSIAN_TIMES_VECTOR_HPP #include -#include +#include #include #include #include diff --git a/stan/math/mix/functor/partial_derivative.hpp b/stan/math/mix/functor/partial_derivative.hpp index 7a7ca856ed0..743404c2c4a 100644 --- a/stan/math/mix/functor/partial_derivative.hpp +++ b/stan/math/mix/functor/partial_derivative.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_MIX_FUNCTOR_PARTIAL_DERIVATIVE_HPP #include -#include +#include #include #include diff --git a/stan/math/opencl/copy.hpp b/stan/math/opencl/copy.hpp index 9360d8e68a6..f572121ada6 100644 --- a/stan/math/opencl/copy.hpp +++ b/stan/math/opencl/copy.hpp @@ -4,7 +4,8 @@ #include #include -#include +#include +#include #include #include #include @@ -15,7 +16,6 @@ #include #include #include -#include #include #include diff --git a/stan/math/opencl/diagonal_multiply.hpp b/stan/math/opencl/diagonal_multiply.hpp index e0c69bb1ca9..553ff7e24b9 100644 --- a/stan/math/opencl/diagonal_multiply.hpp +++ b/stan/math/opencl/diagonal_multiply.hpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include namespace stan { namespace math { diff --git a/stan/math/opencl/err/check_vector.hpp b/stan/math/opencl/err/check_vector.hpp index 84b5ad12593..bda9a7e6663 100644 --- a/stan/math/opencl/err/check_vector.hpp +++ b/stan/math/opencl/err/check_vector.hpp @@ -3,7 +3,7 @@ #ifdef STAN_OPENCL #include -#include +#include #include #include #include diff --git a/stan/math/opencl/kernel_cl.hpp b/stan/math/opencl/kernel_cl.hpp index 89ff3c8d575..601103a68cf 100644 --- a/stan/math/opencl/kernel_cl.hpp +++ b/stan/math/opencl/kernel_cl.hpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/stan/math/opencl/matrix_cl.hpp b/stan/math/opencl/matrix_cl.hpp index 0dc8ec056e8..b5122d44926 100644 --- a/stan/math/opencl/matrix_cl.hpp +++ b/stan/math/opencl/matrix_cl.hpp @@ -2,14 +2,14 @@ #define STAN_MATH_OPENCL_MATRIX_CL_HPP #ifdef STAN_OPENCL -#include -#include #include +#include +#include +#include #include #include #include #include -#include #include #include #include diff --git a/stan/math/opencl/multiply.hpp b/stan/math/opencl/multiply.hpp index 0c666d79192..515b4b2208b 100644 --- a/stan/math/opencl/multiply.hpp +++ b/stan/math/opencl/multiply.hpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include diff --git a/stan/math/opencl/multiply_transpose.hpp b/stan/math/opencl/multiply_transpose.hpp index 2072e4f348d..28250db67e9 100644 --- a/stan/math/opencl/multiply_transpose.hpp +++ b/stan/math/opencl/multiply_transpose.hpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/opencl/opencl.hpp b/stan/math/opencl/opencl.hpp index e28157fdfc4..e0212b5946d 100644 --- a/stan/math/opencl/opencl.hpp +++ b/stan/math/opencl/opencl.hpp @@ -10,7 +10,7 @@ * \ingroup opencl * \defgroup opencl_kernels OpenCL Kernels */ -#include +#include #include #include #include diff --git a/stan/math/opencl/opencl_context.hpp b/stan/math/opencl/opencl_context.hpp index 1398409ad9f..723da24754b 100644 --- a/stan/math/opencl/opencl_context.hpp +++ b/stan/math/opencl/opencl_context.hpp @@ -171,13 +171,13 @@ class opencl_context_base { int cholesky_rev_block_partition = 8; // used in math/opencl/multiply int multiply_wgs_per_compute_unit = 5; - // used in math/prim/mat/fun/gp_exp_quad_cov + // used in math/prim/fun/gp_exp_quad_cov double gp_exp_quad_cov_complex = 1'000'000; double gp_exp_quad_cov_simple = 1'250; - // used in math/prim/mat/fun/multiply + // used in math/prim/fun/multiply // and math/rev/fun/multiply int multiply_dim_prod_worth_transfer = 2000000; - // used in math/prim/mat/fun/mdivide_left_tri + // used in math/prim/fun/mdivide_left_tri // and math/rev/fun/mdivide_left_tri int tri_inverse_size_worth_transfer = 100; } tuning_opts_; diff --git a/stan/math/opencl/prim/bernoulli_logit_glm_lpmf.hpp b/stan/math/opencl/prim/bernoulli_logit_glm_lpmf.hpp index 73ce4fd66b6..f805ba27da0 100644 --- a/stan/math/opencl/prim/bernoulli_logit_glm_lpmf.hpp +++ b/stan/math/opencl/prim/bernoulli_logit_glm_lpmf.hpp @@ -4,14 +4,12 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include diff --git a/stan/math/opencl/prim/categorical_logit_glm_lpmf.hpp b/stan/math/opencl/prim/categorical_logit_glm_lpmf.hpp index 6f11424933b..0a59a04d8ff 100644 --- a/stan/math/opencl/prim/categorical_logit_glm_lpmf.hpp +++ b/stan/math/opencl/prim/categorical_logit_glm_lpmf.hpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/stan/math/opencl/prim/gp_exp_quad_cov.hpp b/stan/math/opencl/prim/gp_exp_quad_cov.hpp index 4d0c5bf0de8..fde0bd73fc9 100644 --- a/stan/math/opencl/prim/gp_exp_quad_cov.hpp +++ b/stan/math/opencl/prim/gp_exp_quad_cov.hpp @@ -3,7 +3,7 @@ #ifdef STAN_OPENCL #include -#include +#include #include #include #include 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 21f7510f058..3f39f4ddd3e 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 @@ -4,19 +4,15 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include - #include #include diff --git a/stan/math/opencl/prim/normal_id_glm_lpdf.hpp b/stan/math/opencl/prim/normal_id_glm_lpdf.hpp index 45ef2d44f30..feb6a90c855 100644 --- a/stan/math/opencl/prim/normal_id_glm_lpdf.hpp +++ b/stan/math/opencl/prim/normal_id_glm_lpdf.hpp @@ -4,18 +4,15 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include #include #include -#include #include +#include #include - #include namespace stan { diff --git a/stan/math/opencl/prim/ordered_logistic_glm_lpmf.hpp b/stan/math/opencl/prim/ordered_logistic_glm_lpmf.hpp index 1dc25d84c7c..aa767683125 100644 --- a/stan/math/opencl/prim/ordered_logistic_glm_lpmf.hpp +++ b/stan/math/opencl/prim/ordered_logistic_glm_lpmf.hpp @@ -2,17 +2,15 @@ #define STAN_MATH_OPENCL_PRIM_ORDERED_LOGISTIC_GLM_LPMF_HPP #ifdef STAN_OPENCL -#include -#include -#include -#include -#include -#include #include - +#include +#include +#include +#include +#include #include -#include #include +#include #include #include diff --git a/stan/math/opencl/prim/poisson_log_glm_lpmf.hpp b/stan/math/opencl/prim/poisson_log_glm_lpmf.hpp index c5b9ef6d455..155f6cd1ec0 100644 --- a/stan/math/opencl/prim/poisson_log_glm_lpmf.hpp +++ b/stan/math/opencl/prim/poisson_log_glm_lpmf.hpp @@ -4,17 +4,15 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include +#include #include #include -#include #include #include diff --git a/stan/math/opencl/rev/copy.hpp b/stan/math/opencl/rev/copy.hpp index 9ecc392cde7..29a595ab256 100644 --- a/stan/math/opencl/rev/copy.hpp +++ b/stan/math/opencl/rev/copy.hpp @@ -3,9 +3,9 @@ #ifdef STAN_OPENCL #include -#include +#include +#include #include -#include #include #include diff --git a/stan/math/opencl/rev/matrix_cl.hpp b/stan/math/opencl/rev/matrix_cl.hpp index 3c2211de344..0142e1ecf32 100644 --- a/stan/math/opencl/rev/matrix_cl.hpp +++ b/stan/math/opencl/rev/matrix_cl.hpp @@ -3,11 +3,11 @@ #ifdef STAN_OPENCL #include -#include +#include +#include +#include #include #include -#include -#include #include #include #include diff --git a/stan/math/opencl/rev/sub_block.hpp b/stan/math/opencl/rev/sub_block.hpp index 2d37eb1108c..7194433aee2 100644 --- a/stan/math/opencl/rev/sub_block.hpp +++ b/stan/math/opencl/rev/sub_block.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_OPENCL_REV_SUB_BLOCK_HPP #ifdef STAN_OPENCL -#include +#include #include #include #include diff --git a/stan/math/opencl/rev/triangular_transpose.hpp b/stan/math/opencl/rev/triangular_transpose.hpp index eb7235f2ff8..d78d5b77ab6 100644 --- a/stan/math/opencl/rev/triangular_transpose.hpp +++ b/stan/math/opencl/rev/triangular_transpose.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_OPENCL_REV_TRIANGULAR_TRANSPOSE_HPP #ifdef STAN_OPENCL -#include +#include #include #include #include diff --git a/stan/math/opencl/rev/zeros.hpp b/stan/math/opencl/rev/zeros.hpp index 14ea55dbdb4..6df84d043dd 100644 --- a/stan/math/opencl/rev/zeros.hpp +++ b/stan/math/opencl/rev/zeros.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_OPENCL_REV_ZEROS_HPP #ifdef STAN_OPENCL -#include +#include #include #include #include diff --git a/stan/math/prim.hpp b/stan/math/prim.hpp index 5abadfad4fa..79c88e315ec 100644 --- a/stan/math/prim.hpp +++ b/stan/math/prim.hpp @@ -1,8 +1,15 @@ #ifndef STAN_MATH_PRIM_HPP #define STAN_MATH_PRIM_HPP -#include -#include -#include +#include + +#include +#include +#include + +#include +#include +#include +#include #endif diff --git a/stan/math/prim/arr.hpp b/stan/math/prim/arr.hpp deleted file mode 100644 index 42044780994..00000000000 --- a/stan/math/prim/arr.hpp +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef STAN_MATH_PRIM_ARR_HPP -#define STAN_MATH_PRIM_ARR_HPP - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#endif diff --git a/stan/math/prim/arr/fun/common_type.hpp b/stan/math/prim/arr/fun/common_type.hpp deleted file mode 100644 index 5578c28d553..00000000000 --- a/stan/math/prim/arr/fun/common_type.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef STAN_MATH_PRIM_ARR_FUN_COMMON_TYPE_HPP -#define STAN_MATH_PRIM_ARR_FUN_COMMON_TYPE_HPP - -#include -#include -#include - -namespace stan { -namespace math { -/** - * Struct which calculates type promotion over two types. - * - *

This specialization is for vector types. - * - * @tparam T1 type of elements contined in std::vector - * @tparam T2 type of elements contined in std::vector - */ -template -struct common_type, std::vector > { - using type = std::vector::type>; -}; - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/arr/fun/dot_self.hpp b/stan/math/prim/arr/fun/dot_self.hpp deleted file mode 100644 index 9b47bbaca5d..00000000000 --- a/stan/math/prim/arr/fun/dot_self.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef STAN_MATH_PRIM_ARR_FUN_DOT_SELF_HPP -#define STAN_MATH_PRIM_ARR_FUN_DOT_SELF_HPP - -#include -#include -#include - -namespace stan { -namespace math { - -inline double dot_self(const std::vector& x) { - double sum = 0.0; - for (double i : x) { - sum += i * i; - } - return sum; -} - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/arr/fun/fill.hpp b/stan/math/prim/arr/fun/fill.hpp deleted file mode 100644 index 210132be7c8..00000000000 --- a/stan/math/prim/arr/fun/fill.hpp +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef STAN_MATH_PRIM_ARR_FUN_FILL_HPP -#define STAN_MATH_PRIM_ARR_FUN_FILL_HPP - -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Fill the specified container with the specified value. - * - * Each container in the specified standard vector is filled - * recursively by calling fill. - * - * @tparam T Type of container in vector. - * @tparam S Type of value. - * @param[in] x Container. - * @param[in, out] y Value. - */ -template -void fill(std::vector& x, const S& y) { - for (typename std::vector::size_type i = 0; i < x.size(); ++i) { - fill(x[i], y); - } -} - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/arr/fun/log_sum_exp.hpp b/stan/math/prim/arr/fun/log_sum_exp.hpp deleted file mode 100644 index 20dce54abf1..00000000000 --- a/stan/math/prim/arr/fun/log_sum_exp.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef STAN_MATH_PRIM_ARR_FUN_LOG_SUM_EXP_HPP -#define STAN_MATH_PRIM_ARR_FUN_LOG_SUM_EXP_HPP - -#include -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Return the log of the sum of the exponentiated values of the specified - * sequence of values. - * - * The function is defined as follows to prevent overflow in exponential - * calculations. - * - * \f$\log \sum_{n=1}^N \exp(x_n) = \max(x) + \log \sum_{n=1}^N \exp(x_n - - * \max(x))\f$. - * - * @param[in] x array of specified values - * @return The log of the sum of the exponentiated vector values. - */ -inline double log_sum_exp(const std::vector& x) { - using std::exp; - using std::log; - double max = NEGATIVE_INFTY; - for (double xx : x) { - if (xx > max) { - max = xx; - } - } - - double sum = 0.0; - for (size_t ii = 0; ii < x.size(); ii++) { - if (x[ii] != NEGATIVE_INFTY) { - sum += exp(x[ii] - max); - } - } - - return max + log(sum); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/arr/fun/promote_elements.hpp b/stan/math/prim/arr/fun/promote_elements.hpp deleted file mode 100644 index bec98a40165..00000000000 --- a/stan/math/prim/arr/fun/promote_elements.hpp +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef STAN_MATH_PRIM_ARR_FUN_PROMOTE_ELEMENTS_HPP -#define STAN_MATH_PRIM_ARR_FUN_PROMOTE_ELEMENTS_HPP - -#include -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Struct with static function for elementwise type promotion. - * - *

This specialization promotes vector elements of different types - * which must be compatible with promotion. - * - * @tparam T type of promoted elements - * @tparam S type of input elements, must be assignable to T - */ -template -struct promote_elements, std::vector > { - /** - * Return input vector of type S as vector of type T. - * - * @param u vector of type S, assignable to type T - * @returns vector of type T - */ - inline static std::vector promote(const std::vector& u) { - std::vector t; - t.reserve(u.size()); - for (size_t i = 0; i < u.size(); ++i) { - t.push_back(promote_elements::promote(u[i])); - } - return t; - } -}; - -/** - * Struct with static function for elementwise type promotion. - * - *

This specialization promotes vector elements of the same type. - * - * @tparam T type of elements - */ -template -struct promote_elements, std::vector > { - /** - * Return input vector. - * - * @param u vector of type T - * @returns vector of type T - */ - inline static const std::vector& promote(const std::vector& u) { - return u; - } -}; - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/arr/fun/promote_scalar.hpp b/stan/math/prim/arr/fun/promote_scalar.hpp deleted file mode 100644 index c8e211ec335..00000000000 --- a/stan/math/prim/arr/fun/promote_scalar.hpp +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef STAN_MATH_PRIM_ARR_FUN_PROMOTE_SCALAR_HPP -#define STAN_MATH_PRIM_ARR_FUN_PROMOTE_SCALAR_HPP - -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Struct to hold static function for promoting underlying scalar - * types. This specialization is for standard vector inputs. - * - * @tparam T return scalar type - * @tparam S input type for standard vector elements in static - * nested function, which must have an underlying scalar type - * assignable to T. - */ -template -struct promote_scalar_struct > { - /** - * Return the standard vector consisting of the recursive - * promotion of the elements of the input standard vector to the - * scalar type specified by the return template parameter. - * - * @param x input standard vector. - * @return standard vector with values promoted from input vector. - */ - static std::vector::type> apply( - const std::vector& x) { - using return_t = std::vector::type>; - using idx_t = typename index_type::type; - return_t y(x.size()); - for (idx_t i = 0; i < x.size(); ++i) { - y[i] = promote_scalar_struct::apply(x[i]); - } - return y; - } -}; - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/arr/fun/sort_asc.hpp b/stan/math/prim/arr/fun/sort_asc.hpp deleted file mode 100644 index 8440367f69e..00000000000 --- a/stan/math/prim/arr/fun/sort_asc.hpp +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef STAN_MATH_PRIM_ARR_FUN_SORT_ASC_HPP -#define STAN_MATH_PRIM_ARR_FUN_SORT_ASC_HPP - -#include -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Return the specified standard vector in ascending order. - * - * @tparam T Type of elements contained in vector. - * @param xs Vector to order. - * @return Vector in ascending order. - * @throw std::domain_error If any of the values are NaN. - */ -template -inline std::vector sort_asc(std::vector xs) { - check_not_nan("sort_asc", "container argument", xs); - std::sort(xs.begin(), xs.end()); - return xs; -} - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/arr/fun/sort_desc.hpp b/stan/math/prim/arr/fun/sort_desc.hpp deleted file mode 100644 index dcb085c3ba9..00000000000 --- a/stan/math/prim/arr/fun/sort_desc.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef STAN_MATH_PRIM_ARR_FUN_SORT_DESC_HPP -#define STAN_MATH_PRIM_ARR_FUN_SORT_DESC_HPP - -#include -#include -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Return the specified standard vector in descending order. - * - * @tparam T Type of elements contained in vector. - * @param xs Vector to order. - * @return Vector in descending order. - * @throw std::domain_error If any of the values are NaN. - */ -template -inline std::vector sort_desc(std::vector xs) { - check_not_nan("sort_asc", "container argument", xs); - std::sort(xs.begin(), xs.end(), std::greater()); - return xs; -} - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/arr/fun/sum.hpp b/stan/math/prim/arr/fun/sum.hpp deleted file mode 100644 index a3639f50e23..00000000000 --- a/stan/math/prim/arr/fun/sum.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef STAN_MATH_PRIM_ARR_FUN_SUM_HPP -#define STAN_MATH_PRIM_ARR_FUN_SUM_HPP - -#include -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Return the sum of the values in the specified standard vector. - * - * @tparam T Type of elements summed. - * @param xs Standard vector to sum. - * @return Sum of elements. - */ -template -inline T sum(const std::vector& xs) { - return std::accumulate(xs.begin(), xs.end(), T{0}); -} - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/arr/fun/value_of.hpp b/stan/math/prim/arr/fun/value_of.hpp deleted file mode 100644 index b3afbcec974..00000000000 --- a/stan/math/prim/arr/fun/value_of.hpp +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef STAN_MATH_PRIM_ARR_FUN_VALUE_OF_HPP -#define STAN_MATH_PRIM_ARR_FUN_VALUE_OF_HPP - -#include -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Convert a std::vector of type T to a std::vector of - * child_type::type. - * - * @tparam T Scalar type in std::vector - * @param[in] x std::vector to be converted - * @return std::vector of values - **/ -template -inline std::vector::type> value_of( - const std::vector& x) { - size_t x_size = x.size(); - std::vector::type> result(x_size); - for (size_t i = 0; i < x_size; i++) { - result[i] = value_of(x[i]); - } - return result; -} - -/** - * Return the specified argument. - * - *

See value_of(T) for a polymorphic - * implementation using static casts. - * - *

This inline pass-through no-op should be compiled away. - * - * @param x Specified std::vector. - * @return Specified std::vector. - */ -inline const std::vector& value_of(const std::vector& x) { - return x; -} - -/** - * Return the specified argument. - * - *

See value_of(T) for a polymorphic - * implementation using static casts. - * - *

This inline pass-through no-op should be compiled away. - * - * @param x Specified std::vector. - * @return Specified std::vector. - */ -inline const std::vector& value_of(const std::vector& x) { return x; } - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/arr/fun/value_of_rec.hpp b/stan/math/prim/arr/fun/value_of_rec.hpp deleted file mode 100644 index d38979b0af0..00000000000 --- a/stan/math/prim/arr/fun/value_of_rec.hpp +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef STAN_MATH_PRIM_ARR_FUN_VALUE_OF_REC_HPP -#define STAN_MATH_PRIM_ARR_FUN_VALUE_OF_REC_HPP - -#include -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Convert a std::vector of type T to a std::vector of doubles. - * - * T must implement value_of_rec. See - * test/math/fwd/fun/value_of_rec.cpp for fvar and var usage. - * - * @tparam T Scalar type in std::vector - * @param[in] x std::vector to be converted - * @return std::vector of values - **/ -template -inline std::vector value_of_rec(const std::vector& x) { - size_t x_size = x.size(); - std::vector result(x_size); - for (size_t i = 0; i < x_size; i++) { - result[i] = value_of_rec(x[i]); - } - return result; -} - -/** - * Return the specified argument. - * - *

See value_of_rec(T) for a polymorphic - * implementation using static casts. - * - *

This inline pass-through no-op should be compiled away. - * - * @param x Specified std::vector. - * @return Specified std::vector. - */ -inline const std::vector& value_of_rec(const std::vector& x) { - return x; -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/eigen_plugins.h b/stan/math/prim/eigen_plugins.h similarity index 98% rename from stan/math/prim/mat/eigen_plugins.h rename to stan/math/prim/eigen_plugins.h index c3cd9e01daf..d49a609be97 100644 --- a/stan/math/prim/mat/eigen_plugins.h +++ b/stan/math/prim/eigen_plugins.h @@ -1,6 +1,5 @@ -#ifndef STAN_MATH_PRIM_MAT_EIGEN_PLUGINS_H -#define STAN_MATH_PRIM_MAT_EIGEN_PLUGINS_H - +#ifndef STAN_MATH_PRIM_EIGEN_PLUGINS_H +#define STAN_MATH_PRIM_EIGEN_PLUGINS_H /** * Reimplements is_fvar without requiring external math headers diff --git a/stan/math/prim/err/check_2F1_converges.hpp b/stan/math/prim/err/check_2F1_converges.hpp index 38fe8edcca5..6c9078745e1 100644 --- a/stan/math/prim/err/check_2F1_converges.hpp +++ b/stan/math/prim/err/check_2F1_converges.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include #include #include diff --git a/stan/math/prim/err/check_3F2_converges.hpp b/stan/math/prim/err/check_3F2_converges.hpp index 074f69e3bf0..d9f0a307ce3 100644 --- a/stan/math/prim/err/check_3F2_converges.hpp +++ b/stan/math/prim/err/check_3F2_converges.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include #include #include diff --git a/stan/math/prim/err/check_cholesky_factor.hpp b/stan/math/prim/err/check_cholesky_factor.hpp index 9f646a27dcb..5c26138a43a 100644 --- a/stan/math/prim/err/check_cholesky_factor.hpp +++ b/stan/math/prim/err/check_cholesky_factor.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_ERR_CHECK_CHOLESKY_FACTOR_HPP #include -#include +#include #include #include #include diff --git a/stan/math/prim/err/check_cholesky_factor_corr.hpp b/stan/math/prim/err/check_cholesky_factor_corr.hpp index 97e9d6e4dac..b2d1fd59774 100644 --- a/stan/math/prim/err/check_cholesky_factor_corr.hpp +++ b/stan/math/prim/err/check_cholesky_factor_corr.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_ERR_CHECK_CHOLESKY_FACTOR_CORR_HPP #include -#include +#include #include #include #include diff --git a/stan/math/prim/err/check_column_index.hpp b/stan/math/prim/err/check_column_index.hpp index a544620113e..b4e42d1458d 100644 --- a/stan/math/prim/err/check_column_index.hpp +++ b/stan/math/prim/err/check_column_index.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include diff --git a/stan/math/prim/err/check_corr_matrix.hpp b/stan/math/prim/err/check_corr_matrix.hpp index 60615d80ee0..20684ed6214 100644 --- a/stan/math/prim/err/check_corr_matrix.hpp +++ b/stan/math/prim/err/check_corr_matrix.hpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/stan/math/prim/err/check_cov_matrix.hpp b/stan/math/prim/err/check_cov_matrix.hpp index b74495db8b0..87b7c67b78d 100644 --- a/stan/math/prim/err/check_cov_matrix.hpp +++ b/stan/math/prim/err/check_cov_matrix.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_ERR_CHECK_COV_MATRIX_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/err/check_finite.hpp b/stan/math/prim/err/check_finite.hpp index d947041b09c..f4366e1c7b5 100644 --- a/stan/math/prim/err/check_finite.hpp +++ b/stan/math/prim/err/check_finite.hpp @@ -5,9 +5,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/err/check_ldlt_factor.hpp b/stan/math/prim/err/check_ldlt_factor.hpp index d722795560d..cdb6ca27229 100644 --- a/stan/math/prim/err/check_ldlt_factor.hpp +++ b/stan/math/prim/err/check_ldlt_factor.hpp @@ -1,9 +1,9 @@ #ifndef STAN_MATH_PRIM_ERR_CHECK_LDLT_FACTOR_HPP #define STAN_MATH_PRIM_ERR_CHECK_LDLT_FACTOR_HPP -#include #include -#include +#include +#include #include #include diff --git a/stan/math/prim/err/check_lower_triangular.hpp b/stan/math/prim/err/check_lower_triangular.hpp index 2cada6d9c8b..331c56913b7 100644 --- a/stan/math/prim/err/check_lower_triangular.hpp +++ b/stan/math/prim/err/check_lower_triangular.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_ERR_CHECK_LOWER_TRIANGULAR_HPP #include -#include +#include #include #include #include diff --git a/stan/math/prim/err/check_matching_dims.hpp b/stan/math/prim/err/check_matching_dims.hpp index f5755cae0a7..94b95ec3ba6 100644 --- a/stan/math/prim/err/check_matching_dims.hpp +++ b/stan/math/prim/err/check_matching_dims.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_ERR_CHECK_MATCHING_DIMS_HPP #include -#include +#include #include #include #include diff --git a/stan/math/prim/err/check_multiplicable.hpp b/stan/math/prim/err/check_multiplicable.hpp index a6ea36adfd8..2182ed89dce 100644 --- a/stan/math/prim/err/check_multiplicable.hpp +++ b/stan/math/prim/err/check_multiplicable.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_ERR_CHECK_MULTIPLICABLE_HPP #include -#include +#include #include #include diff --git a/stan/math/prim/err/check_nonempty.hpp b/stan/math/prim/err/check_nonempty.hpp index 5f268f1ea39..6168a2323bf 100644 --- a/stan/math/prim/err/check_nonempty.hpp +++ b/stan/math/prim/err/check_nonempty.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_ERR_CHECK_NONEMPTY_HPP #include -#include +#include #include #include diff --git a/stan/math/prim/err/check_not_nan.hpp b/stan/math/prim/err/check_not_nan.hpp index 66472cb2721..dd874bde415 100644 --- a/stan/math/prim/err/check_not_nan.hpp +++ b/stan/math/prim/err/check_not_nan.hpp @@ -4,8 +4,8 @@ #include #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/err/check_ordered.hpp b/stan/math/prim/err/check_ordered.hpp index e8201a2d74b..37e2d4c7f7b 100644 --- a/stan/math/prim/err/check_ordered.hpp +++ b/stan/math/prim/err/check_ordered.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include #include diff --git a/stan/math/prim/err/check_pos_definite.hpp b/stan/math/prim/err/check_pos_definite.hpp index be04d068ae9..dd1f8ed8ae0 100644 --- a/stan/math/prim/err/check_pos_definite.hpp +++ b/stan/math/prim/err/check_pos_definite.hpp @@ -1,14 +1,14 @@ #ifndef STAN_MATH_PRIM_ERR_CHECK_POS_DEFINITE_HPP #define STAN_MATH_PRIM_ERR_CHECK_POS_DEFINITE_HPP -#include #include #include #include #include #include #include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/err/check_pos_semidefinite.hpp b/stan/math/prim/err/check_pos_semidefinite.hpp index e87329543b5..74ff031c658 100644 --- a/stan/math/prim/err/check_pos_semidefinite.hpp +++ b/stan/math/prim/err/check_pos_semidefinite.hpp @@ -6,8 +6,8 @@ #include #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/err/check_positive_ordered.hpp b/stan/math/prim/err/check_positive_ordered.hpp index 0ba5532e821..aa44517023f 100644 --- a/stan/math/prim/err/check_positive_ordered.hpp +++ b/stan/math/prim/err/check_positive_ordered.hpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include diff --git a/stan/math/prim/err/check_row_index.hpp b/stan/math/prim/err/check_row_index.hpp index dbd521f4b63..d4aaa5df404 100644 --- a/stan/math/prim/err/check_row_index.hpp +++ b/stan/math/prim/err/check_row_index.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include diff --git a/stan/math/prim/err/check_simplex.hpp b/stan/math/prim/err/check_simplex.hpp index 6987fc7aefe..8368c5ff809 100644 --- a/stan/math/prim/err/check_simplex.hpp +++ b/stan/math/prim/err/check_simplex.hpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/stan/math/prim/err/check_square.hpp b/stan/math/prim/err/check_square.hpp index e626afb48d8..cfed96c715f 100644 --- a/stan/math/prim/err/check_square.hpp +++ b/stan/math/prim/err/check_square.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_ERR_CHECK_SQUARE_HPP #include -#include +#include #include #include diff --git a/stan/math/prim/err/check_symmetric.hpp b/stan/math/prim/err/check_symmetric.hpp index d30e25d2b61..c8bf3818f71 100644 --- a/stan/math/prim/err/check_symmetric.hpp +++ b/stan/math/prim/err/check_symmetric.hpp @@ -5,9 +5,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/stan/math/prim/err/check_unit_vector.hpp b/stan/math/prim/err/check_unit_vector.hpp index fb60b9a3f10..a3686e8684a 100644 --- a/stan/math/prim/err/check_unit_vector.hpp +++ b/stan/math/prim/err/check_unit_vector.hpp @@ -5,8 +5,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/stan/math/prim/err/check_vector.hpp b/stan/math/prim/err/check_vector.hpp index 2cc130128d7..1d91eadd5f1 100644 --- a/stan/math/prim/err/check_vector.hpp +++ b/stan/math/prim/err/check_vector.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include #include diff --git a/stan/math/prim/err/is_cholesky_factor.hpp b/stan/math/prim/err/is_cholesky_factor.hpp index f035d6aaa43..5a791be3806 100644 --- a/stan/math/prim/err/is_cholesky_factor.hpp +++ b/stan/math/prim/err/is_cholesky_factor.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_ERR_IS_CHOLESKY_FACTOR_HPP #include -#include +#include #include #include #include diff --git a/stan/math/prim/err/is_cholesky_factor_corr.hpp b/stan/math/prim/err/is_cholesky_factor_corr.hpp index 56d1b288db0..18f77f54763 100644 --- a/stan/math/prim/err/is_cholesky_factor_corr.hpp +++ b/stan/math/prim/err/is_cholesky_factor_corr.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_ERR_IS_CHOLESKY_FACTOR_CORR_HPP #include -#include +#include #include #include diff --git a/stan/math/prim/err/is_column_index.hpp b/stan/math/prim/err/is_column_index.hpp index a3530b9b981..f668c3f0c11 100644 --- a/stan/math/prim/err/is_column_index.hpp +++ b/stan/math/prim/err/is_column_index.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_ERR_IS_COLUMN_INDEX_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/err/is_corr_matrix.hpp b/stan/math/prim/err/is_corr_matrix.hpp index 470d385d665..9dc3ddd2f83 100644 --- a/stan/math/prim/err/is_corr_matrix.hpp +++ b/stan/math/prim/err/is_corr_matrix.hpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/err/is_ldlt_factor.hpp b/stan/math/prim/err/is_ldlt_factor.hpp index a38375aecc8..67daaba492a 100644 --- a/stan/math/prim/err/is_ldlt_factor.hpp +++ b/stan/math/prim/err/is_ldlt_factor.hpp @@ -2,8 +2,8 @@ #define STAN_MATH_PRIM_ERR_IS_LDLT_FACTOR_HPP #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/err/is_lower_triangular.hpp b/stan/math/prim/err/is_lower_triangular.hpp index f1d2b1990f0..7c6075957de 100644 --- a/stan/math/prim/err/is_lower_triangular.hpp +++ b/stan/math/prim/err/is_lower_triangular.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_ERR_IS_LOWER_TRIANGULAR_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/err/is_mat_finite.hpp b/stan/math/prim/err/is_mat_finite.hpp index 46f52feea01..0ac3ce59e5b 100644 --- a/stan/math/prim/err/is_mat_finite.hpp +++ b/stan/math/prim/err/is_mat_finite.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_ERR_IS_MAT_FINITE_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/err/is_matching_dims.hpp b/stan/math/prim/err/is_matching_dims.hpp index 30de5dcb527..0dbb9cdefe1 100644 --- a/stan/math/prim/err/is_matching_dims.hpp +++ b/stan/math/prim/err/is_matching_dims.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_ERR_IS_MATCHING_DIMS_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/err/is_not_nan.hpp b/stan/math/prim/err/is_not_nan.hpp index 6870960ab84..1d8b98dd783 100644 --- a/stan/math/prim/err/is_not_nan.hpp +++ b/stan/math/prim/err/is_not_nan.hpp @@ -2,8 +2,8 @@ #define STAN_MATH_PRIM_ERR_IS_NOT_NAN_HPP #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/err/is_pos_definite.hpp b/stan/math/prim/err/is_pos_definite.hpp index 32fdbe0cdc3..7e26d2d466c 100644 --- a/stan/math/prim/err/is_pos_definite.hpp +++ b/stan/math/prim/err/is_pos_definite.hpp @@ -6,8 +6,8 @@ #include #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/err/is_scal_finite.hpp b/stan/math/prim/err/is_scal_finite.hpp index 3da97139736..aa5b9426b87 100644 --- a/stan/math/prim/err/is_scal_finite.hpp +++ b/stan/math/prim/err/is_scal_finite.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_ERR_IS_SCAL_FINITE_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/err/is_square.hpp b/stan/math/prim/err/is_square.hpp index 53e2e60d443..5aefc53d73c 100644 --- a/stan/math/prim/err/is_square.hpp +++ b/stan/math/prim/err/is_square.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_ERR_IS_SQUARE_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/err/is_symmetric.hpp b/stan/math/prim/err/is_symmetric.hpp index 9dbe418b8da..0fc7c532c74 100644 --- a/stan/math/prim/err/is_symmetric.hpp +++ b/stan/math/prim/err/is_symmetric.hpp @@ -4,8 +4,8 @@ #include #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/err/is_unit_vector.hpp b/stan/math/prim/err/is_unit_vector.hpp index 4d18bd1a235..e9ca164096a 100644 --- a/stan/math/prim/err/is_unit_vector.hpp +++ b/stan/math/prim/err/is_unit_vector.hpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/fun.hpp b/stan/math/prim/fun.hpp new file mode 100644 index 00000000000..1d82e4748d3 --- /dev/null +++ b/stan/math/prim/fun.hpp @@ -0,0 +1,293 @@ +#ifndef STAN_MATH_PRIM_FUN_HPP +#define STAN_MATH_PRIM_FUN_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/stan/math/prim/mat/fun/Eigen.hpp b/stan/math/prim/fun/Eigen.hpp similarity index 68% rename from stan/math/prim/mat/fun/Eigen.hpp rename to stan/math/prim/fun/Eigen.hpp index 267cea834fe..81d5c50beae 100644 --- a/stan/math/prim/mat/fun/Eigen.hpp +++ b/stan/math/prim/fun/Eigen.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_EIGEN_HPP -#define STAN_MATH_PRIM_MAT_FUN_EIGEN_HPP +#ifndef STAN_MATH_PRIM_FUN_EIGEN_HPP +#define STAN_MATH_PRIM_FUN_EIGEN_HPP #ifdef EIGEN_MATRIXBASE_PLUGIN #ifndef EIGEN_STAN_MATRIXBASE_PLUGIN @@ -7,7 +7,7 @@ "plugin add the eigen_plugin.h file to your plugin." #endif #else -#define EIGEN_MATRIXBASE_PLUGIN "stan/math/prim/mat/eigen_plugins.h" +#define EIGEN_MATRIXBASE_PLUGIN "stan/math/prim/eigen_plugins.h" #endif #include diff --git a/stan/math/prim/scal/fun/F32.hpp b/stan/math/prim/fun/F32.hpp similarity index 95% rename from stan/math/prim/scal/fun/F32.hpp rename to stan/math/prim/fun/F32.hpp index 6374a7ae4db..71e900e45cf 100644 --- a/stan/math/prim/scal/fun/F32.hpp +++ b/stan/math/prim/fun/F32.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_F32_HPP -#define STAN_MATH_PRIM_SCAL_FUN_F32_HPP +#ifndef STAN_MATH_PRIM_FUN_F32_HPP +#define STAN_MATH_PRIM_FUN_F32_HPP #include #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/LDLT_factor.hpp b/stan/math/prim/fun/LDLT_factor.hpp similarity index 92% rename from stan/math/prim/mat/fun/LDLT_factor.hpp rename to stan/math/prim/fun/LDLT_factor.hpp index 0bcf5c31957..119bbbe6521 100644 --- a/stan/math/prim/mat/fun/LDLT_factor.hpp +++ b/stan/math/prim/fun/LDLT_factor.hpp @@ -1,11 +1,11 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_LDLT_FACTOR_HPP -#define STAN_MATH_PRIM_MAT_FUN_LDLT_FACTOR_HPP +#ifndef STAN_MATH_PRIM_FUN_LDLT_FACTOR_HPP +#define STAN_MATH_PRIM_FUN_LDLT_FACTOR_HPP #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/MatrixExponential.h b/stan/math/prim/fun/MatrixExponential.h similarity index 98% rename from stan/math/prim/mat/fun/MatrixExponential.h rename to stan/math/prim/fun/MatrixExponential.h index 82671024fbb..85e9f8274fa 100644 --- a/stan/math/prim/mat/fun/MatrixExponential.h +++ b/stan/math/prim/fun/MatrixExponential.h @@ -11,10 +11,10 @@ // This file was edited for to the Stan math library to create // the matrix exponential function (matrix_exp), 2016. -#ifndef STAN_MATH_PRIM_MAT_FUN_MATRIXEXPONENTIAL_H -#define STAN_MATH_PRIM_MAT_FUN_MATRIXEXPONENTIAL_H +#ifndef STAN_MATH_PRIM_FUN_MATRIXEXPONENTIAL_H +#define STAN_MATH_PRIM_FUN_MATRIXEXPONENTIAL_H -#include +#include #include namespace Eigen { diff --git a/stan/math/prim/scal/fun/Phi.hpp b/stan/math/prim/fun/Phi.hpp similarity index 55% rename from stan/math/prim/scal/fun/Phi.hpp rename to stan/math/prim/fun/Phi.hpp index 2545c14c0a6..58d154209e3 100644 --- a/stan/math/prim/scal/fun/Phi.hpp +++ b/stan/math/prim/fun/Phi.hpp @@ -1,11 +1,13 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_PHI_HPP -#define STAN_MATH_PRIM_SCAL_FUN_PHI_HPP +#ifndef STAN_MATH_PRIM_FUN_PHI_HPP +#define STAN_MATH_PRIM_FUN_PHI_HPP #include -#include -#include -#include #include +#include +#include +#include +#include +#include namespace stan { namespace math { @@ -40,6 +42,33 @@ inline double Phi(double x) { } } +/** + * Structure to wrap Phi() so it can be vectorized. + * + * @tparam T type of argument + * @param x argument + * @return Unit normal CDF of x. + */ +struct Phi_fun { + template + static inline T fun(const T& x) { + return Phi(x); + } +}; + +/** + * Vectorized version of Phi(). + * + * @tparam T type of container + * @param x container + * @return Unit normal CDF of each value in x. + */ +template +inline auto Phi(const T& x) { + return apply_scalar_unary::apply(x); +} + } // namespace math } // namespace stan + #endif diff --git a/stan/math/prim/mat/fun/Phi_approx.hpp b/stan/math/prim/fun/Phi_approx.hpp similarity index 54% rename from stan/math/prim/mat/fun/Phi_approx.hpp rename to stan/math/prim/fun/Phi_approx.hpp index 27df5a33e0b..7ad1c5413dc 100644 --- a/stan/math/prim/mat/fun/Phi_approx.hpp +++ b/stan/math/prim/fun/Phi_approx.hpp @@ -1,12 +1,39 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_PHI_APPROX_HPP -#define STAN_MATH_PRIM_MAT_FUN_PHI_APPROX_HPP +#ifndef STAN_MATH_PRIM_FUN_PHI_APPROX_HPP +#define STAN_MATH_PRIM_FUN_PHI_APPROX_HPP +#include +#include #include -#include +#include namespace stan { namespace math { +/** + * Return an approximation of the unit normal CDF. + * + * http://www.jiem.org/index.php/jiem/article/download/60/27 + * + * This function can be used to implement the inverse link function + * for probit regression. + * + * @param x Argument. + * @return Probability random sample is less than or equal to argument. + */ +inline double Phi_approx(double x) { + using std::pow; + return inv_logit(0.07056 * pow(x, 3.0) + 1.5976 * x); +} + +/** + * Return an approximation of the unit normal CDF. + * + * @param x argument. + * @return approximate probability random sample is less than or + * equal to argument. + */ +inline double Phi_approx(int x) { return Phi_approx(static_cast(x)); } + /** * Structure to wrap Phi_approx() so it can be vectorized. */ diff --git a/stan/math/prim/scal/fun/abs.hpp b/stan/math/prim/fun/abs.hpp similarity index 82% rename from stan/math/prim/scal/fun/abs.hpp rename to stan/math/prim/fun/abs.hpp index 1bb35298d6e..cdf0a52dcd6 100644 --- a/stan/math/prim/scal/fun/abs.hpp +++ b/stan/math/prim/fun/abs.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_ABS_HPP -#define STAN_MATH_PRIM_SCAL_FUN_ABS_HPP +#ifndef STAN_MATH_PRIM_FUN_ABS_HPP +#define STAN_MATH_PRIM_FUN_ABS_HPP #include #include diff --git a/stan/math/prim/mat/fun/accumulator.hpp b/stan/math/prim/fun/accumulator.hpp similarity index 94% rename from stan/math/prim/mat/fun/accumulator.hpp rename to stan/math/prim/fun/accumulator.hpp index e324f2e2881..6d455a8b16b 100644 --- a/stan/math/prim/mat/fun/accumulator.hpp +++ b/stan/math/prim/fun/accumulator.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ACCUMULATOR_HPP -#define STAN_MATH_PRIM_MAT_FUN_ACCUMULATOR_HPP +#ifndef STAN_MATH_PRIM_FUN_ACCUMULATOR_HPP +#define STAN_MATH_PRIM_FUN_ACCUMULATOR_HPP #include -#include -#include +#include +#include #include #include diff --git a/stan/math/prim/mat/fun/acos.hpp b/stan/math/prim/fun/acos.hpp similarity index 90% rename from stan/math/prim/mat/fun/acos.hpp rename to stan/math/prim/fun/acos.hpp index 407d25077da..709864e1db6 100644 --- a/stan/math/prim/mat/fun/acos.hpp +++ b/stan/math/prim/fun/acos.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ACOS_HPP -#define STAN_MATH_PRIM_MAT_FUN_ACOS_HPP +#ifndef STAN_MATH_PRIM_FUN_ACOS_HPP +#define STAN_MATH_PRIM_FUN_ACOS_HPP -#include +#include #include #include #include diff --git a/stan/math/prim/fun/acosh.hpp b/stan/math/prim/fun/acosh.hpp new file mode 100644 index 00000000000..f5b06cdf2dd --- /dev/null +++ b/stan/math/prim/fun/acosh.hpp @@ -0,0 +1,90 @@ +#ifndef STAN_MATH_PRIM_FUN_ACOSH_HPP +#define STAN_MATH_PRIM_FUN_ACOSH_HPP + +#include +#include +#include +#include +#include +#include + +namespace stan { +namespace math { + +/** + * Return the inverse hyperbolic cosine of the specified value. + * Returns nan for nan argument. + * + * @param[in] x Argument. + * @return Inverse hyperbolic cosine of the argument. + * @throw std::domain_error If argument is less than 1. + */ +inline double acosh(double x) { + if (is_nan(x)) { + return x; + } else { + check_greater_or_equal("acosh", "x", x, 1.0); +#ifdef _WIN32 + if (is_inf(x)) + return x; +#endif + return std::acosh(x); + } +} + +/** + * Integer version of acosh. + * + * @param[in] x Argument. + * @return Inverse hyperbolic cosine of the argument. + * @throw std::domain_error If argument is less than 1. + */ +inline double acosh(int x) { + if (is_nan(x)) { + return x; + } else { + check_greater_or_equal("acosh", "x", x, 1); +#ifdef _WIN32 + if (is_inf(x)) + return x; +#endif + return std::acosh(x); + } +} + +/** + * Structure to wrap acosh() so it can be vectorized. + */ +struct acosh_fun { + /** + * Return the inverse hypberbolic cosine of the specified argument. + * + * @tparam T type of argument + * @param x argument + * @return Inverse hyperbolic cosine of the argument. + */ + template + static inline T fun(const T& x) { + return acosh(x); + } +}; + +/** + * Return the elementwise application of acosh() to + * specified argument container. The return type promotes the + * underlying scalar argument type to double if it is an integer, + * and otherwise is the argument type. + * + * @tparam T type of container + * @param x container + * @return Elementwise acosh of members of container. + */ +template +inline auto acosh(const T& x) { + return apply_scalar_unary::apply(x); +} + +} // namespace math +} // namespace stan + +#endif diff --git a/stan/math/prim/mat/fun/add.hpp b/stan/math/prim/fun/add.hpp similarity index 93% rename from stan/math/prim/mat/fun/add.hpp rename to stan/math/prim/fun/add.hpp index 41a92c0f225..f115233597a 100644 --- a/stan/math/prim/mat/fun/add.hpp +++ b/stan/math/prim/fun/add.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ADD_HPP -#define STAN_MATH_PRIM_MAT_FUN_ADD_HPP +#ifndef STAN_MATH_PRIM_FUN_ADD_HPP +#define STAN_MATH_PRIM_FUN_ADD_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/add_diag.hpp b/stan/math/prim/fun/add_diag.hpp similarity index 93% rename from stan/math/prim/mat/fun/add_diag.hpp rename to stan/math/prim/fun/add_diag.hpp index 5bbccab4ae8..bb8af6aee36 100644 --- a/stan/math/prim/mat/fun/add_diag.hpp +++ b/stan/math/prim/fun/add_diag.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ADD_DIAG_HPP -#define STAN_MATH_PRIM_MAT_FUN_ADD_DIAG_HPP +#ifndef STAN_MATH_PRIM_FUN_ADD_DIAG_HPP +#define STAN_MATH_PRIM_FUN_ADD_DIAG_HPP #include #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/append_array.hpp b/stan/math/prim/fun/append_array.hpp similarity index 88% rename from stan/math/prim/mat/fun/append_array.hpp rename to stan/math/prim/fun/append_array.hpp index 1cc662f583f..b141d168cb1 100644 --- a/stan/math/prim/mat/fun/append_array.hpp +++ b/stan/math/prim/fun/append_array.hpp @@ -1,12 +1,12 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_APPEND_ARRAY_HPP -#define STAN_MATH_PRIM_MAT_FUN_APPEND_ARRAY_HPP +#ifndef STAN_MATH_PRIM_FUN_APPEND_ARRAY_HPP +#define STAN_MATH_PRIM_FUN_APPEND_ARRAY_HPP #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/append_col.hpp b/stan/math/prim/fun/append_col.hpp similarity index 98% rename from stan/math/prim/mat/fun/append_col.hpp rename to stan/math/prim/fun/append_col.hpp index ea66d43d880..c2cd6538f2e 100644 --- a/stan/math/prim/mat/fun/append_col.hpp +++ b/stan/math/prim/fun/append_col.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_APPEND_COL_HPP -#define STAN_MATH_PRIM_MAT_FUN_APPEND_COL_HPP +#ifndef STAN_MATH_PRIM_FUN_APPEND_COL_HPP +#define STAN_MATH_PRIM_FUN_APPEND_COL_HPP #include #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/append_row.hpp b/stan/math/prim/fun/append_row.hpp similarity index 98% rename from stan/math/prim/mat/fun/append_row.hpp rename to stan/math/prim/fun/append_row.hpp index 1372dfbea0a..d63fb7e3ca8 100644 --- a/stan/math/prim/mat/fun/append_row.hpp +++ b/stan/math/prim/fun/append_row.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_APPEND_ROW_HPP -#define STAN_MATH_PRIM_MAT_FUN_APPEND_ROW_HPP +#ifndef STAN_MATH_PRIM_FUN_APPEND_ROW_HPP +#define STAN_MATH_PRIM_FUN_APPEND_ROW_HPP #include #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/arr/fun/array_builder.hpp b/stan/math/prim/fun/array_builder.hpp similarity index 86% rename from stan/math/prim/arr/fun/array_builder.hpp rename to stan/math/prim/fun/array_builder.hpp index 0e304885d8a..9be0626f455 100644 --- a/stan/math/prim/arr/fun/array_builder.hpp +++ b/stan/math/prim/fun/array_builder.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_ARR_FUN_ARRAY_BUILDER_HPP -#define STAN_MATH_PRIM_ARR_FUN_ARRAY_BUILDER_HPP +#ifndef STAN_MATH_PRIM_FUN_ARRAY_BUILDER_HPP +#define STAN_MATH_PRIM_FUN_ARRAY_BUILDER_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/as_bool.hpp b/stan/math/prim/fun/as_bool.hpp similarity index 82% rename from stan/math/prim/scal/fun/as_bool.hpp rename to stan/math/prim/fun/as_bool.hpp index c519e652d66..a43ee42740a 100644 --- a/stan/math/prim/scal/fun/as_bool.hpp +++ b/stan/math/prim/fun/as_bool.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_AS_BOOL_HPP -#define STAN_MATH_PRIM_SCAL_FUN_AS_BOOL_HPP +#ifndef STAN_MATH_PRIM_FUN_AS_BOOL_HPP +#define STAN_MATH_PRIM_FUN_AS_BOOL_HPP #include namespace stan { diff --git a/stan/math/prim/mat/fun/asin.hpp b/stan/math/prim/fun/asin.hpp similarity index 90% rename from stan/math/prim/mat/fun/asin.hpp rename to stan/math/prim/fun/asin.hpp index db4ec56b2b7..81a22dcf60b 100644 --- a/stan/math/prim/mat/fun/asin.hpp +++ b/stan/math/prim/fun/asin.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ASIN_HPP -#define STAN_MATH_PRIM_MAT_FUN_ASIN_HPP +#ifndef STAN_MATH_PRIM_FUN_ASIN_HPP +#define STAN_MATH_PRIM_FUN_ASIN_HPP -#include #include +#include #include #include diff --git a/stan/math/prim/mat/fun/asinh.hpp b/stan/math/prim/fun/asinh.hpp similarity index 53% rename from stan/math/prim/mat/fun/asinh.hpp rename to stan/math/prim/fun/asinh.hpp index efb06ab49bf..e8d96eed2bc 100644 --- a/stan/math/prim/mat/fun/asinh.hpp +++ b/stan/math/prim/fun/asinh.hpp @@ -1,12 +1,32 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ASINH_HPP -#define STAN_MATH_PRIM_MAT_FUN_ASINH_HPP +#ifndef STAN_MATH_PRIM_FUN_ASINH_HPP +#define STAN_MATH_PRIM_FUN_ASINH_HPP +#include #include -#include +#include namespace stan { namespace math { +/** + * Return the inverse hyperbolic sine of the specified value. + * Returns infinity for infinity argument and -infinity for + * -infinity argument. + * Returns nan for nan argument. + * + * @param[in] x Argument. + * @return Inverse hyperbolic sine of the argument. + */ +inline double asinh(double x) { return std::asinh(x); } + +/** + * Integer version of asinh. + * + * @param[in] x Argument. + * @return Inverse hyperbolic sine of the argument. + */ +inline double asinh(int x) { return std::asinh(x); } + /** * Structure to wrap asinh() so it can be vectorized. * diff --git a/stan/math/prim/mat/fun/assign.hpp b/stan/math/prim/fun/assign.hpp similarity index 97% rename from stan/math/prim/mat/fun/assign.hpp rename to stan/math/prim/fun/assign.hpp index de5a62b82c6..46f281e2986 100644 --- a/stan/math/prim/mat/fun/assign.hpp +++ b/stan/math/prim/fun/assign.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ASSIGN_HPP -#define STAN_MATH_PRIM_MAT_FUN_ASSIGN_HPP +#ifndef STAN_MATH_PRIM_FUN_ASSIGN_HPP +#define STAN_MATH_PRIM_FUN_ASSIGN_HPP #include -#include +#include #include #include #include diff --git a/stan/math/prim/mat/fun/atan.hpp b/stan/math/prim/fun/atan.hpp similarity index 90% rename from stan/math/prim/mat/fun/atan.hpp rename to stan/math/prim/fun/atan.hpp index 96cc45efe8d..28a05b08d6a 100644 --- a/stan/math/prim/mat/fun/atan.hpp +++ b/stan/math/prim/fun/atan.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ATAN_HPP -#define STAN_MATH_PRIM_MAT_FUN_ATAN_HPP +#ifndef STAN_MATH_PRIM_FUN_ATAN_HPP +#define STAN_MATH_PRIM_FUN_ATAN_HPP -#include #include +#include #include #include diff --git a/stan/math/prim/fun/atanh.hpp b/stan/math/prim/fun/atanh.hpp new file mode 100644 index 00000000000..b7d939dd7ff --- /dev/null +++ b/stan/math/prim/fun/atanh.hpp @@ -0,0 +1,83 @@ +#ifndef STAN_MATH_PRIM_FUN_ATANH_HPP +#define STAN_MATH_PRIM_FUN_ATANH_HPP + +#include +#include +#include +#include +#include + +namespace stan { +namespace math { + +/** + * Return the inverse hyperbolic tangent of the specified value. + * An argument of -1 returns negative infinity and an argument of 1 + * returns infinity. + * Returns nan for nan argument. + * + * @param[in] x Argument. + * @return Inverse hyperbolic tangent of the argument. + * @throw std::domain_error If argument is not in [-1, 1]. + */ +inline double atanh(double x) { + if (is_nan(x)) { + return x; + } else { + check_bounded("atanh", "x", x, -1.0, 1.0); + return std::atanh(x); + } +} + +/** + * Integer version of atanh. + * + * @param[in] x Argument. + * @return Inverse hyperbolic tangent of the argument. + * @throw std::domain_error If argument is less than 1. + */ +inline double atanh(int x) { + if (is_nan(x)) { + return x; + } else { + check_bounded("atanh", "x", x, -1, 1); + return std::atanh(x); + } +} + +/** + * Structure to wrap atanh() so it can be vectorized. + */ +struct atanh_fun { + /** + * Return the inverse hypberbolic tangent of the specified argument. + * + * @tparam T type of argument + * @param x argument + * @return Inverse hyperbolic tangent of the argument. + */ + template + static inline T fun(const T& x) { + return atanh(x); + } +}; + +/** + * Return the elementwise application of atanh() to + * specified argument container. The return type promotes the + * underlying scalar argument type to double if it is an integer, + * and otherwise is the argument type. + * + * @tparam T type of container + * @param x container + * @return Elementwise atanh of members of container. + */ +template +inline auto atanh(const T& x) { + return apply_scalar_unary::apply(x); +} + +} // namespace math +} // namespace stan + +#endif diff --git a/stan/math/prim/mat/fun/autocorrelation.hpp b/stan/math/prim/fun/autocorrelation.hpp similarity index 96% rename from stan/math/prim/mat/fun/autocorrelation.hpp rename to stan/math/prim/fun/autocorrelation.hpp index 556ecd2d195..d5452fa40d2 100644 --- a/stan/math/prim/mat/fun/autocorrelation.hpp +++ b/stan/math/prim/fun/autocorrelation.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_AUTOCORRELATION_HPP -#define STAN_MATH_PRIM_MAT_FUN_AUTOCORRELATION_HPP +#ifndef STAN_MATH_PRIM_FUN_AUTOCORRELATION_HPP +#define STAN_MATH_PRIM_FUN_AUTOCORRELATION_HPP -#include -#include +#include +#include #include #include #include diff --git a/stan/math/prim/mat/fun/autocovariance.hpp b/stan/math/prim/fun/autocovariance.hpp similarity index 93% rename from stan/math/prim/mat/fun/autocovariance.hpp rename to stan/math/prim/fun/autocovariance.hpp index a607964c5f6..3db3aa8bf20 100644 --- a/stan/math/prim/mat/fun/autocovariance.hpp +++ b/stan/math/prim/fun/autocovariance.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_AUTOCOVARIANCE_HPP -#define STAN_MATH_PRIM_MAT_FUN_AUTOCOVARIANCE_HPP +#ifndef STAN_MATH_PRIM_FUN_AUTOCOVARIANCE_HPP +#define STAN_MATH_PRIM_FUN_AUTOCOVARIANCE_HPP -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/bessel_first_kind.hpp b/stan/math/prim/fun/bessel_first_kind.hpp similarity index 90% rename from stan/math/prim/scal/fun/bessel_first_kind.hpp rename to stan/math/prim/fun/bessel_first_kind.hpp index 5ef668535b6..61d8892c69b 100644 --- a/stan/math/prim/scal/fun/bessel_first_kind.hpp +++ b/stan/math/prim/fun/bessel_first_kind.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_BESSEL_FIRST_KIND_HPP -#define STAN_MATH_PRIM_SCAL_FUN_BESSEL_FIRST_KIND_HPP +#ifndef STAN_MATH_PRIM_FUN_BESSEL_FIRST_KIND_HPP +#define STAN_MATH_PRIM_FUN_BESSEL_FIRST_KIND_HPP #include #include diff --git a/stan/math/prim/scal/fun/bessel_second_kind.hpp b/stan/math/prim/fun/bessel_second_kind.hpp similarity index 89% rename from stan/math/prim/scal/fun/bessel_second_kind.hpp rename to stan/math/prim/fun/bessel_second_kind.hpp index 3204859249c..5d448a4dc6c 100644 --- a/stan/math/prim/scal/fun/bessel_second_kind.hpp +++ b/stan/math/prim/fun/bessel_second_kind.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_BESSEL_SECOND_KIND_HPP -#define STAN_MATH_PRIM_SCAL_FUN_BESSEL_SECOND_KIND_HPP +#ifndef STAN_MATH_PRIM_FUN_BESSEL_SECOND_KIND_HPP +#define STAN_MATH_PRIM_FUN_BESSEL_SECOND_KIND_HPP #include #include diff --git a/stan/math/prim/scal/fun/beta.hpp b/stan/math/prim/fun/beta.hpp similarity index 92% rename from stan/math/prim/scal/fun/beta.hpp rename to stan/math/prim/fun/beta.hpp index c03cb5d2a8f..9692d678516 100644 --- a/stan/math/prim/scal/fun/beta.hpp +++ b/stan/math/prim/fun/beta.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_BETA_HPP -#define STAN_MATH_PRIM_SCAL_FUN_BETA_HPP +#ifndef STAN_MATH_PRIM_FUN_BETA_HPP +#define STAN_MATH_PRIM_FUN_BETA_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/binary_log_loss.hpp b/stan/math/prim/fun/binary_log_loss.hpp similarity index 84% rename from stan/math/prim/scal/fun/binary_log_loss.hpp rename to stan/math/prim/fun/binary_log_loss.hpp index 38ea51c29e7..7600b9c5de7 100644 --- a/stan/math/prim/scal/fun/binary_log_loss.hpp +++ b/stan/math/prim/fun/binary_log_loss.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_BINARY_LOG_LOSS_HPP -#define STAN_MATH_PRIM_SCAL_FUN_BINARY_LOG_LOSS_HPP +#ifndef STAN_MATH_PRIM_FUN_BINARY_LOG_LOSS_HPP +#define STAN_MATH_PRIM_FUN_BINARY_LOG_LOSS_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/binomial_coefficient_log.hpp b/stan/math/prim/fun/binomial_coefficient_log.hpp similarity index 89% rename from stan/math/prim/scal/fun/binomial_coefficient_log.hpp rename to stan/math/prim/fun/binomial_coefficient_log.hpp index b7d2900ac1b..89600a35c55 100644 --- a/stan/math/prim/scal/fun/binomial_coefficient_log.hpp +++ b/stan/math/prim/fun/binomial_coefficient_log.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_BINOMIAL_COEFFICIENT_LOG_HPP -#define STAN_MATH_PRIM_SCAL_FUN_BINOMIAL_COEFFICIENT_LOG_HPP +#ifndef STAN_MATH_PRIM_FUN_BINOMIAL_COEFFICIENT_LOG_HPP +#define STAN_MATH_PRIM_FUN_BINOMIAL_COEFFICIENT_LOG_HPP #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/block.hpp b/stan/math/prim/fun/block.hpp similarity index 87% rename from stan/math/prim/mat/fun/block.hpp rename to stan/math/prim/fun/block.hpp index d76aa6ee42f..2ce326ac2d1 100644 --- a/stan/math/prim/mat/fun/block.hpp +++ b/stan/math/prim/fun/block.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_BLOCK_HPP -#define STAN_MATH_PRIM_MAT_FUN_BLOCK_HPP +#ifndef STAN_MATH_PRIM_FUN_BLOCK_HPP +#define STAN_MATH_PRIM_FUN_BLOCK_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/scal/fun/boost_policy.hpp b/stan/math/prim/fun/boost_policy.hpp similarity index 88% rename from stan/math/prim/scal/fun/boost_policy.hpp rename to stan/math/prim/fun/boost_policy.hpp index ce57d138451..03fe78e4c3f 100644 --- a/stan/math/prim/scal/fun/boost_policy.hpp +++ b/stan/math/prim/fun/boost_policy.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_BOOST_POLICY_HPP -#define STAN_MATH_PRIM_SCAL_FUN_BOOST_POLICY_HPP +#ifndef STAN_MATH_PRIM_FUN_BOOST_POLICY_HPP +#define STAN_MATH_PRIM_FUN_BOOST_POLICY_HPP #include #include diff --git a/stan/math/prim/mat/fun/cbrt.hpp b/stan/math/prim/fun/cbrt.hpp similarity index 53% rename from stan/math/prim/mat/fun/cbrt.hpp rename to stan/math/prim/fun/cbrt.hpp index bc5d2eb418f..0f228c8ee64 100644 --- a/stan/math/prim/mat/fun/cbrt.hpp +++ b/stan/math/prim/fun/cbrt.hpp @@ -1,12 +1,31 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_CBRT_HPP -#define STAN_MATH_PRIM_MAT_FUN_CBRT_HPP +#ifndef STAN_MATH_PRIM_FUN_CBRT_HPP +#define STAN_MATH_PRIM_FUN_CBRT_HPP +#include #include -#include +#include namespace stan { namespace math { +/** + * Return the cube root of the specified value + * + * @param[in] x Argument. + * @return Cube root of the argument. + * @throw std::domain_error If argument is negative. + */ +inline double cbrt(double x) { return std::cbrt(x); } + +/** + * Integer version of cbrt. + * + * @param[in] x Argument. + * @return Cube root of the argument. + * @throw std::domain_error If argument is less than 1. + */ +inline double cbrt(int x) { return std::cbrt(x); } + /** * Structure to wrap cbrt() so it can be vectorized. * diff --git a/stan/math/prim/mat/fun/ceil.hpp b/stan/math/prim/fun/ceil.hpp similarity index 90% rename from stan/math/prim/mat/fun/ceil.hpp rename to stan/math/prim/fun/ceil.hpp index d10d8074966..7a78566ac1d 100644 --- a/stan/math/prim/mat/fun/ceil.hpp +++ b/stan/math/prim/fun/ceil.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_CEIL_HPP -#define STAN_MATH_PRIM_MAT_FUN_CEIL_HPP +#ifndef STAN_MATH_PRIM_FUN_CEIL_HPP +#define STAN_MATH_PRIM_FUN_CEIL_HPP -#include +#include #include #include #include diff --git a/stan/math/prim/mat/fun/chol2inv.hpp b/stan/math/prim/fun/chol2inv.hpp similarity index 79% rename from stan/math/prim/mat/fun/chol2inv.hpp rename to stan/math/prim/fun/chol2inv.hpp index 6842cf25b28..f96904e9f44 100644 --- a/stan/math/prim/mat/fun/chol2inv.hpp +++ b/stan/math/prim/fun/chol2inv.hpp @@ -1,12 +1,12 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_CHOL2INV_HPP -#define STAN_MATH_PRIM_MAT_FUN_CHOL2INV_HPP +#ifndef STAN_MATH_PRIM_FUN_CHOL2INV_HPP +#define STAN_MATH_PRIM_FUN_CHOL2INV_HPP #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/cholesky_corr_constrain.hpp b/stan/math/prim/fun/cholesky_corr_constrain.hpp similarity index 86% rename from stan/math/prim/mat/fun/cholesky_corr_constrain.hpp rename to stan/math/prim/fun/cholesky_corr_constrain.hpp index 9e048b32359..17fdbb17d94 100644 --- a/stan/math/prim/mat/fun/cholesky_corr_constrain.hpp +++ b/stan/math/prim/fun/cholesky_corr_constrain.hpp @@ -1,11 +1,11 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_CHOLESKY_CORR_CONSTRAIN_HPP -#define STAN_MATH_PRIM_MAT_FUN_CHOLESKY_CORR_CONSTRAIN_HPP +#ifndef STAN_MATH_PRIM_FUN_CHOLESKY_CORR_CONSTRAIN_HPP +#define STAN_MATH_PRIM_FUN_CHOLESKY_CORR_CONSTRAIN_HPP #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/cholesky_corr_free.hpp b/stan/math/prim/fun/cholesky_corr_free.hpp similarity index 76% rename from stan/math/prim/mat/fun/cholesky_corr_free.hpp rename to stan/math/prim/fun/cholesky_corr_free.hpp index 1efe9034075..dc343d848ed 100644 --- a/stan/math/prim/mat/fun/cholesky_corr_free.hpp +++ b/stan/math/prim/fun/cholesky_corr_free.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_CHOLESKY_CORR_FREE_HPP -#define STAN_MATH_PRIM_MAT_FUN_CHOLESKY_CORR_FREE_HPP +#ifndef STAN_MATH_PRIM_FUN_CHOLESKY_CORR_FREE_HPP +#define STAN_MATH_PRIM_FUN_CHOLESKY_CORR_FREE_HPP #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/cholesky_decompose.hpp b/stan/math/prim/fun/cholesky_decompose.hpp similarity index 94% rename from stan/math/prim/mat/fun/cholesky_decompose.hpp rename to stan/math/prim/fun/cholesky_decompose.hpp index 6792cffc9d2..d9acc2a9b46 100644 --- a/stan/math/prim/mat/fun/cholesky_decompose.hpp +++ b/stan/math/prim/fun/cholesky_decompose.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_CHOLESKY_DECOMPOSE_HPP -#define STAN_MATH_PRIM_MAT_FUN_CHOLESKY_DECOMPOSE_HPP +#ifndef STAN_MATH_PRIM_FUN_CHOLESKY_DECOMPOSE_HPP +#define STAN_MATH_PRIM_FUN_CHOLESKY_DECOMPOSE_HPP #include -#include +#include #ifdef STAN_OPENCL #include #endif diff --git a/stan/math/prim/mat/fun/cholesky_factor_constrain.hpp b/stan/math/prim/fun/cholesky_factor_constrain.hpp similarity index 92% rename from stan/math/prim/mat/fun/cholesky_factor_constrain.hpp rename to stan/math/prim/fun/cholesky_factor_constrain.hpp index 7ac8c9ef6af..2d83a74dfd0 100644 --- a/stan/math/prim/mat/fun/cholesky_factor_constrain.hpp +++ b/stan/math/prim/fun/cholesky_factor_constrain.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_CHOLESKY_FACTOR_CONSTRAIN_HPP -#define STAN_MATH_PRIM_MAT_FUN_CHOLESKY_FACTOR_CONSTRAIN_HPP +#ifndef STAN_MATH_PRIM_FUN_CHOLESKY_FACTOR_CONSTRAIN_HPP +#define STAN_MATH_PRIM_FUN_CHOLESKY_FACTOR_CONSTRAIN_HPP #include -#include -#include +#include +#include #include #include #include diff --git a/stan/math/prim/mat/fun/cholesky_factor_free.hpp b/stan/math/prim/fun/cholesky_factor_free.hpp similarity index 88% rename from stan/math/prim/mat/fun/cholesky_factor_free.hpp rename to stan/math/prim/fun/cholesky_factor_free.hpp index 108b7cf7d11..420e678d0ed 100644 --- a/stan/math/prim/mat/fun/cholesky_factor_free.hpp +++ b/stan/math/prim/fun/cholesky_factor_free.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_CHOLESKY_FACTOR_FREE_HPP -#define STAN_MATH_PRIM_MAT_FUN_CHOLESKY_FACTOR_FREE_HPP +#ifndef STAN_MATH_PRIM_FUN_CHOLESKY_FACTOR_FREE_HPP +#define STAN_MATH_PRIM_FUN_CHOLESKY_FACTOR_FREE_HPP #include -#include +#include #include #include diff --git a/stan/math/prim/scal/fun/choose.hpp b/stan/math/prim/fun/choose.hpp similarity index 92% rename from stan/math/prim/scal/fun/choose.hpp rename to stan/math/prim/fun/choose.hpp index 71ce6fac04b..50af6127655 100644 --- a/stan/math/prim/scal/fun/choose.hpp +++ b/stan/math/prim/fun/choose.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_CHOOSE_HPP -#define STAN_MATH_PRIM_SCAL_FUN_CHOOSE_HPP +#ifndef STAN_MATH_PRIM_FUN_CHOOSE_HPP +#define STAN_MATH_PRIM_FUN_CHOOSE_HPP #include #include diff --git a/stan/math/prim/mat/fun/col.hpp b/stan/math/prim/fun/col.hpp similarity index 86% rename from stan/math/prim/mat/fun/col.hpp rename to stan/math/prim/fun/col.hpp index 725fdde3011..59721f7f026 100644 --- a/stan/math/prim/mat/fun/col.hpp +++ b/stan/math/prim/fun/col.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_COL_HPP -#define STAN_MATH_PRIM_MAT_FUN_COL_HPP +#ifndef STAN_MATH_PRIM_FUN_COL_HPP +#define STAN_MATH_PRIM_FUN_COL_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/cols.hpp b/stan/math/prim/fun/cols.hpp similarity index 80% rename from stan/math/prim/mat/fun/cols.hpp rename to stan/math/prim/fun/cols.hpp index b7ad69067d4..8bc7ce1e9fa 100644 --- a/stan/math/prim/mat/fun/cols.hpp +++ b/stan/math/prim/fun/cols.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_COLS_HPP -#define STAN_MATH_PRIM_MAT_FUN_COLS_HPP +#ifndef STAN_MATH_PRIM_FUN_COLS_HPP +#define STAN_MATH_PRIM_FUN_COLS_HPP -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/columns_dot_product.hpp b/stan/math/prim/fun/columns_dot_product.hpp similarity index 85% rename from stan/math/prim/mat/fun/columns_dot_product.hpp rename to stan/math/prim/fun/columns_dot_product.hpp index e8fb9e438c3..4872682287a 100644 --- a/stan/math/prim/mat/fun/columns_dot_product.hpp +++ b/stan/math/prim/fun/columns_dot_product.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_COLUMNS_DOT_PRODUCT_HPP -#define STAN_MATH_PRIM_MAT_FUN_COLUMNS_DOT_PRODUCT_HPP +#ifndef STAN_MATH_PRIM_FUN_COLUMNS_DOT_PRODUCT_HPP +#define STAN_MATH_PRIM_FUN_COLUMNS_DOT_PRODUCT_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/columns_dot_self.hpp b/stan/math/prim/fun/columns_dot_self.hpp similarity index 76% rename from stan/math/prim/mat/fun/columns_dot_self.hpp rename to stan/math/prim/fun/columns_dot_self.hpp index 5bd755f9d22..f77129737e4 100644 --- a/stan/math/prim/mat/fun/columns_dot_self.hpp +++ b/stan/math/prim/fun/columns_dot_self.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_COLUMNS_DOT_SELF_HPP -#define STAN_MATH_PRIM_MAT_FUN_COLUMNS_DOT_SELF_HPP +#ifndef STAN_MATH_PRIM_FUN_COLUMNS_DOT_SELF_HPP +#define STAN_MATH_PRIM_FUN_COLUMNS_DOT_SELF_HPP -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/fun/common_type.hpp b/stan/math/prim/fun/common_type.hpp new file mode 100644 index 00000000000..7481fb47a52 --- /dev/null +++ b/stan/math/prim/fun/common_type.hpp @@ -0,0 +1,61 @@ +#ifndef STAN_MATH_PRIM_FUN_COMMON_TYPE_HPP +#define STAN_MATH_PRIM_FUN_COMMON_TYPE_HPP + +#include +#include +#include + +namespace stan { +namespace math { +/** + * Struct which calculates type promotion given two types. + * + *

This is the base implementation for scalar types. + * Allowed promotions are: + * - int to double + * - int to var + * - double to var + * + *

Promotion between differing var types is not allowed, i.e., + * cannot promote fvar to var or vice versa. + * + * @tparam T1 scalar type + * @tparam T2 scalar type + */ +template +struct common_type { + using type = return_type_t; +}; + +/** + * Struct which calculates type promotion over two types. + * + *

This specialization is for vector types. + * + * @tparam T1 type of elements contined in std::vector + * @tparam T2 type of elements contined in std::vector + */ +template +struct common_type, std::vector > { + using type = std::vector::type>; +}; + +/** + * Struct which calculates type promotion over two types. + * + *

This specialization is for matrix types. + * + * @tparam T1 type of elements in the first matrix + * @tparam T2 type of elements in the second matrix + * @tparam R number of rows, can be Eigen::Dynamic + * @tparam C number of columns, can be Eigen::Dynamic + */ +template +struct common_type, Eigen::Matrix > { + using type = Eigen::Matrix::type, R, C>; +}; + +} // namespace math +} // namespace stan + +#endif diff --git a/stan/math/prim/scal/fun/constants.hpp b/stan/math/prim/fun/constants.hpp similarity index 97% rename from stan/math/prim/scal/fun/constants.hpp rename to stan/math/prim/fun/constants.hpp index 1bd7bf8b811..8300edc0730 100644 --- a/stan/math/prim/scal/fun/constants.hpp +++ b/stan/math/prim/fun/constants.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_CONSTANTS_HPP -#define STAN_MATH_PRIM_SCAL_FUN_CONSTANTS_HPP +#ifndef STAN_MATH_PRIM_FUN_CONSTANTS_HPP +#define STAN_MATH_PRIM_FUN_CONSTANTS_HPP #include -#include +#include #include #include #include diff --git a/stan/math/prim/scal/fun/corr_constrain.hpp b/stan/math/prim/fun/corr_constrain.hpp similarity index 85% rename from stan/math/prim/scal/fun/corr_constrain.hpp rename to stan/math/prim/fun/corr_constrain.hpp index b09c62b673d..2ded9634c9b 100644 --- a/stan/math/prim/scal/fun/corr_constrain.hpp +++ b/stan/math/prim/fun/corr_constrain.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_CORR_CONSTRAIN_HPP -#define STAN_MATH_PRIM_SCAL_FUN_CORR_CONSTRAIN_HPP +#ifndef STAN_MATH_PRIM_FUN_CORR_CONSTRAIN_HPP +#define STAN_MATH_PRIM_FUN_CORR_CONSTRAIN_HPP #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/corr_free.hpp b/stan/math/prim/fun/corr_free.hpp similarity index 85% rename from stan/math/prim/scal/fun/corr_free.hpp rename to stan/math/prim/fun/corr_free.hpp index 6e08b4bd7a5..a5b4065d0e3 100644 --- a/stan/math/prim/scal/fun/corr_free.hpp +++ b/stan/math/prim/fun/corr_free.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_CORR_FREE_HPP -#define STAN_MATH_PRIM_SCAL_FUN_CORR_FREE_HPP +#ifndef STAN_MATH_PRIM_FUN_CORR_FREE_HPP +#define STAN_MATH_PRIM_FUN_CORR_FREE_HPP #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/corr_matrix_constrain.hpp b/stan/math/prim/fun/corr_matrix_constrain.hpp similarity index 92% rename from stan/math/prim/mat/fun/corr_matrix_constrain.hpp rename to stan/math/prim/fun/corr_matrix_constrain.hpp index 90c01bb9f25..67c2d21c3cd 100644 --- a/stan/math/prim/mat/fun/corr_matrix_constrain.hpp +++ b/stan/math/prim/fun/corr_matrix_constrain.hpp @@ -1,11 +1,11 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_CORR_MATRIX_CONSTRAIN_HPP -#define STAN_MATH_PRIM_MAT_FUN_CORR_MATRIX_CONSTRAIN_HPP +#ifndef STAN_MATH_PRIM_FUN_CORR_MATRIX_CONSTRAIN_HPP +#define STAN_MATH_PRIM_FUN_CORR_MATRIX_CONSTRAIN_HPP #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/corr_matrix_free.hpp b/stan/math/prim/fun/corr_matrix_free.hpp similarity index 90% rename from stan/math/prim/mat/fun/corr_matrix_free.hpp rename to stan/math/prim/fun/corr_matrix_free.hpp index 8f1b966f1c8..57598e0547e 100644 --- a/stan/math/prim/mat/fun/corr_matrix_free.hpp +++ b/stan/math/prim/fun/corr_matrix_free.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_CORR_MATRIX_FREE_HPP -#define STAN_MATH_PRIM_MAT_FUN_CORR_MATRIX_FREE_HPP +#ifndef STAN_MATH_PRIM_FUN_CORR_MATRIX_FREE_HPP +#define STAN_MATH_PRIM_FUN_CORR_MATRIX_FREE_HPP #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/cos.hpp b/stan/math/prim/fun/cos.hpp similarity index 90% rename from stan/math/prim/mat/fun/cos.hpp rename to stan/math/prim/fun/cos.hpp index 100fd7311e8..0c20e53f935 100644 --- a/stan/math/prim/mat/fun/cos.hpp +++ b/stan/math/prim/fun/cos.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_COS_HPP -#define STAN_MATH_PRIM_MAT_FUN_COS_HPP +#ifndef STAN_MATH_PRIM_FUN_COS_HPP +#define STAN_MATH_PRIM_FUN_COS_HPP -#include #include +#include #include #include diff --git a/stan/math/prim/mat/fun/cosh.hpp b/stan/math/prim/fun/cosh.hpp similarity index 90% rename from stan/math/prim/mat/fun/cosh.hpp rename to stan/math/prim/fun/cosh.hpp index fb6bb795f66..3dee3eae2a3 100644 --- a/stan/math/prim/mat/fun/cosh.hpp +++ b/stan/math/prim/fun/cosh.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_COSH_HPP -#define STAN_MATH_PRIM_MAT_FUN_COSH_HPP +#ifndef STAN_MATH_PRIM_FUN_COSH_HPP +#define STAN_MATH_PRIM_FUN_COSH_HPP -#include +#include #include #include #include diff --git a/stan/math/prim/mat/fun/cov_exp_quad.hpp b/stan/math/prim/fun/cov_exp_quad.hpp similarity index 88% rename from stan/math/prim/mat/fun/cov_exp_quad.hpp rename to stan/math/prim/fun/cov_exp_quad.hpp index 0179c44f7b7..abaf040b5be 100644 --- a/stan/math/prim/mat/fun/cov_exp_quad.hpp +++ b/stan/math/prim/fun/cov_exp_quad.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_COV_EXP_QUAD_HPP -#define STAN_MATH_PRIM_MAT_FUN_COV_EXP_QUAD_HPP +#ifndef STAN_MATH_PRIM_FUN_COV_EXP_QUAD_HPP +#define STAN_MATH_PRIM_FUN_COV_EXP_QUAD_HPP #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/stan/math/prim/mat/fun/cov_matrix_constrain.hpp b/stan/math/prim/fun/cov_matrix_constrain.hpp similarity index 91% rename from stan/math/prim/mat/fun/cov_matrix_constrain.hpp rename to stan/math/prim/fun/cov_matrix_constrain.hpp index d887663f4e7..9ea7b2acbf0 100644 --- a/stan/math/prim/mat/fun/cov_matrix_constrain.hpp +++ b/stan/math/prim/fun/cov_matrix_constrain.hpp @@ -1,11 +1,11 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_COV_MATRIX_CONSTRAIN_HPP -#define STAN_MATH_PRIM_MAT_FUN_COV_MATRIX_CONSTRAIN_HPP +#ifndef STAN_MATH_PRIM_FUN_COV_MATRIX_CONSTRAIN_HPP +#define STAN_MATH_PRIM_FUN_COV_MATRIX_CONSTRAIN_HPP #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/cov_matrix_constrain_lkj.hpp b/stan/math/prim/fun/cov_matrix_constrain_lkj.hpp similarity index 90% rename from stan/math/prim/mat/fun/cov_matrix_constrain_lkj.hpp rename to stan/math/prim/fun/cov_matrix_constrain_lkj.hpp index 55f443fa346..fbdc5fcd3dd 100644 --- a/stan/math/prim/mat/fun/cov_matrix_constrain_lkj.hpp +++ b/stan/math/prim/fun/cov_matrix_constrain_lkj.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_COV_MATRIX_CONSTRAIN_LKJ_HPP -#define STAN_MATH_PRIM_MAT_FUN_COV_MATRIX_CONSTRAIN_LKJ_HPP +#ifndef STAN_MATH_PRIM_FUN_COV_MATRIX_CONSTRAIN_LKJ_HPP +#define STAN_MATH_PRIM_FUN_COV_MATRIX_CONSTRAIN_LKJ_HPP -#include -#include -#include -#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/cov_matrix_free.hpp b/stan/math/prim/fun/cov_matrix_free.hpp similarity index 93% rename from stan/math/prim/mat/fun/cov_matrix_free.hpp rename to stan/math/prim/fun/cov_matrix_free.hpp index 15162f82518..c31a1110b64 100644 --- a/stan/math/prim/mat/fun/cov_matrix_free.hpp +++ b/stan/math/prim/fun/cov_matrix_free.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_COV_MATRIX_FREE_HPP -#define STAN_MATH_PRIM_MAT_FUN_COV_MATRIX_FREE_HPP +#ifndef STAN_MATH_PRIM_FUN_COV_MATRIX_FREE_HPP +#define STAN_MATH_PRIM_FUN_COV_MATRIX_FREE_HPP #include #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/cov_matrix_free_lkj.hpp b/stan/math/prim/fun/cov_matrix_free_lkj.hpp similarity index 92% rename from stan/math/prim/mat/fun/cov_matrix_free_lkj.hpp rename to stan/math/prim/fun/cov_matrix_free_lkj.hpp index 5fffcfe4c0f..a0119594bb4 100644 --- a/stan/math/prim/mat/fun/cov_matrix_free_lkj.hpp +++ b/stan/math/prim/fun/cov_matrix_free_lkj.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_COV_MATRIX_FREE_LKJ_HPP -#define STAN_MATH_PRIM_MAT_FUN_COV_MATRIX_FREE_LKJ_HPP +#ifndef STAN_MATH_PRIM_FUN_COV_MATRIX_FREE_LKJ_HPP +#define STAN_MATH_PRIM_FUN_COV_MATRIX_FREE_LKJ_HPP #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/crossprod.hpp b/stan/math/prim/fun/crossprod.hpp similarity index 65% rename from stan/math/prim/mat/fun/crossprod.hpp rename to stan/math/prim/fun/crossprod.hpp index 49f03c3cc98..53a0b0aa976 100644 --- a/stan/math/prim/mat/fun/crossprod.hpp +++ b/stan/math/prim/fun/crossprod.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_CROSSPROD_HPP -#define STAN_MATH_PRIM_MAT_FUN_CROSSPROD_HPP +#ifndef STAN_MATH_PRIM_FUN_CROSSPROD_HPP +#define STAN_MATH_PRIM_FUN_CROSSPROD_HPP -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/csr_extract_u.hpp b/stan/math/prim/fun/csr_extract_u.hpp similarity index 90% rename from stan/math/prim/mat/fun/csr_extract_u.hpp rename to stan/math/prim/fun/csr_extract_u.hpp index 44e96d06183..a25ca18d7cf 100644 --- a/stan/math/prim/mat/fun/csr_extract_u.hpp +++ b/stan/math/prim/fun/csr_extract_u.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_CSR_EXTRACT_U_HPP -#define STAN_MATH_PRIM_MAT_FUN_CSR_EXTRACT_U_HPP +#ifndef STAN_MATH_PRIM_FUN_CSR_EXTRACT_U_HPP +#define STAN_MATH_PRIM_FUN_CSR_EXTRACT_U_HPP #include -#include +#include #include #include diff --git a/stan/math/prim/mat/fun/csr_extract_v.hpp b/stan/math/prim/fun/csr_extract_v.hpp similarity index 90% rename from stan/math/prim/mat/fun/csr_extract_v.hpp rename to stan/math/prim/fun/csr_extract_v.hpp index 9be3a0a5460..151b7d24e78 100644 --- a/stan/math/prim/mat/fun/csr_extract_v.hpp +++ b/stan/math/prim/fun/csr_extract_v.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_CSR_EXTRACT_V_HPP -#define STAN_MATH_PRIM_MAT_FUN_CSR_EXTRACT_V_HPP +#ifndef STAN_MATH_PRIM_FUN_CSR_EXTRACT_V_HPP +#define STAN_MATH_PRIM_FUN_CSR_EXTRACT_V_HPP #include -#include +#include #include #include diff --git a/stan/math/prim/mat/fun/csr_extract_w.hpp b/stan/math/prim/fun/csr_extract_w.hpp similarity index 89% rename from stan/math/prim/mat/fun/csr_extract_w.hpp rename to stan/math/prim/fun/csr_extract_w.hpp index 7a2d5b00032..d6bd29b72f2 100644 --- a/stan/math/prim/mat/fun/csr_extract_w.hpp +++ b/stan/math/prim/fun/csr_extract_w.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_CSR_EXTRACT_W_HPP -#define STAN_MATH_PRIM_MAT_FUN_CSR_EXTRACT_W_HPP +#ifndef STAN_MATH_PRIM_FUN_CSR_EXTRACT_W_HPP +#define STAN_MATH_PRIM_FUN_CSR_EXTRACT_W_HPP -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/csr_matrix_times_vector.hpp b/stan/math/prim/fun/csr_matrix_times_vector.hpp similarity index 94% rename from stan/math/prim/mat/fun/csr_matrix_times_vector.hpp rename to stan/math/prim/fun/csr_matrix_times_vector.hpp index ed3a326b117..65c36e77d1c 100644 --- a/stan/math/prim/mat/fun/csr_matrix_times_vector.hpp +++ b/stan/math/prim/fun/csr_matrix_times_vector.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_CSR_MATRIX_TIMES_VECTOR_HPP -#define STAN_MATH_PRIM_MAT_FUN_CSR_MATRIX_TIMES_VECTOR_HPP +#ifndef STAN_MATH_PRIM_FUN_CSR_MATRIX_TIMES_VECTOR_HPP +#define STAN_MATH_PRIM_FUN_CSR_MATRIX_TIMES_VECTOR_HPP #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/csr_to_dense_matrix.hpp b/stan/math/prim/fun/csr_to_dense_matrix.hpp similarity index 89% rename from stan/math/prim/mat/fun/csr_to_dense_matrix.hpp rename to stan/math/prim/fun/csr_to_dense_matrix.hpp index 22a1a67eb18..af9dc3d69e7 100644 --- a/stan/math/prim/mat/fun/csr_to_dense_matrix.hpp +++ b/stan/math/prim/fun/csr_to_dense_matrix.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_CSR_TO_DENSE_MATRIX_HPP -#define STAN_MATH_PRIM_MAT_FUN_CSR_TO_DENSE_MATRIX_HPP +#ifndef STAN_MATH_PRIM_FUN_CSR_TO_DENSE_MATRIX_HPP +#define STAN_MATH_PRIM_FUN_CSR_TO_DENSE_MATRIX_HPP #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/csr_u_to_z.hpp b/stan/math/prim/fun/csr_u_to_z.hpp similarity index 89% rename from stan/math/prim/mat/fun/csr_u_to_z.hpp rename to stan/math/prim/fun/csr_u_to_z.hpp index b0a6dd7cc7b..7a4411c2bef 100644 --- a/stan/math/prim/mat/fun/csr_u_to_z.hpp +++ b/stan/math/prim/fun/csr_u_to_z.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_CSR_U_TO_Z -#define STAN_MATH_PRIM_MAT_FUN_CSR_U_TO_Z +#ifndef STAN_MATH_PRIM_FUN_CSR_U_TO_Z +#define STAN_MATH_PRIM_FUN_CSR_U_TO_Z #include #include diff --git a/stan/math/prim/mat/fun/cumulative_sum.hpp b/stan/math/prim/fun/cumulative_sum.hpp similarity index 91% rename from stan/math/prim/mat/fun/cumulative_sum.hpp rename to stan/math/prim/fun/cumulative_sum.hpp index dc203be164c..38b26eaad24 100644 --- a/stan/math/prim/mat/fun/cumulative_sum.hpp +++ b/stan/math/prim/fun/cumulative_sum.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_CUMULATIVE_SUM_HPP -#define STAN_MATH_PRIM_MAT_FUN_CUMULATIVE_SUM_HPP +#ifndef STAN_MATH_PRIM_FUN_CUMULATIVE_SUM_HPP +#define STAN_MATH_PRIM_FUN_CUMULATIVE_SUM_HPP -#include +#include #include #include #include diff --git a/stan/math/prim/mat/fun/determinant.hpp b/stan/math/prim/fun/determinant.hpp similarity index 82% rename from stan/math/prim/mat/fun/determinant.hpp rename to stan/math/prim/fun/determinant.hpp index fe28db8f7b1..8fba1d883c4 100644 --- a/stan/math/prim/mat/fun/determinant.hpp +++ b/stan/math/prim/fun/determinant.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_DETERMINANT_HPP -#define STAN_MATH_PRIM_MAT_FUN_DETERMINANT_HPP +#ifndef STAN_MATH_PRIM_FUN_DETERMINANT_HPP +#define STAN_MATH_PRIM_FUN_DETERMINANT_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/diag_matrix.hpp b/stan/math/prim/fun/diag_matrix.hpp similarity index 78% rename from stan/math/prim/mat/fun/diag_matrix.hpp rename to stan/math/prim/fun/diag_matrix.hpp index ffe7e760568..71c7650368d 100644 --- a/stan/math/prim/mat/fun/diag_matrix.hpp +++ b/stan/math/prim/fun/diag_matrix.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_DIAG_MATRIX_HPP -#define STAN_MATH_PRIM_MAT_FUN_DIAG_MATRIX_HPP +#ifndef STAN_MATH_PRIM_FUN_DIAG_MATRIX_HPP +#define STAN_MATH_PRIM_FUN_DIAG_MATRIX_HPP -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/diag_post_multiply.hpp b/stan/math/prim/fun/diag_post_multiply.hpp similarity index 77% rename from stan/math/prim/mat/fun/diag_post_multiply.hpp rename to stan/math/prim/fun/diag_post_multiply.hpp index 12e48d2dd15..e33d07d5789 100644 --- a/stan/math/prim/mat/fun/diag_post_multiply.hpp +++ b/stan/math/prim/fun/diag_post_multiply.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_DIAG_POST_MULTIPLY_HPP -#define STAN_MATH_PRIM_MAT_FUN_DIAG_POST_MULTIPLY_HPP +#ifndef STAN_MATH_PRIM_FUN_DIAG_POST_MULTIPLY_HPP +#define STAN_MATH_PRIM_FUN_DIAG_POST_MULTIPLY_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/diag_pre_multiply.hpp b/stan/math/prim/fun/diag_pre_multiply.hpp similarity index 77% rename from stan/math/prim/mat/fun/diag_pre_multiply.hpp rename to stan/math/prim/fun/diag_pre_multiply.hpp index 9bfaebded80..ec9a02c6f99 100644 --- a/stan/math/prim/mat/fun/diag_pre_multiply.hpp +++ b/stan/math/prim/fun/diag_pre_multiply.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_DIAG_PRE_MULTIPLY_HPP -#define STAN_MATH_PRIM_MAT_FUN_DIAG_PRE_MULTIPLY_HPP +#ifndef STAN_MATH_PRIM_FUN_DIAG_PRE_MULTIPLY_HPP +#define STAN_MATH_PRIM_FUN_DIAG_PRE_MULTIPLY_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/diagonal.hpp b/stan/math/prim/fun/diagonal.hpp similarity index 78% rename from stan/math/prim/mat/fun/diagonal.hpp rename to stan/math/prim/fun/diagonal.hpp index 186375f14b1..ee01663b02b 100644 --- a/stan/math/prim/mat/fun/diagonal.hpp +++ b/stan/math/prim/fun/diagonal.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_DIAGONAL_HPP -#define STAN_MATH_PRIM_MAT_FUN_DIAGONAL_HPP +#ifndef STAN_MATH_PRIM_FUN_DIAGONAL_HPP +#define STAN_MATH_PRIM_FUN_DIAGONAL_HPP -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/scal/fun/digamma.hpp b/stan/math/prim/fun/digamma.hpp similarity index 59% rename from stan/math/prim/scal/fun/digamma.hpp rename to stan/math/prim/fun/digamma.hpp index 0a417a56880..8d293879054 100644 --- a/stan/math/prim/scal/fun/digamma.hpp +++ b/stan/math/prim/fun/digamma.hpp @@ -1,8 +1,9 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_DIGAMMA_HPP -#define STAN_MATH_PRIM_SCAL_FUN_DIGAMMA_HPP +#ifndef STAN_MATH_PRIM_FUN_DIGAMMA_HPP +#define STAN_MATH_PRIM_FUN_DIGAMMA_HPP #include -#include +#include +#include #include namespace stan { @@ -47,6 +48,35 @@ inline double digamma(double x) { return boost::math::digamma(x, boost_policy_t()); } +/** + * Structure to wrap digamma() so it can be vectorized. + * + * @tparam T type of variable + * @param x variable + * @return Digamma function applied to x. + * @throw std::domain_error if x is a negative integer or 0 + */ +struct digamma_fun { + template + static inline T fun(const T& x) { + return digamma(x); + } +}; + +/** + * Vectorized version of digamma(). + * + * @tparam T type of container + * @param x container + * @return Digamma function applied to each value in x. + * @throw std::domain_error if any value is a negative integer or 0 + */ +template +inline auto digamma(const T& x) { + return apply_scalar_unary::apply(x); +} + } // namespace math } // namespace stan + #endif diff --git a/stan/math/prim/mat/fun/dims.hpp b/stan/math/prim/fun/dims.hpp similarity index 84% rename from stan/math/prim/mat/fun/dims.hpp rename to stan/math/prim/fun/dims.hpp index 283f4b81ad3..bfa6c56e275 100644 --- a/stan/math/prim/mat/fun/dims.hpp +++ b/stan/math/prim/fun/dims.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_DIMS_HPP -#define STAN_MATH_PRIM_MAT_FUN_DIMS_HPP +#ifndef STAN_MATH_PRIM_FUN_DIMS_HPP +#define STAN_MATH_PRIM_FUN_DIMS_HPP -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/distance.hpp b/stan/math/prim/fun/distance.hpp similarity index 58% rename from stan/math/prim/mat/fun/distance.hpp rename to stan/math/prim/fun/distance.hpp index 98bf2dd9c72..e76f7d05d9d 100644 --- a/stan/math/prim/mat/fun/distance.hpp +++ b/stan/math/prim/fun/distance.hpp @@ -1,14 +1,31 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_DISTANCE_HPP -#define STAN_MATH_PRIM_MAT_FUN_DISTANCE_HPP +#ifndef STAN_MATH_PRIM_FUN_DISTANCE_HPP +#define STAN_MATH_PRIM_FUN_DISTANCE_HPP +#include #include -#include -#include +#include +#include +#include #include namespace stan { namespace math { +/** + * Returns the distance between two scalars. + * + * @param x1 First scalar. + * @param x2 Second scalar. + * @return Distance between two scalars + * @throw std::domain_error If the arguments are not finite. + */ +template +inline return_type_t distance(const T1& x1, const T2& x2) { + check_finite("distance", "x1", x1); + check_finite("distance", "x2", x2); + return abs(x1 - x2); +} + /** * Returns the distance between the specified vectors. * diff --git a/stan/math/prim/mat/fun/divide.hpp b/stan/math/prim/fun/divide.hpp similarity index 52% rename from stan/math/prim/mat/fun/divide.hpp rename to stan/math/prim/fun/divide.hpp index e91180dfbb7..d8339989d5e 100644 --- a/stan/math/prim/mat/fun/divide.hpp +++ b/stan/math/prim/fun/divide.hpp @@ -1,13 +1,35 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_DIVIDE_HPP -#define STAN_MATH_PRIM_MAT_FUN_DIVIDE_HPP +#ifndef STAN_MATH_PRIM_FUN_DIVIDE_HPP +#define STAN_MATH_PRIM_FUN_DIVIDE_HPP -#include #include +#include +#include +#include +#include #include namespace stan { namespace math { +/** + * Return the division of the first scalar by + * the second scalar. + * @param[in] x Specified vector. + * @param[in] y Specified scalar. + * @return Vector divided by the scalar. + */ +template +inline return_type_t divide(const T1& x, const T2& y) { + return x / y; +} + +inline int divide(int x, int y) { + if (unlikely(y == 0)) { + throw_domain_error("divide", "denominator is", y, ""); + } + return x / y; +} + /** * Return matrix divided by scalar. * diff --git a/stan/math/prim/mat/fun/divide_columns.hpp b/stan/math/prim/fun/divide_columns.hpp similarity index 87% rename from stan/math/prim/mat/fun/divide_columns.hpp rename to stan/math/prim/fun/divide_columns.hpp index 75aac638d62..9f2797dfb4b 100644 --- a/stan/math/prim/mat/fun/divide_columns.hpp +++ b/stan/math/prim/fun/divide_columns.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_DIVIDE_COLUMNS_HPP -#define STAN_MATH_PRIM_MAT_FUN_DIVIDE_COLUMNS_HPP +#ifndef STAN_MATH_PRIM_FUN_DIVIDE_COLUMNS_HPP +#define STAN_MATH_PRIM_FUN_DIVIDE_COLUMNS_HPP #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/arr/fun/dot.hpp b/stan/math/prim/fun/dot.hpp similarity index 81% rename from stan/math/prim/arr/fun/dot.hpp rename to stan/math/prim/fun/dot.hpp index 196452680b6..a21b6b5ec92 100644 --- a/stan/math/prim/arr/fun/dot.hpp +++ b/stan/math/prim/fun/dot.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_ARR_FUN_DOT_HPP -#define STAN_MATH_PRIM_ARR_FUN_DOT_HPP +#ifndef STAN_MATH_PRIM_FUN_DOT_HPP +#define STAN_MATH_PRIM_FUN_DOT_HPP #include #include diff --git a/stan/math/prim/mat/fun/dot_product.hpp b/stan/math/prim/fun/dot_product.hpp similarity index 91% rename from stan/math/prim/mat/fun/dot_product.hpp rename to stan/math/prim/fun/dot_product.hpp index 022a388abf4..d7b12234f7a 100644 --- a/stan/math/prim/mat/fun/dot_product.hpp +++ b/stan/math/prim/fun/dot_product.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_DOT_PRODUCT_HPP -#define STAN_MATH_PRIM_MAT_FUN_DOT_PRODUCT_HPP +#ifndef STAN_MATH_PRIM_FUN_DOT_PRODUCT_HPP +#define STAN_MATH_PRIM_FUN_DOT_PRODUCT_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/dot_self.hpp b/stan/math/prim/fun/dot_self.hpp similarity index 61% rename from stan/math/prim/mat/fun/dot_self.hpp rename to stan/math/prim/fun/dot_self.hpp index 428bb177219..95de5f4b6e1 100644 --- a/stan/math/prim/mat/fun/dot_self.hpp +++ b/stan/math/prim/fun/dot_self.hpp @@ -1,12 +1,23 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_DOT_SELF_HPP -#define STAN_MATH_PRIM_MAT_FUN_DOT_SELF_HPP +#ifndef STAN_MATH_PRIM_FUN_DOT_SELF_HPP +#define STAN_MATH_PRIM_FUN_DOT_SELF_HPP +#include #include -#include +#include +#include +#include namespace stan { namespace math { +inline double dot_self(const std::vector& x) { + double sum = 0.0; + for (double i : x) { + sum += i * i; + } + return sum; +} + /** * Returns the dot product of the specified vector with itself. * diff --git a/stan/math/prim/mat/fun/eigenvalues_sym.hpp b/stan/math/prim/fun/eigenvalues_sym.hpp similarity index 86% rename from stan/math/prim/mat/fun/eigenvalues_sym.hpp rename to stan/math/prim/fun/eigenvalues_sym.hpp index 7e01342fb93..ec7437b90f8 100644 --- a/stan/math/prim/mat/fun/eigenvalues_sym.hpp +++ b/stan/math/prim/fun/eigenvalues_sym.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_EIGENVALUES_SYM_HPP -#define STAN_MATH_PRIM_MAT_FUN_EIGENVALUES_SYM_HPP +#ifndef STAN_MATH_PRIM_FUN_EIGENVALUES_SYM_HPP +#define STAN_MATH_PRIM_FUN_EIGENVALUES_SYM_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/eigenvectors_sym.hpp b/stan/math/prim/fun/eigenvectors_sym.hpp similarity index 77% rename from stan/math/prim/mat/fun/eigenvectors_sym.hpp rename to stan/math/prim/fun/eigenvectors_sym.hpp index 9508de09b02..8c5d840a12e 100644 --- a/stan/math/prim/mat/fun/eigenvectors_sym.hpp +++ b/stan/math/prim/fun/eigenvectors_sym.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_EIGENVECTORS_SYM_HPP -#define STAN_MATH_PRIM_MAT_FUN_EIGENVECTORS_SYM_HPP +#ifndef STAN_MATH_PRIM_FUN_EIGENVECTORS_SYM_HPP +#define STAN_MATH_PRIM_FUN_EIGENVECTORS_SYM_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/elt_divide.hpp b/stan/math/prim/fun/elt_divide.hpp similarity index 93% rename from stan/math/prim/mat/fun/elt_divide.hpp rename to stan/math/prim/fun/elt_divide.hpp index 17ef6592384..e1de9978db3 100644 --- a/stan/math/prim/mat/fun/elt_divide.hpp +++ b/stan/math/prim/fun/elt_divide.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ELT_DIVIDE_HPP -#define STAN_MATH_PRIM_MAT_FUN_ELT_DIVIDE_HPP +#ifndef STAN_MATH_PRIM_FUN_ELT_DIVIDE_HPP +#define STAN_MATH_PRIM_FUN_ELT_DIVIDE_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/elt_multiply.hpp b/stan/math/prim/fun/elt_multiply.hpp similarity index 84% rename from stan/math/prim/mat/fun/elt_multiply.hpp rename to stan/math/prim/fun/elt_multiply.hpp index 95cffc82406..c4e576c36c7 100644 --- a/stan/math/prim/mat/fun/elt_multiply.hpp +++ b/stan/math/prim/fun/elt_multiply.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ELT_MULTIPLY_HPP -#define STAN_MATH_PRIM_MAT_FUN_ELT_MULTIPLY_HPP +#ifndef STAN_MATH_PRIM_FUN_ELT_MULTIPLY_HPP +#define STAN_MATH_PRIM_FUN_ELT_MULTIPLY_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/scal/fun/erf.hpp b/stan/math/prim/fun/erf.hpp similarity index 50% rename from stan/math/prim/scal/fun/erf.hpp rename to stan/math/prim/fun/erf.hpp index c72ef57fab3..32b9f9ab176 100644 --- a/stan/math/prim/scal/fun/erf.hpp +++ b/stan/math/prim/fun/erf.hpp @@ -1,7 +1,8 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_ERF_HPP -#define STAN_MATH_PRIM_SCAL_FUN_ERF_HPP +#ifndef STAN_MATH_PRIM_FUN_ERF_HPP +#define STAN_MATH_PRIM_FUN_ERF_HPP #include +#include #include namespace stan { @@ -28,6 +29,33 @@ inline double erf(double x) { return std::erf(x); } */ inline double erf(int x) { return std::erf(x); } +/** + * Structure to wrap erf() so it can be vectorized. + * + * @tparam T type of variable + * @param x variable + * @return Error function of x. + */ +struct erf_fun { + template + static inline T fun(const T& x) { + return erf(x); + } +}; + +/** + * Vectorized version of erf(). + * + * @tparam T type of container + * @param x container + * @return Error function applied to each value in x. + */ +template +inline auto erf(const T& x) { + return apply_scalar_unary::apply(x); +} + } // namespace math } // namespace stan + #endif diff --git a/stan/math/prim/scal/fun/erfc.hpp b/stan/math/prim/fun/erfc.hpp similarity index 51% rename from stan/math/prim/scal/fun/erfc.hpp rename to stan/math/prim/fun/erfc.hpp index 0c48621902c..09d847b67ad 100644 --- a/stan/math/prim/scal/fun/erfc.hpp +++ b/stan/math/prim/fun/erfc.hpp @@ -1,7 +1,8 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_ERFC_HPP -#define STAN_MATH_PRIM_SCAL_FUN_ERFC_HPP +#ifndef STAN_MATH_PRIM_FUN_ERFC_HPP +#define STAN_MATH_PRIM_FUN_ERFC_HPP #include +#include #include namespace stan { @@ -28,6 +29,33 @@ inline double erfc(double x) { return std::erfc(x); } */ inline double erfc(int x) { return std::erfc(x); } +/** + * Structure to wrap erfc() so that it can be vectorized. + * + * @tparam T type of variable + * @param x variable + * @return Complementary error function applied to x. + */ +struct erfc_fun { + template + static inline T fun(const T& x) { + return erfc(x); + } +}; + +/** + * Vectorized version of erfc(). + * + * @tparam T type of container + * @param x container + * @return Complementary error function applied to each value in x. + */ +template +inline auto erfc(const T& x) { + return apply_scalar_unary::apply(x); +} + } // namespace math } // namespace stan + #endif diff --git a/stan/math/prim/mat/fun/exp.hpp b/stan/math/prim/fun/exp.hpp similarity index 80% rename from stan/math/prim/mat/fun/exp.hpp rename to stan/math/prim/fun/exp.hpp index fbb7152f304..4d60b4c04b5 100644 --- a/stan/math/prim/mat/fun/exp.hpp +++ b/stan/math/prim/fun/exp.hpp @@ -1,15 +1,23 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_EXP_HPP -#define STAN_MATH_PRIM_MAT_FUN_EXP_HPP +#ifndef STAN_MATH_PRIM_FUN_EXP_HPP +#define STAN_MATH_PRIM_FUN_EXP_HPP -#include #include -#include +#include #include #include namespace stan { namespace math { +/** + * Return the natural exponential of the specified argument. This + * version is required to disambiguate exp(int). + * + * @param[in] x Argument. + * @return Natural exponential of argument. + */ +inline double exp(int x) { return std::exp(x); } + /** * Structure to wrap exp() so that it can be * vectorized. diff --git a/stan/math/prim/mat/fun/exp2.hpp b/stan/math/prim/fun/exp2.hpp similarity index 69% rename from stan/math/prim/mat/fun/exp2.hpp rename to stan/math/prim/fun/exp2.hpp index dd867383e56..39e823d849d 100644 --- a/stan/math/prim/mat/fun/exp2.hpp +++ b/stan/math/prim/fun/exp2.hpp @@ -1,13 +1,30 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_EXP2_HPP -#define STAN_MATH_PRIM_MAT_FUN_EXP2_HPP +#ifndef STAN_MATH_PRIM_FUN_EXP2_HPP +#define STAN_MATH_PRIM_FUN_EXP2_HPP -#include -#include #include +#include +#include namespace stan { namespace math { +/** + * Return the exponent base 2 of the specified argument (C99, + * C++11). + * + * The exponent base 2 function is defined by + * + * exp2(y) = pow(2.0, y). + * + * @param y argument. + * @return exponent base 2 of argument. + */ +template > +inline double exp2(T y) { + using std::exp2; + return exp2(y); +} + /** * Structure to wrap exp2() so it can be vectorized. */ diff --git a/stan/math/prim/mat/fun/expm1.hpp b/stan/math/prim/fun/expm1.hpp similarity index 53% rename from stan/math/prim/mat/fun/expm1.hpp rename to stan/math/prim/fun/expm1.hpp index edea1c8c423..6e1d2fd58e5 100644 --- a/stan/math/prim/mat/fun/expm1.hpp +++ b/stan/math/prim/fun/expm1.hpp @@ -1,12 +1,31 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_EXPM1_HPP -#define STAN_MATH_PRIM_MAT_FUN_EXPM1_HPP +#ifndef STAN_MATH_PRIM_FUN_EXPM1_HPP +#define STAN_MATH_PRIM_FUN_EXPM1_HPP +#include #include -#include +#include namespace stan { namespace math { +/** + * Return the natural exponentiation of x minus one. + * Returns infinity for infinity argument and -infinity for + * -infinity argument. + * + * @param[in] x Argument. + * @return Natural exponentiation of argument minus one. + */ +inline double expm1(double x) { return std::expm1(x); } + +/** + * Integer version of expm1. + * + * @param[in] x Argument. + * @return Natural exponentiation of argument minus one. + */ +inline double expm1(int x) { return std::expm1(x); } + /** * Structure to wrap expm1() so that it can be vectorized. * diff --git a/stan/math/prim/mat/fun/fabs.hpp b/stan/math/prim/fun/fabs.hpp similarity index 92% rename from stan/math/prim/mat/fun/fabs.hpp rename to stan/math/prim/fun/fabs.hpp index 8f8f914bdc7..1dc51b0ee3c 100644 --- a/stan/math/prim/mat/fun/fabs.hpp +++ b/stan/math/prim/fun/fabs.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_FABS_HPP -#define STAN_MATH_PRIM_MAT_FUN_FABS_HPP +#ifndef STAN_MATH_PRIM_FUN_FABS_HPP +#define STAN_MATH_PRIM_FUN_FABS_HPP -#include -#include #include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/factor_U.hpp b/stan/math/prim/fun/factor_U.hpp similarity index 84% rename from stan/math/prim/mat/fun/factor_U.hpp rename to stan/math/prim/fun/factor_U.hpp index 6d9baba4223..93f10626fef 100644 --- a/stan/math/prim/mat/fun/factor_U.hpp +++ b/stan/math/prim/fun/factor_U.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_FACTOR_U_HPP -#define STAN_MATH_PRIM_MAT_FUN_FACTOR_U_HPP +#ifndef STAN_MATH_PRIM_FUN_FACTOR_U_HPP +#define STAN_MATH_PRIM_FUN_FACTOR_U_HPP -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/stan/math/prim/mat/fun/factor_cov_matrix.hpp b/stan/math/prim/fun/factor_cov_matrix.hpp similarity index 88% rename from stan/math/prim/mat/fun/factor_cov_matrix.hpp rename to stan/math/prim/fun/factor_cov_matrix.hpp index 009e8fb6217..294bb6f4569 100644 --- a/stan/math/prim/mat/fun/factor_cov_matrix.hpp +++ b/stan/math/prim/fun/factor_cov_matrix.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_FACTOR_COV_MATRIX_HPP -#define STAN_MATH_PRIM_MAT_FUN_FACTOR_COV_MATRIX_HPP +#ifndef STAN_MATH_PRIM_FUN_FACTOR_COV_MATRIX_HPP +#define STAN_MATH_PRIM_FUN_FACTOR_COV_MATRIX_HPP -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/falling_factorial.hpp b/stan/math/prim/fun/falling_factorial.hpp similarity index 92% rename from stan/math/prim/scal/fun/falling_factorial.hpp rename to stan/math/prim/fun/falling_factorial.hpp index 090d9ca0b56..851debee270 100644 --- a/stan/math/prim/scal/fun/falling_factorial.hpp +++ b/stan/math/prim/fun/falling_factorial.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_FALLING_FACTORIAL_HPP -#define STAN_MATH_PRIM_SCAL_FUN_FALLING_FACTORIAL_HPP +#ifndef STAN_MATH_PRIM_FUN_FALLING_FACTORIAL_HPP +#define STAN_MATH_PRIM_FUN_FALLING_FACTORIAL_HPP #include #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/fdim.hpp b/stan/math/prim/fun/fdim.hpp similarity index 86% rename from stan/math/prim/scal/fun/fdim.hpp rename to stan/math/prim/fun/fdim.hpp index c71df614229..c65cd000044 100644 --- a/stan/math/prim/scal/fun/fdim.hpp +++ b/stan/math/prim/fun/fdim.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_FDIM_HPP -#define STAN_MATH_PRIM_SCAL_FUN_FDIM_HPP +#ifndef STAN_MATH_PRIM_FUN_FDIM_HPP +#define STAN_MATH_PRIM_FUN_FDIM_HPP #include diff --git a/stan/math/prim/fun/fill.hpp b/stan/math/prim/fun/fill.hpp new file mode 100644 index 00000000000..9718e2a0f74 --- /dev/null +++ b/stan/math/prim/fun/fill.hpp @@ -0,0 +1,65 @@ +#ifndef STAN_MATH_PRIM_FUN_FILL_HPP +#define STAN_MATH_PRIM_FUN_FILL_HPP + +#include +#include +#include + +namespace stan { +namespace math { + +/** + * Fill the specified container with the specified value. + * + * The specified matrix is filled by element. + * + * @tparam T type of elements in the matrix + * @tparam R number of rows, can be Eigen::Dynamic + * @tparam C number of columns, can be Eigen::Dynamic + * @tparam S Type of value. + * + * @param x Container. + * @param y Value. + */ +template +void fill(Eigen::Matrix& x, const S& y) { + x.fill(y); +} + +/** + * Fill the specified container with the specified value. + * + * This base case simply assigns the value to the container. + * + * @tparam T Type of reference container. + * @tparam S Type of value. + * @param x Container. + * @param y Value. + */ +template +void fill(T& x, const S& y) { + x = y; +} + +/** + * Fill the specified container with the specified value. + * + * Each container in the specified standard vector is filled + * recursively by calling fill. + * + * @tparam T Type of container in vector. + * @tparam S Type of value. + * @param[in] x Container. + * @param[in, out] y Value. + */ +template +void fill(std::vector& x, const S& y) { + for (typename std::vector::size_type i = 0; i < x.size(); ++i) { + fill(x[i], y); + } +} + +} // namespace math +} // namespace stan + +#endif diff --git a/stan/math/prim/scal/fun/finite_diff_stepsize.hpp b/stan/math/prim/fun/finite_diff_stepsize.hpp similarity index 77% rename from stan/math/prim/scal/fun/finite_diff_stepsize.hpp rename to stan/math/prim/fun/finite_diff_stepsize.hpp index dc670be6d34..f97fac00d8f 100644 --- a/stan/math/prim/scal/fun/finite_diff_stepsize.hpp +++ b/stan/math/prim/fun/finite_diff_stepsize.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_FINITE_DIFF_STEPSIZE_HPP -#define STAN_MATH_PRIM_SCAL_FUN_FINITE_DIFF_STEPSIZE_HPP +#ifndef STAN_MATH_PRIM_FUN_FINITE_DIFF_STEPSIZE_HPP +#define STAN_MATH_PRIM_FUN_FINITE_DIFF_STEPSIZE_HPP -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/floor.hpp b/stan/math/prim/fun/floor.hpp similarity index 90% rename from stan/math/prim/mat/fun/floor.hpp rename to stan/math/prim/fun/floor.hpp index 733bc8c4ef7..7f1f37317cd 100644 --- a/stan/math/prim/mat/fun/floor.hpp +++ b/stan/math/prim/fun/floor.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_FLOOR_HPP -#define STAN_MATH_PRIM_MAT_FUN_FLOOR_HPP +#ifndef STAN_MATH_PRIM_FUN_FLOOR_HPP +#define STAN_MATH_PRIM_FUN_FLOOR_HPP -#include -#include #include +#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/fma.hpp b/stan/math/prim/fun/fma.hpp similarity index 89% rename from stan/math/prim/scal/fun/fma.hpp rename to stan/math/prim/fun/fma.hpp index 24ff99b2dea..c80c0191442 100644 --- a/stan/math/prim/scal/fun/fma.hpp +++ b/stan/math/prim/fun/fma.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_FMA_HPP -#define STAN_MATH_PRIM_SCAL_FUN_FMA_HPP +#ifndef STAN_MATH_PRIM_FUN_FMA_HPP +#define STAN_MATH_PRIM_FUN_FMA_HPP #include #include diff --git a/stan/math/prim/scal/fun/fmax.hpp b/stan/math/prim/fun/fmax.hpp similarity index 86% rename from stan/math/prim/scal/fun/fmax.hpp rename to stan/math/prim/fun/fmax.hpp index 457e5e29606..5af85c19003 100644 --- a/stan/math/prim/scal/fun/fmax.hpp +++ b/stan/math/prim/fun/fmax.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_FMAX_HPP -#define STAN_MATH_PRIM_SCAL_FUN_FMAX_HPP +#ifndef STAN_MATH_PRIM_FUN_FMAX_HPP +#define STAN_MATH_PRIM_FUN_FMAX_HPP #include #include diff --git a/stan/math/prim/scal/fun/fmin.hpp b/stan/math/prim/fun/fmin.hpp similarity index 86% rename from stan/math/prim/scal/fun/fmin.hpp rename to stan/math/prim/fun/fmin.hpp index cd344314e01..258ada70ba3 100644 --- a/stan/math/prim/scal/fun/fmin.hpp +++ b/stan/math/prim/fun/fmin.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_FMIN_HPP -#define STAN_MATH_PRIM_SCAL_FUN_FMIN_HPP +#ifndef STAN_MATH_PRIM_FUN_FMIN_HPP +#define STAN_MATH_PRIM_FUN_FMIN_HPP #include #include diff --git a/stan/math/prim/scal/fun/gamma_p.hpp b/stan/math/prim/fun/gamma_p.hpp similarity index 90% rename from stan/math/prim/scal/fun/gamma_p.hpp rename to stan/math/prim/fun/gamma_p.hpp index 9cfc1b36ccc..68f60f64397 100644 --- a/stan/math/prim/scal/fun/gamma_p.hpp +++ b/stan/math/prim/fun/gamma_p.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_GAMMA_P_HPP -#define STAN_MATH_PRIM_SCAL_FUN_GAMMA_P_HPP +#ifndef STAN_MATH_PRIM_FUN_GAMMA_P_HPP +#define STAN_MATH_PRIM_FUN_GAMMA_P_HPP -#include -#include #include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/gamma_q.hpp b/stan/math/prim/fun/gamma_q.hpp similarity index 94% rename from stan/math/prim/scal/fun/gamma_q.hpp rename to stan/math/prim/fun/gamma_q.hpp index 4b886c44b46..0f2dbbf4357 100644 --- a/stan/math/prim/scal/fun/gamma_q.hpp +++ b/stan/math/prim/fun/gamma_q.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_GAMMA_Q_HPP -#define STAN_MATH_PRIM_SCAL_FUN_GAMMA_Q_HPP +#ifndef STAN_MATH_PRIM_FUN_GAMMA_Q_HPP +#define STAN_MATH_PRIM_FUN_GAMMA_Q_HPP #include #include diff --git a/stan/math/prim/mat/fun/get_base1.hpp b/stan/math/prim/fun/get_base1.hpp similarity index 98% rename from stan/math/prim/mat/fun/get_base1.hpp rename to stan/math/prim/fun/get_base1.hpp index 31286bfc1c2..af08cae1bac 100644 --- a/stan/math/prim/mat/fun/get_base1.hpp +++ b/stan/math/prim/fun/get_base1.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_GET_BASE1_HPP -#define STAN_MATH_PRIM_MAT_FUN_GET_BASE1_HPP +#ifndef STAN_MATH_PRIM_FUN_GET_BASE1_HPP +#define STAN_MATH_PRIM_FUN_GET_BASE1_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/get_base1_lhs.hpp b/stan/math/prim/fun/get_base1_lhs.hpp similarity index 98% rename from stan/math/prim/mat/fun/get_base1_lhs.hpp rename to stan/math/prim/fun/get_base1_lhs.hpp index 6d9ecc86ef8..4e2a65a1aee 100644 --- a/stan/math/prim/mat/fun/get_base1_lhs.hpp +++ b/stan/math/prim/fun/get_base1_lhs.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_GET_BASE1_LHS_HPP -#define STAN_MATH_PRIM_MAT_FUN_GET_BASE1_LHS_HPP +#ifndef STAN_MATH_PRIM_FUN_GET_BASE1_LHS_HPP +#define STAN_MATH_PRIM_FUN_GET_BASE1_LHS_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/get_lp.hpp b/stan/math/prim/fun/get_lp.hpp similarity index 67% rename from stan/math/prim/mat/fun/get_lp.hpp rename to stan/math/prim/fun/get_lp.hpp index d8ba8ce8343..a3b21bce3da 100644 --- a/stan/math/prim/mat/fun/get_lp.hpp +++ b/stan/math/prim/fun/get_lp.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_GET_LP_HPP -#define STAN_MATH_PRIM_MAT_FUN_GET_LP_HPP +#ifndef STAN_MATH_PRIM_FUN_GET_LP_HPP +#define STAN_MATH_PRIM_FUN_GET_LP_HPP -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/gp_dot_prod_cov.hpp b/stan/math/prim/fun/gp_dot_prod_cov.hpp similarity index 96% rename from stan/math/prim/mat/fun/gp_dot_prod_cov.hpp rename to stan/math/prim/fun/gp_dot_prod_cov.hpp index b397bd17284..1e45078fb8d 100644 --- a/stan/math/prim/mat/fun/gp_dot_prod_cov.hpp +++ b/stan/math/prim/fun/gp_dot_prod_cov.hpp @@ -1,12 +1,12 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_COV_DOT_PROD_HPP -#define STAN_MATH_PRIM_MAT_FUN_COV_DOT_PROD_HPP +#ifndef STAN_MATH_PRIM_FUN_COV_DOT_PROD_HPP +#define STAN_MATH_PRIM_FUN_COV_DOT_PROD_HPP #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/gp_exp_quad_cov.hpp b/stan/math/prim/fun/gp_exp_quad_cov.hpp similarity index 98% rename from stan/math/prim/mat/fun/gp_exp_quad_cov.hpp rename to stan/math/prim/fun/gp_exp_quad_cov.hpp index 62f709230b4..827e5cbf4f3 100644 --- a/stan/math/prim/mat/fun/gp_exp_quad_cov.hpp +++ b/stan/math/prim/fun/gp_exp_quad_cov.hpp @@ -1,13 +1,13 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_GP_EXP_QUAD_COV_HPP -#define STAN_MATH_PRIM_MAT_FUN_GP_EXP_QUAD_COV_HPP +#ifndef STAN_MATH_PRIM_FUN_GP_EXP_QUAD_COV_HPP +#define STAN_MATH_PRIM_FUN_GP_EXP_QUAD_COV_HPP #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #ifdef STAN_OPENCL #include #endif diff --git a/stan/math/prim/mat/fun/gp_exponential_cov.hpp b/stan/math/prim/fun/gp_exponential_cov.hpp similarity index 96% rename from stan/math/prim/mat/fun/gp_exponential_cov.hpp rename to stan/math/prim/fun/gp_exponential_cov.hpp index d97d1a64622..59d6e982d73 100644 --- a/stan/math/prim/mat/fun/gp_exponential_cov.hpp +++ b/stan/math/prim/fun/gp_exponential_cov.hpp @@ -1,13 +1,12 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_GP_EXPONENTIAL_COV_HPP -#define STAN_MATH_PRIM_MAT_FUN_GP_EXPONENTIAL_COV_HPP +#ifndef STAN_MATH_PRIM_FUN_GP_EXPONENTIAL_COV_HPP +#define STAN_MATH_PRIM_FUN_GP_EXPONENTIAL_COV_HPP #include -#include -#include -#include #include -#include -#include +#include +#include +#include +#include #include #include diff --git a/stan/math/prim/mat/fun/gp_matern32_cov.hpp b/stan/math/prim/fun/gp_matern32_cov.hpp similarity index 95% rename from stan/math/prim/mat/fun/gp_matern32_cov.hpp rename to stan/math/prim/fun/gp_matern32_cov.hpp index 80e269df6a7..b7b99477104 100644 --- a/stan/math/prim/mat/fun/gp_matern32_cov.hpp +++ b/stan/math/prim/fun/gp_matern32_cov.hpp @@ -1,15 +1,14 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_GP_MATERN32_COV_HPP -#define STAN_MATH_PRIM_MAT_FUN_GP_MATERN32_COV_HPP +#ifndef STAN_MATH_PRIM_FUN_GP_MATERN32_COV_HPP +#define STAN_MATH_PRIM_FUN_GP_MATERN32_COV_HPP #include -#include -#include -#include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/stan/math/prim/mat/fun/gp_matern52_cov.hpp b/stan/math/prim/fun/gp_matern52_cov.hpp similarity index 95% rename from stan/math/prim/mat/fun/gp_matern52_cov.hpp rename to stan/math/prim/fun/gp_matern52_cov.hpp index 51c69260c2d..5155e40ad98 100644 --- a/stan/math/prim/mat/fun/gp_matern52_cov.hpp +++ b/stan/math/prim/fun/gp_matern52_cov.hpp @@ -1,15 +1,14 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_GP_MATERN52_COV_HPP -#define STAN_MATH_PRIM_MAT_FUN_GP_MATERN52_COV_HPP +#ifndef STAN_MATH_PRIM_FUN_GP_MATERN52_COV_HPP +#define STAN_MATH_PRIM_FUN_GP_MATERN52_COV_HPP #include -#include -#include -#include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/stan/math/prim/mat/fun/gp_periodic_cov.hpp b/stan/math/prim/fun/gp_periodic_cov.hpp similarity index 92% rename from stan/math/prim/mat/fun/gp_periodic_cov.hpp rename to stan/math/prim/fun/gp_periodic_cov.hpp index 6c621c8c6a0..dfad9514e76 100644 --- a/stan/math/prim/mat/fun/gp_periodic_cov.hpp +++ b/stan/math/prim/fun/gp_periodic_cov.hpp @@ -1,15 +1,14 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_GP_PERIODIC_COV_HPP -#define STAN_MATH_PRIM_MAT_FUN_GP_PERIODIC_COV_HPP +#ifndef STAN_MATH_PRIM_FUN_GP_PERIODIC_COV_HPP +#define STAN_MATH_PRIM_FUN_GP_PERIODIC_COV_HPP #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/stan/math/prim/scal/fun/grad_2F1.hpp b/stan/math/prim/fun/grad_2F1.hpp similarity index 95% rename from stan/math/prim/scal/fun/grad_2F1.hpp rename to stan/math/prim/fun/grad_2F1.hpp index 5057397f641..e44e81eeb52 100644 --- a/stan/math/prim/scal/fun/grad_2F1.hpp +++ b/stan/math/prim/fun/grad_2F1.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_GRAD_2F1_HPP -#define STAN_MATH_PRIM_SCAL_FUN_GRAD_2F1_HPP +#ifndef STAN_MATH_PRIM_FUN_GRAD_2F1_HPP +#define STAN_MATH_PRIM_FUN_GRAD_2F1_HPP #include #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/grad_F32.hpp b/stan/math/prim/fun/grad_F32.hpp similarity index 95% rename from stan/math/prim/scal/fun/grad_F32.hpp rename to stan/math/prim/fun/grad_F32.hpp index 7e12c171ee7..19d49389c3e 100644 --- a/stan/math/prim/scal/fun/grad_F32.hpp +++ b/stan/math/prim/fun/grad_F32.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_GRAD_F32_HPP -#define STAN_MATH_PRIM_SCAL_FUN_GRAD_F32_HPP +#ifndef STAN_MATH_PRIM_FUN_GRAD_F32_HPP +#define STAN_MATH_PRIM_FUN_GRAD_F32_HPP #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/grad_inc_beta.hpp b/stan/math/prim/fun/grad_inc_beta.hpp similarity index 67% rename from stan/math/prim/scal/fun/grad_inc_beta.hpp rename to stan/math/prim/fun/grad_inc_beta.hpp index 0ca0dc474d1..7a80162db56 100644 --- a/stan/math/prim/scal/fun/grad_inc_beta.hpp +++ b/stan/math/prim/fun/grad_inc_beta.hpp @@ -1,13 +1,13 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_GRAD_INC_BETA_HPP -#define STAN_MATH_PRIM_SCAL_FUN_GRAD_INC_BETA_HPP +#ifndef STAN_MATH_PRIM_FUN_GRAD_INC_BETA_HPP +#define STAN_MATH_PRIM_FUN_GRAD_INC_BETA_HPP #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/grad_reg_inc_beta.hpp b/stan/math/prim/fun/grad_reg_inc_beta.hpp similarity index 84% rename from stan/math/prim/scal/fun/grad_reg_inc_beta.hpp rename to stan/math/prim/fun/grad_reg_inc_beta.hpp index 400be9ae755..60c03ae45d8 100644 --- a/stan/math/prim/scal/fun/grad_reg_inc_beta.hpp +++ b/stan/math/prim/fun/grad_reg_inc_beta.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_GRAD_REG_INC_BETA_HPP -#define STAN_MATH_PRIM_SCAL_FUN_GRAD_REG_INC_BETA_HPP +#ifndef STAN_MATH_PRIM_FUN_GRAD_REG_INC_BETA_HPP +#define STAN_MATH_PRIM_FUN_GRAD_REG_INC_BETA_HPP #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/grad_reg_inc_gamma.hpp b/stan/math/prim/fun/grad_reg_inc_gamma.hpp similarity index 88% rename from stan/math/prim/scal/fun/grad_reg_inc_gamma.hpp rename to stan/math/prim/fun/grad_reg_inc_gamma.hpp index 300f12a3360..8caf73ab268 100644 --- a/stan/math/prim/scal/fun/grad_reg_inc_gamma.hpp +++ b/stan/math/prim/fun/grad_reg_inc_gamma.hpp @@ -1,15 +1,15 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_GRAD_REG_INC_GAMMA_HPP -#define STAN_MATH_PRIM_SCAL_FUN_GRAD_REG_INC_GAMMA_HPP +#ifndef STAN_MATH_PRIM_FUN_GRAD_REG_INC_GAMMA_HPP +#define STAN_MATH_PRIM_FUN_GRAD_REG_INC_GAMMA_HPP #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/stan/math/prim/scal/fun/grad_reg_lower_inc_gamma.hpp b/stan/math/prim/fun/grad_reg_lower_inc_gamma.hpp similarity index 90% rename from stan/math/prim/scal/fun/grad_reg_lower_inc_gamma.hpp rename to stan/math/prim/fun/grad_reg_lower_inc_gamma.hpp index a6e95eeb6b0..7fd5b0a12d2 100644 --- a/stan/math/prim/scal/fun/grad_reg_lower_inc_gamma.hpp +++ b/stan/math/prim/fun/grad_reg_lower_inc_gamma.hpp @@ -1,18 +1,18 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOWER_REG_INC_GAMMA_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOWER_REG_INC_GAMMA_HPP +#ifndef STAN_MATH_PRIM_FUN_LOWER_REG_INC_GAMMA_HPP +#define STAN_MATH_PRIM_FUN_LOWER_REG_INC_GAMMA_HPP #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/stan/math/prim/mat/fun/head.hpp b/stan/math/prim/fun/head.hpp similarity index 93% rename from stan/math/prim/mat/fun/head.hpp rename to stan/math/prim/fun/head.hpp index fe60f072347..96ff3fcca6c 100644 --- a/stan/math/prim/mat/fun/head.hpp +++ b/stan/math/prim/fun/head.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_HEAD_HPP -#define STAN_MATH_PRIM_MAT_FUN_HEAD_HPP +#ifndef STAN_MATH_PRIM_FUN_HEAD_HPP +#define STAN_MATH_PRIM_FUN_HEAD_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/hypot.hpp b/stan/math/prim/fun/hypot.hpp similarity index 89% rename from stan/math/prim/scal/fun/hypot.hpp rename to stan/math/prim/fun/hypot.hpp index 57c6cb7473f..dd8948c33ed 100644 --- a/stan/math/prim/scal/fun/hypot.hpp +++ b/stan/math/prim/fun/hypot.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_HYPOT_HPP -#define STAN_MATH_PRIM_SCAL_FUN_HYPOT_HPP +#ifndef STAN_MATH_PRIM_FUN_HYPOT_HPP +#define STAN_MATH_PRIM_FUN_HYPOT_HPP #include #include diff --git a/stan/math/prim/scal/fun/identity_constrain.hpp b/stan/math/prim/fun/identity_constrain.hpp similarity index 89% rename from stan/math/prim/scal/fun/identity_constrain.hpp rename to stan/math/prim/fun/identity_constrain.hpp index d4f6b643d31..51b96dc4a16 100644 --- a/stan/math/prim/scal/fun/identity_constrain.hpp +++ b/stan/math/prim/fun/identity_constrain.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_IDENTITY_CONSTRAIN_HPP -#define STAN_MATH_PRIM_SCAL_FUN_IDENTITY_CONSTRAIN_HPP +#ifndef STAN_MATH_PRIM_FUN_IDENTITY_CONSTRAIN_HPP +#define STAN_MATH_PRIM_FUN_IDENTITY_CONSTRAIN_HPP #include namespace stan { diff --git a/stan/math/prim/scal/fun/identity_free.hpp b/stan/math/prim/fun/identity_free.hpp similarity index 82% rename from stan/math/prim/scal/fun/identity_free.hpp rename to stan/math/prim/fun/identity_free.hpp index 1751ba0b667..e4dbc107082 100644 --- a/stan/math/prim/scal/fun/identity_free.hpp +++ b/stan/math/prim/fun/identity_free.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_IDENTITY_FREE_HPP -#define STAN_MATH_PRIM_SCAL_FUN_IDENTITY_FREE_HPP +#ifndef STAN_MATH_PRIM_FUN_IDENTITY_FREE_HPP +#define STAN_MATH_PRIM_FUN_IDENTITY_FREE_HPP #include namespace stan { diff --git a/stan/math/prim/scal/fun/if_else.hpp b/stan/math/prim/fun/if_else.hpp similarity index 90% rename from stan/math/prim/scal/fun/if_else.hpp rename to stan/math/prim/fun/if_else.hpp index f72e1917879..ae0ced362b0 100644 --- a/stan/math/prim/scal/fun/if_else.hpp +++ b/stan/math/prim/fun/if_else.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_IF_ELSE_HPP -#define STAN_MATH_PRIM_SCAL_FUN_IF_ELSE_HPP +#ifndef STAN_MATH_PRIM_FUN_IF_ELSE_HPP +#define STAN_MATH_PRIM_FUN_IF_ELSE_HPP #include diff --git a/stan/math/prim/scal/fun/inc_beta.hpp b/stan/math/prim/fun/inc_beta.hpp similarity index 85% rename from stan/math/prim/scal/fun/inc_beta.hpp rename to stan/math/prim/fun/inc_beta.hpp index d5444ccc576..7c63405c15a 100644 --- a/stan/math/prim/scal/fun/inc_beta.hpp +++ b/stan/math/prim/fun/inc_beta.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_INC_BETA_HPP -#define STAN_MATH_PRIM_SCAL_FUN_INC_BETA_HPP +#ifndef STAN_MATH_PRIM_FUN_INC_BETA_HPP +#define STAN_MATH_PRIM_FUN_INC_BETA_HPP #include #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/inc_beta_dda.hpp b/stan/math/prim/fun/inc_beta_dda.hpp similarity index 93% rename from stan/math/prim/scal/fun/inc_beta_dda.hpp rename to stan/math/prim/fun/inc_beta_dda.hpp index 8d2d01e5341..22ef24485af 100644 --- a/stan/math/prim/scal/fun/inc_beta_dda.hpp +++ b/stan/math/prim/fun/inc_beta_dda.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_INC_BETA_DDA_HPP -#define STAN_MATH_PRIM_SCAL_FUN_INC_BETA_DDA_HPP +#ifndef STAN_MATH_PRIM_FUN_INC_BETA_DDA_HPP +#define STAN_MATH_PRIM_FUN_INC_BETA_DDA_HPP #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/inc_beta_ddb.hpp b/stan/math/prim/fun/inc_beta_ddb.hpp similarity index 92% rename from stan/math/prim/scal/fun/inc_beta_ddb.hpp rename to stan/math/prim/fun/inc_beta_ddb.hpp index 833fe95ca54..2c60b540739 100644 --- a/stan/math/prim/scal/fun/inc_beta_ddb.hpp +++ b/stan/math/prim/fun/inc_beta_ddb.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_INC_BETA_DDB_HPP -#define STAN_MATH_PRIM_SCAL_FUN_INC_BETA_DDB_HPP +#ifndef STAN_MATH_PRIM_FUN_INC_BETA_DDB_HPP +#define STAN_MATH_PRIM_FUN_INC_BETA_DDB_HPP #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/inc_beta_ddz.hpp b/stan/math/prim/fun/inc_beta_ddz.hpp similarity index 86% rename from stan/math/prim/scal/fun/inc_beta_ddz.hpp rename to stan/math/prim/fun/inc_beta_ddz.hpp index 0328f2996f9..ec61c6e5fc3 100644 --- a/stan/math/prim/scal/fun/inc_beta_ddz.hpp +++ b/stan/math/prim/fun/inc_beta_ddz.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_INC_BETA_DDZ_HPP -#define STAN_MATH_PRIM_SCAL_FUN_INC_BETA_DDZ_HPP +#ifndef STAN_MATH_PRIM_FUN_INC_BETA_DDZ_HPP +#define STAN_MATH_PRIM_FUN_INC_BETA_DDZ_HPP #include -#include +#include #include #include diff --git a/stan/math/prim/mat/fun/initialize.hpp b/stan/math/prim/fun/initialize.hpp similarity index 85% rename from stan/math/prim/mat/fun/initialize.hpp rename to stan/math/prim/fun/initialize.hpp index 2680ef7a41a..a0cceefef12 100644 --- a/stan/math/prim/mat/fun/initialize.hpp +++ b/stan/math/prim/fun/initialize.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_INITIALIZE_HPP -#define STAN_MATH_PRIM_MAT_FUN_INITIALIZE_HPP +#ifndef STAN_MATH_PRIM_FUN_INITIALIZE_HPP +#define STAN_MATH_PRIM_FUN_INITIALIZE_HPP -#include +#include #include #include #include diff --git a/stan/math/prim/scal/fun/int_step.hpp b/stan/math/prim/fun/int_step.hpp similarity index 86% rename from stan/math/prim/scal/fun/int_step.hpp rename to stan/math/prim/fun/int_step.hpp index 3916bc4eec9..4f73927d2f5 100644 --- a/stan/math/prim/scal/fun/int_step.hpp +++ b/stan/math/prim/fun/int_step.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_INT_STEP_HPP -#define STAN_MATH_PRIM_SCAL_FUN_INT_STEP_HPP +#ifndef STAN_MATH_PRIM_FUN_INT_STEP_HPP +#define STAN_MATH_PRIM_FUN_INT_STEP_HPP #include namespace stan { diff --git a/stan/math/prim/mat/fun/inv.hpp b/stan/math/prim/fun/inv.hpp similarity index 90% rename from stan/math/prim/mat/fun/inv.hpp rename to stan/math/prim/fun/inv.hpp index e11fd0b3d1e..f50f17f784c 100644 --- a/stan/math/prim/mat/fun/inv.hpp +++ b/stan/math/prim/fun/inv.hpp @@ -1,14 +1,15 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_INV_HPP -#define STAN_MATH_PRIM_MAT_FUN_INV_HPP +#ifndef STAN_MATH_PRIM_FUN_INV_HPP +#define STAN_MATH_PRIM_FUN_INV_HPP -#include #include -#include +#include #include namespace stan { namespace math { +inline double inv(double x) { return 1.0 / x; } + /** * Structure to wrap inv() so that it can be vectorized. * diff --git a/stan/math/prim/scal/fun/inv_Phi.hpp b/stan/math/prim/fun/inv_Phi.hpp similarity index 71% rename from stan/math/prim/scal/fun/inv_Phi.hpp rename to stan/math/prim/fun/inv_Phi.hpp index 71b5b58bdef..0951a53d373 100644 --- a/stan/math/prim/scal/fun/inv_Phi.hpp +++ b/stan/math/prim/fun/inv_Phi.hpp @@ -1,12 +1,13 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_INV_PHI_HPP -#define STAN_MATH_PRIM_SCAL_FUN_INV_PHI_HPP +#ifndef STAN_MATH_PRIM_FUN_INV_PHI_HPP +#define STAN_MATH_PRIM_FUN_INV_PHI_HPP #include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include namespace stan { @@ -77,6 +78,35 @@ inline double inv_Phi(double p) { return x; } +/** + * Structure to wrap inv_Phi() so it can be vectorized. + * + * @tparam T type of variable + * @param x variable in range [0, 1] + * @return Inverse unit normal CDF of x. + * @throw std::domain_error if x is not between 0 and 1. + */ +struct inv_Phi_fun { + template + static inline T fun(const T& x) { + return inv_Phi(x); + } +}; + +/** + * Vectorized version of inv_Phi(). + * + * @tparam T type of container + * @param x variables in range [0, 1] + * @return Inverse unit normal CDF of each value in x. + * @throw std::domain_error if any value is not between 0 and 1. + */ +template +inline auto inv_Phi(const T& x) { + return apply_scalar_unary::apply(x); +} + } // namespace math } // namespace stan + #endif diff --git a/stan/math/prim/mat/fun/inv_cloglog.hpp b/stan/math/prim/fun/inv_cloglog.hpp similarity index 56% rename from stan/math/prim/mat/fun/inv_cloglog.hpp rename to stan/math/prim/fun/inv_cloglog.hpp index 8822b82a851..945417aa0f9 100644 --- a/stan/math/prim/mat/fun/inv_cloglog.hpp +++ b/stan/math/prim/fun/inv_cloglog.hpp @@ -1,13 +1,57 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_INV_CLOGLOG_HPP -#define STAN_MATH_PRIM_MAT_FUN_INV_CLOGLOG_HPP +#ifndef STAN_MATH_PRIM_FUN_INV_CLOGLOG_HPP +#define STAN_MATH_PRIM_FUN_INV_CLOGLOG_HPP -#include -#include +#include +#include #include +#include namespace stan { namespace math { +/** + * The inverse complementary log-log function. + * + * The function is defined by + * + * inv_cloglog(x) = 1 - exp(-exp(x)). + * + * This function can be used to implement the inverse link + * function for complementary-log-log regression. + * + * + \f[ + \mbox{inv\_cloglog}(y) = + \begin{cases} + \mbox{cloglog}^{-1}(y) & \mbox{if } -\infty\leq y \leq \infty \\[6pt] + \textrm{NaN} & \mbox{if } y = \textrm{NaN} + \end{cases} + \f] + + \f[ + \frac{\partial\, \mbox{inv\_cloglog}(y)}{\partial y} = + \begin{cases} + \frac{\partial\, \mbox{cloglog}^{-1}(y)}{\partial y} & \mbox{if } + -\infty\leq y\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } y = \textrm{NaN} + \end{cases} + \f] + + \f[ + \mbox{cloglog}^{-1}(y) = 1 - \exp \left( - \exp(y) \right) + \f] + + \f[ + \frac{\partial \, \mbox{cloglog}^{-1}(y)}{\partial y} = \exp(y-\exp(y)) + \f] + * + * @param x Argument. + * @return Inverse complementary log-log of the argument. + */ +inline double inv_cloglog(double x) { + using std::exp; + return 1 - exp(-exp(x)); +} + /** * Structure to wrap inv_cloglog() so that it can be vectorized. * diff --git a/stan/math/prim/scal/fun/inv_logit.hpp b/stan/math/prim/fun/inv_logit.hpp similarity index 60% rename from stan/math/prim/scal/fun/inv_logit.hpp rename to stan/math/prim/fun/inv_logit.hpp index 6e4589bfcf1..e4a4ea1fe37 100644 --- a/stan/math/prim/scal/fun/inv_logit.hpp +++ b/stan/math/prim/fun/inv_logit.hpp @@ -1,8 +1,9 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_INV_LOGIT_HPP -#define STAN_MATH_PRIM_SCAL_FUN_INV_LOGIT_HPP +#ifndef STAN_MATH_PRIM_FUN_INV_LOGIT_HPP +#define STAN_MATH_PRIM_FUN_INV_LOGIT_HPP #include -#include +#include +#include #include namespace stan { @@ -58,6 +59,36 @@ inline double inv_logit(double a) { return inv(1 + exp(-a)); } +/** + * Structure to wrap inv_logit() so that it can be vectorized. + * + * @tparam T type of variable + * @param x variable + * @return Inverse logit of x. + */ +struct inv_logit_fun { + template + static inline T fun(const T& x) { + return inv_logit(x); + } +}; + +/** + * Vectorized version of inv_logit(). + * + * @tparam T type of container + * @param x container + * @return Inverse logit applied to each value in x. + */ +template +inline auto inv_logit(const T& x) { + return apply_scalar_unary::apply(x); +} + +// TODO(Tadej): Eigen is introducing their implementation logistic() of this +// in 3.4. Use that once we switch to Eigen 3.4 + } // namespace math } // namespace stan + #endif diff --git a/stan/math/prim/mat/fun/inv_sqrt.hpp b/stan/math/prim/fun/inv_sqrt.hpp similarity index 86% rename from stan/math/prim/mat/fun/inv_sqrt.hpp rename to stan/math/prim/fun/inv_sqrt.hpp index 0b1ab19146d..aa6e0d7ffdf 100644 --- a/stan/math/prim/mat/fun/inv_sqrt.hpp +++ b/stan/math/prim/fun/inv_sqrt.hpp @@ -1,14 +1,20 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_INV_SQRT_HPP -#define STAN_MATH_PRIM_MAT_FUN_INV_SQRT_HPP +#ifndef STAN_MATH_PRIM_FUN_INV_SQRT_HPP +#define STAN_MATH_PRIM_FUN_INV_SQRT_HPP -#include #include +#include +#include #include -#include +#include namespace stan { namespace math { +inline double inv_sqrt(double x) { + using std::sqrt; + return inv(sqrt(x)); +} + /** * Structure to wrap inv_sqrt() so that it can be vectorized. * diff --git a/stan/math/prim/mat/fun/inv_square.hpp b/stan/math/prim/fun/inv_square.hpp similarity index 58% rename from stan/math/prim/mat/fun/inv_square.hpp rename to stan/math/prim/fun/inv_square.hpp index 6c930fd3b50..051c225349e 100644 --- a/stan/math/prim/mat/fun/inv_square.hpp +++ b/stan/math/prim/fun/inv_square.hpp @@ -1,14 +1,16 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_INV_SQUARE_HPP -#define STAN_MATH_PRIM_MAT_FUN_INV_SQUARE_HPP +#ifndef STAN_MATH_PRIM_FUN_INV_SQUARE_HPP +#define STAN_MATH_PRIM_FUN_INV_SQUARE_HPP -#include -#include -#include +#include +#include +#include #include namespace stan { namespace math { +inline double inv_square(double x) { return inv(square(x)); } + /** * Vectorized version of inv_square(). * diff --git a/stan/math/prim/mat/fun/inverse.hpp b/stan/math/prim/fun/inverse.hpp similarity index 82% rename from stan/math/prim/mat/fun/inverse.hpp rename to stan/math/prim/fun/inverse.hpp index bf61d6abbbd..be674ce94f4 100644 --- a/stan/math/prim/mat/fun/inverse.hpp +++ b/stan/math/prim/fun/inverse.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_INVERSE_HPP -#define STAN_MATH_PRIM_MAT_FUN_INVERSE_HPP +#ifndef STAN_MATH_PRIM_FUN_INVERSE_HPP +#define STAN_MATH_PRIM_FUN_INVERSE_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/arr/fun/inverse_softmax.hpp b/stan/math/prim/fun/inverse_softmax.hpp similarity index 100% rename from stan/math/prim/arr/fun/inverse_softmax.hpp rename to stan/math/prim/fun/inverse_softmax.hpp diff --git a/stan/math/prim/mat/fun/inverse_spd.hpp b/stan/math/prim/fun/inverse_spd.hpp similarity index 90% rename from stan/math/prim/mat/fun/inverse_spd.hpp rename to stan/math/prim/fun/inverse_spd.hpp index d9147e18ada..2d6df8e5c11 100644 --- a/stan/math/prim/mat/fun/inverse_spd.hpp +++ b/stan/math/prim/fun/inverse_spd.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_INVERSE_SPD_HPP -#define STAN_MATH_PRIM_MAT_FUN_INVERSE_SPD_HPP +#ifndef STAN_MATH_PRIM_FUN_INVERSE_SPD_HPP +#define STAN_MATH_PRIM_FUN_INVERSE_SPD_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/scal/fun/is_any_nan.hpp b/stan/math/prim/fun/is_any_nan.hpp similarity index 86% rename from stan/math/prim/scal/fun/is_any_nan.hpp rename to stan/math/prim/fun/is_any_nan.hpp index 1d9d56e2713..06c03ffc711 100644 --- a/stan/math/prim/scal/fun/is_any_nan.hpp +++ b/stan/math/prim/fun/is_any_nan.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_IS_ANY_NAN_HPP -#define STAN_MATH_PRIM_SCAL_FUN_IS_ANY_NAN_HPP +#ifndef STAN_MATH_PRIM_FUN_IS_ANY_NAN_HPP +#define STAN_MATH_PRIM_FUN_IS_ANY_NAN_HPP -#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/is_inf.hpp b/stan/math/prim/fun/is_inf.hpp similarity index 82% rename from stan/math/prim/scal/fun/is_inf.hpp rename to stan/math/prim/fun/is_inf.hpp index 583452ec313..28274a158c9 100644 --- a/stan/math/prim/scal/fun/is_inf.hpp +++ b/stan/math/prim/fun/is_inf.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_IS_INF_HPP -#define STAN_MATH_PRIM_SCAL_FUN_IS_INF_HPP +#ifndef STAN_MATH_PRIM_FUN_IS_INF_HPP +#define STAN_MATH_PRIM_FUN_IS_INF_HPP #include #include diff --git a/stan/math/prim/scal/fun/is_integer.hpp b/stan/math/prim/fun/is_integer.hpp similarity index 80% rename from stan/math/prim/scal/fun/is_integer.hpp rename to stan/math/prim/fun/is_integer.hpp index 9b563d78b5f..6371115d3ef 100644 --- a/stan/math/prim/scal/fun/is_integer.hpp +++ b/stan/math/prim/fun/is_integer.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_IS_INTEGER_HPP -#define STAN_MATH_PRIM_SCAL_FUN_IS_INTEGER_HPP +#ifndef STAN_MATH_PRIM_FUN_IS_INTEGER_HPP +#define STAN_MATH_PRIM_FUN_IS_INTEGER_HPP #include #include diff --git a/stan/math/prim/scal/fun/is_nan.hpp b/stan/math/prim/fun/is_nan.hpp similarity index 83% rename from stan/math/prim/scal/fun/is_nan.hpp rename to stan/math/prim/fun/is_nan.hpp index f8171b807ed..04b85fc28cd 100644 --- a/stan/math/prim/scal/fun/is_nan.hpp +++ b/stan/math/prim/fun/is_nan.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_IS_NAN_HPP -#define STAN_MATH_PRIM_SCAL_FUN_IS_NAN_HPP +#ifndef STAN_MATH_PRIM_FUN_IS_NAN_HPP +#define STAN_MATH_PRIM_FUN_IS_NAN_HPP #include #include diff --git a/stan/math/prim/scal/fun/is_nonpositive_integer.hpp b/stan/math/prim/fun/is_nonpositive_integer.hpp similarity index 77% rename from stan/math/prim/scal/fun/is_nonpositive_integer.hpp rename to stan/math/prim/fun/is_nonpositive_integer.hpp index 48f061a7cb3..6cdcaba9657 100644 --- a/stan/math/prim/scal/fun/is_nonpositive_integer.hpp +++ b/stan/math/prim/fun/is_nonpositive_integer.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_IS_NONPOSITIVE_INTEGER_HPP -#define STAN_MATH_PRIM_SCAL_FUN_IS_NONPOSITIVE_INTEGER_HPP +#ifndef STAN_MATH_PRIM_FUN_IS_NONPOSITIVE_INTEGER_HPP +#define STAN_MATH_PRIM_FUN_IS_NONPOSITIVE_INTEGER_HPP #include #include diff --git a/stan/math/prim/scal/fun/is_uninitialized.hpp b/stan/math/prim/fun/is_uninitialized.hpp similarity index 83% rename from stan/math/prim/scal/fun/is_uninitialized.hpp rename to stan/math/prim/fun/is_uninitialized.hpp index 51e12f39e01..712ea2ff4fb 100644 --- a/stan/math/prim/scal/fun/is_uninitialized.hpp +++ b/stan/math/prim/fun/is_uninitialized.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_IS_UNINITIALIZED_HPP -#define STAN_MATH_PRIM_SCAL_FUN_IS_UNINITIALIZED_HPP +#ifndef STAN_MATH_PRIM_FUN_IS_UNINITIALIZED_HPP +#define STAN_MATH_PRIM_FUN_IS_UNINITIALIZED_HPP #include namespace stan { diff --git a/stan/math/prim/scal/fun/lb_constrain.hpp b/stan/math/prim/fun/lb_constrain.hpp similarity index 89% rename from stan/math/prim/scal/fun/lb_constrain.hpp rename to stan/math/prim/fun/lb_constrain.hpp index 63a0b84b26e..1981f0518fe 100644 --- a/stan/math/prim/scal/fun/lb_constrain.hpp +++ b/stan/math/prim/fun/lb_constrain.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LB_CONSTRAIN_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LB_CONSTRAIN_HPP +#ifndef STAN_MATH_PRIM_FUN_LB_CONSTRAIN_HPP +#define STAN_MATH_PRIM_FUN_LB_CONSTRAIN_HPP #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/lb_free.hpp b/stan/math/prim/fun/lb_free.hpp similarity index 83% rename from stan/math/prim/scal/fun/lb_free.hpp rename to stan/math/prim/fun/lb_free.hpp index c5fd621a7b7..8696a9ecaa0 100644 --- a/stan/math/prim/scal/fun/lb_free.hpp +++ b/stan/math/prim/fun/lb_free.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LB_FREE_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LB_FREE_HPP +#ifndef STAN_MATH_PRIM_FUN_LB_FREE_HPP +#define STAN_MATH_PRIM_FUN_LB_FREE_HPP #include -#include -#include #include +#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/lbeta.hpp b/stan/math/prim/fun/lbeta.hpp similarity index 92% rename from stan/math/prim/scal/fun/lbeta.hpp rename to stan/math/prim/fun/lbeta.hpp index 8b5af38646e..23a9ba9e5fb 100644 --- a/stan/math/prim/scal/fun/lbeta.hpp +++ b/stan/math/prim/fun/lbeta.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LBETA_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LBETA_HPP +#ifndef STAN_MATH_PRIM_FUN_LBETA_HPP +#define STAN_MATH_PRIM_FUN_LBETA_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/scal/fun/ldexp.hpp b/stan/math/prim/fun/ldexp.hpp similarity index 86% rename from stan/math/prim/scal/fun/ldexp.hpp rename to stan/math/prim/fun/ldexp.hpp index 02d711ee6e7..fa67f1b7692 100644 --- a/stan/math/prim/scal/fun/ldexp.hpp +++ b/stan/math/prim/fun/ldexp.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LDEXP_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LDEXP_HPP +#ifndef STAN_MATH_PRIM_FUN_LDEXP_HPP +#define STAN_MATH_PRIM_FUN_LDEXP_HPP #include #include diff --git a/stan/math/prim/scal/fun/lgamma.hpp b/stan/math/prim/fun/lgamma.hpp similarity index 74% rename from stan/math/prim/scal/fun/lgamma.hpp rename to stan/math/prim/fun/lgamma.hpp index 43d74f1b684..e3cc98a10f6 100644 --- a/stan/math/prim/scal/fun/lgamma.hpp +++ b/stan/math/prim/fun/lgamma.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LGAMMA_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LGAMMA_HPP +#ifndef STAN_MATH_PRIM_FUN_LGAMMA_HPP +#define STAN_MATH_PRIM_FUN_LGAMMA_HPP /* * The lgamma implementation in stan-math is based on either the @@ -24,11 +24,12 @@ #else // MinGW compilers on Windows do not provide the reentrant lgamma_r // such that we fall back to boost whenever we are on MinGW. -#include -#include +#include #include #include #endif +#include +#include namespace stan { namespace math { @@ -89,6 +90,36 @@ inline double lgamma(int x) { #endif } +/** + * Structure to wrap lgamma() so that it can be vectorized. + * + * @tparam T type of variable + * @param x variable + * @return Natural log of the gamma function applied to x. + * @throw std::domain_error if x is a negative integer or 0. + */ +struct lgamma_fun { + template + static inline T fun(const T& x) { + return lgamma(x); + } +}; + +/** + * Vectorized version of lgamma(). + * + * @tparam T type of container + * @param x container + * @return Natural log of the gamma function + * applied to each value in x. + * @throw std::domain_error if any value is a negative integer or 0. + */ +template +inline auto lgamma(const T& x) { + return apply_scalar_unary::apply(x); +} + } // namespace math } // namespace stan + #endif diff --git a/stan/math/prim/scal/fun/lmgamma.hpp b/stan/math/prim/fun/lmgamma.hpp similarity index 90% rename from stan/math/prim/scal/fun/lmgamma.hpp rename to stan/math/prim/fun/lmgamma.hpp index 04b9bea4e1c..030d52d79e5 100644 --- a/stan/math/prim/scal/fun/lmgamma.hpp +++ b/stan/math/prim/fun/lmgamma.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LMGAMMA_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LMGAMMA_HPP +#ifndef STAN_MATH_PRIM_FUN_LMGAMMA_HPP +#define STAN_MATH_PRIM_FUN_LMGAMMA_HPP #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/log.hpp b/stan/math/prim/fun/log.hpp similarity index 78% rename from stan/math/prim/mat/fun/log.hpp rename to stan/math/prim/fun/log.hpp index 0b4da8465f7..2e32bc5aa4b 100644 --- a/stan/math/prim/mat/fun/log.hpp +++ b/stan/math/prim/fun/log.hpp @@ -1,15 +1,24 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_LOG_HPP -#define STAN_MATH_PRIM_MAT_FUN_LOG_HPP +#ifndef STAN_MATH_PRIM_FUN_LOG_HPP +#define STAN_MATH_PRIM_FUN_LOG_HPP -#include #include -#include +#include +#include #include #include namespace stan { namespace math { +/** + * Return the natural log of the specified argument. This version + * is required to disambiguate log(int). + * + * @param[in] x Argument. + * @return Natural log of argument. + */ +inline double log(int x) { return std::log(x); } + /** * Structure to wrap log() so that it can be vectorized. */ diff --git a/stan/math/prim/mat/fun/log10.hpp b/stan/math/prim/fun/log10.hpp similarity index 90% rename from stan/math/prim/mat/fun/log10.hpp rename to stan/math/prim/fun/log10.hpp index eaf79aeeebd..808bdb85bad 100644 --- a/stan/math/prim/mat/fun/log10.hpp +++ b/stan/math/prim/fun/log10.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_LOG10_HPP -#define STAN_MATH_PRIM_MAT_FUN_LOG10_HPP +#ifndef STAN_MATH_PRIM_FUN_LOG10_HPP +#define STAN_MATH_PRIM_FUN_LOG10_HPP -#include -#include #include +#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/log1m.hpp b/stan/math/prim/fun/log1m.hpp similarity index 61% rename from stan/math/prim/scal/fun/log1m.hpp rename to stan/math/prim/fun/log1m.hpp index aaab55a609b..8447bb49f31 100644 --- a/stan/math/prim/scal/fun/log1m.hpp +++ b/stan/math/prim/fun/log1m.hpp @@ -1,10 +1,11 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOG1M_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOG1M_HPP +#ifndef STAN_MATH_PRIM_FUN_LOG1M_HPP +#define STAN_MATH_PRIM_FUN_LOG1M_HPP #include -#include -#include #include +#include +#include +#include namespace stan { namespace math { @@ -46,6 +47,32 @@ inline double log1m(double x) { return stan::math::log1p(-x); } +/** + * Structure to wrap log1m() so it can be vectorized. + * + * @tparam T type of variable + * @param x variable + * @return Natural log of (1 - x). + */ +struct log1m_fun { + template + static inline T fun(const T& x) { + return log1m(x); + } +}; + +/** + * Vectorized version of log1m(). + * + * @tparam T type of container + * @param x container + * @return Natural log of 1 minus each value in x. + */ +template +inline auto log1m(const T& x) { + return apply_scalar_unary::apply(x); +} + } // namespace math } // namespace stan diff --git a/stan/math/prim/scal/fun/log1m_exp.hpp b/stan/math/prim/fun/log1m_exp.hpp similarity index 58% rename from stan/math/prim/scal/fun/log1m_exp.hpp rename to stan/math/prim/fun/log1m_exp.hpp index 84701cd0bfa..2cf1a32df1d 100644 --- a/stan/math/prim/scal/fun/log1m_exp.hpp +++ b/stan/math/prim/fun/log1m_exp.hpp @@ -1,10 +1,11 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOG1M_EXP_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOG1M_EXP_HPP +#ifndef STAN_MATH_PRIM_FUN_LOG1M_EXP_HPP +#define STAN_MATH_PRIM_FUN_LOG1M_EXP_HPP #include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { @@ -54,6 +55,32 @@ inline double log1m_exp(double a) { } } +/** + * Structure to wrap log1m_exp() so it can be vectorized. + * + * @tparam T type of variable + * @param x variable + * @return Natural log of (1 - exp(x)). + */ +struct log1m_exp_fun { + template + static inline T fun(const T& x) { + return log1m_exp(x); + } +}; + +/** + * Vectorized version of log1m_exp(). + * + * @tparam T type of container + * @param x container + * @return Natural log of (1 - exp()) applied to each value in x. + */ +template +inline auto log1m_exp(const T& x) { + return apply_scalar_unary::apply(x); +} + } // namespace math } // namespace stan diff --git a/stan/math/prim/scal/fun/log1m_inv_logit.hpp b/stan/math/prim/fun/log1m_inv_logit.hpp similarity index 50% rename from stan/math/prim/scal/fun/log1m_inv_logit.hpp rename to stan/math/prim/fun/log1m_inv_logit.hpp index 214080264e1..643018f957c 100644 --- a/stan/math/prim/scal/fun/log1m_inv_logit.hpp +++ b/stan/math/prim/fun/log1m_inv_logit.hpp @@ -1,8 +1,9 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOG1M_INV_LOGIT_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOG1M_INV_LOGIT_HPP +#ifndef STAN_MATH_PRIM_FUN_LOG1M_INV_LOGIT_HPP +#define STAN_MATH_PRIM_FUN_LOG1M_INV_LOGIT_HPP #include -#include +#include +#include #include namespace stan { @@ -51,6 +52,41 @@ inline double log1m_inv_logit(int u) { return log1m_inv_logit(static_cast(u)); } +/** + * Structure to wrap log1m_inv_logit() so it can be vectorized. + */ +struct log1m_inv_logit_fun { + /** + * Return the natural logarithm of one minus the inverse logit + * of the specified argument. + * + * @tparam T type of argument + * @param x argument + * @return natural log of one minus inverse logit of argument + */ + template + static inline T fun(const T& x) { + return log1m_inv_logit(x); + } +}; + +/** + * Return the elementwise application of + * log1m_inv_logit() to specified argument container. + * The return type promotes the underlying scalar argument type to + * double if it is an integer, and otherwise is the argument type. + * + * @tparam T type of container + * @param x container + * @return Elementwise log1m_inv_logit of members of container. + */ +template +inline typename apply_scalar_unary::return_t +log1m_inv_logit(const T& x) { + return apply_scalar_unary::apply(x); +} + } // namespace math } // namespace stan + #endif diff --git a/stan/math/prim/scal/fun/log1p.hpp b/stan/math/prim/fun/log1p.hpp similarity index 52% rename from stan/math/prim/scal/fun/log1p.hpp rename to stan/math/prim/fun/log1p.hpp index d49df91ebfe..cead9a9d7ba 100644 --- a/stan/math/prim/scal/fun/log1p.hpp +++ b/stan/math/prim/fun/log1p.hpp @@ -1,9 +1,12 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOG1P_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOG1P_HPP +#ifndef STAN_MATH_PRIM_FUN_LOG1P_HPP +#define STAN_MATH_PRIM_FUN_LOG1P_HPP #include #include -#include +#include +#include +#include +#include #include namespace stan { @@ -51,6 +54,39 @@ inline double log1p(int x) { } } +/** + * Structure to wrap log1p() so it can be vectorized. + */ +struct log1p_fun { + /** + * Return the natural logarithm of one plus the specified value. + * + * @tparam T type of argument + * @param x argument + * @return natural log of one plus the argument + */ + template + static inline T fun(const T& x) { + return log1p(x); + } +}; + +/** + * Return the elementwise application of log1p() to + * specified argument container. The return type promotes the + * underlying scalar argument type to double if it is an integer, + * and otherwise is the argument type. + * + * @tparam T type of container + * @param x container + * @return Elementwise log1p of members of container. + */ +template +inline auto log1p(const T& x) { + return apply_scalar_unary::apply(x); +} + } // namespace math } // namespace stan + #endif diff --git a/stan/math/prim/scal/fun/log1p_exp.hpp b/stan/math/prim/fun/log1p_exp.hpp similarity index 58% rename from stan/math/prim/scal/fun/log1p_exp.hpp rename to stan/math/prim/fun/log1p_exp.hpp index eff51abc5d2..6d7adf595e9 100644 --- a/stan/math/prim/scal/fun/log1p_exp.hpp +++ b/stan/math/prim/fun/log1p_exp.hpp @@ -1,8 +1,9 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOG1P_EXP_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOG1P_EXP_HPP +#ifndef STAN_MATH_PRIM_FUN_LOG1P_EXP_HPP +#define STAN_MATH_PRIM_FUN_LOG1P_EXP_HPP #include -#include +#include +#include #include namespace stan { @@ -49,6 +50,32 @@ inline double log1p_exp(double a) { return log1p(exp(a)); } +/** + * Structure to wrap log1m_exp() so that it can be vectorized. + * + * @tparam T type of variable + * @param x variable + * @return Natural log of (1 + exp(x)). + */ +struct log1p_exp_fun { + template + static inline T fun(const T& x) { + return log1p_exp(x); + } +}; + +/** + * Vectorized version of log1m_exp(). + * + * @tparam T type of container + * @param x container + * @return Natural log of (1 + exp()) applied to each value in x. + */ +template +inline auto log1p_exp(const T& x) { + return apply_scalar_unary::apply(x); +} + } // namespace math } // namespace stan diff --git a/stan/math/prim/mat/fun/log2.hpp b/stan/math/prim/fun/log2.hpp similarity index 62% rename from stan/math/prim/mat/fun/log2.hpp rename to stan/math/prim/fun/log2.hpp index ce62dfdd9fc..a864d483cef 100644 --- a/stan/math/prim/mat/fun/log2.hpp +++ b/stan/math/prim/fun/log2.hpp @@ -1,13 +1,37 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_LOG2_HPP -#define STAN_MATH_PRIM_MAT_FUN_LOG2_HPP +#ifndef STAN_MATH_PRIM_FUN_LOG2_HPP +#define STAN_MATH_PRIM_FUN_LOG2_HPP -#include -#include #include +#include +#include +#include namespace stan { namespace math { +/** + * Returns the base two logarithm of the argument (C99, C++11). + * + * The function is defined by: + * + * log2(a) = log(a) / std::log(2.0). + * + * @param[in] u argument + * @return base two logarithm of argument + */ +template > +inline double log2(T u) { + using std::log2; + return log2(u); +} + +/** + * Return natural logarithm of two. + * + * @return Natural logarithm of two. + */ +inline double log2() { return LOG_TWO; } + /** * Structure to wrap log2() so it can be vectorized. */ diff --git a/stan/math/prim/mat/fun/log_determinant.hpp b/stan/math/prim/fun/log_determinant.hpp similarity index 83% rename from stan/math/prim/mat/fun/log_determinant.hpp rename to stan/math/prim/fun/log_determinant.hpp index 076c39ae909..78a9819c29a 100644 --- a/stan/math/prim/mat/fun/log_determinant.hpp +++ b/stan/math/prim/fun/log_determinant.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_LOG_DETERMINANT_HPP -#define STAN_MATH_PRIM_MAT_FUN_LOG_DETERMINANT_HPP +#ifndef STAN_MATH_PRIM_FUN_LOG_DETERMINANT_HPP +#define STAN_MATH_PRIM_FUN_LOG_DETERMINANT_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/log_determinant_ldlt.hpp b/stan/math/prim/fun/log_determinant_ldlt.hpp similarity index 76% rename from stan/math/prim/mat/fun/log_determinant_ldlt.hpp rename to stan/math/prim/fun/log_determinant_ldlt.hpp index 8157cfb11c4..b61510a2260 100644 --- a/stan/math/prim/mat/fun/log_determinant_ldlt.hpp +++ b/stan/math/prim/fun/log_determinant_ldlt.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_LOG_DETERMINANT_LDLT_HPP -#define STAN_MATH_PRIM_MAT_FUN_LOG_DETERMINANT_LDLT_HPP +#ifndef STAN_MATH_PRIM_FUN_LOG_DETERMINANT_LDLT_HPP +#define STAN_MATH_PRIM_FUN_LOG_DETERMINANT_LDLT_HPP -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/log_determinant_spd.hpp b/stan/math/prim/fun/log_determinant_spd.hpp similarity index 76% rename from stan/math/prim/mat/fun/log_determinant_spd.hpp rename to stan/math/prim/fun/log_determinant_spd.hpp index fc355f5d6ae..acb6b3171d6 100644 --- a/stan/math/prim/mat/fun/log_determinant_spd.hpp +++ b/stan/math/prim/fun/log_determinant_spd.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_LOG_DETERMINANT_SPD_HPP -#define STAN_MATH_PRIM_MAT_FUN_LOG_DETERMINANT_SPD_HPP +#ifndef STAN_MATH_PRIM_FUN_LOG_DETERMINANT_SPD_HPP +#define STAN_MATH_PRIM_FUN_LOG_DETERMINANT_SPD_HPP #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/log_diff_exp.hpp b/stan/math/prim/fun/log_diff_exp.hpp similarity index 87% rename from stan/math/prim/scal/fun/log_diff_exp.hpp rename to stan/math/prim/fun/log_diff_exp.hpp index 5e656f1eaaa..ae36b5f482c 100644 --- a/stan/math/prim/scal/fun/log_diff_exp.hpp +++ b/stan/math/prim/fun/log_diff_exp.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOG_DIFF_EXP_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOG_DIFF_EXP_HPP +#ifndef STAN_MATH_PRIM_FUN_LOG_DIFF_EXP_HPP +#define STAN_MATH_PRIM_FUN_LOG_DIFF_EXP_HPP #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/scal/fun/log_falling_factorial.hpp b/stan/math/prim/fun/log_falling_factorial.hpp similarity index 86% rename from stan/math/prim/scal/fun/log_falling_factorial.hpp rename to stan/math/prim/fun/log_falling_factorial.hpp index 5773896b9c1..85a3c79b541 100644 --- a/stan/math/prim/scal/fun/log_falling_factorial.hpp +++ b/stan/math/prim/fun/log_falling_factorial.hpp @@ -1,11 +1,11 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOG_FALLING_FACTORIAL_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOG_FALLING_FACTORIAL_HPP +#ifndef STAN_MATH_PRIM_FUN_LOG_FALLING_FACTORIAL_HPP +#define STAN_MATH_PRIM_FUN_LOG_FALLING_FACTORIAL_HPP #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/scal/fun/log_inv_logit.hpp b/stan/math/prim/fun/log_inv_logit.hpp similarity index 51% rename from stan/math/prim/scal/fun/log_inv_logit.hpp rename to stan/math/prim/fun/log_inv_logit.hpp index 237a30f87d7..be7fe641504 100644 --- a/stan/math/prim/scal/fun/log_inv_logit.hpp +++ b/stan/math/prim/fun/log_inv_logit.hpp @@ -1,8 +1,9 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOG_INV_LOGIT_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOG_INV_LOGIT_HPP +#ifndef STAN_MATH_PRIM_FUN_LOG_INV_LOGIT_HPP +#define STAN_MATH_PRIM_FUN_LOG_INV_LOGIT_HPP #include -#include +#include +#include #include namespace stan { @@ -48,6 +49,39 @@ inline double log_inv_logit(int u) { return log_inv_logit(static_cast(u)); } +/** + * Structure to wrap log_inv_logit() so it can be vectorized. + */ +struct log_inv_logit_fun { + /** + * Return the natural logarithm of the inverse logit + * of the specified argument. + * + * @tparam T argument scalar type + * @param x argument + * @return natural log of inverse logit of argument + */ + template + static inline T fun(const T& x) { + return log_inv_logit(x); + } +}; + +/** + * Return the elementwise application of + * log_inv_logit() to specified argument container. + * The return type promotes the underlying scalar argument type to + * double if it is an integer, and otherwise is the argument type. + * + * @tparam T type of container + * @param x container + * @return elementwise log_inv_logit of members of container + */ +template +inline auto log_inv_logit(const T& x) { + return apply_scalar_unary::apply(x); +} + } // namespace math } // namespace stan diff --git a/stan/math/prim/scal/fun/log_inv_logit_diff.hpp b/stan/math/prim/fun/log_inv_logit_diff.hpp similarity index 81% rename from stan/math/prim/scal/fun/log_inv_logit_diff.hpp rename to stan/math/prim/fun/log_inv_logit_diff.hpp index d00912830d0..564abf6d83c 100644 --- a/stan/math/prim/scal/fun/log_inv_logit_diff.hpp +++ b/stan/math/prim/fun/log_inv_logit_diff.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOG_INV_LOGIT_DIFF_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOG_INV_LOGIT_DIFF_HPP +#ifndef STAN_MATH_PRIM_FUN_LOG_INV_LOGIT_DIFF_HPP +#define STAN_MATH_PRIM_FUN_LOG_INV_LOGIT_DIFF_HPP #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/log_mix.hpp b/stan/math/prim/fun/log_mix.hpp similarity index 70% rename from stan/math/prim/mat/fun/log_mix.hpp rename to stan/math/prim/fun/log_mix.hpp index e6f41b8ee0f..0cef983ff09 100644 --- a/stan/math/prim/mat/fun/log_mix.hpp +++ b/stan/math/prim/fun/log_mix.hpp @@ -1,17 +1,121 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_LOG_MIX_HPP -#define STAN_MATH_PRIM_MAT_FUN_LOG_MIX_HPP +#ifndef STAN_MATH_PRIM_FUN_LOG_MIX_HPP +#define STAN_MATH_PRIM_FUN_LOG_MIX_HPP #include -#include -#include -#include #include -#include +#include +#include +#include +#include #include +#include namespace stan { namespace math { +/** + * Return the log mixture density with specified mixing proportion + * and log densities. + * + * \f[ + * \mbox{log\_mix}(\theta, \lambda_1, \lambda_2) + * = \log \left( \theta \lambda_1 + (1 - \theta) \lambda_2 \right). + * \f] + * + * @param[in] theta mixing proportion in [0, 1]. + * @param[in] lambda1 first log density. + * @param[in] lambda2 second log density. + * @return log mixture of densities in specified proportion + */ +inline double log_mix(double theta, double lambda1, double lambda2) { + using std::log; + check_not_nan("log_mix", "lambda1", lambda1); + check_not_nan("log_mix", "lambda2", lambda2); + check_bounded("log_mix", "theta", theta, 0, 1); + return log_sum_exp(log(theta) + lambda1, log1m(theta) + lambda2); +} + +/** + * Return the log mixture density with specified mixing proportion + * and log densities. + * + * @param[in] theta mixing proportion in [0, 1]. + * @param[in] lambda1 first log density. + * @param[in] lambda2 second log density. + * @return log mixture of densities in specified proportion + */ +inline double log_mix(double theta, double lambda1, int lambda2) { + return log_mix(theta, lambda1, static_cast(lambda2)); +} + +/** + * Return the log mixture density with specified mixing proportion + * and log densities. + * + * @param[in] theta mixing proportion in [0, 1]. + * @param[in] lambda1 first log density. + * @param[in] lambda2 second log density. + * @return log mixture of densities in specified proportion + */ +inline double log_mix(double theta, int lambda1, double lambda2) { + return log_mix(theta, static_cast(lambda1), lambda2); +} + +/** + * Return the log mixture density with specified mixing proportion + * and log densities. + * + * @param[in] theta mixing proportion in [0, 1]. + * @param[in] lambda1 first log density. + * @param[in] lambda2 second log density. + * @return log mixture of densities in specified proportion + */ +inline double log_mix(int theta, double lambda1, double lambda2) { + return log_mix(static_cast(theta), lambda1, lambda2); +} + +/** + * Return the log mixture density with specified mixing proportion + * and log densities. + * + * @param[in] theta mixing proportion in [0, 1]. + * @param[in] lambda1 first log density. + * @param[in] lambda2 second log density. + * @return log mixture of densities in specified proportion + */ +inline double log_mix(double theta, int lambda1, int lambda2) { + return log_mix(theta, static_cast(lambda1), + static_cast(lambda2)); +} + +/** + * Return the log mixture density with specified mixing proportion + * and log densities. + * + * @param[in] theta mixing proportion in [0, 1]. + * @param[in] lambda1 first log density. + * @param[in] lambda2 second log density. + * @return log mixture of densities in specified proportion + */ +inline double log_mix(int theta, double lambda1, int lambda2) { + return log_mix(static_cast(theta), lambda1, + static_cast(lambda2)); +} + +/** + * Return the log mixture density with specified mixing proportion + * and log densities. + * + * @param[in] theta mixing proportion in [0, 1]. + * @param[in] lambda1 first log density. + * @param[in] lambda2 second log density. + * @return log mixture of densities in specified proportion + */ +inline double log_mix(int theta, int lambda1, int lambda2) { + return log_mix(static_cast(theta), static_cast(lambda1), + static_cast(lambda2)); +} + /** * Return the log mixture density with specified mixing proportions * and log densities. diff --git a/stan/math/prim/scal/fun/log_modified_bessel_first_kind.hpp b/stan/math/prim/fun/log_modified_bessel_first_kind.hpp similarity index 94% rename from stan/math/prim/scal/fun/log_modified_bessel_first_kind.hpp rename to stan/math/prim/fun/log_modified_bessel_first_kind.hpp index e82371cf35e..7c2ea6fc418 100644 --- a/stan/math/prim/scal/fun/log_modified_bessel_first_kind.hpp +++ b/stan/math/prim/fun/log_modified_bessel_first_kind.hpp @@ -1,19 +1,19 @@ // Copyright (c) 2006 Xiaogang Zhang // Copyright (c) 2007, 2017 John Maddock -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOG_MODIFIED_BESSEL_FIRST_KIND_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOG_MODIFIED_BESSEL_FIRST_KIND_HPP +#ifndef STAN_MATH_PRIM_FUN_LOG_MODIFIED_BESSEL_FIRST_KIND_HPP +#define STAN_MATH_PRIM_FUN_LOG_MODIFIED_BESSEL_FIRST_KIND_HPP #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/stan/math/prim/scal/fun/log_rising_factorial.hpp b/stan/math/prim/fun/log_rising_factorial.hpp similarity index 87% rename from stan/math/prim/scal/fun/log_rising_factorial.hpp rename to stan/math/prim/fun/log_rising_factorial.hpp index b30e11256dd..f8ed033ac52 100644 --- a/stan/math/prim/scal/fun/log_rising_factorial.hpp +++ b/stan/math/prim/fun/log_rising_factorial.hpp @@ -1,11 +1,11 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOG_RISING_FACTORIAL_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOG_RISING_FACTORIAL_HPP +#ifndef STAN_MATH_PRIM_FUN_LOG_RISING_FACTORIAL_HPP +#define STAN_MATH_PRIM_FUN_LOG_RISING_FACTORIAL_HPP #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/log_softmax.hpp b/stan/math/prim/fun/log_softmax.hpp similarity index 84% rename from stan/math/prim/mat/fun/log_softmax.hpp rename to stan/math/prim/fun/log_softmax.hpp index 139c04835c7..a51370d0b1a 100644 --- a/stan/math/prim/mat/fun/log_softmax.hpp +++ b/stan/math/prim/fun/log_softmax.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_LOG_SOFTMAX_HPP -#define STAN_MATH_PRIM_MAT_FUN_LOG_SOFTMAX_HPP +#ifndef STAN_MATH_PRIM_FUN_LOG_SOFTMAX_HPP +#define STAN_MATH_PRIM_FUN_LOG_SOFTMAX_HPP #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/fun/log_sum_exp.hpp b/stan/math/prim/fun/log_sum_exp.hpp new file mode 100644 index 00000000000..2193cb0de7e --- /dev/null +++ b/stan/math/prim/fun/log_sum_exp.hpp @@ -0,0 +1,129 @@ +#ifndef STAN_MATH_PRIM_FUN_LOG_SUM_EXP_HPP +#define STAN_MATH_PRIM_FUN_LOG_SUM_EXP_HPP + +#include +#include +#include +#include +#include +#include + +namespace stan { +namespace math { + +/** + * Calculates the log sum of exponetials without overflow. + * + * \f$\log (\exp(a) + \exp(b)) = m + \log(\exp(a-m) + \exp(b-m))\f$, + * + * where \f$m = max(a, b)\f$. + * + * + \f[ + \mbox{log\_sum\_exp}(x, y) = + \begin{cases} + \ln(\exp(x)+\exp(y)) & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] + \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} + \end{cases} + \f] + + \f[ + \frac{\partial\, \mbox{log\_sum\_exp}(x, y)}{\partial x} = + \begin{cases} + \frac{\exp(x)}{\exp(x)+\exp(y)} & \mbox{if } -\infty\leq x, y \leq \infty + \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} + \end{cases} + \f] + + \f[ + \frac{\partial\, \mbox{log\_sum\_exp}(x, y)}{\partial y} = + \begin{cases} + \frac{\exp(y)}{\exp(x)+\exp(y)} & \mbox{if } -\infty\leq x, y \leq \infty + \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} + \end{cases} + \f] + * + * @param a the first variable + * @param b the second variable + */ +template +inline return_type_t log_sum_exp(const T2& a, const T1& b) { + if (a == NEGATIVE_INFTY) { + return b; + } + if (a == INFTY && b == INFTY) { + return INFTY; + } + if (a > b) { + return a + log1p_exp(b - a); + } + return b + log1p_exp(a - b); +} + +/** + * Return the log of the sum of the exponentiated values of the specified + * sequence of values. + * + * The function is defined as follows to prevent overflow in exponential + * calculations. + * + * \f$\log \sum_{n=1}^N \exp(x_n) = \max(x) + \log \sum_{n=1}^N \exp(x_n - + * \max(x))\f$. + * + * @param[in] x array of specified values + * @return The log of the sum of the exponentiated vector values. + */ +inline double log_sum_exp(const std::vector& x) { + using std::exp; + using std::log; + double max = NEGATIVE_INFTY; + for (double xx : x) { + if (xx > max) { + max = xx; + } + } + + double sum = 0.0; + for (size_t ii = 0; ii < x.size(); ii++) { + if (x[ii] != NEGATIVE_INFTY) { + sum += exp(x[ii] - max); + } + } + + return max + log(sum); +} + +/** + * Return the log of the sum of the exponentiated values of the specified + * matrix of values. The matrix may be a full matrix, a vector, + * or a row vector. + * + * The function is defined as follows to prevent overflow in exponential + * calculations. + * + * \f$\log \sum_{n=1}^N \exp(x_n) = \max(x) + \log \sum_{n=1}^N \exp(x_n - + * \max(x))\f$. + * + * @tparam R number of rows, can be Eigen::Dynamic + * @tparam C number of columns, can be Eigen::Dynamic + * + * @param[in] x Matrix of specified values + * @return The log of the sum of the exponentiated vector values. + */ +template +double log_sum_exp(const Eigen::Matrix& x) { + if (x.size() == 0) { + return NEGATIVE_INFTY; + } + + const double max = x.maxCoeff(); + if (!std::isfinite(max)) { + return max; + } + return max + std::log((x.array() - max).exp().sum()); +} + +} // namespace math +} // namespace stan + +#endif diff --git a/stan/math/prim/scal/fun/logical_and.hpp b/stan/math/prim/fun/logical_and.hpp similarity index 89% rename from stan/math/prim/scal/fun/logical_and.hpp rename to stan/math/prim/fun/logical_and.hpp index f860b876eb8..4966be2ea79 100644 --- a/stan/math/prim/scal/fun/logical_and.hpp +++ b/stan/math/prim/fun/logical_and.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOGICAL_AND_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOGICAL_AND_HPP +#ifndef STAN_MATH_PRIM_FUN_LOGICAL_AND_HPP +#define STAN_MATH_PRIM_FUN_LOGICAL_AND_HPP #include namespace stan { diff --git a/stan/math/prim/scal/fun/logical_eq.hpp b/stan/math/prim/fun/logical_eq.hpp similarity index 84% rename from stan/math/prim/scal/fun/logical_eq.hpp rename to stan/math/prim/fun/logical_eq.hpp index eb994bae23b..26100ab4739 100644 --- a/stan/math/prim/scal/fun/logical_eq.hpp +++ b/stan/math/prim/fun/logical_eq.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOGICAL_EQ_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOGICAL_EQ_HPP +#ifndef STAN_MATH_PRIM_FUN_LOGICAL_EQ_HPP +#define STAN_MATH_PRIM_FUN_LOGICAL_EQ_HPP #include namespace stan { diff --git a/stan/math/prim/scal/fun/logical_gt.hpp b/stan/math/prim/fun/logical_gt.hpp similarity index 84% rename from stan/math/prim/scal/fun/logical_gt.hpp rename to stan/math/prim/fun/logical_gt.hpp index 33e91537a8c..b9f1164ef65 100644 --- a/stan/math/prim/scal/fun/logical_gt.hpp +++ b/stan/math/prim/fun/logical_gt.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOGICAL_GT_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOGICAL_GT_HPP +#ifndef STAN_MATH_PRIM_FUN_LOGICAL_GT_HPP +#define STAN_MATH_PRIM_FUN_LOGICAL_GT_HPP namespace stan { namespace math { diff --git a/stan/math/prim/scal/fun/logical_gte.hpp b/stan/math/prim/fun/logical_gte.hpp similarity index 84% rename from stan/math/prim/scal/fun/logical_gte.hpp rename to stan/math/prim/fun/logical_gte.hpp index fec522c9dff..a1241e6941a 100644 --- a/stan/math/prim/scal/fun/logical_gte.hpp +++ b/stan/math/prim/fun/logical_gte.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOGICAL_GTE_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOGICAL_GTE_HPP +#ifndef STAN_MATH_PRIM_FUN_LOGICAL_GTE_HPP +#define STAN_MATH_PRIM_FUN_LOGICAL_GTE_HPP namespace stan { namespace math { diff --git a/stan/math/prim/scal/fun/logical_lt.hpp b/stan/math/prim/fun/logical_lt.hpp similarity index 83% rename from stan/math/prim/scal/fun/logical_lt.hpp rename to stan/math/prim/fun/logical_lt.hpp index 891500b7f05..3abc8279453 100644 --- a/stan/math/prim/scal/fun/logical_lt.hpp +++ b/stan/math/prim/fun/logical_lt.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOGICAL_LT_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOGICAL_LT_HPP +#ifndef STAN_MATH_PRIM_FUN_LOGICAL_LT_HPP +#define STAN_MATH_PRIM_FUN_LOGICAL_LT_HPP namespace stan { namespace math { diff --git a/stan/math/prim/scal/fun/logical_lte.hpp b/stan/math/prim/fun/logical_lte.hpp similarity index 84% rename from stan/math/prim/scal/fun/logical_lte.hpp rename to stan/math/prim/fun/logical_lte.hpp index 0bd505ad93a..481384553cf 100644 --- a/stan/math/prim/scal/fun/logical_lte.hpp +++ b/stan/math/prim/fun/logical_lte.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOGICAL_LTE_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOGICAL_LTE_HPP +#ifndef STAN_MATH_PRIM_FUN_LOGICAL_LTE_HPP +#define STAN_MATH_PRIM_FUN_LOGICAL_LTE_HPP namespace stan { namespace math { diff --git a/stan/math/prim/scal/fun/logical_negation.hpp b/stan/math/prim/fun/logical_negation.hpp similarity index 79% rename from stan/math/prim/scal/fun/logical_negation.hpp rename to stan/math/prim/fun/logical_negation.hpp index 67ac2cac000..7cca1691767 100644 --- a/stan/math/prim/scal/fun/logical_negation.hpp +++ b/stan/math/prim/fun/logical_negation.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOGICAL_NEGATION_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOGICAL_NEGATION_HPP +#ifndef STAN_MATH_PRIM_FUN_LOGICAL_NEGATION_HPP +#define STAN_MATH_PRIM_FUN_LOGICAL_NEGATION_HPP #include namespace stan { diff --git a/stan/math/prim/scal/fun/logical_neq.hpp b/stan/math/prim/fun/logical_neq.hpp similarity index 84% rename from stan/math/prim/scal/fun/logical_neq.hpp rename to stan/math/prim/fun/logical_neq.hpp index 39e705f505c..cb5c9dc03ec 100644 --- a/stan/math/prim/scal/fun/logical_neq.hpp +++ b/stan/math/prim/fun/logical_neq.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOGICAL_NEQ_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOGICAL_NEQ_HPP +#ifndef STAN_MATH_PRIM_FUN_LOGICAL_NEQ_HPP +#define STAN_MATH_PRIM_FUN_LOGICAL_NEQ_HPP #include namespace stan { diff --git a/stan/math/prim/scal/fun/logical_or.hpp b/stan/math/prim/fun/logical_or.hpp similarity index 89% rename from stan/math/prim/scal/fun/logical_or.hpp rename to stan/math/prim/fun/logical_or.hpp index f549639198c..9f83f5a5e1f 100644 --- a/stan/math/prim/scal/fun/logical_or.hpp +++ b/stan/math/prim/fun/logical_or.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOGICAL_OR_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOGICAL_OR_HPP +#ifndef STAN_MATH_PRIM_FUN_LOGICAL_OR_HPP +#define STAN_MATH_PRIM_FUN_LOGICAL_OR_HPP #include namespace stan { diff --git a/stan/math/prim/scal/fun/logit.hpp b/stan/math/prim/fun/logit.hpp similarity index 56% rename from stan/math/prim/scal/fun/logit.hpp rename to stan/math/prim/fun/logit.hpp index 8c8b27dba27..463b17793d1 100644 --- a/stan/math/prim/scal/fun/logit.hpp +++ b/stan/math/prim/fun/logit.hpp @@ -1,7 +1,8 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOGIT_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOGIT_HPP +#ifndef STAN_MATH_PRIM_FUN_LOGIT_HPP +#define STAN_MATH_PRIM_FUN_LOGIT_HPP #include +#include #include namespace stan { @@ -52,6 +53,39 @@ inline double logit(double u) { */ inline double logit(int u) { return logit(static_cast(u)); } +/** + * Structure to wrap logit() so it can be vectorized. + */ +struct logit_fun { + /** + * Return the log odds of the specified argument. + * + * @tparam T type of argument + * @param x argument + * @return log odds of the argument + */ + template + static inline T fun(const T& x) { + return logit(x); + } +}; + +/** + * Return the elementwise application of logit() to + * specified argument container. The return type promotes the + * underlying scalar argument type to double if it is an integer, + * and otherwise is the argument type. + * + * @tparam T type of container + * @param x container + * @return elementwise logit of container elements + */ +template +inline auto logit(const T& x) { + return apply_scalar_unary::apply(x); +} + } // namespace math } // namespace stan + #endif diff --git a/stan/math/prim/scal/fun/lub_constrain.hpp b/stan/math/prim/fun/lub_constrain.hpp similarity index 93% rename from stan/math/prim/scal/fun/lub_constrain.hpp rename to stan/math/prim/fun/lub_constrain.hpp index 8cb79c02395..890fd511024 100644 --- a/stan/math/prim/scal/fun/lub_constrain.hpp +++ b/stan/math/prim/fun/lub_constrain.hpp @@ -1,13 +1,13 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LUB_CONSTRAIN_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LUB_CONSTRAIN_HPP +#ifndef STAN_MATH_PRIM_FUN_LUB_CONSTRAIN_HPP +#define STAN_MATH_PRIM_FUN_LUB_CONSTRAIN_HPP #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/lub_free.hpp b/stan/math/prim/fun/lub_free.hpp similarity index 88% rename from stan/math/prim/scal/fun/lub_free.hpp rename to stan/math/prim/fun/lub_free.hpp index 4bbfbdd70a7..3930a844d47 100644 --- a/stan/math/prim/scal/fun/lub_free.hpp +++ b/stan/math/prim/fun/lub_free.hpp @@ -1,11 +1,11 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LUB_FREE_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LUB_FREE_HPP +#ifndef STAN_MATH_PRIM_FUN_LUB_FREE_HPP +#define STAN_MATH_PRIM_FUN_LUB_FREE_HPP #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/make_nu.hpp b/stan/math/prim/fun/make_nu.hpp similarity index 89% rename from stan/math/prim/mat/fun/make_nu.hpp rename to stan/math/prim/fun/make_nu.hpp index d329a158e0b..6ce2074ccc5 100644 --- a/stan/math/prim/mat/fun/make_nu.hpp +++ b/stan/math/prim/fun/make_nu.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MAKE_NU_HPP -#define STAN_MATH_PRIM_MAT_FUN_MAKE_NU_HPP +#ifndef STAN_MATH_PRIM_FUN_MAKE_NU_HPP +#define STAN_MATH_PRIM_FUN_MAKE_NU_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/matrix_exp.hpp b/stan/math/prim/fun/matrix_exp.hpp similarity index 90% rename from stan/math/prim/mat/fun/matrix_exp.hpp rename to stan/math/prim/fun/matrix_exp.hpp index 97f60574a57..5b77eff42f9 100644 --- a/stan/math/prim/mat/fun/matrix_exp.hpp +++ b/stan/math/prim/fun/matrix_exp.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MATRIX_EXP_HPP -#define STAN_MATH_PRIM_MAT_FUN_MATRIX_EXP_HPP +#ifndef STAN_MATH_PRIM_FUN_MATRIX_EXP_HPP +#define STAN_MATH_PRIM_FUN_MATRIX_EXP_HPP -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/matrix_exp_2x2.hpp b/stan/math/prim/fun/matrix_exp_2x2.hpp similarity index 87% rename from stan/math/prim/mat/fun/matrix_exp_2x2.hpp rename to stan/math/prim/fun/matrix_exp_2x2.hpp index e648ef68c7f..ef86f029795 100644 --- a/stan/math/prim/mat/fun/matrix_exp_2x2.hpp +++ b/stan/math/prim/fun/matrix_exp_2x2.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MATRIX_EXP_2X2_HPP -#define STAN_MATH_PRIM_MAT_FUN_MATRIX_EXP_2X2_HPP +#ifndef STAN_MATH_PRIM_FUN_MATRIX_EXP_2X2_HPP +#define STAN_MATH_PRIM_FUN_MATRIX_EXP_2X2_HPP -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/matrix_exp_action_handler.hpp b/stan/math/prim/fun/matrix_exp_action_handler.hpp similarity index 95% rename from stan/math/prim/mat/fun/matrix_exp_action_handler.hpp rename to stan/math/prim/fun/matrix_exp_action_handler.hpp index e9afbd50508..6b03bea5c2a 100644 --- a/stan/math/prim/mat/fun/matrix_exp_action_handler.hpp +++ b/stan/math/prim/fun/matrix_exp_action_handler.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MATRIX_EXP_ACTION_HANDLER_HPP -#define STAN_MATH_PRIM_MAT_FUN_MATRIX_EXP_ACTION_HANDLER_HPP +#ifndef STAN_MATH_PRIM_FUN_MATRIX_EXP_ACTION_HANDLER_HPP +#define STAN_MATH_PRIM_FUN_MATRIX_EXP_ACTION_HANDLER_HPP -#include +#include #include #include diff --git a/stan/math/prim/mat/fun/matrix_exp_multiply.hpp b/stan/math/prim/fun/matrix_exp_multiply.hpp similarity index 79% rename from stan/math/prim/mat/fun/matrix_exp_multiply.hpp rename to stan/math/prim/fun/matrix_exp_multiply.hpp index 6a1848dbce3..7f80182c1b1 100644 --- a/stan/math/prim/mat/fun/matrix_exp_multiply.hpp +++ b/stan/math/prim/fun/matrix_exp_multiply.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MATRIX_EXP_MULTIPLY_HPP -#define STAN_MATH_PRIM_MAT_FUN_MATRIX_EXP_MULTIPLY_HPP +#ifndef STAN_MATH_PRIM_FUN_MATRIX_EXP_MULTIPLY_HPP +#define STAN_MATH_PRIM_FUN_MATRIX_EXP_MULTIPLY_HPP -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/matrix_exp_pade.hpp b/stan/math/prim/fun/matrix_exp_pade.hpp similarity index 86% rename from stan/math/prim/mat/fun/matrix_exp_pade.hpp rename to stan/math/prim/fun/matrix_exp_pade.hpp index 2397722ee3b..31c52880cd0 100644 --- a/stan/math/prim/mat/fun/matrix_exp_pade.hpp +++ b/stan/math/prim/fun/matrix_exp_pade.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MATRIX_EXP_PADE_HPP -#define STAN_MATH_PRIM_MAT_FUN_MATRIX_EXP_PADE_HPP +#ifndef STAN_MATH_PRIM_FUN_MATRIX_EXP_PADE_HPP +#define STAN_MATH_PRIM_FUN_MATRIX_EXP_PADE_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/matrix_power.hpp b/stan/math/prim/fun/matrix_power.hpp similarity index 91% rename from stan/math/prim/mat/fun/matrix_power.hpp rename to stan/math/prim/fun/matrix_power.hpp index 509393572ff..d7882ccccb5 100644 --- a/stan/math/prim/mat/fun/matrix_power.hpp +++ b/stan/math/prim/fun/matrix_power.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MATRIX_POWER_HPP -#define STAN_MATH_PRIM_MAT_FUN_MATRIX_POWER_HPP +#ifndef STAN_MATH_PRIM_FUN_MATRIX_POWER_HPP +#define STAN_MATH_PRIM_FUN_MATRIX_POWER_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/max.hpp b/stan/math/prim/fun/max.hpp similarity index 90% rename from stan/math/prim/mat/fun/max.hpp rename to stan/math/prim/fun/max.hpp index f0f3bca0bb7..0d508eabdf0 100644 --- a/stan/math/prim/mat/fun/max.hpp +++ b/stan/math/prim/fun/max.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MAX_HPP -#define STAN_MATH_PRIM_MAT_FUN_MAX_HPP +#ifndef STAN_MATH_PRIM_FUN_MAX_HPP +#define STAN_MATH_PRIM_FUN_MAX_HPP #include -#include -#include +#include +#include #include #include diff --git a/stan/math/prim/mat/fun/mdivide_left.hpp b/stan/math/prim/fun/mdivide_left.hpp similarity index 87% rename from stan/math/prim/mat/fun/mdivide_left.hpp rename to stan/math/prim/fun/mdivide_left.hpp index 59942f65afe..6009ff2e093 100644 --- a/stan/math/prim/mat/fun/mdivide_left.hpp +++ b/stan/math/prim/fun/mdivide_left.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MDIVIDE_LEFT_HPP -#define STAN_MATH_PRIM_MAT_FUN_MDIVIDE_LEFT_HPP +#ifndef STAN_MATH_PRIM_FUN_MDIVIDE_LEFT_HPP +#define STAN_MATH_PRIM_FUN_MDIVIDE_LEFT_HPP #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/mdivide_left_ldlt.hpp b/stan/math/prim/fun/mdivide_left_ldlt.hpp similarity index 84% rename from stan/math/prim/mat/fun/mdivide_left_ldlt.hpp rename to stan/math/prim/fun/mdivide_left_ldlt.hpp index 8a7240440c3..c2da7801ef0 100644 --- a/stan/math/prim/mat/fun/mdivide_left_ldlt.hpp +++ b/stan/math/prim/fun/mdivide_left_ldlt.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MDIVIDE_LEFT_LDLT_HPP -#define STAN_MATH_PRIM_MAT_FUN_MDIVIDE_LEFT_LDLT_HPP +#ifndef STAN_MATH_PRIM_FUN_MDIVIDE_LEFT_LDLT_HPP +#define STAN_MATH_PRIM_FUN_MDIVIDE_LEFT_LDLT_HPP #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/mdivide_left_spd.hpp b/stan/math/prim/fun/mdivide_left_spd.hpp similarity index 87% rename from stan/math/prim/mat/fun/mdivide_left_spd.hpp rename to stan/math/prim/fun/mdivide_left_spd.hpp index f07e2d746d8..b55c4dc161f 100644 --- a/stan/math/prim/mat/fun/mdivide_left_spd.hpp +++ b/stan/math/prim/fun/mdivide_left_spd.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MDIVIDE_LEFT_SPD_HPP -#define STAN_MATH_PRIM_MAT_FUN_MDIVIDE_LEFT_SPD_HPP +#ifndef STAN_MATH_PRIM_FUN_MDIVIDE_LEFT_SPD_HPP +#define STAN_MATH_PRIM_FUN_MDIVIDE_LEFT_SPD_HPP #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/mdivide_left_tri.hpp b/stan/math/prim/fun/mdivide_left_tri.hpp similarity index 96% rename from stan/math/prim/mat/fun/mdivide_left_tri.hpp rename to stan/math/prim/fun/mdivide_left_tri.hpp index afc52a17a89..9ca2d71121b 100644 --- a/stan/math/prim/mat/fun/mdivide_left_tri.hpp +++ b/stan/math/prim/fun/mdivide_left_tri.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MDIVIDE_LEFT_TRI_HPP -#define STAN_MATH_PRIM_MAT_FUN_MDIVIDE_LEFT_TRI_HPP +#ifndef STAN_MATH_PRIM_FUN_MDIVIDE_LEFT_TRI_HPP +#define STAN_MATH_PRIM_FUN_MDIVIDE_LEFT_TRI_HPP #include -#include -#include +#include +#include #ifdef STAN_OPENCL #include #endif diff --git a/stan/math/prim/mat/fun/mdivide_left_tri_low.hpp b/stan/math/prim/fun/mdivide_left_tri_low.hpp similarity index 89% rename from stan/math/prim/mat/fun/mdivide_left_tri_low.hpp rename to stan/math/prim/fun/mdivide_left_tri_low.hpp index 746d981f37c..8d38b5fe7ed 100644 --- a/stan/math/prim/mat/fun/mdivide_left_tri_low.hpp +++ b/stan/math/prim/fun/mdivide_left_tri_low.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MDIVIDE_LEFT_TRI_LOW_HPP -#define STAN_MATH_PRIM_MAT_FUN_MDIVIDE_LEFT_TRI_LOW_HPP +#ifndef STAN_MATH_PRIM_FUN_MDIVIDE_LEFT_TRI_LOW_HPP +#define STAN_MATH_PRIM_FUN_MDIVIDE_LEFT_TRI_LOW_HPP #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/mdivide_right.hpp b/stan/math/prim/fun/mdivide_right.hpp similarity index 88% rename from stan/math/prim/mat/fun/mdivide_right.hpp rename to stan/math/prim/fun/mdivide_right.hpp index cfe64e66013..c9fbae2c903 100644 --- a/stan/math/prim/mat/fun/mdivide_right.hpp +++ b/stan/math/prim/fun/mdivide_right.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MDIVIDE_RIGHT_HPP -#define STAN_MATH_PRIM_MAT_FUN_MDIVIDE_RIGHT_HPP +#ifndef STAN_MATH_PRIM_FUN_MDIVIDE_RIGHT_HPP +#define STAN_MATH_PRIM_FUN_MDIVIDE_RIGHT_HPP #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/mdivide_right_ldlt.hpp b/stan/math/prim/fun/mdivide_right_ldlt.hpp similarity index 84% rename from stan/math/prim/mat/fun/mdivide_right_ldlt.hpp rename to stan/math/prim/fun/mdivide_right_ldlt.hpp index 3b7dce37cd0..d7a5a1a2c11 100644 --- a/stan/math/prim/mat/fun/mdivide_right_ldlt.hpp +++ b/stan/math/prim/fun/mdivide_right_ldlt.hpp @@ -1,11 +1,11 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MDIVIDE_RIGHT_LDLT_HPP -#define STAN_MATH_PRIM_MAT_FUN_MDIVIDE_RIGHT_LDLT_HPP +#ifndef STAN_MATH_PRIM_FUN_MDIVIDE_RIGHT_LDLT_HPP +#define STAN_MATH_PRIM_FUN_MDIVIDE_RIGHT_LDLT_HPP -#include -#include -#include -#include #include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/mdivide_right_spd.hpp b/stan/math/prim/fun/mdivide_right_spd.hpp similarity index 84% rename from stan/math/prim/mat/fun/mdivide_right_spd.hpp rename to stan/math/prim/fun/mdivide_right_spd.hpp index 36135647d31..560a4d6a99a 100644 --- a/stan/math/prim/mat/fun/mdivide_right_spd.hpp +++ b/stan/math/prim/fun/mdivide_right_spd.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MDIVIDE_RIGHT_SPD_HPP -#define STAN_MATH_PRIM_MAT_FUN_MDIVIDE_RIGHT_SPD_HPP +#ifndef STAN_MATH_PRIM_FUN_MDIVIDE_RIGHT_SPD_HPP +#define STAN_MATH_PRIM_FUN_MDIVIDE_RIGHT_SPD_HPP -#include -#include -#include #include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/mdivide_right_tri.hpp b/stan/math/prim/fun/mdivide_right_tri.hpp similarity index 92% rename from stan/math/prim/mat/fun/mdivide_right_tri.hpp rename to stan/math/prim/fun/mdivide_right_tri.hpp index d82c9ef2857..488398c83d8 100644 --- a/stan/math/prim/mat/fun/mdivide_right_tri.hpp +++ b/stan/math/prim/fun/mdivide_right_tri.hpp @@ -1,11 +1,11 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MDIVIDE_RIGHT_TRI_HPP -#define STAN_MATH_PRIM_MAT_FUN_MDIVIDE_RIGHT_TRI_HPP +#ifndef STAN_MATH_PRIM_FUN_MDIVIDE_RIGHT_TRI_HPP +#define STAN_MATH_PRIM_FUN_MDIVIDE_RIGHT_TRI_HPP -#include -#include -#include -#include #include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/mdivide_right_tri_low.hpp b/stan/math/prim/fun/mdivide_right_tri_low.hpp similarity index 83% rename from stan/math/prim/mat/fun/mdivide_right_tri_low.hpp rename to stan/math/prim/fun/mdivide_right_tri_low.hpp index 84ec0103375..3ea1c6bb898 100644 --- a/stan/math/prim/mat/fun/mdivide_right_tri_low.hpp +++ b/stan/math/prim/fun/mdivide_right_tri_low.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MDIVIDE_RIGHT_TRI_LOW_HPP -#define STAN_MATH_PRIM_MAT_FUN_MDIVIDE_RIGHT_TRI_LOW_HPP +#ifndef STAN_MATH_PRIM_FUN_MDIVIDE_RIGHT_TRI_LOW_HPP +#define STAN_MATH_PRIM_FUN_MDIVIDE_RIGHT_TRI_LOW_HPP -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/mean.hpp b/stan/math/prim/fun/mean.hpp similarity index 90% rename from stan/math/prim/mat/fun/mean.hpp rename to stan/math/prim/fun/mean.hpp index fe2831962b8..4fd79b6f3f0 100644 --- a/stan/math/prim/mat/fun/mean.hpp +++ b/stan/math/prim/fun/mean.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MEAN_HPP -#define STAN_MATH_PRIM_MAT_FUN_MEAN_HPP +#ifndef STAN_MATH_PRIM_FUN_MEAN_HPP +#define STAN_MATH_PRIM_FUN_MEAN_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/min.hpp b/stan/math/prim/fun/min.hpp similarity index 90% rename from stan/math/prim/mat/fun/min.hpp rename to stan/math/prim/fun/min.hpp index e6f12c0a579..1b76e38b450 100644 --- a/stan/math/prim/mat/fun/min.hpp +++ b/stan/math/prim/fun/min.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MIN_HPP -#define STAN_MATH_PRIM_MAT_FUN_MIN_HPP +#ifndef STAN_MATH_PRIM_FUN_MIN_HPP +#define STAN_MATH_PRIM_FUN_MIN_HPP #include -#include -#include +#include +#include #include #include diff --git a/stan/math/prim/mat/fun/minus.hpp b/stan/math/prim/fun/minus.hpp similarity index 79% rename from stan/math/prim/mat/fun/minus.hpp rename to stan/math/prim/fun/minus.hpp index 22906305aaa..7f374462fc0 100644 --- a/stan/math/prim/mat/fun/minus.hpp +++ b/stan/math/prim/fun/minus.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MINUS_HPP -#define STAN_MATH_PRIM_MAT_FUN_MINUS_HPP +#ifndef STAN_MATH_PRIM_FUN_MINUS_HPP +#define STAN_MATH_PRIM_FUN_MINUS_HPP namespace stan { namespace math { diff --git a/stan/math/prim/scal/fun/modified_bessel_first_kind.hpp b/stan/math/prim/fun/modified_bessel_first_kind.hpp similarity index 89% rename from stan/math/prim/scal/fun/modified_bessel_first_kind.hpp rename to stan/math/prim/fun/modified_bessel_first_kind.hpp index f9be6438771..c8ed75bb766 100644 --- a/stan/math/prim/scal/fun/modified_bessel_first_kind.hpp +++ b/stan/math/prim/fun/modified_bessel_first_kind.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_MODIFIED_BESSEL_FIRST_KIND_HPP -#define STAN_MATH_PRIM_SCAL_FUN_MODIFIED_BESSEL_FIRST_KIND_HPP +#ifndef STAN_MATH_PRIM_FUN_MODIFIED_BESSEL_FIRST_KIND_HPP +#define STAN_MATH_PRIM_FUN_MODIFIED_BESSEL_FIRST_KIND_HPP #include #include diff --git a/stan/math/prim/scal/fun/modified_bessel_second_kind.hpp b/stan/math/prim/fun/modified_bessel_second_kind.hpp similarity index 88% rename from stan/math/prim/scal/fun/modified_bessel_second_kind.hpp rename to stan/math/prim/fun/modified_bessel_second_kind.hpp index 1fc5eb8fcb0..a6b7a3736fb 100644 --- a/stan/math/prim/scal/fun/modified_bessel_second_kind.hpp +++ b/stan/math/prim/fun/modified_bessel_second_kind.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_MODIFIED_BESSEL_SECOND_KIND_HPP -#define STAN_MATH_PRIM_SCAL_FUN_MODIFIED_BESSEL_SECOND_KIND_HPP +#ifndef STAN_MATH_PRIM_FUN_MODIFIED_BESSEL_SECOND_KIND_HPP +#define STAN_MATH_PRIM_FUN_MODIFIED_BESSEL_SECOND_KIND_HPP #include #include diff --git a/stan/math/prim/scal/fun/modulus.hpp b/stan/math/prim/fun/modulus.hpp similarity index 79% rename from stan/math/prim/scal/fun/modulus.hpp rename to stan/math/prim/fun/modulus.hpp index af9f60dd2a2..7adc2822557 100644 --- a/stan/math/prim/scal/fun/modulus.hpp +++ b/stan/math/prim/fun/modulus.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_MODULUS_HPP -#define STAN_MATH_PRIM_SCAL_FUN_MODULUS_HPP +#ifndef STAN_MATH_PRIM_FUN_MODULUS_HPP +#define STAN_MATH_PRIM_FUN_MODULUS_HPP #include #include diff --git a/stan/math/prim/mat/fun/multiply.hpp b/stan/math/prim/fun/multiply.hpp similarity index 96% rename from stan/math/prim/mat/fun/multiply.hpp rename to stan/math/prim/fun/multiply.hpp index ee75eb414c0..b37bb381e05 100644 --- a/stan/math/prim/mat/fun/multiply.hpp +++ b/stan/math/prim/fun/multiply.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MULTIPLY_HPP -#define STAN_MATH_PRIM_MAT_FUN_MULTIPLY_HPP +#ifndef STAN_MATH_PRIM_FUN_MULTIPLY_HPP +#define STAN_MATH_PRIM_FUN_MULTIPLY_HPP #include #include -#include +#include #ifdef STAN_OPENCL #include #endif diff --git a/stan/math/prim/scal/fun/multiply_log.hpp b/stan/math/prim/fun/multiply_log.hpp similarity index 93% rename from stan/math/prim/scal/fun/multiply_log.hpp rename to stan/math/prim/fun/multiply_log.hpp index 8c4c82dc2dd..c5b35dd7832 100644 --- a/stan/math/prim/scal/fun/multiply_log.hpp +++ b/stan/math/prim/fun/multiply_log.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_MULTIPLY_LOG_HPP -#define STAN_MATH_PRIM_SCAL_FUN_MULTIPLY_LOG_HPP +#ifndef STAN_MATH_PRIM_FUN_MULTIPLY_LOG_HPP +#define STAN_MATH_PRIM_FUN_MULTIPLY_LOG_HPP #include #include diff --git a/stan/math/prim/mat/fun/multiply_lower_tri_self_transpose.hpp b/stan/math/prim/fun/multiply_lower_tri_self_transpose.hpp similarity index 80% rename from stan/math/prim/mat/fun/multiply_lower_tri_self_transpose.hpp rename to stan/math/prim/fun/multiply_lower_tri_self_transpose.hpp index 4492a67cd80..fe2bd922b77 100644 --- a/stan/math/prim/mat/fun/multiply_lower_tri_self_transpose.hpp +++ b/stan/math/prim/fun/multiply_lower_tri_self_transpose.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_MULTIPLY_LOWER_TRI_SELF_TRANSPOSE_HPP -#define STAN_MATH_PRIM_MAT_FUN_MULTIPLY_LOWER_TRI_SELF_TRANSPOSE_HPP +#ifndef STAN_MATH_PRIM_FUN_MULTIPLY_LOWER_TRI_SELF_TRANSPOSE_HPP +#define STAN_MATH_PRIM_FUN_MULTIPLY_LOWER_TRI_SELF_TRANSPOSE_HPP -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/num_elements.hpp b/stan/math/prim/fun/num_elements.hpp similarity index 89% rename from stan/math/prim/mat/fun/num_elements.hpp rename to stan/math/prim/fun/num_elements.hpp index 86186454761..196adee4705 100644 --- a/stan/math/prim/mat/fun/num_elements.hpp +++ b/stan/math/prim/fun/num_elements.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_NUM_ELEMENTS_HPP -#define STAN_MATH_PRIM_MAT_FUN_NUM_ELEMENTS_HPP +#ifndef STAN_MATH_PRIM_FUN_NUM_ELEMENTS_HPP +#define STAN_MATH_PRIM_FUN_NUM_ELEMENTS_HPP -#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/offset_multiplier_constrain.hpp b/stan/math/prim/fun/offset_multiplier_constrain.hpp similarity index 91% rename from stan/math/prim/scal/fun/offset_multiplier_constrain.hpp rename to stan/math/prim/fun/offset_multiplier_constrain.hpp index 8b19dd2d551..df53655c28f 100644 --- a/stan/math/prim/scal/fun/offset_multiplier_constrain.hpp +++ b/stan/math/prim/fun/offset_multiplier_constrain.hpp @@ -1,11 +1,11 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_OFFSET_MULTIPLIER_CONSTRAIN_HPP -#define STAN_MATH_PRIM_SCAL_FUN_OFFSET_MULTIPLIER_CONSTRAIN_HPP +#ifndef STAN_MATH_PRIM_FUN_OFFSET_MULTIPLIER_CONSTRAIN_HPP +#define STAN_MATH_PRIM_FUN_OFFSET_MULTIPLIER_CONSTRAIN_HPP #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/offset_multiplier_free.hpp b/stan/math/prim/fun/offset_multiplier_free.hpp similarity index 90% rename from stan/math/prim/scal/fun/offset_multiplier_free.hpp rename to stan/math/prim/fun/offset_multiplier_free.hpp index d1a2c7f5a53..cb8b1dc226e 100644 --- a/stan/math/prim/scal/fun/offset_multiplier_free.hpp +++ b/stan/math/prim/fun/offset_multiplier_free.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_OFFSET_MULTIPLIER_FREE_HPP -#define STAN_MATH_PRIM_SCAL_FUN_OFFSET_MULTIPLIER_FREE_HPP +#ifndef STAN_MATH_PRIM_FUN_OFFSET_MULTIPLIER_FREE_HPP +#define STAN_MATH_PRIM_FUN_OFFSET_MULTIPLIER_FREE_HPP #include #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/ordered_constrain.hpp b/stan/math/prim/fun/ordered_constrain.hpp similarity index 92% rename from stan/math/prim/mat/fun/ordered_constrain.hpp rename to stan/math/prim/fun/ordered_constrain.hpp index c1dfc2ee572..5c158d0d37f 100644 --- a/stan/math/prim/mat/fun/ordered_constrain.hpp +++ b/stan/math/prim/fun/ordered_constrain.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ORDERED_CONSTRAIN_HPP -#define STAN_MATH_PRIM_MAT_FUN_ORDERED_CONSTRAIN_HPP +#ifndef STAN_MATH_PRIM_FUN_ORDERED_CONSTRAIN_HPP +#define STAN_MATH_PRIM_FUN_ORDERED_CONSTRAIN_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/ordered_free.hpp b/stan/math/prim/fun/ordered_free.hpp similarity index 89% rename from stan/math/prim/mat/fun/ordered_free.hpp rename to stan/math/prim/fun/ordered_free.hpp index 5ca82490039..e2d585863f4 100644 --- a/stan/math/prim/mat/fun/ordered_free.hpp +++ b/stan/math/prim/fun/ordered_free.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ORDERED_FREE_HPP -#define STAN_MATH_PRIM_MAT_FUN_ORDERED_FREE_HPP +#ifndef STAN_MATH_PRIM_FUN_ORDERED_FREE_HPP +#define STAN_MATH_PRIM_FUN_ORDERED_FREE_HPP #include #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/owens_t.hpp b/stan/math/prim/fun/owens_t.hpp similarity index 95% rename from stan/math/prim/scal/fun/owens_t.hpp rename to stan/math/prim/fun/owens_t.hpp index 646622169bf..f381abe5e40 100644 --- a/stan/math/prim/scal/fun/owens_t.hpp +++ b/stan/math/prim/fun/owens_t.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_OWENS_T_HPP -#define STAN_MATH_PRIM_SCAL_FUN_OWENS_T_HPP +#ifndef STAN_MATH_PRIM_FUN_OWENS_T_HPP +#define STAN_MATH_PRIM_FUN_OWENS_T_HPP #include #include diff --git a/stan/math/prim/scal/fun/positive_constrain.hpp b/stan/math/prim/fun/positive_constrain.hpp similarity index 91% rename from stan/math/prim/scal/fun/positive_constrain.hpp rename to stan/math/prim/fun/positive_constrain.hpp index 20422d5f20a..7fa278c5a2b 100644 --- a/stan/math/prim/scal/fun/positive_constrain.hpp +++ b/stan/math/prim/fun/positive_constrain.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_POSITIVE_CONSTRAIN_HPP -#define STAN_MATH_PRIM_SCAL_FUN_POSITIVE_CONSTRAIN_HPP +#ifndef STAN_MATH_PRIM_FUN_POSITIVE_CONSTRAIN_HPP +#define STAN_MATH_PRIM_FUN_POSITIVE_CONSTRAIN_HPP #include #include diff --git a/stan/math/prim/scal/fun/positive_free.hpp b/stan/math/prim/fun/positive_free.hpp similarity index 89% rename from stan/math/prim/scal/fun/positive_free.hpp rename to stan/math/prim/fun/positive_free.hpp index a47dbcd1c22..9a8ea92d379 100644 --- a/stan/math/prim/scal/fun/positive_free.hpp +++ b/stan/math/prim/fun/positive_free.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_POSITIVE_FREE_HPP -#define STAN_MATH_PRIM_SCAL_FUN_POSITIVE_FREE_HPP +#ifndef STAN_MATH_PRIM_FUN_POSITIVE_FREE_HPP +#define STAN_MATH_PRIM_FUN_POSITIVE_FREE_HPP #include #include diff --git a/stan/math/prim/mat/fun/positive_ordered_constrain.hpp b/stan/math/prim/fun/positive_ordered_constrain.hpp similarity index 91% rename from stan/math/prim/mat/fun/positive_ordered_constrain.hpp rename to stan/math/prim/fun/positive_ordered_constrain.hpp index d63e03d1594..564d52fc232 100644 --- a/stan/math/prim/mat/fun/positive_ordered_constrain.hpp +++ b/stan/math/prim/fun/positive_ordered_constrain.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_POSITIVE_ORDERED_CONSTRAIN_HPP -#define STAN_MATH_PRIM_MAT_FUN_POSITIVE_ORDERED_CONSTRAIN_HPP +#ifndef STAN_MATH_PRIM_FUN_POSITIVE_ORDERED_CONSTRAIN_HPP +#define STAN_MATH_PRIM_FUN_POSITIVE_ORDERED_CONSTRAIN_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/positive_ordered_free.hpp b/stan/math/prim/fun/positive_ordered_free.hpp similarity index 88% rename from stan/math/prim/mat/fun/positive_ordered_free.hpp rename to stan/math/prim/fun/positive_ordered_free.hpp index 4df0e24da21..212402357a2 100644 --- a/stan/math/prim/mat/fun/positive_ordered_free.hpp +++ b/stan/math/prim/fun/positive_ordered_free.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_POSITIVE_ORDERED_FREE_HPP -#define STAN_MATH_PRIM_MAT_FUN_POSITIVE_ORDERED_FREE_HPP +#ifndef STAN_MATH_PRIM_FUN_POSITIVE_ORDERED_FREE_HPP +#define STAN_MATH_PRIM_FUN_POSITIVE_ORDERED_FREE_HPP #include #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/primitive_value.hpp b/stan/math/prim/fun/primitive_value.hpp similarity index 88% rename from stan/math/prim/scal/fun/primitive_value.hpp rename to stan/math/prim/fun/primitive_value.hpp index ae747cb40a7..bfd9eee2013 100644 --- a/stan/math/prim/scal/fun/primitive_value.hpp +++ b/stan/math/prim/fun/primitive_value.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_PRIMITIVE_VALUE_HPP -#define STAN_MATH_PRIM_SCAL_FUN_PRIMITIVE_VALUE_HPP +#ifndef STAN_MATH_PRIM_FUN_PRIMITIVE_VALUE_HPP +#define STAN_MATH_PRIM_FUN_PRIMITIVE_VALUE_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/prob_constrain.hpp b/stan/math/prim/fun/prob_constrain.hpp similarity index 88% rename from stan/math/prim/scal/fun/prob_constrain.hpp rename to stan/math/prim/fun/prob_constrain.hpp index ebb99afac0c..37a346d16e6 100644 --- a/stan/math/prim/scal/fun/prob_constrain.hpp +++ b/stan/math/prim/fun/prob_constrain.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_PROB_CONSTRAIN_HPP -#define STAN_MATH_PRIM_SCAL_FUN_PROB_CONSTRAIN_HPP +#ifndef STAN_MATH_PRIM_FUN_PROB_CONSTRAIN_HPP +#define STAN_MATH_PRIM_FUN_PROB_CONSTRAIN_HPP #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/prob_free.hpp b/stan/math/prim/fun/prob_free.hpp similarity index 85% rename from stan/math/prim/scal/fun/prob_free.hpp rename to stan/math/prim/fun/prob_free.hpp index e91783d79e7..debefb5efb5 100644 --- a/stan/math/prim/scal/fun/prob_free.hpp +++ b/stan/math/prim/fun/prob_free.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_PROB_FREE_HPP -#define STAN_MATH_PRIM_SCAL_FUN_PROB_FREE_HPP +#ifndef STAN_MATH_PRIM_FUN_PROB_FREE_HPP +#define STAN_MATH_PRIM_FUN_PROB_FREE_HPP #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/prod.hpp b/stan/math/prim/fun/prod.hpp similarity index 87% rename from stan/math/prim/mat/fun/prod.hpp rename to stan/math/prim/fun/prod.hpp index 149e4b96af7..d0c5fa04d07 100644 --- a/stan/math/prim/mat/fun/prod.hpp +++ b/stan/math/prim/fun/prod.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_PROD_HPP -#define STAN_MATH_PRIM_MAT_FUN_PROD_HPP +#ifndef STAN_MATH_PRIM_FUN_PROD_HPP +#define STAN_MATH_PRIM_FUN_PROD_HPP -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/promote_common.hpp b/stan/math/prim/fun/promote_common.hpp similarity index 76% rename from stan/math/prim/mat/fun/promote_common.hpp rename to stan/math/prim/fun/promote_common.hpp index 0d6fffa378d..9c586366a05 100644 --- a/stan/math/prim/mat/fun/promote_common.hpp +++ b/stan/math/prim/fun/promote_common.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_PROMOTE_COMMON_HPP -#define STAN_MATH_PRIM_MAT_FUN_PROMOTE_COMMON_HPP +#ifndef STAN_MATH_PRIM_FUN_PROMOTE_COMMON_HPP +#define STAN_MATH_PRIM_FUN_PROMOTE_COMMON_HPP -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/fun/promote_elements.hpp b/stan/math/prim/fun/promote_elements.hpp new file mode 100644 index 00000000000..a40484487c4 --- /dev/null +++ b/stan/math/prim/fun/promote_elements.hpp @@ -0,0 +1,151 @@ +#ifndef STAN_MATH_PRIM_FUN_PROMOTE_ELEMENTS_HPP +#define STAN_MATH_PRIM_FUN_PROMOTE_ELEMENTS_HPP + +#include +#include +#include +#include + +namespace stan { +namespace math { + +/** + * Struct with static function for elementwise type promotion. + * + *

This base implementation promotes one scalar value to another. + * + * @tparam T type of promoted element + * @tparam S type of input element, must be assignable to T + */ +template +struct promote_elements { + /** + * Return input element. + * + * @param u input of type S, assignable to type T + * @returns input as type T + */ + inline static T promote(const S& u) { return u; } +}; + +/** + * Struct with static function for elementwise type promotion. + * + *

This specialization promotes scalar values of the same type. + * + * @tparam T type of elements + */ +template +struct promote_elements { + /** + * Return input element. + * + * @param u input of type T + * @returns input as type T + */ + inline static const T& promote(const T& u) { return u; } +}; + +/** + * Struct with static function for elementwise type promotion. + * + *

This specialization promotes vector elements of different types + * which must be compatible with promotion. + * + * @tparam T type of promoted elements + * @tparam S type of input elements, must be assignable to T + */ +template +struct promote_elements, std::vector > { + /** + * Return input vector of type S as vector of type T. + * + * @param u vector of type S, assignable to type T + * @returns vector of type T + */ + inline static std::vector promote(const std::vector& u) { + std::vector t; + t.reserve(u.size()); + for (size_t i = 0; i < u.size(); ++i) { + t.push_back(promote_elements::promote(u[i])); + } + return t; + } +}; + +/** + * Struct with static function for elementwise type promotion. + * + *

This specialization promotes vector elements of the same type. + * + * @tparam T type of elements + */ +template +struct promote_elements, std::vector > { + /** + * Return input vector. + * + * @param u vector of type T + * @returns vector of type T + */ + inline static const std::vector& promote(const std::vector& u) { + return u; + } +}; + +/** + * Struct with static function for elementwise type promotion. + * + *

This specialization promotes matrix elements of different types + * which must be compatible with promotion. + * + * @tparam T type of promoted elements + * @tparam S type of input elements, must be assignable to T + * @tparam R number of rows, can be Eigen::Dynamic + * @tparam C number of columns, can be Eigen::Dynamic + */ +template +struct promote_elements, Eigen::Matrix > { + /** + * Return input matrix of type S as matrix of type T. + * + * @param u matrix of type S, assignable to type T + * @returns matrix of type T + */ + inline static Eigen::Matrix promote( + const Eigen::Matrix& u) { + Eigen::Matrix t(u.rows(), u.cols()); + for (int i = 0; i < u.size(); ++i) { + t(i) = promote_elements::promote(u(i)); + } + return t; + } +}; + +/** + * Struct with static function for elementwise type promotion. + * + *

This specialization promotes matrix elements of the same type. + * + * @tparam T type of elements in the matrices + * @tparam R number of rows, can be Eigen::Dynamic + * @tparam C number of columns, can be Eigen::Dynamic + */ +template +struct promote_elements, Eigen::Matrix > { + /** + * Return input matrix. + * + * @param u matrix of type T + * @returns matrix of type T + */ + inline static const Eigen::Matrix& promote( + const Eigen::Matrix& u) { + return u; + } +}; + +} // namespace math +} // namespace stan + +#endif diff --git a/stan/math/prim/fun/promote_scalar.hpp b/stan/math/prim/fun/promote_scalar.hpp new file mode 100644 index 00000000000..fc8aa274339 --- /dev/null +++ b/stan/math/prim/fun/promote_scalar.hpp @@ -0,0 +1,122 @@ +#ifndef STAN_MATH_PRIM_FUN_PROMOTE_SCALAR_HPP +#define STAN_MATH_PRIM_FUN_PROMOTE_SCALAR_HPP + +#include +#include +#include + +namespace stan { +namespace math { + +/** + * General struct to hold static function for promoting underlying + * scalar types. + * + * @tparam T return type of nested static function. + * @tparam S input type for nested static function, whose underlying + * scalar type must be assignable to T. + */ +template +struct promote_scalar_struct { + /** + * Return the value of the input argument promoted to the type + * specified by the template parameter. + * + * This is the base case for mismatching template parameter + * types in which the underlying scalar type of template + * parameter S is assignable to type T. + * + * @param x input of type S. + * @return input promoted to have scalars of type T. + */ + static T apply(S x) { return T(x); } +}; + +/** + * Struct to hold static function for promoting underlying scalar + * types. This specialization is for equal input and output types + * of function types. + * + * @tparam T input and return type of nested static function. + */ +template +struct promote_scalar_struct { + /** + * Return the unmodified input. + * + * @param x input of type T. + * @return input unmodified. + */ + static T apply(const T& x) { return x; } +}; + +/** + * This is the top-level function to call to promote the scalar + * types of an input of type S to type T. + * + * @tparam T scalar type of output. + * @tparam S input type. + * @param x input vector. + * @return input vector with scalars promoted to type T. + */ +template +typename promote_scalar_type::type promote_scalar(const S& x) { + return promote_scalar_struct::apply(x); +} + +/** + * Struct to hold static function for promoting underlying scalar + * types. This specialization is for standard vector inputs. + * + * @tparam T return scalar type + * @tparam S input type for standard vector elements in static + * nested function, which must have an underlying scalar type + * assignable to T. + */ +template +struct promote_scalar_struct> { + /** + * Return the standard vector consisting of the recursive + * promotion of the elements of the input standard vector to the + * scalar type specified by the return template parameter. + * + * @param x input standard vector. + * @return standard vector with values promoted from input vector. + */ + static std::vector::type> apply( + const std::vector& x) { + using return_t = std::vector::type>; + using idx_t = typename index_type::type; + return_t y(x.size()); + for (idx_t i = 0; i < x.size(); ++i) { + y[i] = promote_scalar_struct::apply(x[i]); + } + return y; + } +}; + +/** + * Struct to hold static function for promoting underlying scalar + * types. This specialization is for Eigen inputs. + * + * @tparam T return scalar type + * @tparam S input matrix or vector or row vector type for static nested + * function, which must have a scalar type assignable to T + */ +template +struct promote_scalar_struct> { + /** + * Return the matrix consisting of the recursive promotion of + * the elements of the input matrix to the scalar type specified + * by the return template parameter. + * + * @param x input matrix. + * @return matrix with values promoted from input vector. + */ + static auto apply(const S& x) { return x.template cast(); } +}; + +} // namespace math +} // namespace stan + +#endif diff --git a/stan/math/prim/mat/fun/qr_Q.hpp b/stan/math/prim/fun/qr_Q.hpp similarity index 87% rename from stan/math/prim/mat/fun/qr_Q.hpp rename to stan/math/prim/fun/qr_Q.hpp index 888e72293df..3a96e1c6250 100644 --- a/stan/math/prim/mat/fun/qr_Q.hpp +++ b/stan/math/prim/fun/qr_Q.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_QR_Q_HPP -#define STAN_MATH_PRIM_MAT_FUN_QR_Q_HPP +#ifndef STAN_MATH_PRIM_FUN_QR_Q_HPP +#define STAN_MATH_PRIM_FUN_QR_Q_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/qr_R.hpp b/stan/math/prim/fun/qr_R.hpp similarity index 89% rename from stan/math/prim/mat/fun/qr_R.hpp rename to stan/math/prim/fun/qr_R.hpp index eb1529fe391..4b98fc28176 100644 --- a/stan/math/prim/mat/fun/qr_R.hpp +++ b/stan/math/prim/fun/qr_R.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_QR_R_HPP -#define STAN_MATH_PRIM_MAT_FUN_QR_R_HPP +#ifndef STAN_MATH_PRIM_FUN_QR_R_HPP +#define STAN_MATH_PRIM_FUN_QR_R_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/qr_thin_Q.hpp b/stan/math/prim/fun/qr_thin_Q.hpp similarity index 87% rename from stan/math/prim/mat/fun/qr_thin_Q.hpp rename to stan/math/prim/fun/qr_thin_Q.hpp index 7aea312da4f..8999c50f3aa 100644 --- a/stan/math/prim/mat/fun/qr_thin_Q.hpp +++ b/stan/math/prim/fun/qr_thin_Q.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_QR_THIN_Q_HPP -#define STAN_MATH_PRIM_MAT_FUN_QR_THIN_Q_HPP +#ifndef STAN_MATH_PRIM_FUN_QR_THIN_Q_HPP +#define STAN_MATH_PRIM_FUN_QR_THIN_Q_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/qr_thin_R.hpp b/stan/math/prim/fun/qr_thin_R.hpp similarity index 87% rename from stan/math/prim/mat/fun/qr_thin_R.hpp rename to stan/math/prim/fun/qr_thin_R.hpp index 987dc3c5a40..73a7b99f318 100644 --- a/stan/math/prim/mat/fun/qr_thin_R.hpp +++ b/stan/math/prim/fun/qr_thin_R.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_QR_THIN_R_HPP -#define STAN_MATH_PRIM_MAT_FUN_QR_THIN_R_HPP +#ifndef STAN_MATH_PRIM_FUN_QR_THIN_R_HPP +#define STAN_MATH_PRIM_FUN_QR_THIN_R_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/quad_form.hpp b/stan/math/prim/fun/quad_form.hpp similarity index 84% rename from stan/math/prim/mat/fun/quad_form.hpp rename to stan/math/prim/fun/quad_form.hpp index 4c3f57e020b..861aed0534b 100644 --- a/stan/math/prim/mat/fun/quad_form.hpp +++ b/stan/math/prim/fun/quad_form.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_QUAD_FORM_HPP -#define STAN_MATH_PRIM_MAT_FUN_QUAD_FORM_HPP +#ifndef STAN_MATH_PRIM_FUN_QUAD_FORM_HPP +#define STAN_MATH_PRIM_FUN_QUAD_FORM_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/quad_form_diag.hpp b/stan/math/prim/fun/quad_form_diag.hpp similarity index 81% rename from stan/math/prim/mat/fun/quad_form_diag.hpp rename to stan/math/prim/fun/quad_form_diag.hpp index 4c061cafa56..1fe0503f213 100644 --- a/stan/math/prim/mat/fun/quad_form_diag.hpp +++ b/stan/math/prim/fun/quad_form_diag.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_QUAD_FORM_DIAG_HPP -#define STAN_MATH_PRIM_MAT_FUN_QUAD_FORM_DIAG_HPP +#ifndef STAN_MATH_PRIM_FUN_QUAD_FORM_DIAG_HPP +#define STAN_MATH_PRIM_FUN_QUAD_FORM_DIAG_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/quad_form_sym.hpp b/stan/math/prim/fun/quad_form_sym.hpp similarity index 84% rename from stan/math/prim/mat/fun/quad_form_sym.hpp rename to stan/math/prim/fun/quad_form_sym.hpp index 9213d83cadd..391ebe3ef4c 100644 --- a/stan/math/prim/mat/fun/quad_form_sym.hpp +++ b/stan/math/prim/fun/quad_form_sym.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_QUAD_FORM_SYM_HPP -#define STAN_MATH_PRIM_MAT_FUN_QUAD_FORM_SYM_HPP +#ifndef STAN_MATH_PRIM_FUN_QUAD_FORM_SYM_HPP +#define STAN_MATH_PRIM_FUN_QUAD_FORM_SYM_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/rank.hpp b/stan/math/prim/fun/rank.hpp similarity index 89% rename from stan/math/prim/mat/fun/rank.hpp rename to stan/math/prim/fun/rank.hpp index 4201fd79455..1bf59dc71de 100644 --- a/stan/math/prim/mat/fun/rank.hpp +++ b/stan/math/prim/fun/rank.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_RANK_HPP -#define STAN_MATH_PRIM_MAT_FUN_RANK_HPP +#ifndef STAN_MATH_PRIM_FUN_RANK_HPP +#define STAN_MATH_PRIM_FUN_RANK_HPP #include #include diff --git a/stan/math/prim/mat/fun/read_corr_L.hpp b/stan/math/prim/fun/read_corr_L.hpp similarity index 91% rename from stan/math/prim/mat/fun/read_corr_L.hpp rename to stan/math/prim/fun/read_corr_L.hpp index 09f1fa10928..2481acdd883 100644 --- a/stan/math/prim/mat/fun/read_corr_L.hpp +++ b/stan/math/prim/fun/read_corr_L.hpp @@ -1,11 +1,11 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_READ_CORR_L_HPP -#define STAN_MATH_PRIM_MAT_FUN_READ_CORR_L_HPP +#ifndef STAN_MATH_PRIM_FUN_READ_CORR_L_HPP +#define STAN_MATH_PRIM_FUN_READ_CORR_L_HPP -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include diff --git a/stan/math/prim/mat/fun/read_corr_matrix.hpp b/stan/math/prim/fun/read_corr_matrix.hpp similarity index 88% rename from stan/math/prim/mat/fun/read_corr_matrix.hpp rename to stan/math/prim/fun/read_corr_matrix.hpp index 222ce9c14bc..55d50cd7735 100644 --- a/stan/math/prim/mat/fun/read_corr_matrix.hpp +++ b/stan/math/prim/fun/read_corr_matrix.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_READ_CORR_MATRIX_HPP -#define STAN_MATH_PRIM_MAT_FUN_READ_CORR_MATRIX_HPP +#ifndef STAN_MATH_PRIM_FUN_READ_CORR_MATRIX_HPP +#define STAN_MATH_PRIM_FUN_READ_CORR_MATRIX_HPP -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/read_cov_L.hpp b/stan/math/prim/fun/read_cov_L.hpp similarity index 76% rename from stan/math/prim/mat/fun/read_cov_L.hpp rename to stan/math/prim/fun/read_cov_L.hpp index 98c48483398..ff768305577 100644 --- a/stan/math/prim/mat/fun/read_cov_L.hpp +++ b/stan/math/prim/fun/read_cov_L.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_READ_COV_L_HPP -#define STAN_MATH_PRIM_MAT_FUN_READ_COV_L_HPP +#ifndef STAN_MATH_PRIM_FUN_READ_COV_L_HPP +#define STAN_MATH_PRIM_FUN_READ_COV_L_HPP -#include -#include -#include -#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/read_cov_matrix.hpp b/stan/math/prim/fun/read_cov_matrix.hpp similarity index 83% rename from stan/math/prim/mat/fun/read_cov_matrix.hpp rename to stan/math/prim/fun/read_cov_matrix.hpp index f3a8d03a48d..eddf91a858d 100644 --- a/stan/math/prim/mat/fun/read_cov_matrix.hpp +++ b/stan/math/prim/fun/read_cov_matrix.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_READ_COV_MATRIX_HPP -#define STAN_MATH_PRIM_MAT_FUN_READ_COV_MATRIX_HPP +#ifndef STAN_MATH_PRIM_FUN_READ_COV_MATRIX_HPP +#define STAN_MATH_PRIM_FUN_READ_COV_MATRIX_HPP -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/arr/fun/rep_array.hpp b/stan/math/prim/fun/rep_array.hpp similarity index 91% rename from stan/math/prim/arr/fun/rep_array.hpp rename to stan/math/prim/fun/rep_array.hpp index 26caa05204d..6970e38db37 100644 --- a/stan/math/prim/arr/fun/rep_array.hpp +++ b/stan/math/prim/fun/rep_array.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_ARR_FUN_REP_ARRAY_HPP -#define STAN_MATH_PRIM_ARR_FUN_REP_ARRAY_HPP +#ifndef STAN_MATH_PRIM_FUN_REP_ARRAY_HPP +#define STAN_MATH_PRIM_FUN_REP_ARRAY_HPP #include #include diff --git a/stan/math/prim/mat/fun/rep_matrix.hpp b/stan/math/prim/fun/rep_matrix.hpp similarity index 88% rename from stan/math/prim/mat/fun/rep_matrix.hpp rename to stan/math/prim/fun/rep_matrix.hpp index 6bcf97cb062..d81114f9887 100644 --- a/stan/math/prim/mat/fun/rep_matrix.hpp +++ b/stan/math/prim/fun/rep_matrix.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_REP_MATRIX_HPP -#define STAN_MATH_PRIM_MAT_FUN_REP_MATRIX_HPP +#ifndef STAN_MATH_PRIM_FUN_REP_MATRIX_HPP +#define STAN_MATH_PRIM_FUN_REP_MATRIX_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/rep_row_vector.hpp b/stan/math/prim/fun/rep_row_vector.hpp similarity index 71% rename from stan/math/prim/mat/fun/rep_row_vector.hpp rename to stan/math/prim/fun/rep_row_vector.hpp index 14f044f32ce..6b4a95887d1 100644 --- a/stan/math/prim/mat/fun/rep_row_vector.hpp +++ b/stan/math/prim/fun/rep_row_vector.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_REP_ROW_VECTOR_HPP -#define STAN_MATH_PRIM_MAT_FUN_REP_ROW_VECTOR_HPP +#ifndef STAN_MATH_PRIM_FUN_REP_ROW_VECTOR_HPP +#define STAN_MATH_PRIM_FUN_REP_ROW_VECTOR_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/rep_vector.hpp b/stan/math/prim/fun/rep_vector.hpp similarity index 75% rename from stan/math/prim/mat/fun/rep_vector.hpp rename to stan/math/prim/fun/rep_vector.hpp index 733e75a4929..9668228a808 100644 --- a/stan/math/prim/mat/fun/rep_vector.hpp +++ b/stan/math/prim/fun/rep_vector.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_REP_VECTOR_HPP -#define STAN_MATH_PRIM_MAT_FUN_REP_VECTOR_HPP +#ifndef STAN_MATH_PRIM_FUN_REP_VECTOR_HPP +#define STAN_MATH_PRIM_FUN_REP_VECTOR_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/resize.hpp b/stan/math/prim/fun/resize.hpp similarity index 89% rename from stan/math/prim/mat/fun/resize.hpp rename to stan/math/prim/fun/resize.hpp index 94df57c9c34..ccd9214a3ec 100644 --- a/stan/math/prim/mat/fun/resize.hpp +++ b/stan/math/prim/fun/resize.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_RESIZE_HPP -#define STAN_MATH_PRIM_MAT_FUN_RESIZE_HPP +#ifndef STAN_MATH_PRIM_FUN_RESIZE_HPP +#define STAN_MATH_PRIM_FUN_RESIZE_HPP -#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/rising_factorial.hpp b/stan/math/prim/fun/rising_factorial.hpp similarity index 92% rename from stan/math/prim/scal/fun/rising_factorial.hpp rename to stan/math/prim/fun/rising_factorial.hpp index f1749fffc2f..abb323a6665 100644 --- a/stan/math/prim/scal/fun/rising_factorial.hpp +++ b/stan/math/prim/fun/rising_factorial.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_RISING_FACTORIAL_HPP -#define STAN_MATH_PRIM_SCAL_FUN_RISING_FACTORIAL_HPP +#ifndef STAN_MATH_PRIM_FUN_RISING_FACTORIAL_HPP +#define STAN_MATH_PRIM_FUN_RISING_FACTORIAL_HPP #include #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/round.hpp b/stan/math/prim/fun/round.hpp similarity index 65% rename from stan/math/prim/mat/fun/round.hpp rename to stan/math/prim/fun/round.hpp index eaf87766118..66b2d6a428c 100644 --- a/stan/math/prim/mat/fun/round.hpp +++ b/stan/math/prim/fun/round.hpp @@ -1,14 +1,32 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ROUND_HPP -#define STAN_MATH_PRIM_MAT_FUN_ROUND_HPP +#ifndef STAN_MATH_PRIM_FUN_ROUND_HPP +#define STAN_MATH_PRIM_FUN_ROUND_HPP -#include #include -#include +#include #include +#include namespace stan { namespace math { +/** + * Return the closest integer to the specified argument, with + * halfway cases rounded away from zero. + * + * @param x Argument. + * @return The rounded value of the argument. + */ +inline double round(double x) { return std::round(x); } + +/** + * Return the closest integer to the specified argument, with + * halfway cases rounded away from zero. + * + * @param x Argument. + * @return The rounded value of the argument. + */ +inline double round(int x) { return std::round(x); } + /** * Structure to wrap round() so it can be vectorized. * diff --git a/stan/math/prim/mat/fun/row.hpp b/stan/math/prim/fun/row.hpp similarity index 85% rename from stan/math/prim/mat/fun/row.hpp rename to stan/math/prim/fun/row.hpp index fbd954cd7ff..2540456e976 100644 --- a/stan/math/prim/mat/fun/row.hpp +++ b/stan/math/prim/fun/row.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ROW_HPP -#define STAN_MATH_PRIM_MAT_FUN_ROW_HPP +#ifndef STAN_MATH_PRIM_FUN_ROW_HPP +#define STAN_MATH_PRIM_FUN_ROW_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/rows.hpp b/stan/math/prim/fun/rows.hpp similarity index 80% rename from stan/math/prim/mat/fun/rows.hpp rename to stan/math/prim/fun/rows.hpp index 4f0598b7fe6..ac70decc8a2 100644 --- a/stan/math/prim/mat/fun/rows.hpp +++ b/stan/math/prim/fun/rows.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ROWS_HPP -#define STAN_MATH_PRIM_MAT_FUN_ROWS_HPP +#ifndef STAN_MATH_PRIM_FUN_ROWS_HPP +#define STAN_MATH_PRIM_FUN_ROWS_HPP -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/rows_dot_product.hpp b/stan/math/prim/fun/rows_dot_product.hpp similarity index 87% rename from stan/math/prim/mat/fun/rows_dot_product.hpp rename to stan/math/prim/fun/rows_dot_product.hpp index 202b589d7c4..e885a01a3b0 100644 --- a/stan/math/prim/mat/fun/rows_dot_product.hpp +++ b/stan/math/prim/fun/rows_dot_product.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ROWS_DOT_PRODUCT_HPP -#define STAN_MATH_PRIM_MAT_FUN_ROWS_DOT_PRODUCT_HPP +#ifndef STAN_MATH_PRIM_FUN_ROWS_DOT_PRODUCT_HPP +#define STAN_MATH_PRIM_FUN_ROWS_DOT_PRODUCT_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/rows_dot_self.hpp b/stan/math/prim/fun/rows_dot_self.hpp similarity index 77% rename from stan/math/prim/mat/fun/rows_dot_self.hpp rename to stan/math/prim/fun/rows_dot_self.hpp index 087b4d60556..2f3c78177ef 100644 --- a/stan/math/prim/mat/fun/rows_dot_self.hpp +++ b/stan/math/prim/fun/rows_dot_self.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ROWS_DOT_SELF_HPP -#define STAN_MATH_PRIM_MAT_FUN_ROWS_DOT_SELF_HPP +#ifndef STAN_MATH_PRIM_FUN_ROWS_DOT_SELF_HPP +#define STAN_MATH_PRIM_FUN_ROWS_DOT_SELF_HPP -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/scale_matrix_exp_multiply.hpp b/stan/math/prim/fun/scale_matrix_exp_multiply.hpp similarity index 89% rename from stan/math/prim/mat/fun/scale_matrix_exp_multiply.hpp rename to stan/math/prim/fun/scale_matrix_exp_multiply.hpp index a33c574d746..aaca42be2e5 100644 --- a/stan/math/prim/mat/fun/scale_matrix_exp_multiply.hpp +++ b/stan/math/prim/fun/scale_matrix_exp_multiply.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SCALE_MATRIX_EXP_MULTIPLY_HPP -#define STAN_MATH_PRIM_MAT_FUN_SCALE_MATRIX_EXP_MULTIPLY_HPP +#ifndef STAN_MATH_PRIM_FUN_SCALE_MATRIX_EXP_MULTIPLY_HPP +#define STAN_MATH_PRIM_FUN_SCALE_MATRIX_EXP_MULTIPLY_HPP -#include #include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/arr/fun/scaled_add.hpp b/stan/math/prim/fun/scaled_add.hpp similarity index 79% rename from stan/math/prim/arr/fun/scaled_add.hpp rename to stan/math/prim/fun/scaled_add.hpp index 63646447e76..e4c15e93bcf 100644 --- a/stan/math/prim/arr/fun/scaled_add.hpp +++ b/stan/math/prim/fun/scaled_add.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_ARR_FUN_SCALED_ADD_HPP -#define STAN_MATH_PRIM_ARR_FUN_SCALED_ADD_HPP +#ifndef STAN_MATH_PRIM_FUN_SCALED_ADD_HPP +#define STAN_MATH_PRIM_FUN_SCALED_ADD_HPP #include #include diff --git a/stan/math/prim/mat/fun/sd.hpp b/stan/math/prim/fun/sd.hpp similarity index 84% rename from stan/math/prim/mat/fun/sd.hpp rename to stan/math/prim/fun/sd.hpp index 4e9d9712272..2ccf4d8d03a 100644 --- a/stan/math/prim/mat/fun/sd.hpp +++ b/stan/math/prim/fun/sd.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SD_HPP -#define STAN_MATH_PRIM_MAT_FUN_SD_HPP +#ifndef STAN_MATH_PRIM_FUN_SD_HPP +#define STAN_MATH_PRIM_FUN_SD_HPP #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/stan/math/prim/mat/fun/segment.hpp b/stan/math/prim/fun/segment.hpp similarity index 93% rename from stan/math/prim/mat/fun/segment.hpp rename to stan/math/prim/fun/segment.hpp index 6925ddd8689..53d731f8844 100644 --- a/stan/math/prim/mat/fun/segment.hpp +++ b/stan/math/prim/fun/segment.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SEGMENT_HPP -#define STAN_MATH_PRIM_MAT_FUN_SEGMENT_HPP +#ifndef STAN_MATH_PRIM_FUN_SEGMENT_HPP +#define STAN_MATH_PRIM_FUN_SEGMENT_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/sign.hpp b/stan/math/prim/fun/sign.hpp similarity index 75% rename from stan/math/prim/scal/fun/sign.hpp rename to stan/math/prim/fun/sign.hpp index c28981168f5..c1a32ee06b0 100644 --- a/stan/math/prim/scal/fun/sign.hpp +++ b/stan/math/prim/fun/sign.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_SIGN_HPP -#define STAN_MATH_PRIM_SCAL_FUN_SIGN_HPP +#ifndef STAN_MATH_PRIM_FUN_SIGN_HPP +#define STAN_MATH_PRIM_FUN_SIGN_HPP #include namespace stan { diff --git a/stan/math/prim/mat/fun/simplex_constrain.hpp b/stan/math/prim/fun/simplex_constrain.hpp similarity index 87% rename from stan/math/prim/mat/fun/simplex_constrain.hpp rename to stan/math/prim/fun/simplex_constrain.hpp index ff7fceacdbe..bafc78e738b 100644 --- a/stan/math/prim/mat/fun/simplex_constrain.hpp +++ b/stan/math/prim/fun/simplex_constrain.hpp @@ -1,12 +1,12 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SIMPLEX_CONSTRAIN_HPP -#define STAN_MATH_PRIM_MAT_FUN_SIMPLEX_CONSTRAIN_HPP +#ifndef STAN_MATH_PRIM_FUN_SIMPLEX_CONSTRAIN_HPP +#define STAN_MATH_PRIM_FUN_SIMPLEX_CONSTRAIN_HPP #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/simplex_free.hpp b/stan/math/prim/fun/simplex_free.hpp similarity index 87% rename from stan/math/prim/mat/fun/simplex_free.hpp rename to stan/math/prim/fun/simplex_free.hpp index 902cb80ab13..1433ae22dc2 100644 --- a/stan/math/prim/mat/fun/simplex_free.hpp +++ b/stan/math/prim/fun/simplex_free.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SIMPLEX_FREE_HPP -#define STAN_MATH_PRIM_MAT_FUN_SIMPLEX_FREE_HPP +#ifndef STAN_MATH_PRIM_FUN_SIMPLEX_FREE_HPP +#define STAN_MATH_PRIM_FUN_SIMPLEX_FREE_HPP #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/sin.hpp b/stan/math/prim/fun/sin.hpp similarity index 90% rename from stan/math/prim/mat/fun/sin.hpp rename to stan/math/prim/fun/sin.hpp index 6c8c9132f79..f2ed9102f97 100644 --- a/stan/math/prim/mat/fun/sin.hpp +++ b/stan/math/prim/fun/sin.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SIN_HPP -#define STAN_MATH_PRIM_MAT_FUN_SIN_HPP +#ifndef STAN_MATH_PRIM_FUN_SIN_HPP +#define STAN_MATH_PRIM_FUN_SIN_HPP -#include +#include #include #include #include diff --git a/stan/math/prim/mat/fun/singular_values.hpp b/stan/math/prim/fun/singular_values.hpp similarity index 82% rename from stan/math/prim/mat/fun/singular_values.hpp rename to stan/math/prim/fun/singular_values.hpp index 4228fd5ffe3..5f7300d2305 100644 --- a/stan/math/prim/mat/fun/singular_values.hpp +++ b/stan/math/prim/fun/singular_values.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SINGULAR_VALUES_HPP -#define STAN_MATH_PRIM_MAT_FUN_SINGULAR_VALUES_HPP +#ifndef STAN_MATH_PRIM_FUN_SINGULAR_VALUES_HPP +#define STAN_MATH_PRIM_FUN_SINGULAR_VALUES_HPP -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/sinh.hpp b/stan/math/prim/fun/sinh.hpp similarity index 92% rename from stan/math/prim/mat/fun/sinh.hpp rename to stan/math/prim/fun/sinh.hpp index 8e975d482fc..5e13a03993e 100644 --- a/stan/math/prim/mat/fun/sinh.hpp +++ b/stan/math/prim/fun/sinh.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SINH_HPP -#define STAN_MATH_PRIM_MAT_FUN_SINH_HPP +#ifndef STAN_MATH_PRIM_FUN_SINH_HPP +#define STAN_MATH_PRIM_FUN_SINH_HPP -#include #include +#include #include #include diff --git a/stan/math/prim/scal/fun/size_zero.hpp b/stan/math/prim/fun/size_zero.hpp similarity index 87% rename from stan/math/prim/scal/fun/size_zero.hpp rename to stan/math/prim/fun/size_zero.hpp index d7a7998adb7..c1ab4f7a7c4 100644 --- a/stan/math/prim/scal/fun/size_zero.hpp +++ b/stan/math/prim/fun/size_zero.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_SIZE_ZERO_HPP -#define STAN_MATH_PRIM_SCAL_FUN_SIZE_ZERO_HPP +#ifndef STAN_MATH_PRIM_FUN_SIZE_ZERO_HPP +#define STAN_MATH_PRIM_FUN_SIZE_ZERO_HPP #include #include diff --git a/stan/math/prim/mat/fun/softmax.hpp b/stan/math/prim/fun/softmax.hpp similarity index 90% rename from stan/math/prim/mat/fun/softmax.hpp rename to stan/math/prim/fun/softmax.hpp index cd17b1d3104..3637c0e03a9 100644 --- a/stan/math/prim/mat/fun/softmax.hpp +++ b/stan/math/prim/fun/softmax.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SOFTMAX_HPP -#define STAN_MATH_PRIM_MAT_FUN_SOFTMAX_HPP +#ifndef STAN_MATH_PRIM_FUN_SOFTMAX_HPP +#define STAN_MATH_PRIM_FUN_SOFTMAX_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/sort_asc.hpp b/stan/math/prim/fun/sort_asc.hpp similarity index 53% rename from stan/math/prim/mat/fun/sort_asc.hpp rename to stan/math/prim/fun/sort_asc.hpp index ad71cbff187..07217adf1bd 100644 --- a/stan/math/prim/mat/fun/sort_asc.hpp +++ b/stan/math/prim/fun/sort_asc.hpp @@ -1,13 +1,30 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SORT_ASC_HPP -#define STAN_MATH_PRIM_MAT_FUN_SORT_ASC_HPP +#ifndef STAN_MATH_PRIM_FUN_SORT_ASC_HPP +#define STAN_MATH_PRIM_FUN_SORT_ASC_HPP +#include #include -#include +#include #include +#include namespace stan { namespace math { +/** + * Return the specified standard vector in ascending order. + * + * @tparam T Type of elements contained in vector. + * @param xs Vector to order. + * @return Vector in ascending order. + * @throw std::domain_error If any of the values are NaN. + */ +template +inline std::vector sort_asc(std::vector xs) { + check_not_nan("sort_asc", "container argument", xs); + std::sort(xs.begin(), xs.end()); + return xs; +} + /** * Return the specified vector in ascending order. * diff --git a/stan/math/prim/mat/fun/sort_desc.hpp b/stan/math/prim/fun/sort_desc.hpp similarity index 52% rename from stan/math/prim/mat/fun/sort_desc.hpp rename to stan/math/prim/fun/sort_desc.hpp index d1d003a8c4b..87bdac14965 100644 --- a/stan/math/prim/mat/fun/sort_desc.hpp +++ b/stan/math/prim/fun/sort_desc.hpp @@ -1,15 +1,32 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SORT_DESC_HPP -#define STAN_MATH_PRIM_MAT_FUN_SORT_DESC_HPP +#ifndef STAN_MATH_PRIM_FUN_SORT_DESC_HPP +#define STAN_MATH_PRIM_FUN_SORT_DESC_HPP +#include #include -#include -#include +#include +#include #include #include +#include namespace stan { namespace math { +/** + * Return the specified standard vector in descending order. + * + * @tparam T Type of elements contained in vector. + * @param xs Vector to order. + * @return Vector in descending order. + * @throw std::domain_error If any of the values are NaN. + */ +template +inline std::vector sort_desc(std::vector xs) { + check_not_nan("sort_asc", "container argument", xs); + std::sort(xs.begin(), xs.end(), std::greater()); + return xs; +} + /** * Return the specified vector in descending order. * diff --git a/stan/math/prim/mat/fun/sort_indices.hpp b/stan/math/prim/fun/sort_indices.hpp similarity index 93% rename from stan/math/prim/mat/fun/sort_indices.hpp rename to stan/math/prim/fun/sort_indices.hpp index 3134cf3cf11..211e2181faa 100644 --- a/stan/math/prim/mat/fun/sort_indices.hpp +++ b/stan/math/prim/fun/sort_indices.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SORT_INDICES_HPP -#define STAN_MATH_PRIM_MAT_FUN_SORT_INDICES_HPP +#ifndef STAN_MATH_PRIM_FUN_SORT_INDICES_HPP +#define STAN_MATH_PRIM_FUN_SORT_INDICES_HPP #include -#include +#include #include #include diff --git a/stan/math/prim/mat/fun/sort_indices_asc.hpp b/stan/math/prim/fun/sort_indices_asc.hpp similarity index 64% rename from stan/math/prim/mat/fun/sort_indices_asc.hpp rename to stan/math/prim/fun/sort_indices_asc.hpp index 898cdcddf8c..079bdf3179e 100644 --- a/stan/math/prim/mat/fun/sort_indices_asc.hpp +++ b/stan/math/prim/fun/sort_indices_asc.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SORT_INDICES_ASC_HPP -#define STAN_MATH_PRIM_MAT_FUN_SORT_INDICES_ASC_HPP +#ifndef STAN_MATH_PRIM_FUN_SORT_INDICES_ASC_HPP +#define STAN_MATH_PRIM_FUN_SORT_INDICES_ASC_HPP #include -#include -#include -#include // std::sort +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/sort_indices_desc.hpp b/stan/math/prim/fun/sort_indices_desc.hpp similarity index 64% rename from stan/math/prim/mat/fun/sort_indices_desc.hpp rename to stan/math/prim/fun/sort_indices_desc.hpp index 6dfd89e6416..51b0ad7d0c6 100644 --- a/stan/math/prim/mat/fun/sort_indices_desc.hpp +++ b/stan/math/prim/fun/sort_indices_desc.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SORT_INDICES_DESC_HPP -#define STAN_MATH_PRIM_MAT_FUN_SORT_INDICES_DESC_HPP +#ifndef STAN_MATH_PRIM_FUN_SORT_INDICES_DESC_HPP +#define STAN_MATH_PRIM_FUN_SORT_INDICES_DESC_HPP #include -#include -#include -#include // std::sort +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/sqrt.hpp b/stan/math/prim/fun/sqrt.hpp similarity index 76% rename from stan/math/prim/mat/fun/sqrt.hpp rename to stan/math/prim/fun/sqrt.hpp index 2172975cc28..ae1b6dace93 100644 --- a/stan/math/prim/mat/fun/sqrt.hpp +++ b/stan/math/prim/fun/sqrt.hpp @@ -1,14 +1,23 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SQRT_HPP -#define STAN_MATH_PRIM_MAT_FUN_SQRT_HPP +#ifndef STAN_MATH_PRIM_FUN_SQRT_HPP +#define STAN_MATH_PRIM_FUN_SQRT_HPP -#include #include +#include #include #include namespace stan { namespace math { +/** + * Return the square root of the specified argument. This + * version is required to disambiguate sqrt(int). + * + * @param[in] x Argument. + * @return Natural exponential of argument. + */ +inline double sqrt(int x) { return std::sqrt(x); } + /** * Structure to wrap sqrt() so that it can be vectorized. * diff --git a/stan/math/prim/mat/fun/square.hpp b/stan/math/prim/fun/square.hpp similarity index 63% rename from stan/math/prim/mat/fun/square.hpp rename to stan/math/prim/fun/square.hpp index 0beef423ac7..6484f1ebe9f 100644 --- a/stan/math/prim/mat/fun/square.hpp +++ b/stan/math/prim/fun/square.hpp @@ -1,14 +1,30 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SQUARE_HPP -#define STAN_MATH_PRIM_MAT_FUN_SQUARE_HPP +#ifndef STAN_MATH_PRIM_FUN_SQUARE_HPP +#define STAN_MATH_PRIM_FUN_SQUARE_HPP -#include #include -#include +#include +#include #include +#include namespace stan { namespace math { +/** + * Return the square of the specified argument. + * + *

\f$\mbox{square}(x) = x^2\f$. + * + *

The implementation of square(x) is just + * x * x. Given this, this method is mainly useful + * in cases where x is not a simple primitive type, + * particularly when it is an auto-dif type. + * + * @param x Input to square. + * @return Square of input. + */ +inline double square(double x) { return std::pow(x, 2); } + /** * Structure to wrap square() so that it can be vectorized. * diff --git a/stan/math/prim/mat/fun/squared_distance.hpp b/stan/math/prim/fun/squared_distance.hpp similarity index 73% rename from stan/math/prim/mat/fun/squared_distance.hpp rename to stan/math/prim/fun/squared_distance.hpp index a304a43b40a..489830ff0ad 100644 --- a/stan/math/prim/mat/fun/squared_distance.hpp +++ b/stan/math/prim/fun/squared_distance.hpp @@ -1,13 +1,30 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SQUARED_DISTANCE_HPP -#define STAN_MATH_PRIM_MAT_FUN_SQUARED_DISTANCE_HPP +#ifndef STAN_MATH_PRIM_FUN_SQUARED_DISTANCE_HPP +#define STAN_MATH_PRIM_FUN_SQUARED_DISTANCE_HPP +#include #include -#include -#include +#include +#include namespace stan { namespace math { +/** + * Returns the squared distance. + * + * @param x1 First vector. + * @param x2 Second vector. + * @return Dot product of the vectors. + * @throw std::domain_error If the vectors are not the same + * size or if they are both not vector dimensioned. + */ +template +inline return_type_t squared_distance(const T1& x1, const T2& x2) { + check_finite("squared_distance", "x1", x1); + check_finite("squared_distance", "x2", x2); + return square(x1 - x2); +} + /** * Returns the squared distance between the specified vectors * of the same dimensions. diff --git a/stan/math/prim/mat/fun/stan_print.hpp b/stan/math/prim/fun/stan_print.hpp similarity index 90% rename from stan/math/prim/mat/fun/stan_print.hpp rename to stan/math/prim/fun/stan_print.hpp index eaedec00076..835c905385a 100644 --- a/stan/math/prim/mat/fun/stan_print.hpp +++ b/stan/math/prim/fun/stan_print.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_STAN_PRINT_HPP -#define STAN_MATH_PRIM_MAT_FUN_STAN_PRINT_HPP +#ifndef STAN_MATH_PRIM_FUN_STAN_PRINT_HPP +#define STAN_MATH_PRIM_FUN_STAN_PRINT_HPP -#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/step.hpp b/stan/math/prim/fun/step.hpp similarity index 88% rename from stan/math/prim/scal/fun/step.hpp rename to stan/math/prim/fun/step.hpp index efa331db4af..4cf4e223435 100644 --- a/stan/math/prim/scal/fun/step.hpp +++ b/stan/math/prim/fun/step.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_STEP_HPP -#define STAN_MATH_PRIM_SCAL_FUN_STEP_HPP +#ifndef STAN_MATH_PRIM_FUN_STEP_HPP +#define STAN_MATH_PRIM_FUN_STEP_HPP #include namespace stan { diff --git a/stan/math/prim/mat/fun/sub_col.hpp b/stan/math/prim/fun/sub_col.hpp similarity index 86% rename from stan/math/prim/mat/fun/sub_col.hpp rename to stan/math/prim/fun/sub_col.hpp index fecb5dae293..cb846ccc8b1 100644 --- a/stan/math/prim/mat/fun/sub_col.hpp +++ b/stan/math/prim/fun/sub_col.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SUB_COL_HPP -#define STAN_MATH_PRIM_MAT_FUN_SUB_COL_HPP +#ifndef STAN_MATH_PRIM_FUN_SUB_COL_HPP +#define STAN_MATH_PRIM_FUN_SUB_COL_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/sub_row.hpp b/stan/math/prim/fun/sub_row.hpp similarity index 86% rename from stan/math/prim/mat/fun/sub_row.hpp rename to stan/math/prim/fun/sub_row.hpp index da6ccbd2a92..6b01c36c21e 100644 --- a/stan/math/prim/mat/fun/sub_row.hpp +++ b/stan/math/prim/fun/sub_row.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SUB_ROW_HPP -#define STAN_MATH_PRIM_MAT_FUN_SUB_ROW_HPP +#ifndef STAN_MATH_PRIM_FUN_SUB_ROW_HPP +#define STAN_MATH_PRIM_FUN_SUB_ROW_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/subtract.hpp b/stan/math/prim/fun/subtract.hpp similarity index 90% rename from stan/math/prim/mat/fun/subtract.hpp rename to stan/math/prim/fun/subtract.hpp index 300012835be..3364abf0782 100644 --- a/stan/math/prim/mat/fun/subtract.hpp +++ b/stan/math/prim/fun/subtract.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SUBTRACT_HPP -#define STAN_MATH_PRIM_MAT_FUN_SUBTRACT_HPP +#ifndef STAN_MATH_PRIM_FUN_SUBTRACT_HPP +#define STAN_MATH_PRIM_FUN_SUBTRACT_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/fun/sum.hpp b/stan/math/prim/fun/sum.hpp new file mode 100644 index 00000000000..edd12160dc9 --- /dev/null +++ b/stan/math/prim/fun/sum.hpp @@ -0,0 +1,60 @@ +#ifndef STAN_MATH_PRIM_FUN_SUM_HPP +#define STAN_MATH_PRIM_FUN_SUM_HPP + +#include +#include +#include +#include +#include + +namespace stan { +namespace math { + +/** + * Returns specified input value. + * + * @tparam T Type of element. + * @param v Specified value. + * @return Same value (the sum of one value). + */ +inline double sum(double v) { return v; } + +/** + * Returns specified input value. + * + * @tparam T Type of element. + * @param v Specified value. + * @return Same value (the sum of one value). + */ +inline int sum(int v) { return v; } + +/** + * Return the sum of the values in the specified standard vector. + * + * @tparam T Type of elements summed. + * @param xs Standard vector to sum. + * @return Sum of elements. + */ +template +inline T sum(const std::vector& xs) { + return std::accumulate(xs.begin(), xs.end(), T{0}); +} + +/** + * Returns the sum of the coefficients of the specified + * Eigen Matrix, Array or expression. + * + * @tparam Derived type of argument + * @param v argument + * @return Sum of coefficients of argument. + */ +template +inline typename Eigen::DenseBase::Scalar sum( + const Eigen::DenseBase& v) { + return v.sum(); +} + +} // namespace math +} // namespace stan + +#endif diff --git a/stan/math/prim/mat/fun/tail.hpp b/stan/math/prim/fun/tail.hpp similarity index 93% rename from stan/math/prim/mat/fun/tail.hpp rename to stan/math/prim/fun/tail.hpp index 432c3bebfc8..491d15d14c5 100644 --- a/stan/math/prim/mat/fun/tail.hpp +++ b/stan/math/prim/fun/tail.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_TAIL_HPP -#define STAN_MATH_PRIM_MAT_FUN_TAIL_HPP +#ifndef STAN_MATH_PRIM_FUN_TAIL_HPP +#define STAN_MATH_PRIM_FUN_TAIL_HPP #include #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/tan.hpp b/stan/math/prim/fun/tan.hpp similarity index 90% rename from stan/math/prim/mat/fun/tan.hpp rename to stan/math/prim/fun/tan.hpp index e4666ffa979..7064300e695 100644 --- a/stan/math/prim/mat/fun/tan.hpp +++ b/stan/math/prim/fun/tan.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_TAN_HPP -#define STAN_MATH_PRIM_MAT_FUN_TAN_HPP +#ifndef STAN_MATH_PRIM_FUN_TAN_HPP +#define STAN_MATH_PRIM_FUN_TAN_HPP -#include #include +#include #include #include diff --git a/stan/math/prim/mat/fun/tanh.hpp b/stan/math/prim/fun/tanh.hpp similarity index 90% rename from stan/math/prim/mat/fun/tanh.hpp rename to stan/math/prim/fun/tanh.hpp index 91b1c7ba452..60c4d405fb2 100644 --- a/stan/math/prim/mat/fun/tanh.hpp +++ b/stan/math/prim/fun/tanh.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_TANH_HPP -#define STAN_MATH_PRIM_MAT_FUN_TANH_HPP +#ifndef STAN_MATH_PRIM_FUN_TANH_HPP +#define STAN_MATH_PRIM_FUN_TANH_HPP -#include #include +#include #include #include diff --git a/stan/math/prim/mat/fun/tcrossprod.hpp b/stan/math/prim/fun/tcrossprod.hpp similarity index 78% rename from stan/math/prim/mat/fun/tcrossprod.hpp rename to stan/math/prim/fun/tcrossprod.hpp index 6b1d2c1bfac..7a2f88b1ee4 100644 --- a/stan/math/prim/mat/fun/tcrossprod.hpp +++ b/stan/math/prim/fun/tcrossprod.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_TCROSSPROD_HPP -#define STAN_MATH_PRIM_MAT_FUN_TCROSSPROD_HPP +#ifndef STAN_MATH_PRIM_FUN_TCROSSPROD_HPP +#define STAN_MATH_PRIM_FUN_TCROSSPROD_HPP -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/tgamma.hpp b/stan/math/prim/fun/tgamma.hpp similarity index 59% rename from stan/math/prim/mat/fun/tgamma.hpp rename to stan/math/prim/fun/tgamma.hpp index 5a49065cd76..11d5529274d 100644 --- a/stan/math/prim/mat/fun/tgamma.hpp +++ b/stan/math/prim/fun/tgamma.hpp @@ -1,12 +1,28 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_TGAMMA_HPP -#define STAN_MATH_PRIM_MAT_FUN_TGAMMA_HPP +#ifndef STAN_MATH_PRIM_FUN_TGAMMA_HPP +#define STAN_MATH_PRIM_FUN_TGAMMA_HPP +#include +#include +#include #include -#include +#include namespace stan { namespace math { +/** + * Return the gamma function applied to the specified argument. + * + * @param x Argument. + * @return The gamma function applied to argument. + */ +inline double tgamma(double x) { + if (x == 0.0 || is_nonpositive_integer(x)) { + throw_domain_error("tgamma", "x", x, "x == 0 or negative integer"); + } + return std::tgamma(x); +} + /** * Structure to wrap tgamma() so that it can be vectorized. * diff --git a/stan/math/prim/mat/fun/to_array_1d.hpp b/stan/math/prim/fun/to_array_1d.hpp similarity index 88% rename from stan/math/prim/mat/fun/to_array_1d.hpp rename to stan/math/prim/fun/to_array_1d.hpp index caf948e7452..d141a3df2ae 100644 --- a/stan/math/prim/mat/fun/to_array_1d.hpp +++ b/stan/math/prim/fun/to_array_1d.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_TO_ARRAY_1D_HPP -#define STAN_MATH_PRIM_MAT_FUN_TO_ARRAY_1D_HPP +#ifndef STAN_MATH_PRIM_FUN_TO_ARRAY_1D_HPP +#define STAN_MATH_PRIM_FUN_TO_ARRAY_1D_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/to_array_2d.hpp b/stan/math/prim/fun/to_array_2d.hpp similarity index 80% rename from stan/math/prim/mat/fun/to_array_2d.hpp rename to stan/math/prim/fun/to_array_2d.hpp index 7751111ae5a..41e13c55feb 100644 --- a/stan/math/prim/mat/fun/to_array_2d.hpp +++ b/stan/math/prim/fun/to_array_2d.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_TO_ARRAY_2D_HPP -#define STAN_MATH_PRIM_MAT_FUN_TO_ARRAY_2D_HPP +#ifndef STAN_MATH_PRIM_FUN_TO_ARRAY_2D_HPP +#define STAN_MATH_PRIM_FUN_TO_ARRAY_2D_HPP -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/to_matrix.hpp b/stan/math/prim/fun/to_matrix.hpp similarity index 98% rename from stan/math/prim/mat/fun/to_matrix.hpp rename to stan/math/prim/fun/to_matrix.hpp index 336f78ad5e7..5f5802b96ec 100644 --- a/stan/math/prim/mat/fun/to_matrix.hpp +++ b/stan/math/prim/fun/to_matrix.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_TO_MATRIX_HPP -#define STAN_MATH_PRIM_MAT_FUN_TO_MATRIX_HPP +#ifndef STAN_MATH_PRIM_FUN_TO_MATRIX_HPP +#define STAN_MATH_PRIM_FUN_TO_MATRIX_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/to_row_vector.hpp b/stan/math/prim/fun/to_row_vector.hpp similarity index 87% rename from stan/math/prim/mat/fun/to_row_vector.hpp rename to stan/math/prim/fun/to_row_vector.hpp index c24f5ab2cea..754b36e5699 100644 --- a/stan/math/prim/mat/fun/to_row_vector.hpp +++ b/stan/math/prim/fun/to_row_vector.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_TO_ROW_VECTOR_HPP -#define STAN_MATH_PRIM_MAT_FUN_TO_ROW_VECTOR_HPP +#ifndef STAN_MATH_PRIM_FUN_TO_ROW_VECTOR_HPP +#define STAN_MATH_PRIM_FUN_TO_ROW_VECTOR_HPP -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/to_vector.hpp b/stan/math/prim/fun/to_vector.hpp similarity index 87% rename from stan/math/prim/mat/fun/to_vector.hpp rename to stan/math/prim/fun/to_vector.hpp index 6ab70c8ea2e..4d2a0f7d31c 100644 --- a/stan/math/prim/mat/fun/to_vector.hpp +++ b/stan/math/prim/fun/to_vector.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_TO_VECTOR_HPP -#define STAN_MATH_PRIM_MAT_FUN_TO_VECTOR_HPP +#ifndef STAN_MATH_PRIM_FUN_TO_VECTOR_HPP +#define STAN_MATH_PRIM_FUN_TO_VECTOR_HPP -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/trace.hpp b/stan/math/prim/fun/trace.hpp similarity index 82% rename from stan/math/prim/mat/fun/trace.hpp rename to stan/math/prim/fun/trace.hpp index c81a6d53357..6507552c489 100644 --- a/stan/math/prim/mat/fun/trace.hpp +++ b/stan/math/prim/fun/trace.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_TRACE_HPP -#define STAN_MATH_PRIM_MAT_FUN_TRACE_HPP +#ifndef STAN_MATH_PRIM_FUN_TRACE_HPP +#define STAN_MATH_PRIM_FUN_TRACE_HPP -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/trace_gen_inv_quad_form_ldlt.hpp b/stan/math/prim/fun/trace_gen_inv_quad_form_ldlt.hpp similarity index 82% rename from stan/math/prim/mat/fun/trace_gen_inv_quad_form_ldlt.hpp rename to stan/math/prim/fun/trace_gen_inv_quad_form_ldlt.hpp index 235eb959564..9a18d32b468 100644 --- a/stan/math/prim/mat/fun/trace_gen_inv_quad_form_ldlt.hpp +++ b/stan/math/prim/fun/trace_gen_inv_quad_form_ldlt.hpp @@ -1,14 +1,14 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_TRACE_GEN_INV_QUAD_FORM_LDLT_HPP -#define STAN_MATH_PRIM_MAT_FUN_TRACE_GEN_INV_QUAD_FORM_LDLT_HPP +#ifndef STAN_MATH_PRIM_FUN_TRACE_GEN_INV_QUAD_FORM_LDLT_HPP +#define STAN_MATH_PRIM_FUN_TRACE_GEN_INV_QUAD_FORM_LDLT_HPP #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/trace_gen_quad_form.hpp b/stan/math/prim/fun/trace_gen_quad_form.hpp similarity index 92% rename from stan/math/prim/mat/fun/trace_gen_quad_form.hpp rename to stan/math/prim/fun/trace_gen_quad_form.hpp index 75d4401c91e..28835611c88 100644 --- a/stan/math/prim/mat/fun/trace_gen_quad_form.hpp +++ b/stan/math/prim/fun/trace_gen_quad_form.hpp @@ -1,12 +1,12 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_TRACE_GEN_QUAD_FORM_HPP -#define STAN_MATH_PRIM_MAT_FUN_TRACE_GEN_QUAD_FORM_HPP +#ifndef STAN_MATH_PRIM_FUN_TRACE_GEN_QUAD_FORM_HPP +#define STAN_MATH_PRIM_FUN_TRACE_GEN_QUAD_FORM_HPP #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/trace_inv_quad_form_ldlt.hpp b/stan/math/prim/fun/trace_inv_quad_form_ldlt.hpp similarity index 76% rename from stan/math/prim/mat/fun/trace_inv_quad_form_ldlt.hpp rename to stan/math/prim/fun/trace_inv_quad_form_ldlt.hpp index 49181fc6b67..c176caea4f3 100644 --- a/stan/math/prim/mat/fun/trace_inv_quad_form_ldlt.hpp +++ b/stan/math/prim/fun/trace_inv_quad_form_ldlt.hpp @@ -1,14 +1,14 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_TRACE_INV_QUAD_FORM_LDLT_HPP -#define STAN_MATH_PRIM_MAT_FUN_TRACE_INV_QUAD_FORM_LDLT_HPP +#ifndef STAN_MATH_PRIM_FUN_TRACE_INV_QUAD_FORM_LDLT_HPP +#define STAN_MATH_PRIM_FUN_TRACE_INV_QUAD_FORM_LDLT_HPP #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/trace_quad_form.hpp b/stan/math/prim/fun/trace_quad_form.hpp similarity index 86% rename from stan/math/prim/mat/fun/trace_quad_form.hpp rename to stan/math/prim/fun/trace_quad_form.hpp index 482dee20927..ea128bba160 100644 --- a/stan/math/prim/mat/fun/trace_quad_form.hpp +++ b/stan/math/prim/fun/trace_quad_form.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_TRACE_QUAD_FORM_HPP -#define STAN_MATH_PRIM_MAT_FUN_TRACE_QUAD_FORM_HPP +#ifndef STAN_MATH_PRIM_FUN_TRACE_QUAD_FORM_HPP +#define STAN_MATH_PRIM_FUN_TRACE_QUAD_FORM_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/mat/fun/transpose.hpp b/stan/math/prim/fun/transpose.hpp similarity index 62% rename from stan/math/prim/mat/fun/transpose.hpp rename to stan/math/prim/fun/transpose.hpp index ebaa5d7cac9..317e8e21abb 100644 --- a/stan/math/prim/mat/fun/transpose.hpp +++ b/stan/math/prim/fun/transpose.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_TRANSPOSE_HPP -#define STAN_MATH_PRIM_MAT_FUN_TRANSPOSE_HPP +#ifndef STAN_MATH_PRIM_FUN_TRANSPOSE_HPP +#define STAN_MATH_PRIM_FUN_TRANSPOSE_HPP -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/scal/fun/trigamma.hpp b/stan/math/prim/fun/trigamma.hpp similarity index 74% rename from stan/math/prim/scal/fun/trigamma.hpp rename to stan/math/prim/fun/trigamma.hpp index f3cdd90962e..9b710f8da28 100644 --- a/stan/math/prim/scal/fun/trigamma.hpp +++ b/stan/math/prim/fun/trigamma.hpp @@ -1,7 +1,13 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_TRIGAMMA_HPP -#define STAN_MATH_PRIM_SCAL_FUN_TRIGAMMA_HPP +#ifndef STAN_MATH_PRIM_FUN_TRIGAMMA_HPP +#define STAN_MATH_PRIM_FUN_TRIGAMMA_HPP #include +#include +#include +#include +#include +#include + // Reference: // BE Schneider, // Algorithm AS 121: @@ -9,11 +15,6 @@ // Applied Statistics, // Volume 27, Number 1, pages 97-99, 1978. -#include -#include -#include -#include - namespace stan { namespace math { @@ -124,6 +125,39 @@ inline double trigamma(double u) { return trigamma_impl(u); } */ inline double trigamma(int u) { return trigamma(static_cast(u)); } +/** + * Structure to wrap trigamma() so it can be vectorized. + */ +struct trigamma_fun { + /** + * Return the trigamma() function applied to + * the argument. + * + * @tparam T type of argument + * @param x argument + * @return trigamma applied to argument. + */ + template + static inline T fun(const T& x) { + return trigamma(x); + } +}; + +/** + * Return the elementwise application of trigamma() to + * specified argument container. The return type promotes the + * underlying scalar argument type to double if it is an integer, + * and otherwise is the argument type. + * + * @tparam T type of container + * @param x container + * @return elementwise trigamma of container elements + */ +template +inline auto trigamma(const T& x) { + return apply_scalar_unary::apply(x); +} + } // namespace math } // namespace stan diff --git a/stan/math/prim/mat/fun/trunc.hpp b/stan/math/prim/fun/trunc.hpp similarity index 62% rename from stan/math/prim/mat/fun/trunc.hpp rename to stan/math/prim/fun/trunc.hpp index eafecca64f3..9831c055a5f 100644 --- a/stan/math/prim/mat/fun/trunc.hpp +++ b/stan/math/prim/fun/trunc.hpp @@ -1,12 +1,31 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_TRUNC_HPP -#define STAN_MATH_PRIM_MAT_FUN_TRUNC_HPP +#ifndef STAN_MATH_PRIM_FUN_TRUNC_HPP +#define STAN_MATH_PRIM_FUN_TRUNC_HPP +#include #include -#include +#include namespace stan { namespace math { +/** + * Return the nearest integral value that is not larger in + * magnitude than the specified argument. + * + * @param[in] x Argument. + * @return The truncated argument. + */ +inline double trunc(double x) { return std::trunc(x); } + +/** + * Return the nearest integral value that is not larger in + * magnitude than the specified argument. + * + * @param[in] x Argument. + * @return The truncated argument. + */ +inline double trunc(int x) { return std::trunc(x); } + /** * Structure to wrap trunc() so it can be vectorized. */ diff --git a/stan/math/prim/mat/fun/typedefs.hpp b/stan/math/prim/fun/typedefs.hpp similarity index 82% rename from stan/math/prim/mat/fun/typedefs.hpp rename to stan/math/prim/fun/typedefs.hpp index 54b961a9069..19fd772a3b1 100644 --- a/stan/math/prim/mat/fun/typedefs.hpp +++ b/stan/math/prim/fun/typedefs.hpp @@ -1,8 +1,8 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_TYPEDEFS_HPP -#define STAN_MATH_PRIM_MAT_FUN_TYPEDEFS_HPP +#ifndef STAN_MATH_PRIM_FUN_TYPEDEFS_HPP +#define STAN_MATH_PRIM_FUN_TYPEDEFS_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/scal/fun/ub_constrain.hpp b/stan/math/prim/fun/ub_constrain.hpp similarity index 89% rename from stan/math/prim/scal/fun/ub_constrain.hpp rename to stan/math/prim/fun/ub_constrain.hpp index ba9a1e12ea9..8002b9dbc4f 100644 --- a/stan/math/prim/scal/fun/ub_constrain.hpp +++ b/stan/math/prim/fun/ub_constrain.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_UB_CONSTRAIN_HPP -#define STAN_MATH_PRIM_SCAL_FUN_UB_CONSTRAIN_HPP +#ifndef STAN_MATH_PRIM_FUN_UB_CONSTRAIN_HPP +#define STAN_MATH_PRIM_FUN_UB_CONSTRAIN_HPP #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/scal/fun/ub_free.hpp b/stan/math/prim/fun/ub_free.hpp similarity index 85% rename from stan/math/prim/scal/fun/ub_free.hpp rename to stan/math/prim/fun/ub_free.hpp index f8fd2918b4d..e02c7cd47a7 100644 --- a/stan/math/prim/scal/fun/ub_free.hpp +++ b/stan/math/prim/fun/ub_free.hpp @@ -1,10 +1,10 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_UB_FREE_HPP -#define STAN_MATH_PRIM_SCAL_FUN_UB_FREE_HPP +#ifndef STAN_MATH_PRIM_FUN_UB_FREE_HPP +#define STAN_MATH_PRIM_FUN_UB_FREE_HPP #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/unit_vector_constrain.hpp b/stan/math/prim/fun/unit_vector_constrain.hpp similarity index 89% rename from stan/math/prim/mat/fun/unit_vector_constrain.hpp rename to stan/math/prim/fun/unit_vector_constrain.hpp index 567035d3a9b..0db69a1e976 100644 --- a/stan/math/prim/mat/fun/unit_vector_constrain.hpp +++ b/stan/math/prim/fun/unit_vector_constrain.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_UNIT_VECTOR_CONSTRAIN_HPP -#define STAN_MATH_PRIM_MAT_FUN_UNIT_VECTOR_CONSTRAIN_HPP +#ifndef STAN_MATH_PRIM_FUN_UNIT_VECTOR_CONSTRAIN_HPP +#define STAN_MATH_PRIM_FUN_UNIT_VECTOR_CONSTRAIN_HPP #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/unit_vector_free.hpp b/stan/math/prim/fun/unit_vector_free.hpp similarity index 82% rename from stan/math/prim/mat/fun/unit_vector_free.hpp rename to stan/math/prim/fun/unit_vector_free.hpp index ad3ad1e95ca..0d61346f371 100644 --- a/stan/math/prim/mat/fun/unit_vector_free.hpp +++ b/stan/math/prim/fun/unit_vector_free.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_UNIT_VECTOR_FREE_HPP -#define STAN_MATH_PRIM_MAT_FUN_UNIT_VECTOR_FREE_HPP +#ifndef STAN_MATH_PRIM_FUN_UNIT_VECTOR_FREE_HPP +#define STAN_MATH_PRIM_FUN_UNIT_VECTOR_FREE_HPP #include #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/fun/value_of.hpp b/stan/math/prim/fun/value_of.hpp new file mode 100644 index 00000000000..a431a2e64ac --- /dev/null +++ b/stan/math/prim/fun/value_of.hpp @@ -0,0 +1,176 @@ +#ifndef STAN_MATH_PRIM_FUN_VALUE_OF_HPP +#define STAN_MATH_PRIM_FUN_VALUE_OF_HPP + +#include +#include +#include +#include + +namespace stan { +namespace math { + +/** + * Return the value of the specified scalar argument + * converted to a double value. + * + *

See the primitive_value function to + * extract values without casting to double. + * + *

This function is meant to cover the primitive types. For + * types requiring pass-by-reference, this template function + * should be specialized. + * + * @tparam T type of scalar. + * @param x scalar to convert to double + * @return value of scalar cast to double + */ +template +inline double value_of(const T x) { + return static_cast(x); +} + +/** + * Return the specified argument. + * + *

See value_of(T) for a polymorphic + * implementation using static casts. + * + *

This inline pass-through no-op should be compiled away. + * + * @param x value + * @return input value + */ +template <> +inline double value_of(double x) { + return x; +} + +/** + * Return the specified argument. + * + *

See value_of(T) for a polymorphic + * implementation using static casts. + * + *

This inline pass-through no-op should be compiled away. + * + * @param x value + * @return input value + */ +inline int value_of(int x) { return x; } + +/** + * Convert a std::vector of type T to a std::vector of + * child_type::type. + * + * @tparam T Scalar type in std::vector + * @param[in] x std::vector to be converted + * @return std::vector of values + **/ +template +inline std::vector::type> value_of( + const std::vector& x) { + size_t x_size = x.size(); + std::vector::type> result(x_size); + for (size_t i = 0; i < x_size; i++) { + result[i] = value_of(x[i]); + } + return result; +} + +/** + * Return the specified argument. + * + *

See value_of(T) for a polymorphic + * implementation using static casts. + * + *

This inline pass-through no-op should be compiled away. + * + * @param x Specified std::vector. + * @return Specified std::vector. + */ +inline const std::vector& value_of(const std::vector& x) { + return x; +} + +/** + * Return the specified argument. + * + *

See value_of(T) for a polymorphic + * implementation using static casts. + * + *

This inline pass-through no-op should be compiled away. + * + * @param x Specified std::vector. + * @return Specified std::vector. + */ +inline const std::vector& value_of(const std::vector& x) { return x; } + +/** + * Convert a matrix of type T to a matrix of doubles. + * + * T must implement value_of. See + * test/math/fwd/fun/value_of.cpp for fvar and var usage. + * + * @tparam T type of elements in the matrix + * @tparam R number of rows in the matrix, can be Eigen::Dynamic + * @tparam C number of columns in the matrix, can be Eigen::Dynamic + * + * @param[in] M Matrix to be converted + * @return Matrix of values + **/ +template +inline Eigen::Matrix::type, R, C> value_of( + const Eigen::Matrix& M) { + Eigen::Matrix::type, R, C> Md(M.rows(), M.cols()); + for (int j = 0; j < M.cols(); j++) { + for (int i = 0; i < M.rows(); i++) { + Md(i, j) = value_of(M(i, j)); + } + } + return Md; +} + +/** + * Return the specified argument. + * + *

See value_of(T) for a polymorphic + * implementation using static casts. + * + *

This inline pass-through no-op should be compiled away. + * + * @tparam R number of rows in the matrix, can be Eigen::Dynamic + * @tparam C number of columns in the matrix, can be Eigen::Dynamic + * + * @param x Specified matrix. + * @return Specified matrix. + */ +template +inline const Eigen::Matrix& value_of( + const Eigen::Matrix& x) { + return x; +} + +/** + * Return the specified argument. + * + *

See value_of(T) for a polymorphic + * implementation using static casts. + * + *

This inline pass-through no-op should be compiled away. + * + * @tparam R number of rows in the matrix, can be Eigen::Dynamic + * @tparam C number of columns in the matrix, can be Eigen::Dynamic + * + * @param x Specified matrix. + * @return Specified matrix. + */ +template +inline const Eigen::Matrix& value_of( + const Eigen::Matrix& x) { + return x; +} + +} // namespace math +} // namespace stan + +#endif diff --git a/stan/math/prim/fun/value_of_rec.hpp b/stan/math/prim/fun/value_of_rec.hpp new file mode 100644 index 00000000000..c6f4fd1ab9c --- /dev/null +++ b/stan/math/prim/fun/value_of_rec.hpp @@ -0,0 +1,116 @@ +#ifndef STAN_MATH_PRIM_FUN_VALUE_OF_REC_HPP +#define STAN_MATH_PRIM_FUN_VALUE_OF_REC_HPP + +#include +#include +#include +#include + +namespace stan { +namespace math { + +/** + * Return the value of the specified scalar argument + * converted to a double value. + * + *

See the primitive_value function to + * extract values without casting to double. + * + *

This function is meant to cover the primitive types. For + * types requiring pass-by-reference, this template function + * should be specialized. + * + * @tparam T Type of scalar. + * @param x Scalar to convert to double. + * @return Value of scalar cast to a double. + */ +template > +inline double value_of_rec(const T x) { + return static_cast(x); +} + +/** + * Return the specified argument. + * + *

See value_of(T) for a polymorphic + * implementation using static casts. + * + *

This inline pass-through no-op should be compiled away. + * + * @param x Specified value. + * @return Specified value. + */ +inline double value_of_rec(double x) { return x; } + +/** + * Convert a std::vector of type T to a std::vector of doubles. + * + * T must implement value_of_rec. See + * test/math/fwd/fun/value_of_rec.cpp for fvar and var usage. + * + * @tparam T Scalar type in std::vector + * @param[in] x std::vector to be converted + * @return std::vector of values + **/ +template +inline std::vector value_of_rec(const std::vector& x) { + size_t x_size = x.size(); + std::vector result(x_size); + for (size_t i = 0; i < x_size; i++) { + result[i] = value_of_rec(x[i]); + } + return result; +} + +/** + * Return the specified argument. + * + *

See value_of_rec(T) for a polymorphic + * implementation using static casts. + * + *

This inline pass-through no-op should be compiled away. + * + * @param x Specified std::vector. + * @return Specified std::vector. + */ +inline const std::vector& value_of_rec(const std::vector& x) { + return x; +} + +/** + * Convert a matrix of type T to a matrix of doubles. + * + * T must implement value_of_rec. See + * test/unit/math/fwd/fun/value_of_test.cpp for fvar and var usage. + * + * @tparam T Type of matrix + * @param[in] M Matrix to be converted + * @return Matrix of values + **/ +template , + typename = require_eigen_t> +inline auto value_of_rec(const T& M) { + return M.unaryExpr([](auto x) { return value_of_rec(x); }); +} + +/** + * Return the specified argument. + * + *

See value_of_rec(T) for a polymorphic + * implementation using static casts. + * + *

This inline pass-through no-op should be compiled away. + * + * @tparam T Type of matrix. + * @param x Specified matrix. + * @return Specified matrix. + */ +template , + typename = require_eigen_t> +inline const T& value_of_rec(const T& x) { + return x; +} +} // namespace math +} // namespace stan + +#endif diff --git a/stan/math/prim/mat/fun/variance.hpp b/stan/math/prim/fun/variance.hpp similarity index 90% rename from stan/math/prim/mat/fun/variance.hpp rename to stan/math/prim/fun/variance.hpp index 19500eb835e..4e38dcbc7d9 100644 --- a/stan/math/prim/mat/fun/variance.hpp +++ b/stan/math/prim/fun/variance.hpp @@ -1,9 +1,9 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_VARIANCE_HPP -#define STAN_MATH_PRIM_MAT_FUN_VARIANCE_HPP +#ifndef STAN_MATH_PRIM_FUN_VARIANCE_HPP +#define STAN_MATH_PRIM_FUN_VARIANCE_HPP #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/arr/fun/vec_concat.hpp b/stan/math/prim/fun/vec_concat.hpp similarity index 91% rename from stan/math/prim/arr/fun/vec_concat.hpp rename to stan/math/prim/fun/vec_concat.hpp index b648ee83a9d..b678e61309f 100644 --- a/stan/math/prim/arr/fun/vec_concat.hpp +++ b/stan/math/prim/fun/vec_concat.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_ARR_FUN_VEC_CONCAT_HPP -#define STAN_MATH_PRIM_ARR_FUN_VEC_CONCAT_HPP +#ifndef STAN_MATH_PRIM_FUN_VEC_CONCAT_HPP +#define STAN_MATH_PRIM_FUN_VEC_CONCAT_HPP #include #include diff --git a/stan/math/prim/mat/fun/welford_covar_estimator.hpp b/stan/math/prim/fun/welford_covar_estimator.hpp similarity index 84% rename from stan/math/prim/mat/fun/welford_covar_estimator.hpp rename to stan/math/prim/fun/welford_covar_estimator.hpp index b679dfde898..819e1ad769a 100644 --- a/stan/math/prim/mat/fun/welford_covar_estimator.hpp +++ b/stan/math/prim/fun/welford_covar_estimator.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_WELFORD_COVAR_ESTIMATOR_HPP -#define STAN_MATH_PRIM_MAT_FUN_WELFORD_COVAR_ESTIMATOR_HPP +#ifndef STAN_MATH_PRIM_FUN_WELFORD_COVAR_ESTIMATOR_HPP +#define STAN_MATH_PRIM_FUN_WELFORD_COVAR_ESTIMATOR_HPP -#include +#include #include namespace stan { diff --git a/stan/math/prim/mat/fun/welford_var_estimator.hpp b/stan/math/prim/fun/welford_var_estimator.hpp similarity index 84% rename from stan/math/prim/mat/fun/welford_var_estimator.hpp rename to stan/math/prim/fun/welford_var_estimator.hpp index c3cd7784176..73dab695153 100644 --- a/stan/math/prim/mat/fun/welford_var_estimator.hpp +++ b/stan/math/prim/fun/welford_var_estimator.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_WELFORD_VAR_ESTIMATOR_HPP -#define STAN_MATH_PRIM_MAT_FUN_WELFORD_VAR_ESTIMATOR_HPP +#ifndef STAN_MATH_PRIM_FUN_WELFORD_VAR_ESTIMATOR_HPP +#define STAN_MATH_PRIM_FUN_WELFORD_VAR_ESTIMATOR_HPP -#include +#include #include namespace stan { diff --git a/stan/math/prim/functor.hpp b/stan/math/prim/functor.hpp new file mode 100644 index 00000000000..e973e864ef4 --- /dev/null +++ b/stan/math/prim/functor.hpp @@ -0,0 +1,21 @@ +#ifndef STAN_MATH_PRIM_FUNCTOR_HPP +#define STAN_MATH_PRIM_FUNCTOR_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/stan/math/prim/functor/coupled_ode_observer.hpp b/stan/math/prim/functor/coupled_ode_observer.hpp index ba475f37a31..a3f2cc0043f 100644 --- a/stan/math/prim/functor/coupled_ode_observer.hpp +++ b/stan/math/prim/functor/coupled_ode_observer.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include diff --git a/stan/math/prim/functor/finite_diff_gradient.hpp b/stan/math/prim/functor/finite_diff_gradient.hpp index bc76204b92f..47a794e4b46 100644 --- a/stan/math/prim/functor/finite_diff_gradient.hpp +++ b/stan/math/prim/functor/finite_diff_gradient.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_FUNCTOR_FINITE_DIFF_GRADIENT_HPP #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/functor/finite_diff_gradient_auto.hpp b/stan/math/prim/functor/finite_diff_gradient_auto.hpp index ccf402f30f9..013d9ee8bc0 100644 --- a/stan/math/prim/functor/finite_diff_gradient_auto.hpp +++ b/stan/math/prim/functor/finite_diff_gradient_auto.hpp @@ -1,8 +1,8 @@ #ifndef STAN_MATH_PRIM_FUNCTOR_FINITE_DIFF_GRADIENT_AUTO_HPP #define STAN_MATH_PRIM_FUNCTOR_FINITE_DIFF_GRADIENT_AUTO_HPP -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/functor/finite_diff_hessian.hpp b/stan/math/prim/functor/finite_diff_hessian.hpp index 632d51c9a95..5c2a98a4430 100644 --- a/stan/math/prim/functor/finite_diff_hessian.hpp +++ b/stan/math/prim/functor/finite_diff_hessian.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_FUNCTOR_FINITE_DIFF_HESSIAN_HPP #include -#include +#include #include #include diff --git a/stan/math/prim/functor/finite_diff_hessian_auto.hpp b/stan/math/prim/functor/finite_diff_hessian_auto.hpp index 16b98d6cf1a..dbc11c2eac6 100644 --- a/stan/math/prim/functor/finite_diff_hessian_auto.hpp +++ b/stan/math/prim/functor/finite_diff_hessian_auto.hpp @@ -1,10 +1,10 @@ #ifndef STAN_MATH_PRIM_FUNCTOR_FINITE_DIFF_HESSIAN_AUTO_HPP #define STAN_MATH_PRIM_FUNCTOR_FINITE_DIFF_HESSIAN_AUTO_HPP -#include +#include +#include #include #include -#include namespace stan { namespace math { diff --git a/stan/math/prim/functor/finite_diff_hessian_helper.hpp b/stan/math/prim/functor/finite_diff_hessian_helper.hpp index 46e212dff34..7e4daaf5c7d 100644 --- a/stan/math/prim/functor/finite_diff_hessian_helper.hpp +++ b/stan/math/prim/functor/finite_diff_hessian_helper.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_PRIM_FUNCTOR_FINITE_DIFF_HESSIAN_HELPER_HPP #define STAN_MATH_PRIM_FUNCTOR_FINITE_DIFF_HESSIAN_HELPER_HPP -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/functor/integrate_1d.hpp b/stan/math/prim/functor/integrate_1d.hpp index 66b8cbcf991..2b9efe9feb9 100644 --- a/stan/math/prim/functor/integrate_1d.hpp +++ b/stan/math/prim/functor/integrate_1d.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include #include diff --git a/stan/math/prim/functor/integrate_ode_rk45.hpp b/stan/math/prim/functor/integrate_ode_rk45.hpp index 8a491029325..f920b65d5a7 100644 --- a/stan/math/prim/functor/integrate_ode_rk45.hpp +++ b/stan/math/prim/functor/integrate_ode_rk45.hpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #if BOOST_VERSION == 106400 #include diff --git a/stan/math/prim/functor/map_rect.hpp b/stan/math/prim/functor/map_rect.hpp index 09cfbfec572..4481dc1e769 100644 --- a/stan/math/prim/functor/map_rect.hpp +++ b/stan/math/prim/functor/map_rect.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #define STAN_REGISTER_MAP_RECT(CALLID, FUNCTOR) diff --git a/stan/math/prim/functor/map_rect_combine.hpp b/stan/math/prim/functor/map_rect_combine.hpp index 6bb81e551ca..19de6ab1f5c 100644 --- a/stan/math/prim/functor/map_rect_combine.hpp +++ b/stan/math/prim/functor/map_rect_combine.hpp @@ -2,8 +2,8 @@ #define STAN_MATH_PRIM_FUNCTOR_MAP_RECT_COMBINE_HPP #include -#include -#include +#include +#include #include diff --git a/stan/math/prim/functor/map_rect_concurrent.hpp b/stan/math/prim/functor/map_rect_concurrent.hpp index c72749b03d0..bea35ce0287 100644 --- a/stan/math/prim/functor/map_rect_concurrent.hpp +++ b/stan/math/prim/functor/map_rect_concurrent.hpp @@ -2,8 +2,7 @@ #define STAN_MATH_PRIM_FUNCTOR_MAP_RECT_CONCURRENT_HPP #include -#include - +#include #include namespace stan { diff --git a/stan/math/prim/functor/map_rect_reduce.hpp b/stan/math/prim/functor/map_rect_reduce.hpp index 7fe55bd7760..e7852e9e194 100644 --- a/stan/math/prim/functor/map_rect_reduce.hpp +++ b/stan/math/prim/functor/map_rect_reduce.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_FUNCTOR_MAP_RECT_REDUCE_HPP #include -#include +#include #include diff --git a/stan/math/prim/functor/mpi_parallel_call.hpp b/stan/math/prim/functor/mpi_parallel_call.hpp index 5955acafb83..a87190d1d30 100644 --- a/stan/math/prim/functor/mpi_parallel_call.hpp +++ b/stan/math/prim/functor/mpi_parallel_call.hpp @@ -6,8 +6,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/stan/math/prim/mat.hpp b/stan/math/prim/mat.hpp deleted file mode 100644 index 6c2741c50c8..00000000000 --- a/stan/math/prim/mat.hpp +++ /dev/null @@ -1,337 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_HPP -#define STAN_MATH_PRIM_MAT_HPP - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#endif diff --git a/stan/math/prim/mat/err/check_finite.hpp b/stan/math/prim/mat/err/check_finite.hpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/stan/math/prim/mat/fun/Phi.hpp b/stan/math/prim/mat/fun/Phi.hpp deleted file mode 100644 index 9965a7bcfba..00000000000 --- a/stan/math/prim/mat/fun/Phi.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_PHI_HPP -#define STAN_MATH_PRIM_MAT_FUN_PHI_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Structure to wrap Phi() so it can be vectorized. - * - * @tparam T type of argument - * @param x argument - * @return Unit normal CDF of x. - */ -struct Phi_fun { - template - static inline T fun(const T& x) { - return Phi(x); - } -}; - -/** - * Vectorized version of Phi(). - * - * @tparam T type of container - * @param x container - * @return Unit normal CDF of each value in x. - */ -template -inline auto Phi(const T& x) { - return apply_scalar_unary::apply(x); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/acosh.hpp b/stan/math/prim/mat/fun/acosh.hpp deleted file mode 100644 index 215f7c743b3..00000000000 --- a/stan/math/prim/mat/fun/acosh.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ACOSH_HPP -#define STAN_MATH_PRIM_MAT_FUN_ACOSH_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Structure to wrap acosh() so it can be vectorized. - */ -struct acosh_fun { - /** - * Return the inverse hypberbolic cosine of the specified argument. - * - * @tparam T type of argument - * @param x argument - * @return Inverse hyperbolic cosine of the argument. - */ - template - static inline T fun(const T& x) { - return acosh(x); - } -}; - -/** - * Return the elementwise application of acosh() to - * specified argument container. The return type promotes the - * underlying scalar argument type to double if it is an integer, - * and otherwise is the argument type. - * - * @tparam T type of container - * @param x container - * @return Elementwise acosh of members of container. - */ -template -inline auto acosh(const T& x) { - return apply_scalar_unary::apply(x); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/atanh.hpp b/stan/math/prim/mat/fun/atanh.hpp deleted file mode 100644 index 36bc7451f11..00000000000 --- a/stan/math/prim/mat/fun/atanh.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ATANH_HPP -#define STAN_MATH_PRIM_MAT_FUN_ATANH_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Structure to wrap atanh() so it can be vectorized. - */ -struct atanh_fun { - /** - * Return the inverse hypberbolic tangent of the specified argument. - * - * @tparam T type of argument - * @param x argument - * @return Inverse hyperbolic tangent of the argument. - */ - template - static inline T fun(const T& x) { - return atanh(x); - } -}; - -/** - * Return the elementwise application of atanh() to - * specified argument container. The return type promotes the - * underlying scalar argument type to double if it is an integer, - * and otherwise is the argument type. - * - * @tparam T type of container - * @param x container - * @return Elementwise atanh of members of container. - */ -template -inline auto atanh(const T& x) { - return apply_scalar_unary::apply(x); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/common_type.hpp b/stan/math/prim/mat/fun/common_type.hpp deleted file mode 100644 index 882ca799951..00000000000 --- a/stan/math/prim/mat/fun/common_type.hpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_COMMON_TYPE_HPP -#define STAN_MATH_PRIM_MAT_FUN_COMMON_TYPE_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Struct which calculates type promotion over two types. - * - *

This specialization is for matrix types. - * - * @tparam T1 type of elements in the first matrix - * @tparam T2 type of elements in the second matrix - * @tparam R number of rows, can be Eigen::Dynamic - * @tparam C number of columns, can be Eigen::Dynamic - */ -template -struct common_type, Eigen::Matrix > { - using type = Eigen::Matrix::type, R, C>; -}; - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/digamma.hpp b/stan/math/prim/mat/fun/digamma.hpp deleted file mode 100644 index 69118b58af6..00000000000 --- a/stan/math/prim/mat/fun/digamma.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_DIGAMMA_HPP -#define STAN_MATH_PRIM_MAT_FUN_DIGAMMA_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Structure to wrap digamma() so it can be vectorized. - * - * @tparam T type of variable - * @param x variable - * @return Digamma function applied to x. - * @throw std::domain_error if x is a negative integer or 0 - */ -struct digamma_fun { - template - static inline T fun(const T& x) { - return digamma(x); - } -}; - -/** - * Vectorized version of digamma(). - * - * @tparam T type of container - * @param x container - * @return Digamma function applied to each value in x. - * @throw std::domain_error if any value is a negative integer or 0 - */ -template -inline auto digamma(const T& x) { - return apply_scalar_unary::apply(x); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/erf.hpp b/stan/math/prim/mat/fun/erf.hpp deleted file mode 100644 index bdd0c77a2f8..00000000000 --- a/stan/math/prim/mat/fun/erf.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ERF_HPP -#define STAN_MATH_PRIM_MAT_FUN_ERF_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Structure to wrap erf() so it can be vectorized. - * - * @tparam T type of variable - * @param x variable - * @return Error function of x. - */ -struct erf_fun { - template - static inline T fun(const T& x) { - return erf(x); - } -}; - -/** - * Vectorized version of erf(). - * - * @tparam T type of container - * @param x container - * @return Error function applied to each value in x. - */ -template -inline auto erf(const T& x) { - return apply_scalar_unary::apply(x); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/erfc.hpp b/stan/math/prim/mat/fun/erfc.hpp deleted file mode 100644 index a3f29efae45..00000000000 --- a/stan/math/prim/mat/fun/erfc.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_ERFC_HPP -#define STAN_MATH_PRIM_MAT_FUN_ERFC_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Structure to wrap erfc() so that it can be vectorized. - * - * @tparam T type of variable - * @param x variable - * @return Complementary error function applied to x. - */ -struct erfc_fun { - template - static inline T fun(const T& x) { - return erfc(x); - } -}; - -/** - * Vectorized version of erfc(). - * - * @tparam T type of container - * @param x container - * @return Complementary error function applied to each value in x. - */ -template -inline auto erfc(const T& x) { - return apply_scalar_unary::apply(x); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/fill.hpp b/stan/math/prim/mat/fun/fill.hpp deleted file mode 100644 index fc9b45e80f1..00000000000 --- a/stan/math/prim/mat/fun/fill.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_FILL_HPP -#define STAN_MATH_PRIM_MAT_FUN_FILL_HPP - -#include - -namespace stan { -namespace math { - -/** - * Fill the specified container with the specified value. - * - * The specified matrix is filled by element. - * - * @tparam T type of elements in the matrix - * @tparam R number of rows, can be Eigen::Dynamic - * @tparam C number of columns, can be Eigen::Dynamic - * @tparam S Type of value. - * - * @param x Container. - * @param y Value. - */ -template -void fill(Eigen::Matrix& x, const S& y) { - x.fill(y); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/inv_Phi.hpp b/stan/math/prim/mat/fun/inv_Phi.hpp deleted file mode 100644 index 8e56036f568..00000000000 --- a/stan/math/prim/mat/fun/inv_Phi.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_INV_PHI_HPP -#define STAN_MATH_PRIM_MAT_FUN_INV_PHI_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Structure to wrap inv_Phi() so it can be vectorized. - * - * @tparam T type of variable - * @param x variable in range [0, 1] - * @return Inverse unit normal CDF of x. - * @throw std::domain_error if x is not between 0 and 1. - */ -struct inv_Phi_fun { - template - static inline T fun(const T& x) { - return inv_Phi(x); - } -}; - -/** - * Vectorized version of inv_Phi(). - * - * @tparam T type of container - * @param x variables in range [0, 1] - * @return Inverse unit normal CDF of each value in x. - * @throw std::domain_error if any value is not between 0 and 1. - */ -template -inline auto inv_Phi(const T& x) { - return apply_scalar_unary::apply(x); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/inv_logit.hpp b/stan/math/prim/mat/fun/inv_logit.hpp deleted file mode 100644 index e7469356fc6..00000000000 --- a/stan/math/prim/mat/fun/inv_logit.hpp +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_INV_LOGIT_HPP -#define STAN_MATH_PRIM_MAT_FUN_INV_LOGIT_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Structure to wrap inv_logit() so that it can be vectorized. - * - * @tparam T type of variable - * @param x variable - * @return Inverse logit of x. - */ -struct inv_logit_fun { - template - static inline T fun(const T& x) { - return inv_logit(x); - } -}; - -/** - * Vectorized version of inv_logit(). - * - * @tparam T type of container - * @param x container - * @return Inverse logit applied to each value in x. - */ -template -inline auto inv_logit(const T& x) { - return apply_scalar_unary::apply(x); -} - -// TODO(Tadej): Eigen is introducing their implementation logistic() of this -// in 3.4. Use that once we switch to Eigen 3.4 - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/lgamma.hpp b/stan/math/prim/mat/fun/lgamma.hpp deleted file mode 100644 index 2b4dd455567..00000000000 --- a/stan/math/prim/mat/fun/lgamma.hpp +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_LGAMMA_HPP -#define STAN_MATH_PRIM_MAT_FUN_LGAMMA_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Structure to wrap lgamma() so that it can be vectorized. - * - * @tparam T type of variable - * @param x variable - * @return Natural log of the gamma function applied to x. - * @throw std::domain_error if x is a negative integer or 0. - */ -struct lgamma_fun { - template - static inline T fun(const T& x) { - return lgamma(x); - } -}; - -/** - * Vectorized version of lgamma(). - * - * @tparam T type of container - * @param x container - * @return Natural log of the gamma function - * applied to each value in x. - * @throw std::domain_error if any value is a negative integer or 0. - */ -template -inline auto lgamma(const T& x) { - return apply_scalar_unary::apply(x); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/log1m.hpp b/stan/math/prim/mat/fun/log1m.hpp deleted file mode 100644 index 2613b2390b1..00000000000 --- a/stan/math/prim/mat/fun/log1m.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_LOG1M_HPP -#define STAN_MATH_PRIM_MAT_FUN_LOG1M_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Structure to wrap log1m() so it can be vectorized. - * - * @tparam T type of variable - * @param x variable - * @return Natural log of (1 - x). - */ -struct log1m_fun { - template - static inline T fun(const T& x) { - return log1m(x); - } -}; - -/** - * Vectorized version of log1m(). - * - * @tparam T type of container - * @param x container - * @return Natural log of 1 minus each value in x. - */ -template -inline auto log1m(const T& x) { - return apply_scalar_unary::apply(x); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/log1m_exp.hpp b/stan/math/prim/mat/fun/log1m_exp.hpp deleted file mode 100644 index 07a3f888611..00000000000 --- a/stan/math/prim/mat/fun/log1m_exp.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_LOG1M_EXP_HPP -#define STAN_MATH_PRIM_MAT_FUN_LOG1M_EXP_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Structure to wrap log1m_exp() so it can be vectorized. - * - * @tparam T type of variable - * @param x variable - * @return Natural log of (1 - exp(x)). - */ -struct log1m_exp_fun { - template - static inline T fun(const T& x) { - return log1m_exp(x); - } -}; - -/** - * Vectorized version of log1m_exp(). - * - * @tparam T type of container - * @param x container - * @return Natural log of (1 - exp()) applied to each value in x. - */ -template -inline auto log1m_exp(const T& x) { - return apply_scalar_unary::apply(x); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/log1m_inv_logit.hpp b/stan/math/prim/mat/fun/log1m_inv_logit.hpp deleted file mode 100644 index f2f00e28271..00000000000 --- a/stan/math/prim/mat/fun/log1m_inv_logit.hpp +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_LOG1M_INV_LOGIT_HPP -#define STAN_MATH_PRIM_MAT_FUN_LOG1M_INV_LOGIT_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Structure to wrap log1m_inv_logit() so it can be vectorized. - */ -struct log1m_inv_logit_fun { - /** - * Return the natural logarithm of one minus the inverse logit - * of the specified argument. - * - * @tparam T type of argument - * @param x argument - * @return natural log of one minus inverse logit of argument - */ - template - static inline T fun(const T& x) { - return log1m_inv_logit(x); - } -}; - -/** - * Return the elementwise application of - * log1m_inv_logit() to specified argument container. - * The return type promotes the underlying scalar argument type to - * double if it is an integer, and otherwise is the argument type. - * - * @tparam T type of container - * @param x container - * @return Elementwise log1m_inv_logit of members of container. - */ -template -inline typename apply_scalar_unary::return_t -log1m_inv_logit(const T& x) { - return apply_scalar_unary::apply(x); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/log1p.hpp b/stan/math/prim/mat/fun/log1p.hpp deleted file mode 100644 index ef0457ba05d..00000000000 --- a/stan/math/prim/mat/fun/log1p.hpp +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_LOG1P_HPP -#define STAN_MATH_PRIM_MAT_FUN_LOG1P_HPP - -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Structure to wrap log1p() so it can be vectorized. - */ -struct log1p_fun { - /** - * Return the natural logarithm of one plus the specified value. - * - * @tparam T type of argument - * @param x argument - * @return natural log of one plus the argument - */ - template - static inline T fun(const T& x) { - return log1p(x); - } -}; - -/** - * Return the elementwise application of log1p() to - * specified argument container. The return type promotes the - * underlying scalar argument type to double if it is an integer, - * and otherwise is the argument type. - * - * @tparam T type of container - * @param x container - * @return Elementwise log1p of members of container. - */ -template -inline auto log1p(const T& x) { - return apply_scalar_unary::apply(x); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/log1p_exp.hpp b/stan/math/prim/mat/fun/log1p_exp.hpp deleted file mode 100644 index bcbafb0e090..00000000000 --- a/stan/math/prim/mat/fun/log1p_exp.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_LOG1P_EXP_HPP -#define STAN_MATH_PRIM_MAT_FUN_LOG1P_EXP_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Structure to wrap log1m_exp() so that it can be vectorized. - * - * @tparam T type of variable - * @param x variable - * @return Natural log of (1 + exp(x)). - */ -struct log1p_exp_fun { - template - static inline T fun(const T& x) { - return log1p_exp(x); - } -}; - -/** - * Vectorized version of log1m_exp(). - * - * @tparam T type of container - * @param x container - * @return Natural log of (1 + exp()) applied to each value in x. - */ -template -inline auto log1p_exp(const T& x) { - return apply_scalar_unary::apply(x); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/log_inv_logit.hpp b/stan/math/prim/mat/fun/log_inv_logit.hpp deleted file mode 100644 index bfae28da5bc..00000000000 --- a/stan/math/prim/mat/fun/log_inv_logit.hpp +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_LOG_INV_LOGIT_HPP -#define STAN_MATH_PRIM_MAT_FUN_LOG_INV_LOGIT_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Structure to wrap log_inv_logit() so it can be vectorized. - */ -struct log_inv_logit_fun { - /** - * Return the natural logarithm of the inverse logit - * of the specified argument. - * - * @tparam T argument scalar type - * @param x argument - * @return natural log of inverse logit of argument - */ - template - static inline T fun(const T& x) { - return log_inv_logit(x); - } -}; - -/** - * Return the elementwise application of - * log_inv_logit() to specified argument container. - * The return type promotes the underlying scalar argument type to - * double if it is an integer, and otherwise is the argument type. - * - * @tparam T type of container - * @param x container - * @return elementwise log_inv_logit of members of container - */ -template -inline auto log_inv_logit(const T& x) { - return apply_scalar_unary::apply(x); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/log_sum_exp.hpp b/stan/math/prim/mat/fun/log_sum_exp.hpp deleted file mode 100644 index 4fbbbbee966..00000000000 --- a/stan/math/prim/mat/fun/log_sum_exp.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_LOG_SUM_EXP_HPP -#define STAN_MATH_PRIM_MAT_FUN_LOG_SUM_EXP_HPP - -#include -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Return the log of the sum of the exponentiated values of the specified - * matrix of values. The matrix may be a full matrix, a vector, - * or a row vector. - * - * The function is defined as follows to prevent overflow in exponential - * calculations. - * - * \f$\log \sum_{n=1}^N \exp(x_n) = \max(x) + \log \sum_{n=1}^N \exp(x_n - - * \max(x))\f$. - * - * @tparam R number of rows, can be Eigen::Dynamic - * @tparam C number of columns, can be Eigen::Dynamic - * - * @param[in] x Matrix of specified values - * @return The log of the sum of the exponentiated vector values. - */ -template -double log_sum_exp(const Eigen::Matrix& x) { - if (x.size() == 0) { - return NEGATIVE_INFTY; - } - - const double max = x.maxCoeff(); - if (!std::isfinite(max)) { - return max; - } - return max + std::log((x.array() - max).exp().sum()); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/logit.hpp b/stan/math/prim/mat/fun/logit.hpp deleted file mode 100644 index 0d47dc76548..00000000000 --- a/stan/math/prim/mat/fun/logit.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_LOGIT_HPP -#define STAN_MATH_PRIM_MAT_FUN_LOGIT_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Structure to wrap logit() so it can be vectorized. - */ -struct logit_fun { - /** - * Return the log odds of the specified argument. - * - * @tparam T type of argument - * @param x argument - * @return log odds of the argument - */ - template - static inline T fun(const T& x) { - return logit(x); - } -}; - -/** - * Return the elementwise application of logit() to - * specified argument container. The return type promotes the - * underlying scalar argument type to double if it is an integer, - * and otherwise is the argument type. - * - * @tparam T type of container - * @param x container - * @return elementwise logit of container elements - */ -template -inline auto logit(const T& x) { - return apply_scalar_unary::apply(x); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/promote_elements.hpp b/stan/math/prim/mat/fun/promote_elements.hpp deleted file mode 100644 index 839b77cf5f5..00000000000 --- a/stan/math/prim/mat/fun/promote_elements.hpp +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_PROMOTE_ELEMENTS_HPP -#define STAN_MATH_PRIM_MAT_FUN_PROMOTE_ELEMENTS_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Struct with static function for elementwise type promotion. - * - *

This specialization promotes matrix elements of different types - * which must be compatible with promotion. - * - * @tparam T type of promoted elements - * @tparam S type of input elements, must be assignable to T - * @tparam R number of rows, can be Eigen::Dynamic - * @tparam C number of columns, can be Eigen::Dynamic - */ -template -struct promote_elements, Eigen::Matrix > { - /** - * Return input matrix of type S as matrix of type T. - * - * @param u matrix of type S, assignable to type T - * @returns matrix of type T - */ - inline static Eigen::Matrix promote( - const Eigen::Matrix& u) { - Eigen::Matrix t(u.rows(), u.cols()); - for (int i = 0; i < u.size(); ++i) { - t(i) = promote_elements::promote(u(i)); - } - return t; - } -}; - -/** - * Struct with static function for elementwise type promotion. - * - *

This specialization promotes matrix elements of the same type. - * - * @tparam T type of elements in the matrices - * @tparam R number of rows, can be Eigen::Dynamic - * @tparam C number of columns, can be Eigen::Dynamic - */ -template -struct promote_elements, Eigen::Matrix > { - /** - * Return input matrix. - * - * @param u matrix of type T - * @returns matrix of type T - */ - inline static const Eigen::Matrix& promote( - const Eigen::Matrix& u) { - return u; - } -}; - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/promote_scalar.hpp b/stan/math/prim/mat/fun/promote_scalar.hpp deleted file mode 100644 index 92e105fffb0..00000000000 --- a/stan/math/prim/mat/fun/promote_scalar.hpp +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_PROMOTE_SCALAR_HPP -#define STAN_MATH_PRIM_MAT_FUN_PROMOTE_SCALAR_HPP - -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Struct to hold static function for promoting underlying scalar - * types. This specialization is for Eigen inputs. - * - * @tparam T return scalar type - * @tparam S input matrix or vector or row vector type for static nested - * function, which must have a scalar type assignable to T - */ -template -struct promote_scalar_struct> { - /** - * Return the matrix consisting of the recursive promotion of - * the elements of the input matrix to the scalar type specified - * by the return template parameter. - * - * @param x input matrix. - * @return matrix with values promoted from input vector. - */ - static auto apply(const S& x) { return x.template cast(); } -}; - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/sum.hpp b/stan/math/prim/mat/fun/sum.hpp deleted file mode 100644 index c1e66309ba3..00000000000 --- a/stan/math/prim/mat/fun/sum.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_SUM_HPP -#define STAN_MATH_PRIM_MAT_FUN_SUM_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Returns the sum of the coefficients of the specified - * Eigen Matrix, Array or expression. - * - * @tparam Derived type of argument - * @param v argument - * @return Sum of coefficients of argument. - */ -template -inline typename Eigen::DenseBase::Scalar sum( - const Eigen::DenseBase& v) { - return v.sum(); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/trigamma.hpp b/stan/math/prim/mat/fun/trigamma.hpp deleted file mode 100644 index dca7e34df19..00000000000 --- a/stan/math/prim/mat/fun/trigamma.hpp +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_TRIGAMMA_HPP -#define STAN_MATH_PRIM_MAT_FUN_TRIGAMMA_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Structure to wrap trigamma() so it can be vectorized. - */ -struct trigamma_fun { - /** - * Return the trigamma() function applied to - * the argument. - * - * @tparam T type of argument - * @param x argument - * @return trigamma applied to argument. - */ - template - static inline T fun(const T& x) { - return trigamma(x); - } -}; - -/** - * Return the elementwise application of trigamma() to - * specified argument container. The return type promotes the - * underlying scalar argument type to double if it is an integer, - * and otherwise is the argument type. - * - * @tparam T type of container - * @param x container - * @return elementwise trigamma of container elements - */ -template -inline auto trigamma(const T& x) { - return apply_scalar_unary::apply(x); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/value_of.hpp b/stan/math/prim/mat/fun/value_of.hpp deleted file mode 100644 index dcf104be1a4..00000000000 --- a/stan/math/prim/mat/fun/value_of.hpp +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_VALUE_OF_HPP -#define STAN_MATH_PRIM_MAT_FUN_VALUE_OF_HPP - -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Convert a matrix of type T to a matrix of doubles. - * - * T must implement value_of. See - * test/math/fwd/fun/value_of.cpp for fvar and var usage. - * - * @tparam T type of elements in the matrix - * @tparam R number of rows in the matrix, can be Eigen::Dynamic - * @tparam C number of columns in the matrix, can be Eigen::Dynamic - * - * @param[in] M Matrix to be converted - * @return Matrix of values - **/ -template -inline Eigen::Matrix::type, R, C> value_of( - const Eigen::Matrix& M) { - Eigen::Matrix::type, R, C> Md(M.rows(), M.cols()); - for (int j = 0; j < M.cols(); j++) { - for (int i = 0; i < M.rows(); i++) { - Md(i, j) = value_of(M(i, j)); - } - } - return Md; -} - -/** - * Return the specified argument. - * - *

See value_of(T) for a polymorphic - * implementation using static casts. - * - *

This inline pass-through no-op should be compiled away. - * - * @tparam R number of rows in the matrix, can be Eigen::Dynamic - * @tparam C number of columns in the matrix, can be Eigen::Dynamic - * - * @param x Specified matrix. - * @return Specified matrix. - */ -template -inline const Eigen::Matrix& value_of( - const Eigen::Matrix& x) { - return x; -} - -/** - * Return the specified argument. - * - *

See value_of(T) for a polymorphic - * implementation using static casts. - * - *

This inline pass-through no-op should be compiled away. - * - * @tparam R number of rows in the matrix, can be Eigen::Dynamic - * @tparam C number of columns in the matrix, can be Eigen::Dynamic - * - * @param x Specified matrix. - * @return Specified matrix. - */ -template -inline const Eigen::Matrix& value_of( - const Eigen::Matrix& x) { - return x; -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/mat/fun/value_of_rec.hpp b/stan/math/prim/mat/fun/value_of_rec.hpp deleted file mode 100644 index 9dd84766d4f..00000000000 --- a/stan/math/prim/mat/fun/value_of_rec.hpp +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_VALUE_OF_REC_HPP -#define STAN_MATH_PRIM_MAT_FUN_VALUE_OF_REC_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Convert a matrix of type T to a matrix of doubles. - * - * T must implement value_of_rec. See - * test/unit/math/fwd/fun/value_of_test.cpp for fvar and var usage. - * - * @tparam T Type of matrix - * @param[in] M Matrix to be converted - * @return Matrix of values - **/ -template , - typename = require_eigen_t> -inline auto value_of_rec(const T& M) { - return M.unaryExpr([](auto x) { return value_of_rec(x); }); -} - -/** - * Return the specified argument. - * - *

See value_of_rec(T) for a polymorphic - * implementation using static casts. - * - *

This inline pass-through no-op should be compiled away. - * - * @tparam T Type of matrix. - * @param x Specified matrix. - * @return Specified matrix. - */ -template , - typename = require_eigen_t> -inline const T& value_of_rec(const T& x) { - return x; -} -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/meta/append_return_type.hpp b/stan/math/prim/meta/append_return_type.hpp index db2c7707eac..59dd2732b39 100644 --- a/stan/math/prim/meta/append_return_type.hpp +++ b/stan/math/prim/meta/append_return_type.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_PRIM_META_APPEND_RETURN_TYPE_HPP #define STAN_MATH_PRIM_META_APPEND_RETURN_TYPE_HPP -#include +#include #include #include diff --git a/stan/math/prim/meta/as_array_or_scalar.hpp b/stan/math/prim/meta/as_array_or_scalar.hpp index 2e788d558d6..918c2af4a7e 100644 --- a/stan/math/prim/meta/as_array_or_scalar.hpp +++ b/stan/math/prim/meta/as_array_or_scalar.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_PRIM_META_AS_ARRAY_OR_SCALAR_HPP #define STAN_MATH_PRIM_META_AS_ARRAY_OR_SCALAR_HPP -#include +#include #include #include diff --git a/stan/math/prim/meta/as_column_vector_or_scalar.hpp b/stan/math/prim/meta/as_column_vector_or_scalar.hpp index 4ff3b23ed5f..09aafb4cd4d 100644 --- a/stan/math/prim/meta/as_column_vector_or_scalar.hpp +++ b/stan/math/prim/meta/as_column_vector_or_scalar.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_PRIM_META_AS_COLUMN_VECTOR_OR_SCALAR_HPP #define STAN_MATH_PRIM_META_AS_COLUMN_VECTOR_OR_SCALAR_HPP -#include +#include #include #include diff --git a/stan/math/prim/meta/broadcast_array.hpp b/stan/math/prim/meta/broadcast_array.hpp index 6438272ada8..991a6fa9ea5 100644 --- a/stan/math/prim/meta/broadcast_array.hpp +++ b/stan/math/prim/meta/broadcast_array.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/meta/get.hpp b/stan/math/prim/meta/get.hpp index 9222cfc83fd..8176af83c20 100644 --- a/stan/math/prim/meta/get.hpp +++ b/stan/math/prim/meta/get.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include #include diff --git a/stan/math/prim/meta/index_type.hpp b/stan/math/prim/meta/index_type.hpp index be65513f0e9..b749d7098a1 100644 --- a/stan/math/prim/meta/index_type.hpp +++ b/stan/math/prim/meta/index_type.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_PRIM_META_INDEX_TYPE_HPP #define STAN_MATH_PRIM_META_INDEX_TYPE_HPP -#include +#include #include #include #include diff --git a/stan/math/prim/meta/is_constant.hpp b/stan/math/prim/meta/is_constant.hpp index f4907815d99..028d72478ee 100644 --- a/stan/math/prim/meta/is_constant.hpp +++ b/stan/math/prim/meta/is_constant.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_PRIM_META_IS_CONSTANT_HPP #define STAN_MATH_PRIM_META_IS_CONSTANT_HPP -#include +#include #include #include #include diff --git a/stan/math/prim/meta/is_container.hpp b/stan/math/prim/meta/is_container.hpp index 85bbbbb5e54..1c3f1b5642b 100644 --- a/stan/math/prim/meta/is_container.hpp +++ b/stan/math/prim/meta/is_container.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_IS_CONTAINER_HPP -#define STAN_MATH_PRIM_SCAL_IS_CONTAINER_HPP +#ifndef STAN_MATH_PRIM_META_IS_CONTAINER_HPP +#define STAN_MATH_PRIM_META_IS_CONTAINER_HPP #include #include diff --git a/stan/math/prim/meta/is_detected.hpp b/stan/math/prim/meta/is_detected.hpp index 5fe7b044035..487ce961d33 100644 --- a/stan/math/prim/meta/is_detected.hpp +++ b/stan/math/prim/meta/is_detected.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_IS_DETECTED_HPP -#define STAN_MATH_PRIM_SCAL_IS_DETECTED_HPP +#ifndef STAN_MATH_PRIM_META_IS_DETECTED_HPP +#define STAN_MATH_PRIM_META_IS_DETECTED_HPP #include #include diff --git a/stan/math/prim/meta/is_eigen.hpp b/stan/math/prim/meta/is_eigen.hpp index 64409365218..2012c5aee86 100644 --- a/stan/math/prim/meta/is_eigen.hpp +++ b/stan/math/prim/meta/is_eigen.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_PRIM_META_IS_EIGEN_HPP #define STAN_MATH_PRIM_META_IS_EIGEN_HPP -#include +#include #include #include diff --git a/stan/math/prim/meta/is_string_convertible.hpp b/stan/math/prim/meta/is_string_convertible.hpp index f8e179bb2ca..cfafaf5a322 100644 --- a/stan/math/prim/meta/is_string_convertible.hpp +++ b/stan/math/prim/meta/is_string_convertible.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_IS_STRING_CONVERTIBLE_HPP -#define STAN_MATH_PRIM_SCAL_IS_STRING_CONVERTIBLE_HPP +#ifndef STAN_MATH_PRIM_META_IS_STRING_CONVERTIBLE_HPP +#define STAN_MATH_PRIM_META_IS_STRING_CONVERTIBLE_HPP #include #include diff --git a/stan/math/prim/meta/operands_and_partials.hpp b/stan/math/prim/meta/operands_and_partials.hpp index b8d1f371883..19d4d0febab 100644 --- a/stan/math/prim/meta/operands_and_partials.hpp +++ b/stan/math/prim/meta/operands_and_partials.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_PRIM_META_OPERANDS_AND_PARTIALS_HPP #define STAN_MATH_PRIM_META_OPERANDS_AND_PARTIALS_HPP -#include +#include #include #include #include diff --git a/stan/math/prim/meta/plain_type.hpp b/stan/math/prim/meta/plain_type.hpp index ba0e0d29435..89fde1db496 100644 --- a/stan/math/prim/meta/plain_type.hpp +++ b/stan/math/prim/meta/plain_type.hpp @@ -52,4 +52,4 @@ struct plain_type> { } // namespace stan -#endif // STAN_MATH_PRIM_MAT_META_PLAIN_TYPE_HPP +#endif // STAN_MATH_PRIM_META_PLAIN_TYPE_HPP diff --git a/stan/math/prim/meta/promote_scalar_type.hpp b/stan/math/prim/meta/promote_scalar_type.hpp index b1a6f9b2049..d1362d33fac 100644 --- a/stan/math/prim/meta/promote_scalar_type.hpp +++ b/stan/math/prim/meta/promote_scalar_type.hpp @@ -1,7 +1,7 @@ -#ifndef STAN_MATH_PRIM_SCAL_META_PROMOTE_SCALAR_TYPE_HPP -#define STAN_MATH_PRIM_SCAL_META_PROMOTE_SCALAR_TYPE_HPP +#ifndef STAN_MATH_PRIM_META_PROMOTE_SCALAR_TYPE_HPP +#define STAN_MATH_PRIM_META_PROMOTE_SCALAR_TYPE_HPP -#include +#include #include #include diff --git a/stan/math/prim/meta/scalar_type.hpp b/stan/math/prim/meta/scalar_type.hpp index f6cbf43ce9c..13a7d820868 100644 --- a/stan/math/prim/meta/scalar_type.hpp +++ b/stan/math/prim/meta/scalar_type.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_PRIM_META_SCALAR_TYPE_HPP #define STAN_MATH_PRIM_META_SCALAR_TYPE_HPP -#include +#include #include #include #include diff --git a/stan/math/prim/meta/seq_view.hpp b/stan/math/prim/meta/seq_view.hpp index c02743c3fbf..6f3decda7a6 100644 --- a/stan/math/prim/meta/seq_view.hpp +++ b/stan/math/prim/meta/seq_view.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_PRIM_META_SEQ_VIEW_HPP #define STAN_MATH_PRIM_META_SEQ_VIEW_HPP -#include +#include #include namespace stan { diff --git a/stan/math/prim/meta/size.hpp b/stan/math/prim/meta/size.hpp index 9dd689d7094..39b6ca5189d 100644 --- a/stan/math/prim/meta/size.hpp +++ b/stan/math/prim/meta/size.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_META_SIZE_HPP #include -#include +#include #include #include diff --git a/stan/math/prim/meta/size_mvt.hpp b/stan/math/prim/meta/size_mvt.hpp index e6784a3ad32..d5e3ae7b407 100644 --- a/stan/math/prim/meta/size_mvt.hpp +++ b/stan/math/prim/meta/size_mvt.hpp @@ -2,7 +2,7 @@ #ifndef STAN_MATH_PRIM_META_SIZE_MVT_HPP #define STAN_MATH_PRIM_META_SIZE_MVT_HPP -#include +#include #include #include diff --git a/stan/math/prim/meta/value_type.hpp b/stan/math/prim/meta/value_type.hpp index f74a6249d2a..368cbdc447e 100644 --- a/stan/math/prim/meta/value_type.hpp +++ b/stan/math/prim/meta/value_type.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_PRIM_META_VALUE_TYPE_HPP #define STAN_MATH_PRIM_META_VALUE_TYPE_HPP -#include +#include #include #include #include diff --git a/stan/math/prim/meta/vector_seq_view.hpp b/stan/math/prim/meta/vector_seq_view.hpp index 6198190da73..905bd4275f8 100644 --- a/stan/math/prim/meta/vector_seq_view.hpp +++ b/stan/math/prim/meta/vector_seq_view.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_PRIM_META_vector_SEQ_VIEW_HPP #define STAN_MATH_PRIM_META_vector_SEQ_VIEW_HPP -#include +#include #include namespace stan { diff --git a/stan/math/prim/meta/void_t.hpp b/stan/math/prim/meta/void_t.hpp index f9917d25bab..f51d9fa66fa 100644 --- a/stan/math/prim/meta/void_t.hpp +++ b/stan/math/prim/meta/void_t.hpp @@ -1,5 +1,5 @@ -#ifndef STAN_MATH_PRIM_SCAL_VOID_T_HPP -#define STAN_MATH_PRIM_SCAL_VOID_T_HPP +#ifndef STAN_MATH_PRIM_META_VOID_T_HPP +#define STAN_MATH_PRIM_META_VOID_T_HPP #include #include diff --git a/stan/math/prim/prob/bernoulli_cdf.hpp b/stan/math/prim/prob/bernoulli_cdf.hpp index 798b7f8c949..5efcc376deb 100644 --- a/stan/math/prim/prob/bernoulli_cdf.hpp +++ b/stan/math/prim/prob/bernoulli_cdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/bernoulli_lccdf.hpp b/stan/math/prim/prob/bernoulli_lccdf.hpp index dd78e9683db..0c306f63fb0 100644 --- a/stan/math/prim/prob/bernoulli_lccdf.hpp +++ b/stan/math/prim/prob/bernoulli_lccdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/bernoulli_lcdf.hpp b/stan/math/prim/prob/bernoulli_lcdf.hpp index 4992648943a..08eaaaf3c5a 100644 --- a/stan/math/prim/prob/bernoulli_lcdf.hpp +++ b/stan/math/prim/prob/bernoulli_lcdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/bernoulli_logit_glm_lpmf.hpp b/stan/math/prim/prob/bernoulli_logit_glm_lpmf.hpp index 15ef6b97aa7..9590ee6d6b9 100644 --- a/stan/math/prim/prob/bernoulli_logit_glm_lpmf.hpp +++ b/stan/math/prim/prob/bernoulli_logit_glm_lpmf.hpp @@ -3,12 +3,10 @@ #include #include -#include -#include -#include -#include -#include - +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/bernoulli_logit_glm_rng.hpp b/stan/math/prim/prob/bernoulli_logit_glm_rng.hpp index d32162c8550..35cbae43234 100644 --- a/stan/math/prim/prob/bernoulli_logit_glm_rng.hpp +++ b/stan/math/prim/prob/bernoulli_logit_glm_rng.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include #include #include diff --git a/stan/math/prim/prob/bernoulli_logit_lpmf.hpp b/stan/math/prim/prob/bernoulli_logit_lpmf.hpp index 93ce38235f5..52f2f2c1ce3 100644 --- a/stan/math/prim/prob/bernoulli_logit_lpmf.hpp +++ b/stan/math/prim/prob/bernoulli_logit_lpmf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/bernoulli_logit_rng.hpp b/stan/math/prim/prob/bernoulli_logit_rng.hpp index d72a07518c9..b01112b8ac6 100644 --- a/stan/math/prim/prob/bernoulli_logit_rng.hpp +++ b/stan/math/prim/prob/bernoulli_logit_rng.hpp @@ -2,8 +2,8 @@ #define STAN_MATH_PRIM_PROB_BERNOULLI_LOGIT_RNG_HPP #include -#include #include +#include #include #include diff --git a/stan/math/prim/prob/bernoulli_lpmf.hpp b/stan/math/prim/prob/bernoulli_lpmf.hpp index ee8f99ef668..b2b570fa194 100644 --- a/stan/math/prim/prob/bernoulli_lpmf.hpp +++ b/stan/math/prim/prob/bernoulli_lpmf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/beta_binomial_cdf.hpp b/stan/math/prim/prob/beta_binomial_cdf.hpp index c0a6db20bdc..4f19b28c9a7 100644 --- a/stan/math/prim/prob/beta_binomial_cdf.hpp +++ b/stan/math/prim/prob/beta_binomial_cdf.hpp @@ -3,14 +3,14 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/beta_binomial_lccdf.hpp b/stan/math/prim/prob/beta_binomial_lccdf.hpp index fb31c0ac104..0a8491f51ba 100644 --- a/stan/math/prim/prob/beta_binomial_lccdf.hpp +++ b/stan/math/prim/prob/beta_binomial_lccdf.hpp @@ -3,14 +3,14 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/beta_binomial_lcdf.hpp b/stan/math/prim/prob/beta_binomial_lcdf.hpp index df1a19dc2b0..cddb89cbfcf 100644 --- a/stan/math/prim/prob/beta_binomial_lcdf.hpp +++ b/stan/math/prim/prob/beta_binomial_lcdf.hpp @@ -3,14 +3,14 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/beta_binomial_lpmf.hpp b/stan/math/prim/prob/beta_binomial_lpmf.hpp index 7cd235fe1dd..b687616ffa4 100644 --- a/stan/math/prim/prob/beta_binomial_lpmf.hpp +++ b/stan/math/prim/prob/beta_binomial_lpmf.hpp @@ -3,15 +3,15 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/beta_cdf.hpp b/stan/math/prim/prob/beta_cdf.hpp index ab72b6fe1eb..1bbf7db741d 100644 --- a/stan/math/prim/prob/beta_cdf.hpp +++ b/stan/math/prim/prob/beta_cdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/beta_lccdf.hpp b/stan/math/prim/prob/beta_lccdf.hpp index 374bdfdcb39..f29ec5a1156 100644 --- a/stan/math/prim/prob/beta_lccdf.hpp +++ b/stan/math/prim/prob/beta_lccdf.hpp @@ -3,12 +3,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/beta_lcdf.hpp b/stan/math/prim/prob/beta_lcdf.hpp index e5e36cfdc4f..4ceff664b6a 100644 --- a/stan/math/prim/prob/beta_lcdf.hpp +++ b/stan/math/prim/prob/beta_lcdf.hpp @@ -3,12 +3,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/beta_lpdf.hpp b/stan/math/prim/prob/beta_lpdf.hpp index ce3de4ff588..75ae874b433 100644 --- a/stan/math/prim/prob/beta_lpdf.hpp +++ b/stan/math/prim/prob/beta_lpdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/beta_proportion_lccdf.hpp b/stan/math/prim/prob/beta_proportion_lccdf.hpp index 45e443c36e7..5a84442c516 100644 --- a/stan/math/prim/prob/beta_proportion_lccdf.hpp +++ b/stan/math/prim/prob/beta_proportion_lccdf.hpp @@ -3,12 +3,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/beta_proportion_lcdf.hpp b/stan/math/prim/prob/beta_proportion_lcdf.hpp index f32f7ce8c67..36dcf063ac8 100644 --- a/stan/math/prim/prob/beta_proportion_lcdf.hpp +++ b/stan/math/prim/prob/beta_proportion_lcdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/beta_proportion_lpdf.hpp b/stan/math/prim/prob/beta_proportion_lpdf.hpp index a814d61a671..cba0cf15aad 100644 --- a/stan/math/prim/prob/beta_proportion_lpdf.hpp +++ b/stan/math/prim/prob/beta_proportion_lpdf.hpp @@ -3,12 +3,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/beta_rng.hpp b/stan/math/prim/prob/beta_rng.hpp index 474997db5ba..f4f1d08057a 100644 --- a/stan/math/prim/prob/beta_rng.hpp +++ b/stan/math/prim/prob/beta_rng.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include #include diff --git a/stan/math/prim/prob/binomial_cdf.hpp b/stan/math/prim/prob/binomial_cdf.hpp index 72296f11f9f..41b54ca374e 100644 --- a/stan/math/prim/prob/binomial_cdf.hpp +++ b/stan/math/prim/prob/binomial_cdf.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/binomial_lccdf.hpp b/stan/math/prim/prob/binomial_lccdf.hpp index f7eb9c86a16..03cd8e58403 100644 --- a/stan/math/prim/prob/binomial_lccdf.hpp +++ b/stan/math/prim/prob/binomial_lccdf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/binomial_lcdf.hpp b/stan/math/prim/prob/binomial_lcdf.hpp index 1c95d1131a5..653f053252a 100644 --- a/stan/math/prim/prob/binomial_lcdf.hpp +++ b/stan/math/prim/prob/binomial_lcdf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/binomial_logit_lpmf.hpp b/stan/math/prim/prob/binomial_logit_lpmf.hpp index d01f68bec5e..bd5c8452a44 100644 --- a/stan/math/prim/prob/binomial_logit_lpmf.hpp +++ b/stan/math/prim/prob/binomial_logit_lpmf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/binomial_lpmf.hpp b/stan/math/prim/prob/binomial_lpmf.hpp index ef543e8ca71..1d5bd282bbf 100644 --- a/stan/math/prim/prob/binomial_lpmf.hpp +++ b/stan/math/prim/prob/binomial_lpmf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/categorical_log.hpp b/stan/math/prim/prob/categorical_log.hpp index ef727f58544..4d59e491aed 100644 --- a/stan/math/prim/prob/categorical_log.hpp +++ b/stan/math/prim/prob/categorical_log.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_PROB_CATEGORICAL_LOG_HPP #include -#include +#include #include #include diff --git a/stan/math/prim/prob/categorical_logit_glm_lpmf.hpp b/stan/math/prim/prob/categorical_logit_glm_lpmf.hpp index 70730c3819d..fb0747a8ff6 100644 --- a/stan/math/prim/prob/categorical_logit_glm_lpmf.hpp +++ b/stan/math/prim/prob/categorical_logit_glm_lpmf.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include diff --git a/stan/math/prim/prob/categorical_logit_log.hpp b/stan/math/prim/prob/categorical_logit_log.hpp index 5a4de6a2182..8f061bd1211 100644 --- a/stan/math/prim/prob/categorical_logit_log.hpp +++ b/stan/math/prim/prob/categorical_logit_log.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_PROB_CATEGORICAL_LOGIT_LOG_HPP #include -#include +#include #include #include diff --git a/stan/math/prim/prob/categorical_logit_lpmf.hpp b/stan/math/prim/prob/categorical_logit_lpmf.hpp index ef61bff23a4..9007290d8cc 100644 --- a/stan/math/prim/prob/categorical_logit_lpmf.hpp +++ b/stan/math/prim/prob/categorical_logit_lpmf.hpp @@ -3,10 +3,9 @@ #include #include -#include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/categorical_logit_rng.hpp b/stan/math/prim/prob/categorical_logit_rng.hpp index c4ce673c16c..c64d0ddbf5a 100644 --- a/stan/math/prim/prob/categorical_logit_rng.hpp +++ b/stan/math/prim/prob/categorical_logit_rng.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/stan/math/prim/prob/categorical_lpmf.hpp b/stan/math/prim/prob/categorical_lpmf.hpp index ad49449ce30..cc638c2b77f 100644 --- a/stan/math/prim/prob/categorical_lpmf.hpp +++ b/stan/math/prim/prob/categorical_lpmf.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include diff --git a/stan/math/prim/prob/categorical_rng.hpp b/stan/math/prim/prob/categorical_rng.hpp index 29fba91831e..0d1a8c04388 100644 --- a/stan/math/prim/prob/categorical_rng.hpp +++ b/stan/math/prim/prob/categorical_rng.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include diff --git a/stan/math/prim/prob/cauchy_cdf.hpp b/stan/math/prim/prob/cauchy_cdf.hpp index 3659a925839..1ce43f9dc9e 100644 --- a/stan/math/prim/prob/cauchy_cdf.hpp +++ b/stan/math/prim/prob/cauchy_cdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/cauchy_lccdf.hpp b/stan/math/prim/prob/cauchy_lccdf.hpp index 78ea217fecf..56da671dd9d 100644 --- a/stan/math/prim/prob/cauchy_lccdf.hpp +++ b/stan/math/prim/prob/cauchy_lccdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/cauchy_lcdf.hpp b/stan/math/prim/prob/cauchy_lcdf.hpp index 42297d1eebe..9a9fc9cce94 100644 --- a/stan/math/prim/prob/cauchy_lcdf.hpp +++ b/stan/math/prim/prob/cauchy_lcdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/cauchy_lpdf.hpp b/stan/math/prim/prob/cauchy_lpdf.hpp index db73e683866..adbf8f42cfc 100644 --- a/stan/math/prim/prob/cauchy_lpdf.hpp +++ b/stan/math/prim/prob/cauchy_lpdf.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/chi_square_cdf.hpp b/stan/math/prim/prob/chi_square_cdf.hpp index 7e0ac6936de..a244f8feb53 100644 --- a/stan/math/prim/prob/chi_square_cdf.hpp +++ b/stan/math/prim/prob/chi_square_cdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/chi_square_lccdf.hpp b/stan/math/prim/prob/chi_square_lccdf.hpp index d65e28eaf18..3bec6cfd81d 100644 --- a/stan/math/prim/prob/chi_square_lccdf.hpp +++ b/stan/math/prim/prob/chi_square_lccdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/chi_square_lcdf.hpp b/stan/math/prim/prob/chi_square_lcdf.hpp index af16dd255cf..cbc327a6717 100644 --- a/stan/math/prim/prob/chi_square_lcdf.hpp +++ b/stan/math/prim/prob/chi_square_lcdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/chi_square_lpdf.hpp b/stan/math/prim/prob/chi_square_lpdf.hpp index 9aff9eb33be..0d4b6030d53 100644 --- a/stan/math/prim/prob/chi_square_lpdf.hpp +++ b/stan/math/prim/prob/chi_square_lpdf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/dirichlet_log.hpp b/stan/math/prim/prob/dirichlet_log.hpp index 997cebc7ed9..30413cdda80 100644 --- a/stan/math/prim/prob/dirichlet_log.hpp +++ b/stan/math/prim/prob/dirichlet_log.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/dirichlet_lpdf.hpp b/stan/math/prim/prob/dirichlet_lpdf.hpp index 68861ae63e7..0451e5182d2 100644 --- a/stan/math/prim/prob/dirichlet_lpdf.hpp +++ b/stan/math/prim/prob/dirichlet_lpdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/dirichlet_rng.hpp b/stan/math/prim/prob/dirichlet_rng.hpp index a95fe5b3ae7..bc8106605f8 100644 --- a/stan/math/prim/prob/dirichlet_rng.hpp +++ b/stan/math/prim/prob/dirichlet_rng.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_PROB_DIRICHLET_RNG_HPP #include -#include +#include #include #include #include diff --git a/stan/math/prim/prob/double_exponential_cdf.hpp b/stan/math/prim/prob/double_exponential_cdf.hpp index ba7e3008d78..3d6144c489c 100644 --- a/stan/math/prim/prob/double_exponential_cdf.hpp +++ b/stan/math/prim/prob/double_exponential_cdf.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/double_exponential_lccdf.hpp b/stan/math/prim/prob/double_exponential_lccdf.hpp index 972700245f8..b97bcd311e0 100644 --- a/stan/math/prim/prob/double_exponential_lccdf.hpp +++ b/stan/math/prim/prob/double_exponential_lccdf.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/double_exponential_lcdf.hpp b/stan/math/prim/prob/double_exponential_lcdf.hpp index b3d2aca7edd..7e43e979d58 100644 --- a/stan/math/prim/prob/double_exponential_lcdf.hpp +++ b/stan/math/prim/prob/double_exponential_lcdf.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/double_exponential_lpdf.hpp b/stan/math/prim/prob/double_exponential_lpdf.hpp index ceef855255f..821f44555f2 100644 --- a/stan/math/prim/prob/double_exponential_lpdf.hpp +++ b/stan/math/prim/prob/double_exponential_lpdf.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/double_exponential_rng.hpp b/stan/math/prim/prob/double_exponential_rng.hpp index bcb077281b5..674a0202d0e 100644 --- a/stan/math/prim/prob/double_exponential_rng.hpp +++ b/stan/math/prim/prob/double_exponential_rng.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include #include diff --git a/stan/math/prim/prob/exp_mod_normal_cdf.hpp b/stan/math/prim/prob/exp_mod_normal_cdf.hpp index 4f100351c89..ada4b1b4a59 100644 --- a/stan/math/prim/prob/exp_mod_normal_cdf.hpp +++ b/stan/math/prim/prob/exp_mod_normal_cdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/exp_mod_normal_lccdf.hpp b/stan/math/prim/prob/exp_mod_normal_lccdf.hpp index b2500d1fce2..311291d28f1 100644 --- a/stan/math/prim/prob/exp_mod_normal_lccdf.hpp +++ b/stan/math/prim/prob/exp_mod_normal_lccdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/exp_mod_normal_lcdf.hpp b/stan/math/prim/prob/exp_mod_normal_lcdf.hpp index 2cf2ed79b10..5ee35f6157a 100644 --- a/stan/math/prim/prob/exp_mod_normal_lcdf.hpp +++ b/stan/math/prim/prob/exp_mod_normal_lcdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/exp_mod_normal_lpdf.hpp b/stan/math/prim/prob/exp_mod_normal_lpdf.hpp index 548b682f3e2..8479b555abd 100644 --- a/stan/math/prim/prob/exp_mod_normal_lpdf.hpp +++ b/stan/math/prim/prob/exp_mod_normal_lpdf.hpp @@ -3,12 +3,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/exponential_cdf.hpp b/stan/math/prim/prob/exponential_cdf.hpp index 28256a34b2b..c53e798d718 100644 --- a/stan/math/prim/prob/exponential_cdf.hpp +++ b/stan/math/prim/prob/exponential_cdf.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/exponential_lccdf.hpp b/stan/math/prim/prob/exponential_lccdf.hpp index 8f234b9b123..4ab32bddc3e 100644 --- a/stan/math/prim/prob/exponential_lccdf.hpp +++ b/stan/math/prim/prob/exponential_lccdf.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/exponential_lcdf.hpp b/stan/math/prim/prob/exponential_lcdf.hpp index b5b91933f45..fbb1fc487be 100644 --- a/stan/math/prim/prob/exponential_lcdf.hpp +++ b/stan/math/prim/prob/exponential_lcdf.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/exponential_lpdf.hpp b/stan/math/prim/prob/exponential_lpdf.hpp index 7b9fffdc89a..eef60a33906 100644 --- a/stan/math/prim/prob/exponential_lpdf.hpp +++ b/stan/math/prim/prob/exponential_lpdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/frechet_cdf.hpp b/stan/math/prim/prob/frechet_cdf.hpp index 722994807db..2fbc47f0f9d 100644 --- a/stan/math/prim/prob/frechet_cdf.hpp +++ b/stan/math/prim/prob/frechet_cdf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include diff --git a/stan/math/prim/prob/frechet_lccdf.hpp b/stan/math/prim/prob/frechet_lccdf.hpp index 0404ecca257..0bc2b6c3776 100644 --- a/stan/math/prim/prob/frechet_lccdf.hpp +++ b/stan/math/prim/prob/frechet_lccdf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include diff --git a/stan/math/prim/prob/frechet_lcdf.hpp b/stan/math/prim/prob/frechet_lcdf.hpp index 1e6da0b3ffb..35efacfbeec 100644 --- a/stan/math/prim/prob/frechet_lcdf.hpp +++ b/stan/math/prim/prob/frechet_lcdf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include diff --git a/stan/math/prim/prob/frechet_lpdf.hpp b/stan/math/prim/prob/frechet_lpdf.hpp index b59809848dc..8c486485c5e 100644 --- a/stan/math/prim/prob/frechet_lpdf.hpp +++ b/stan/math/prim/prob/frechet_lpdf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include diff --git a/stan/math/prim/prob/gamma_cdf.hpp b/stan/math/prim/prob/gamma_cdf.hpp index 1087eebeec4..18021d8a584 100644 --- a/stan/math/prim/prob/gamma_cdf.hpp +++ b/stan/math/prim/prob/gamma_cdf.hpp @@ -3,14 +3,14 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include diff --git a/stan/math/prim/prob/gamma_lccdf.hpp b/stan/math/prim/prob/gamma_lccdf.hpp index fd8a37e08af..775c2ff8172 100644 --- a/stan/math/prim/prob/gamma_lccdf.hpp +++ b/stan/math/prim/prob/gamma_lccdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/gamma_lcdf.hpp b/stan/math/prim/prob/gamma_lcdf.hpp index cd90c037815..9a9943fff49 100644 --- a/stan/math/prim/prob/gamma_lcdf.hpp +++ b/stan/math/prim/prob/gamma_lcdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/gamma_lpdf.hpp b/stan/math/prim/prob/gamma_lpdf.hpp index 99331d2e60e..5e6ef502138 100644 --- a/stan/math/prim/prob/gamma_lpdf.hpp +++ b/stan/math/prim/prob/gamma_lpdf.hpp @@ -3,12 +3,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/gaussian_dlm_obs_log.hpp b/stan/math/prim/prob/gaussian_dlm_obs_log.hpp index 1a0b9fe154c..db7181129d1 100644 --- a/stan/math/prim/prob/gaussian_dlm_obs_log.hpp +++ b/stan/math/prim/prob/gaussian_dlm_obs_log.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/gaussian_dlm_obs_lpdf.hpp b/stan/math/prim/prob/gaussian_dlm_obs_lpdf.hpp index c68409f9937..a8d135d8660 100644 --- a/stan/math/prim/prob/gaussian_dlm_obs_lpdf.hpp +++ b/stan/math/prim/prob/gaussian_dlm_obs_lpdf.hpp @@ -3,19 +3,19 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include /* diff --git a/stan/math/prim/prob/gaussian_dlm_obs_rng.hpp b/stan/math/prim/prob/gaussian_dlm_obs_rng.hpp index bb84f985e8d..2d85228cc55 100644 --- a/stan/math/prim/prob/gaussian_dlm_obs_rng.hpp +++ b/stan/math/prim/prob/gaussian_dlm_obs_rng.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include #include diff --git a/stan/math/prim/prob/gumbel_cdf.hpp b/stan/math/prim/prob/gumbel_cdf.hpp index cbc001af6b6..03fa187c971 100644 --- a/stan/math/prim/prob/gumbel_cdf.hpp +++ b/stan/math/prim/prob/gumbel_cdf.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/gumbel_lccdf.hpp b/stan/math/prim/prob/gumbel_lccdf.hpp index 37b538440a5..e5775350113 100644 --- a/stan/math/prim/prob/gumbel_lccdf.hpp +++ b/stan/math/prim/prob/gumbel_lccdf.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/gumbel_lcdf.hpp b/stan/math/prim/prob/gumbel_lcdf.hpp index 9d79b88cdb0..8898df97c72 100644 --- a/stan/math/prim/prob/gumbel_lcdf.hpp +++ b/stan/math/prim/prob/gumbel_lcdf.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/gumbel_lpdf.hpp b/stan/math/prim/prob/gumbel_lpdf.hpp index 4e242bf20f2..421d7e001d2 100644 --- a/stan/math/prim/prob/gumbel_lpdf.hpp +++ b/stan/math/prim/prob/gumbel_lpdf.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/hypergeometric_lpmf.hpp b/stan/math/prim/prob/hypergeometric_lpmf.hpp index c508579651e..1d8de448662 100644 --- a/stan/math/prim/prob/hypergeometric_lpmf.hpp +++ b/stan/math/prim/prob/hypergeometric_lpmf.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/inv_chi_square_cdf.hpp b/stan/math/prim/prob/inv_chi_square_cdf.hpp index afd21883559..06b55183611 100644 --- a/stan/math/prim/prob/inv_chi_square_cdf.hpp +++ b/stan/math/prim/prob/inv_chi_square_cdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/inv_chi_square_lccdf.hpp b/stan/math/prim/prob/inv_chi_square_lccdf.hpp index 817546d231a..539820409fa 100644 --- a/stan/math/prim/prob/inv_chi_square_lccdf.hpp +++ b/stan/math/prim/prob/inv_chi_square_lccdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/inv_chi_square_lcdf.hpp b/stan/math/prim/prob/inv_chi_square_lcdf.hpp index 646b66e6d6c..83bd8390d9c 100644 --- a/stan/math/prim/prob/inv_chi_square_lcdf.hpp +++ b/stan/math/prim/prob/inv_chi_square_lcdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/inv_chi_square_lpdf.hpp b/stan/math/prim/prob/inv_chi_square_lpdf.hpp index f338e75bba4..2fff4a75f9b 100644 --- a/stan/math/prim/prob/inv_chi_square_lpdf.hpp +++ b/stan/math/prim/prob/inv_chi_square_lpdf.hpp @@ -3,12 +3,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/inv_gamma_cdf.hpp b/stan/math/prim/prob/inv_gamma_cdf.hpp index dc625959705..be476d6af55 100644 --- a/stan/math/prim/prob/inv_gamma_cdf.hpp +++ b/stan/math/prim/prob/inv_gamma_cdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/inv_gamma_lccdf.hpp b/stan/math/prim/prob/inv_gamma_lccdf.hpp index c06c086f9af..40cb7923fbc 100644 --- a/stan/math/prim/prob/inv_gamma_lccdf.hpp +++ b/stan/math/prim/prob/inv_gamma_lccdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/inv_gamma_lcdf.hpp b/stan/math/prim/prob/inv_gamma_lcdf.hpp index 438ed1563a0..541556e9b53 100644 --- a/stan/math/prim/prob/inv_gamma_lcdf.hpp +++ b/stan/math/prim/prob/inv_gamma_lcdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/inv_gamma_lpdf.hpp b/stan/math/prim/prob/inv_gamma_lpdf.hpp index c796534f465..4b2c1f9ed39 100644 --- a/stan/math/prim/prob/inv_gamma_lpdf.hpp +++ b/stan/math/prim/prob/inv_gamma_lpdf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/inv_wishart_log.hpp b/stan/math/prim/prob/inv_wishart_log.hpp index a90ee1bd8f2..2f694672210 100644 --- a/stan/math/prim/prob/inv_wishart_log.hpp +++ b/stan/math/prim/prob/inv_wishart_log.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_PROB_INV_WISHART_LOG_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/inv_wishart_lpdf.hpp b/stan/math/prim/prob/inv_wishart_lpdf.hpp index c9ae66e1e20..5861c1202c4 100644 --- a/stan/math/prim/prob/inv_wishart_lpdf.hpp +++ b/stan/math/prim/prob/inv_wishart_lpdf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/inv_wishart_rng.hpp b/stan/math/prim/prob/inv_wishart_rng.hpp index 709d2c963e6..0c4d5a16ac4 100644 --- a/stan/math/prim/prob/inv_wishart_rng.hpp +++ b/stan/math/prim/prob/inv_wishart_rng.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/lkj_corr_cholesky_log.hpp b/stan/math/prim/prob/lkj_corr_cholesky_log.hpp index 6f7c260af75..906db49bd48 100644 --- a/stan/math/prim/prob/lkj_corr_cholesky_log.hpp +++ b/stan/math/prim/prob/lkj_corr_cholesky_log.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_PROB_LKJ_CORR_CHOLESKY_LOG_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/lkj_corr_cholesky_lpdf.hpp b/stan/math/prim/prob/lkj_corr_cholesky_lpdf.hpp index c81f6916e6a..14cd643813f 100644 --- a/stan/math/prim/prob/lkj_corr_cholesky_lpdf.hpp +++ b/stan/math/prim/prob/lkj_corr_cholesky_lpdf.hpp @@ -3,10 +3,10 @@ #include #include -#include +#include +#include +#include #include -#include -#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/lkj_corr_cholesky_rng.hpp b/stan/math/prim/prob/lkj_corr_cholesky_rng.hpp index d1640ce7c8c..6caeb8247bc 100644 --- a/stan/math/prim/prob/lkj_corr_cholesky_rng.hpp +++ b/stan/math/prim/prob/lkj_corr_cholesky_rng.hpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/lkj_corr_log.hpp b/stan/math/prim/prob/lkj_corr_log.hpp index 80845c1809f..69cd9b6b4ab 100644 --- a/stan/math/prim/prob/lkj_corr_log.hpp +++ b/stan/math/prim/prob/lkj_corr_log.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_PROB_LKJ_CORR_LOG_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/lkj_corr_lpdf.hpp b/stan/math/prim/prob/lkj_corr_lpdf.hpp index a2fcba2cb28..7fe41e9afe5 100644 --- a/stan/math/prim/prob/lkj_corr_lpdf.hpp +++ b/stan/math/prim/prob/lkj_corr_lpdf.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/lkj_corr_rng.hpp b/stan/math/prim/prob/lkj_corr_rng.hpp index d4aa5896589..8e4717cb3f7 100644 --- a/stan/math/prim/prob/lkj_corr_rng.hpp +++ b/stan/math/prim/prob/lkj_corr_rng.hpp @@ -2,9 +2,9 @@ #define STAN_MATH_PRIM_PROB_LKJ_CORR_RNG_HPP #include -#include -#include #include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/lkj_cov_log.hpp b/stan/math/prim/prob/lkj_cov_log.hpp index 51b915dc004..93d88d81580 100644 --- a/stan/math/prim/prob/lkj_cov_log.hpp +++ b/stan/math/prim/prob/lkj_cov_log.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_PROB_LKJ_COV_LOG_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/logistic_cdf.hpp b/stan/math/prim/prob/logistic_cdf.hpp index 44b11e7be67..c431089c81b 100644 --- a/stan/math/prim/prob/logistic_cdf.hpp +++ b/stan/math/prim/prob/logistic_cdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/stan/math/prim/prob/logistic_lccdf.hpp b/stan/math/prim/prob/logistic_lccdf.hpp index fb9bdeefb78..21796fc1fc2 100644 --- a/stan/math/prim/prob/logistic_lccdf.hpp +++ b/stan/math/prim/prob/logistic_lccdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/stan/math/prim/prob/logistic_lcdf.hpp b/stan/math/prim/prob/logistic_lcdf.hpp index 732854a0f9b..d2b6f7d8fda 100644 --- a/stan/math/prim/prob/logistic_lcdf.hpp +++ b/stan/math/prim/prob/logistic_lcdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/stan/math/prim/prob/logistic_lpdf.hpp b/stan/math/prim/prob/logistic_lpdf.hpp index 79efccef463..6cf56c2e85e 100644 --- a/stan/math/prim/prob/logistic_lpdf.hpp +++ b/stan/math/prim/prob/logistic_lpdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/lognormal_cdf.hpp b/stan/math/prim/prob/lognormal_cdf.hpp index c18f21e0721..03ba45077fa 100644 --- a/stan/math/prim/prob/lognormal_cdf.hpp +++ b/stan/math/prim/prob/lognormal_cdf.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/lognormal_lccdf.hpp b/stan/math/prim/prob/lognormal_lccdf.hpp index 882d33ea200..18067190d65 100644 --- a/stan/math/prim/prob/lognormal_lccdf.hpp +++ b/stan/math/prim/prob/lognormal_lccdf.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/lognormal_lcdf.hpp b/stan/math/prim/prob/lognormal_lcdf.hpp index e68891ed74f..a06e5736167 100644 --- a/stan/math/prim/prob/lognormal_lcdf.hpp +++ b/stan/math/prim/prob/lognormal_lcdf.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/lognormal_lpdf.hpp b/stan/math/prim/prob/lognormal_lpdf.hpp index 88069a0c354..0a3c37501be 100644 --- a/stan/math/prim/prob/lognormal_lpdf.hpp +++ b/stan/math/prim/prob/lognormal_lpdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/matrix_normal_prec_log.hpp b/stan/math/prim/prob/matrix_normal_prec_log.hpp index 4bede6ceeb7..b51417b5d32 100644 --- a/stan/math/prim/prob/matrix_normal_prec_log.hpp +++ b/stan/math/prim/prob/matrix_normal_prec_log.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_PROB_MATRIX_NORMAL_PREC_LOG_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/matrix_normal_prec_lpdf.hpp b/stan/math/prim/prob/matrix_normal_prec_lpdf.hpp index 22f6bd0ab09..ef5f2c05a0d 100644 --- a/stan/math/prim/prob/matrix_normal_prec_lpdf.hpp +++ b/stan/math/prim/prob/matrix_normal_prec_lpdf.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/matrix_normal_prec_rng.hpp b/stan/math/prim/prob/matrix_normal_prec_rng.hpp index 8751b01a342..305dbd1fb07 100644 --- a/stan/math/prim/prob/matrix_normal_prec_rng.hpp +++ b/stan/math/prim/prob/matrix_normal_prec_rng.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include diff --git a/stan/math/prim/prob/multi_gp_cholesky_log.hpp b/stan/math/prim/prob/multi_gp_cholesky_log.hpp index 3be906d3528..23b7a55dbd7 100644 --- a/stan/math/prim/prob/multi_gp_cholesky_log.hpp +++ b/stan/math/prim/prob/multi_gp_cholesky_log.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_PROB_MULTI_GP_CHOLESKY_LOG_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/multi_gp_cholesky_lpdf.hpp b/stan/math/prim/prob/multi_gp_cholesky_lpdf.hpp index c78fe341752..0de010389ab 100644 --- a/stan/math/prim/prob/multi_gp_cholesky_lpdf.hpp +++ b/stan/math/prim/prob/multi_gp_cholesky_lpdf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/multi_gp_log.hpp b/stan/math/prim/prob/multi_gp_log.hpp index 4ec2f894808..be81e0fdffc 100644 --- a/stan/math/prim/prob/multi_gp_log.hpp +++ b/stan/math/prim/prob/multi_gp_log.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_PROB_MULTI_GP_LOG_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/multi_gp_lpdf.hpp b/stan/math/prim/prob/multi_gp_lpdf.hpp index 64259ee5299..dc139d552b3 100644 --- a/stan/math/prim/prob/multi_gp_lpdf.hpp +++ b/stan/math/prim/prob/multi_gp_lpdf.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/multi_normal_cholesky_log.hpp b/stan/math/prim/prob/multi_normal_cholesky_log.hpp index afd2f258482..7dd31f117cf 100644 --- a/stan/math/prim/prob/multi_normal_cholesky_log.hpp +++ b/stan/math/prim/prob/multi_normal_cholesky_log.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_PROB_MULTI_NORMAL_CHOLESKY_LOG_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/multi_normal_cholesky_lpdf.hpp b/stan/math/prim/prob/multi_normal_cholesky_lpdf.hpp index c7e5120950a..ccd4ef020d8 100644 --- a/stan/math/prim/prob/multi_normal_cholesky_lpdf.hpp +++ b/stan/math/prim/prob/multi_normal_cholesky_lpdf.hpp @@ -3,12 +3,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/multi_normal_lpdf.hpp b/stan/math/prim/prob/multi_normal_lpdf.hpp index 0642f9e3152..a121724d033 100644 --- a/stan/math/prim/prob/multi_normal_lpdf.hpp +++ b/stan/math/prim/prob/multi_normal_lpdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/multi_normal_prec_lpdf.hpp b/stan/math/prim/prob/multi_normal_prec_lpdf.hpp index 428714c0eb7..a18a0ca4073 100644 --- a/stan/math/prim/prob/multi_normal_prec_lpdf.hpp +++ b/stan/math/prim/prob/multi_normal_prec_lpdf.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/multi_normal_prec_rng.hpp b/stan/math/prim/prob/multi_normal_prec_rng.hpp index e886e13860e..5bf8e40722f 100644 --- a/stan/math/prim/prob/multi_normal_prec_rng.hpp +++ b/stan/math/prim/prob/multi_normal_prec_rng.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include diff --git a/stan/math/prim/prob/multi_student_t_lpdf.hpp b/stan/math/prim/prob/multi_student_t_lpdf.hpp index 938433e86c5..875ed69f84f 100644 --- a/stan/math/prim/prob/multi_student_t_lpdf.hpp +++ b/stan/math/prim/prob/multi_student_t_lpdf.hpp @@ -4,10 +4,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/stan/math/prim/prob/multinomial_log.hpp b/stan/math/prim/prob/multinomial_log.hpp index 2ea82fd4dec..908e043b173 100644 --- a/stan/math/prim/prob/multinomial_log.hpp +++ b/stan/math/prim/prob/multinomial_log.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_PROB_MULTINOMIAL_LOG_HPP #include -#include +#include #include #include diff --git a/stan/math/prim/prob/multinomial_lpmf.hpp b/stan/math/prim/prob/multinomial_lpmf.hpp index 172297cb0cc..337312f167f 100644 --- a/stan/math/prim/prob/multinomial_lpmf.hpp +++ b/stan/math/prim/prob/multinomial_lpmf.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/neg_binomial_2_cdf.hpp b/stan/math/prim/prob/neg_binomial_2_cdf.hpp index 377560160a1..a080ebe55cb 100644 --- a/stan/math/prim/prob/neg_binomial_2_cdf.hpp +++ b/stan/math/prim/prob/neg_binomial_2_cdf.hpp @@ -3,12 +3,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/neg_binomial_2_lccdf.hpp b/stan/math/prim/prob/neg_binomial_2_lccdf.hpp index 7f22f469371..36a34b06f2b 100644 --- a/stan/math/prim/prob/neg_binomial_2_lccdf.hpp +++ b/stan/math/prim/prob/neg_binomial_2_lccdf.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/neg_binomial_2_lcdf.hpp b/stan/math/prim/prob/neg_binomial_2_lcdf.hpp index 26c484fc419..966e1102f9a 100644 --- a/stan/math/prim/prob/neg_binomial_2_lcdf.hpp +++ b/stan/math/prim/prob/neg_binomial_2_lcdf.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include 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 5f6ae565195..f79d2068cb8 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 @@ -3,13 +3,12 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include 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 a433dc9a5de..b0a0eb5450a 100644 --- a/stan/math/prim/prob/neg_binomial_2_log_lpmf.hpp +++ b/stan/math/prim/prob/neg_binomial_2_log_lpmf.hpp @@ -3,12 +3,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/neg_binomial_2_log_rng.hpp b/stan/math/prim/prob/neg_binomial_2_log_rng.hpp index 237866b1625..d3bae3d2b7f 100644 --- a/stan/math/prim/prob/neg_binomial_2_log_rng.hpp +++ b/stan/math/prim/prob/neg_binomial_2_log_rng.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include #include diff --git a/stan/math/prim/prob/neg_binomial_2_lpmf.hpp b/stan/math/prim/prob/neg_binomial_2_lpmf.hpp index 9b67d5356c0..435ebeff2e3 100644 --- a/stan/math/prim/prob/neg_binomial_2_lpmf.hpp +++ b/stan/math/prim/prob/neg_binomial_2_lpmf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include diff --git a/stan/math/prim/prob/neg_binomial_2_rng.hpp b/stan/math/prim/prob/neg_binomial_2_rng.hpp index f4069a89dbf..855b0663e9e 100644 --- a/stan/math/prim/prob/neg_binomial_2_rng.hpp +++ b/stan/math/prim/prob/neg_binomial_2_rng.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include #include diff --git a/stan/math/prim/prob/neg_binomial_cdf.hpp b/stan/math/prim/prob/neg_binomial_cdf.hpp index 8b50f572f45..0dca1aae2bf 100644 --- a/stan/math/prim/prob/neg_binomial_cdf.hpp +++ b/stan/math/prim/prob/neg_binomial_cdf.hpp @@ -2,13 +2,13 @@ #define STAN_MATH_PRIM_PROB_NEG_BINOMIAL_CDF_HPP #include -#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/stan/math/prim/prob/neg_binomial_lccdf.hpp b/stan/math/prim/prob/neg_binomial_lccdf.hpp index 563d17055a5..15323fe2a78 100644 --- a/stan/math/prim/prob/neg_binomial_lccdf.hpp +++ b/stan/math/prim/prob/neg_binomial_lccdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/stan/math/prim/prob/neg_binomial_lcdf.hpp b/stan/math/prim/prob/neg_binomial_lcdf.hpp index c772cff32a9..30a10433f18 100644 --- a/stan/math/prim/prob/neg_binomial_lcdf.hpp +++ b/stan/math/prim/prob/neg_binomial_lcdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/stan/math/prim/prob/neg_binomial_lpmf.hpp b/stan/math/prim/prob/neg_binomial_lpmf.hpp index 39ce1af2ebf..e4fa3fabcce 100644 --- a/stan/math/prim/prob/neg_binomial_lpmf.hpp +++ b/stan/math/prim/prob/neg_binomial_lpmf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/neg_binomial_rng.hpp b/stan/math/prim/prob/neg_binomial_rng.hpp index 55e78f0d73b..8d7d69e0501 100644 --- a/stan/math/prim/prob/neg_binomial_rng.hpp +++ b/stan/math/prim/prob/neg_binomial_rng.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include #include diff --git a/stan/math/prim/prob/normal_cdf.hpp b/stan/math/prim/prob/normal_cdf.hpp index 4866e8ca3c2..d15d8daa6af 100644 --- a/stan/math/prim/prob/normal_cdf.hpp +++ b/stan/math/prim/prob/normal_cdf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/normal_id_glm_lpdf.hpp b/stan/math/prim/prob/normal_id_glm_lpdf.hpp index d7480ad14ab..50414a376f0 100644 --- a/stan/math/prim/prob/normal_id_glm_lpdf.hpp +++ b/stan/math/prim/prob/normal_id_glm_lpdf.hpp @@ -3,13 +3,11 @@ #include #include -#include -#include -#include -#include -#include -#include - +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/normal_lccdf.hpp b/stan/math/prim/prob/normal_lccdf.hpp index caaf286e92c..9c60c57f77c 100644 --- a/stan/math/prim/prob/normal_lccdf.hpp +++ b/stan/math/prim/prob/normal_lccdf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/normal_lcdf.hpp b/stan/math/prim/prob/normal_lcdf.hpp index 325020c2275..a189e140760 100644 --- a/stan/math/prim/prob/normal_lcdf.hpp +++ b/stan/math/prim/prob/normal_lcdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/stan/math/prim/prob/normal_lpdf.hpp b/stan/math/prim/prob/normal_lpdf.hpp index 36087979d2b..18f6562c961 100644 --- a/stan/math/prim/prob/normal_lpdf.hpp +++ b/stan/math/prim/prob/normal_lpdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/normal_sufficient_lpdf.hpp b/stan/math/prim/prob/normal_sufficient_lpdf.hpp index 76acb63e2dc..235fd1449d4 100644 --- a/stan/math/prim/prob/normal_sufficient_lpdf.hpp +++ b/stan/math/prim/prob/normal_sufficient_lpdf.hpp @@ -2,11 +2,11 @@ #define STAN_MATH_PRIM_PROB_NORMAL_SUFFICIENT_LPDF_HPP #include -#include #include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/ordered_logistic_glm_lpmf.hpp b/stan/math/prim/prob/ordered_logistic_glm_lpmf.hpp index 5a6d1d7ce74..77af289ba0b 100644 --- a/stan/math/prim/prob/ordered_logistic_glm_lpmf.hpp +++ b/stan/math/prim/prob/ordered_logistic_glm_lpmf.hpp @@ -3,10 +3,9 @@ #include #include -#include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/ordered_logistic_lpmf.hpp b/stan/math/prim/prob/ordered_logistic_lpmf.hpp index c3fc1c51b71..fd8a4244176 100644 --- a/stan/math/prim/prob/ordered_logistic_lpmf.hpp +++ b/stan/math/prim/prob/ordered_logistic_lpmf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/ordered_logistic_rng.hpp b/stan/math/prim/prob/ordered_logistic_rng.hpp index 8f5397666ca..29b96f41351 100644 --- a/stan/math/prim/prob/ordered_logistic_rng.hpp +++ b/stan/math/prim/prob/ordered_logistic_rng.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include diff --git a/stan/math/prim/prob/ordered_probit_lpmf.hpp b/stan/math/prim/prob/ordered_probit_lpmf.hpp index 800ec23833e..4e6a2a6cd7b 100644 --- a/stan/math/prim/prob/ordered_probit_lpmf.hpp +++ b/stan/math/prim/prob/ordered_probit_lpmf.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/stan/math/prim/prob/ordered_probit_rng.hpp b/stan/math/prim/prob/ordered_probit_rng.hpp index 13197fd7d18..724b1a3e77c 100644 --- a/stan/math/prim/prob/ordered_probit_rng.hpp +++ b/stan/math/prim/prob/ordered_probit_rng.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/pareto_cdf.hpp b/stan/math/prim/prob/pareto_cdf.hpp index 78eb34afdc8..a366a55617c 100644 --- a/stan/math/prim/prob/pareto_cdf.hpp +++ b/stan/math/prim/prob/pareto_cdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/pareto_lccdf.hpp b/stan/math/prim/prob/pareto_lccdf.hpp index b26f5b23228..2681ff0b86a 100644 --- a/stan/math/prim/prob/pareto_lccdf.hpp +++ b/stan/math/prim/prob/pareto_lccdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/pareto_lcdf.hpp b/stan/math/prim/prob/pareto_lcdf.hpp index f6dcfbbc946..6bf4a61fe83 100644 --- a/stan/math/prim/prob/pareto_lcdf.hpp +++ b/stan/math/prim/prob/pareto_lcdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/pareto_lpdf.hpp b/stan/math/prim/prob/pareto_lpdf.hpp index fb98cd2ec92..f9cb9dabb1c 100644 --- a/stan/math/prim/prob/pareto_lpdf.hpp +++ b/stan/math/prim/prob/pareto_lpdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/pareto_type_2_cdf.hpp b/stan/math/prim/prob/pareto_type_2_cdf.hpp index 7604b6b62f7..e27ed11ae1e 100644 --- a/stan/math/prim/prob/pareto_type_2_cdf.hpp +++ b/stan/math/prim/prob/pareto_type_2_cdf.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/pareto_type_2_lccdf.hpp b/stan/math/prim/prob/pareto_type_2_lccdf.hpp index 422d8e822b5..3bbfce034ac 100644 --- a/stan/math/prim/prob/pareto_type_2_lccdf.hpp +++ b/stan/math/prim/prob/pareto_type_2_lccdf.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/pareto_type_2_lcdf.hpp b/stan/math/prim/prob/pareto_type_2_lcdf.hpp index ff11a836f9e..716bf530e4b 100644 --- a/stan/math/prim/prob/pareto_type_2_lcdf.hpp +++ b/stan/math/prim/prob/pareto_type_2_lcdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/pareto_type_2_lpdf.hpp b/stan/math/prim/prob/pareto_type_2_lpdf.hpp index d68eff0176c..fcb99594741 100644 --- a/stan/math/prim/prob/pareto_type_2_lpdf.hpp +++ b/stan/math/prim/prob/pareto_type_2_lpdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/poisson_cdf.hpp b/stan/math/prim/prob/poisson_cdf.hpp index f4290424a44..de1b5a7c0ca 100644 --- a/stan/math/prim/prob/poisson_cdf.hpp +++ b/stan/math/prim/prob/poisson_cdf.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/stan/math/prim/prob/poisson_lccdf.hpp b/stan/math/prim/prob/poisson_lccdf.hpp index 0888d0dbe61..fc56755c2d3 100644 --- a/stan/math/prim/prob/poisson_lccdf.hpp +++ b/stan/math/prim/prob/poisson_lccdf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include diff --git a/stan/math/prim/prob/poisson_lcdf.hpp b/stan/math/prim/prob/poisson_lcdf.hpp index dfeae3821b0..440c18f80a1 100644 --- a/stan/math/prim/prob/poisson_lcdf.hpp +++ b/stan/math/prim/prob/poisson_lcdf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include diff --git a/stan/math/prim/prob/poisson_log_glm_lpmf.hpp b/stan/math/prim/prob/poisson_log_glm_lpmf.hpp index 7708443e0cf..432e5f10d26 100644 --- a/stan/math/prim/prob/poisson_log_glm_lpmf.hpp +++ b/stan/math/prim/prob/poisson_log_glm_lpmf.hpp @@ -3,11 +3,10 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/poisson_log_lpmf.hpp b/stan/math/prim/prob/poisson_log_lpmf.hpp index 035c76128ea..ffdb04b8bdc 100644 --- a/stan/math/prim/prob/poisson_log_lpmf.hpp +++ b/stan/math/prim/prob/poisson_log_lpmf.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/poisson_log_rng.hpp b/stan/math/prim/prob/poisson_log_rng.hpp index a6a3005e272..7136813f507 100644 --- a/stan/math/prim/prob/poisson_log_rng.hpp +++ b/stan/math/prim/prob/poisson_log_rng.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include #include diff --git a/stan/math/prim/prob/poisson_lpmf.hpp b/stan/math/prim/prob/poisson_lpmf.hpp index 6b748804a44..5779d9c548b 100644 --- a/stan/math/prim/prob/poisson_lpmf.hpp +++ b/stan/math/prim/prob/poisson_lpmf.hpp @@ -3,12 +3,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/poisson_rng.hpp b/stan/math/prim/prob/poisson_rng.hpp index 278205dd092..a535bd2b060 100644 --- a/stan/math/prim/prob/poisson_rng.hpp +++ b/stan/math/prim/prob/poisson_rng.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include diff --git a/stan/math/prim/prob/rayleigh_cdf.hpp b/stan/math/prim/prob/rayleigh_cdf.hpp index f4aa324b544..6b702139361 100644 --- a/stan/math/prim/prob/rayleigh_cdf.hpp +++ b/stan/math/prim/prob/rayleigh_cdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/rayleigh_lccdf.hpp b/stan/math/prim/prob/rayleigh_lccdf.hpp index b95ca0aa81b..906f0235468 100644 --- a/stan/math/prim/prob/rayleigh_lccdf.hpp +++ b/stan/math/prim/prob/rayleigh_lccdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/rayleigh_lcdf.hpp b/stan/math/prim/prob/rayleigh_lcdf.hpp index cd9755aa677..f032157d1e1 100644 --- a/stan/math/prim/prob/rayleigh_lcdf.hpp +++ b/stan/math/prim/prob/rayleigh_lcdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/rayleigh_lpdf.hpp b/stan/math/prim/prob/rayleigh_lpdf.hpp index fdc584eddef..6199e23e8aa 100644 --- a/stan/math/prim/prob/rayleigh_lpdf.hpp +++ b/stan/math/prim/prob/rayleigh_lpdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { 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 abae189bce8..a18204b0355 100644 --- a/stan/math/prim/prob/scaled_inv_chi_square_cdf.hpp +++ b/stan/math/prim/prob/scaled_inv_chi_square_cdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { 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 1fb4d8fa692..d0de2af42c2 100644 --- a/stan/math/prim/prob/scaled_inv_chi_square_lccdf.hpp +++ b/stan/math/prim/prob/scaled_inv_chi_square_lccdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { 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 32d51ab901b..4054381a096 100644 --- a/stan/math/prim/prob/scaled_inv_chi_square_lcdf.hpp +++ b/stan/math/prim/prob/scaled_inv_chi_square_lcdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { 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 12ae1df6381..0cd4762d3f9 100644 --- a/stan/math/prim/prob/scaled_inv_chi_square_lpdf.hpp +++ b/stan/math/prim/prob/scaled_inv_chi_square_lpdf.hpp @@ -3,12 +3,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/skew_normal_cdf.hpp b/stan/math/prim/prob/skew_normal_cdf.hpp index 527c0558c04..cbb2cbfca52 100644 --- a/stan/math/prim/prob/skew_normal_cdf.hpp +++ b/stan/math/prim/prob/skew_normal_cdf.hpp @@ -3,12 +3,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/skew_normal_lccdf.hpp b/stan/math/prim/prob/skew_normal_lccdf.hpp index abb9340f74b..6f76ec9973c 100644 --- a/stan/math/prim/prob/skew_normal_lccdf.hpp +++ b/stan/math/prim/prob/skew_normal_lccdf.hpp @@ -3,12 +3,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/skew_normal_lcdf.hpp b/stan/math/prim/prob/skew_normal_lcdf.hpp index cc55f84b536..24f6190e9bf 100644 --- a/stan/math/prim/prob/skew_normal_lcdf.hpp +++ b/stan/math/prim/prob/skew_normal_lcdf.hpp @@ -3,12 +3,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/skew_normal_lpdf.hpp b/stan/math/prim/prob/skew_normal_lpdf.hpp index 63e83078fd7..a9595881a60 100644 --- a/stan/math/prim/prob/skew_normal_lpdf.hpp +++ b/stan/math/prim/prob/skew_normal_lpdf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/std_normal_cdf.hpp b/stan/math/prim/prob/std_normal_cdf.hpp index 499c26511bf..a155aa5ef57 100644 --- a/stan/math/prim/prob/std_normal_cdf.hpp +++ b/stan/math/prim/prob/std_normal_cdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/std_normal_lccdf.hpp b/stan/math/prim/prob/std_normal_lccdf.hpp index e28c464b309..1be4fb8035e 100644 --- a/stan/math/prim/prob/std_normal_lccdf.hpp +++ b/stan/math/prim/prob/std_normal_lccdf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/std_normal_lcdf.hpp b/stan/math/prim/prob/std_normal_lcdf.hpp index f5d5084c0bc..c5a35aaa39e 100644 --- a/stan/math/prim/prob/std_normal_lcdf.hpp +++ b/stan/math/prim/prob/std_normal_lcdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/stan/math/prim/prob/std_normal_lpdf.hpp b/stan/math/prim/prob/std_normal_lpdf.hpp index fb2e9fdbe3b..a2911c64923 100644 --- a/stan/math/prim/prob/std_normal_lpdf.hpp +++ b/stan/math/prim/prob/std_normal_lpdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/student_t_cdf.hpp b/stan/math/prim/prob/student_t_cdf.hpp index 3bf4338e1c2..362840ef92c 100644 --- a/stan/math/prim/prob/student_t_cdf.hpp +++ b/stan/math/prim/prob/student_t_cdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/student_t_lccdf.hpp b/stan/math/prim/prob/student_t_lccdf.hpp index bb4c1e39a10..ab8c43190b6 100644 --- a/stan/math/prim/prob/student_t_lccdf.hpp +++ b/stan/math/prim/prob/student_t_lccdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/student_t_lcdf.hpp b/stan/math/prim/prob/student_t_lcdf.hpp index c937b3de0fe..09d0b019112 100644 --- a/stan/math/prim/prob/student_t_lcdf.hpp +++ b/stan/math/prim/prob/student_t_lcdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/student_t_lpdf.hpp b/stan/math/prim/prob/student_t_lpdf.hpp index afd897a5730..819ef98863a 100644 --- a/stan/math/prim/prob/student_t_lpdf.hpp +++ b/stan/math/prim/prob/student_t_lpdf.hpp @@ -3,13 +3,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/uniform_cdf.hpp b/stan/math/prim/prob/uniform_cdf.hpp index 87803c27a31..2c9f290d931 100644 --- a/stan/math/prim/prob/uniform_cdf.hpp +++ b/stan/math/prim/prob/uniform_cdf.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/uniform_lccdf.hpp b/stan/math/prim/prob/uniform_lccdf.hpp index 0a1726c8b42..b817120421d 100644 --- a/stan/math/prim/prob/uniform_lccdf.hpp +++ b/stan/math/prim/prob/uniform_lccdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/uniform_lcdf.hpp b/stan/math/prim/prob/uniform_lcdf.hpp index e3ec7b383f2..b762b90ebf9 100644 --- a/stan/math/prim/prob/uniform_lcdf.hpp +++ b/stan/math/prim/prob/uniform_lcdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/uniform_lpdf.hpp b/stan/math/prim/prob/uniform_lpdf.hpp index 281c298422a..cc1d8fea778 100644 --- a/stan/math/prim/prob/uniform_lpdf.hpp +++ b/stan/math/prim/prob/uniform_lpdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/uniform_rng.hpp b/stan/math/prim/prob/uniform_rng.hpp index ac728bf77ac..bfcd19fbe47 100644 --- a/stan/math/prim/prob/uniform_rng.hpp +++ b/stan/math/prim/prob/uniform_rng.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/stan/math/prim/prob/von_mises_lpdf.hpp b/stan/math/prim/prob/von_mises_lpdf.hpp index 8a11b7e5878..60783eb3932 100644 --- a/stan/math/prim/prob/von_mises_lpdf.hpp +++ b/stan/math/prim/prob/von_mises_lpdf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/von_mises_rng.hpp b/stan/math/prim/prob/von_mises_rng.hpp index 04f775e5395..89241b7c9cb 100644 --- a/stan/math/prim/prob/von_mises_rng.hpp +++ b/stan/math/prim/prob/von_mises_rng.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include #include diff --git a/stan/math/prim/prob/weibull_cdf.hpp b/stan/math/prim/prob/weibull_cdf.hpp index 759de78e464..5c932d6dcac 100644 --- a/stan/math/prim/prob/weibull_cdf.hpp +++ b/stan/math/prim/prob/weibull_cdf.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/weibull_lccdf.hpp b/stan/math/prim/prob/weibull_lccdf.hpp index 255d48c637c..5297f0338f4 100644 --- a/stan/math/prim/prob/weibull_lccdf.hpp +++ b/stan/math/prim/prob/weibull_lccdf.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/weibull_lcdf.hpp b/stan/math/prim/prob/weibull_lcdf.hpp index 3da37d04812..b172bd5de34 100644 --- a/stan/math/prim/prob/weibull_lcdf.hpp +++ b/stan/math/prim/prob/weibull_lcdf.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/weibull_lpdf.hpp b/stan/math/prim/prob/weibull_lpdf.hpp index f4539c6b257..309730d0aa4 100644 --- a/stan/math/prim/prob/weibull_lpdf.hpp +++ b/stan/math/prim/prob/weibull_lpdf.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/wiener_lpdf.hpp b/stan/math/prim/prob/wiener_lpdf.hpp index b23d2a3fed7..42fc8682751 100644 --- a/stan/math/prim/prob/wiener_lpdf.hpp +++ b/stan/math/prim/prob/wiener_lpdf.hpp @@ -31,11 +31,11 @@ #ifndef STAN_MATH_PRIM_PROB_WIENER_LPDF_HPP #define STAN_MATH_PRIM_PROB_WIENER_LPDF_HPP -#include -#include -#include #include -#include +#include +#include +#include +#include #include #include #include diff --git a/stan/math/prim/prob/wishart_log.hpp b/stan/math/prim/prob/wishart_log.hpp index 38795e45cba..4ce80610a42 100644 --- a/stan/math/prim/prob/wishart_log.hpp +++ b/stan/math/prim/prob/wishart_log.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_PRIM_PROB_WISHART_LOG_HPP #include -#include +#include #include namespace stan { diff --git a/stan/math/prim/prob/wishart_lpdf.hpp b/stan/math/prim/prob/wishart_lpdf.hpp index 1ea01d2a61b..62be9f27708 100644 --- a/stan/math/prim/prob/wishart_lpdf.hpp +++ b/stan/math/prim/prob/wishart_lpdf.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/prim/prob/wishart_rng.hpp b/stan/math/prim/prob/wishart_rng.hpp index 76667c2397b..caf49123100 100644 --- a/stan/math/prim/prob/wishart_rng.hpp +++ b/stan/math/prim/prob/wishart_rng.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include #include diff --git a/stan/math/prim/scal.hpp b/stan/math/prim/scal.hpp deleted file mode 100644 index c378b75696d..00000000000 --- a/stan/math/prim/scal.hpp +++ /dev/null @@ -1,395 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_HPP -#define STAN_MATH_PRIM_SCAL_HPP - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#endif diff --git a/stan/math/prim/scal/fun/Phi_approx.hpp b/stan/math/prim/scal/fun/Phi_approx.hpp deleted file mode 100644 index d95ecbdf3ee..00000000000 --- a/stan/math/prim/scal/fun/Phi_approx.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_PHI_APPROX_HPP -#define STAN_MATH_PRIM_SCAL_FUN_PHI_APPROX_HPP - -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Return an approximation of the unit normal CDF. - * - * http://www.jiem.org/index.php/jiem/article/download/60/27 - * - * This function can be used to implement the inverse link function - * for probit regression. - * - * @param x Argument. - * @return Probability random sample is less than or equal to argument. - */ -inline double Phi_approx(double x) { - using std::pow; - return inv_logit(0.07056 * pow(x, 3.0) + 1.5976 * x); -} - -/** - * Return an approximation of the unit normal CDF. - * - * @param x argument. - * @return approximate probability random sample is less than or - * equal to argument. - */ -inline double Phi_approx(int x) { return Phi_approx(static_cast(x)); } - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/scal/fun/acosh.hpp b/stan/math/prim/scal/fun/acosh.hpp deleted file mode 100644 index 9e785ac71be..00000000000 --- a/stan/math/prim/scal/fun/acosh.hpp +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_ACOSH_HPP -#define STAN_MATH_PRIM_SCAL_FUN_ACOSH_HPP - -#include -#include -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Return the inverse hyperbolic cosine of the specified value. - * Returns nan for nan argument. - * - * @param[in] x Argument. - * @return Inverse hyperbolic cosine of the argument. - * @throw std::domain_error If argument is less than 1. - */ -inline double acosh(double x) { - if (is_nan(x)) { - return x; - } else { - check_greater_or_equal("acosh", "x", x, 1.0); -#ifdef _WIN32 - if (is_inf(x)) - return x; -#endif - return std::acosh(x); - } -} - -/** - * Integer version of acosh. - * - * @param[in] x Argument. - * @return Inverse hyperbolic cosine of the argument. - * @throw std::domain_error If argument is less than 1. - */ -inline double acosh(int x) { - if (is_nan(x)) { - return x; - } else { - check_greater_or_equal("acosh", "x", x, 1); -#ifdef _WIN32 - if (is_inf(x)) - return x; -#endif - return std::acosh(x); - } -} - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/scal/fun/asinh.hpp b/stan/math/prim/scal/fun/asinh.hpp deleted file mode 100644 index c409eb67f77..00000000000 --- a/stan/math/prim/scal/fun/asinh.hpp +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_ASINH_HPP -#define STAN_MATH_PRIM_SCAL_FUN_ASINH_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Return the inverse hyperbolic sine of the specified value. - * Returns infinity for infinity argument and -infinity for - * -infinity argument. - * Returns nan for nan argument. - * - * @param[in] x Argument. - * @return Inverse hyperbolic sine of the argument. - */ -inline double asinh(double x) { return std::asinh(x); } - -/** - * Integer version of asinh. - * - * @param[in] x Argument. - * @return Inverse hyperbolic sine of the argument. - */ -inline double asinh(int x) { return std::asinh(x); } - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/scal/fun/atanh.hpp b/stan/math/prim/scal/fun/atanh.hpp deleted file mode 100644 index aa4bfc6456f..00000000000 --- a/stan/math/prim/scal/fun/atanh.hpp +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_ATANH_HPP -#define STAN_MATH_PRIM_SCAL_FUN_ATANH_HPP - -#include -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Return the inverse hyperbolic tangent of the specified value. - * An argument of -1 returns negative infinity and an argument of 1 - * returns infinity. - * Returns nan for nan argument. - * - * @param[in] x Argument. - * @return Inverse hyperbolic tangent of the argument. - * @throw std::domain_error If argument is not in [-1, 1]. - */ -inline double atanh(double x) { - if (is_nan(x)) { - return x; - } else { - check_bounded("atanh", "x", x, -1.0, 1.0); - return std::atanh(x); - } -} - -/** - * Integer version of atanh. - * - * @param[in] x Argument. - * @return Inverse hyperbolic tangent of the argument. - * @throw std::domain_error If argument is less than 1. - */ -inline double atanh(int x) { - if (is_nan(x)) { - return x; - } else { - check_bounded("atanh", "x", x, -1, 1); - return std::atanh(x); - } -} - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/scal/fun/cbrt.hpp b/stan/math/prim/scal/fun/cbrt.hpp deleted file mode 100644 index 7ce8eef5372..00000000000 --- a/stan/math/prim/scal/fun/cbrt.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_CBRT_HPP -#define STAN_MATH_PRIM_SCAL_FUN_CBRT_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Return the cube root of the specified value - * - * @param[in] x Argument. - * @return Cube root of the argument. - * @throw std::domain_error If argument is negative. - */ -inline double cbrt(double x) { return std::cbrt(x); } - -/** - * Integer version of cbrt. - * - * @param[in] x Argument. - * @return Cube root of the argument. - * @throw std::domain_error If argument is less than 1. - */ -inline double cbrt(int x) { return std::cbrt(x); } - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/scal/fun/common_type.hpp b/stan/math/prim/scal/fun/common_type.hpp deleted file mode 100644 index 863f4c99d14..00000000000 --- a/stan/math/prim/scal/fun/common_type.hpp +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_COMMON_TYPE_HPP -#define STAN_MATH_PRIM_SCAL_FUN_COMMON_TYPE_HPP - -#include - -namespace stan { -namespace math { -/** - * Struct which calculates type promotion given two types. - * - *

This is the base implementation for scalar types. - * Allowed promotions are: - * - int to double - * - int to var - * - double to var - * - *

Promotion between differing var types is not allowed, i.e., - * cannot promote fvar to var or vice versa. - * - * @tparam T1 scalar type - * @tparam T2 scalar type - */ -template -struct common_type { - using type = return_type_t; -}; - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/scal/fun/distance.hpp b/stan/math/prim/scal/fun/distance.hpp deleted file mode 100644 index 9db02c5630b..00000000000 --- a/stan/math/prim/scal/fun/distance.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_DISTANCE_HPP -#define STAN_MATH_PRIM_SCAL_FUN_DISTANCE_HPP - -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Returns the distance between two scalars. - * - * @param x1 First scalar. - * @param x2 Second scalar. - * @return Distance between two scalars - * @throw std::domain_error If the arguments are not finite. - */ -template -inline return_type_t distance(const T1& x1, const T2& x2) { - check_finite("distance", "x1", x1); - check_finite("distance", "x2", x2); - return abs(x1 - x2); -} -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/scal/fun/divide.hpp b/stan/math/prim/scal/fun/divide.hpp deleted file mode 100644 index 2cce3e009cc..00000000000 --- a/stan/math/prim/scal/fun/divide.hpp +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_DIVIDE_HPP -#define STAN_MATH_PRIM_SCAL_FUN_DIVIDE_HPP - -#include -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Return the division of the first scalar by - * the second scalar. - * @param[in] x Specified vector. - * @param[in] y Specified scalar. - * @return Vector divided by the scalar. - */ -template -inline return_type_t divide(const T1& x, const T2& y) { - return x / y; -} - -inline int divide(int x, int y) { - if (unlikely(y == 0)) { - throw_domain_error("divide", "denominator is", y, ""); - } - return x / y; -} - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/scal/fun/exp.hpp b/stan/math/prim/scal/fun/exp.hpp deleted file mode 100644 index a7f087f8b5e..00000000000 --- a/stan/math/prim/scal/fun/exp.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_EXP_HPP -#define STAN_MATH_PRIM_SCAL_FUN_EXP_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Return the natural exponential of the specified argument. This - * version is required to disambiguate exp(int). - * - * @param[in] x Argument. - * @return Natural exponential of argument. - */ -inline double exp(int x) { return std::exp(x); } - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/scal/fun/exp2.hpp b/stan/math/prim/scal/fun/exp2.hpp deleted file mode 100644 index 4e1ed0775db..00000000000 --- a/stan/math/prim/scal/fun/exp2.hpp +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_EXP2_HPP -#define STAN_MATH_PRIM_SCAL_FUN_EXP2_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Return the exponent base 2 of the specified argument (C99, - * C++11). - * - * The exponent base 2 function is defined by - * - * exp2(y) = pow(2.0, y). - * - * @param y argument. - * @return exponent base 2 of argument. - */ -template > -inline double exp2(T y) { - using std::exp2; - return exp2(y); -} - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/scal/fun/expm1.hpp b/stan/math/prim/scal/fun/expm1.hpp deleted file mode 100644 index c3033d68985..00000000000 --- a/stan/math/prim/scal/fun/expm1.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_EXPM1_HPP -#define STAN_MATH_PRIM_SCAL_FUN_EXPM1_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Return the natural exponentiation of x minus one. - * Returns infinity for infinity argument and -infinity for - * -infinity argument. - * - * @param[in] x Argument. - * @return Natural exponentiation of argument minus one. - */ -inline double expm1(double x) { return std::expm1(x); } - -/** - * Integer version of expm1. - * - * @param[in] x Argument. - * @return Natural exponentiation of argument minus one. - */ -inline double expm1(int x) { return std::expm1(x); } - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/scal/fun/fill.hpp b/stan/math/prim/scal/fun/fill.hpp deleted file mode 100644 index ba0852f8b53..00000000000 --- a/stan/math/prim/scal/fun/fill.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_FILL_HPP -#define STAN_MATH_PRIM_SCAL_FUN_FILL_HPP - -#include -namespace stan { -namespace math { - -/** - * Fill the specified container with the specified value. - * - * This base case simply assigns the value to the container. - * - * @tparam T Type of reference container. - * @tparam S Type of value. - * @param x Container. - * @param y Value. - */ -template -void fill(T& x, const S& y) { - x = y; -} - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/scal/fun/inv.hpp b/stan/math/prim/scal/fun/inv.hpp deleted file mode 100644 index a72416ac32a..00000000000 --- a/stan/math/prim/scal/fun/inv.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_INV_HPP -#define STAN_MATH_PRIM_SCAL_FUN_INV_HPP - -#include -namespace stan { -namespace math { - -inline double inv(double x) { return 1.0 / x; } - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/scal/fun/inv_cloglog.hpp b/stan/math/prim/scal/fun/inv_cloglog.hpp deleted file mode 100644 index 8ae8133bf48..00000000000 --- a/stan/math/prim/scal/fun/inv_cloglog.hpp +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_INV_CLOGLOG_HPP -#define STAN_MATH_PRIM_SCAL_FUN_INV_CLOGLOG_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * The inverse complementary log-log function. - * - * The function is defined by - * - * inv_cloglog(x) = 1 - exp(-exp(x)). - * - * This function can be used to implement the inverse link - * function for complementary-log-log regression. - * - * - \f[ - \mbox{inv\_cloglog}(y) = - \begin{cases} - \mbox{cloglog}^{-1}(y) & \mbox{if } -\infty\leq y \leq \infty \\[6pt] - \textrm{NaN} & \mbox{if } y = \textrm{NaN} - \end{cases} - \f] - - \f[ - \frac{\partial\, \mbox{inv\_cloglog}(y)}{\partial y} = - \begin{cases} - \frac{\partial\, \mbox{cloglog}^{-1}(y)}{\partial y} & \mbox{if } - -\infty\leq y\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } y = \textrm{NaN} - \end{cases} - \f] - - \f[ - \mbox{cloglog}^{-1}(y) = 1 - \exp \left( - \exp(y) \right) - \f] - - \f[ - \frac{\partial \, \mbox{cloglog}^{-1}(y)}{\partial y} = \exp(y-\exp(y)) - \f] - * - * @param x Argument. - * @return Inverse complementary log-log of the argument. - */ -inline double inv_cloglog(double x) { - using std::exp; - return 1 - exp(-exp(x)); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/scal/fun/inv_sqrt.hpp b/stan/math/prim/scal/fun/inv_sqrt.hpp deleted file mode 100644 index bdffe882409..00000000000 --- a/stan/math/prim/scal/fun/inv_sqrt.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_INV_SQRT_HPP -#define STAN_MATH_PRIM_SCAL_FUN_INV_SQRT_HPP - -#include -#include -#include - -namespace stan { -namespace math { - -inline double inv_sqrt(double x) { - using std::sqrt; - return inv(sqrt(x)); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/scal/fun/inv_square.hpp b/stan/math/prim/scal/fun/inv_square.hpp deleted file mode 100644 index b7d49459632..00000000000 --- a/stan/math/prim/scal/fun/inv_square.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_INV_SQUARE_HPP -#define STAN_MATH_PRIM_SCAL_FUN_INV_SQUARE_HPP - -#include -#include - -namespace stan { -namespace math { - -inline double inv_square(double x) { return inv(square(x)); } -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/scal/fun/log.hpp b/stan/math/prim/scal/fun/log.hpp deleted file mode 100644 index bf1a6c1743f..00000000000 --- a/stan/math/prim/scal/fun/log.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOG_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOG_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Return the natural log of the specified argument. This version - * is required to disambiguate log(int). - * - * @param[in] x Argument. - * @return Natural log of argument. - */ -inline double log(int x) { return std::log(x); } - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/scal/fun/log2.hpp b/stan/math/prim/scal/fun/log2.hpp deleted file mode 100644 index a3f954eca33..00000000000 --- a/stan/math/prim/scal/fun/log2.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOG2_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOG2_HPP - -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Returns the base two logarithm of the argument (C99, C++11). - * - * The function is defined by: - * - * log2(a) = log(a) / std::log(2.0). - * - * @param[in] u argument - * @return base two logarithm of argument - */ -template > -inline double log2(T u) { - using std::log2; - return log2(u); -} - -/** - * Return natural logarithm of two. - * - * @return Natural logarithm of two. - */ -inline double log2() { return LOG_TWO; } - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/scal/fun/log_mix.hpp b/stan/math/prim/scal/fun/log_mix.hpp deleted file mode 100644 index 7209e00e0e5..00000000000 --- a/stan/math/prim/scal/fun/log_mix.hpp +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOG_MIX_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOG_MIX_HPP - -#include -#include -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Return the log mixture density with specified mixing proportion - * and log densities. - * - * \f[ - * \mbox{log\_mix}(\theta, \lambda_1, \lambda_2) - * = \log \left( \theta \lambda_1 + (1 - \theta) \lambda_2 \right). - * \f] - * - * @param[in] theta mixing proportion in [0, 1]. - * @param[in] lambda1 first log density. - * @param[in] lambda2 second log density. - * @return log mixture of densities in specified proportion - */ -inline double log_mix(double theta, double lambda1, double lambda2) { - using std::log; - check_not_nan("log_mix", "lambda1", lambda1); - check_not_nan("log_mix", "lambda2", lambda2); - check_bounded("log_mix", "theta", theta, 0, 1); - return log_sum_exp(log(theta) + lambda1, log1m(theta) + lambda2); -} - -/** - * Return the log mixture density with specified mixing proportion - * and log densities. - * - * @param[in] theta mixing proportion in [0, 1]. - * @param[in] lambda1 first log density. - * @param[in] lambda2 second log density. - * @return log mixture of densities in specified proportion - */ -inline double log_mix(double theta, double lambda1, int lambda2) { - return log_mix(theta, lambda1, static_cast(lambda2)); -} - -/** - * Return the log mixture density with specified mixing proportion - * and log densities. - * - * @param[in] theta mixing proportion in [0, 1]. - * @param[in] lambda1 first log density. - * @param[in] lambda2 second log density. - * @return log mixture of densities in specified proportion - */ -inline double log_mix(double theta, int lambda1, double lambda2) { - return log_mix(theta, static_cast(lambda1), lambda2); -} - -/** - * Return the log mixture density with specified mixing proportion - * and log densities. - * - * @param[in] theta mixing proportion in [0, 1]. - * @param[in] lambda1 first log density. - * @param[in] lambda2 second log density. - * @return log mixture of densities in specified proportion - */ -inline double log_mix(int theta, double lambda1, double lambda2) { - return log_mix(static_cast(theta), lambda1, lambda2); -} - -/** - * Return the log mixture density with specified mixing proportion - * and log densities. - * - * @param[in] theta mixing proportion in [0, 1]. - * @param[in] lambda1 first log density. - * @param[in] lambda2 second log density. - * @return log mixture of densities in specified proportion - */ -inline double log_mix(double theta, int lambda1, int lambda2) { - return log_mix(theta, static_cast(lambda1), - static_cast(lambda2)); -} - -/** - * Return the log mixture density with specified mixing proportion - * and log densities. - * - * @param[in] theta mixing proportion in [0, 1]. - * @param[in] lambda1 first log density. - * @param[in] lambda2 second log density. - * @return log mixture of densities in specified proportion - */ -inline double log_mix(int theta, double lambda1, int lambda2) { - return log_mix(static_cast(theta), lambda1, - static_cast(lambda2)); -} - -/** - * Return the log mixture density with specified mixing proportion - * and log densities. - * - * @param[in] theta mixing proportion in [0, 1]. - * @param[in] lambda1 first log density. - * @param[in] lambda2 second log density. - * @return log mixture of densities in specified proportion - */ -inline double log_mix(int theta, int lambda1, int lambda2) { - return log_mix(static_cast(theta), static_cast(lambda1), - static_cast(lambda2)); -} - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/scal/fun/log_sum_exp.hpp b/stan/math/prim/scal/fun/log_sum_exp.hpp deleted file mode 100644 index c73d4b7e559..00000000000 --- a/stan/math/prim/scal/fun/log_sum_exp.hpp +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_LOG_SUM_EXP_HPP -#define STAN_MATH_PRIM_SCAL_FUN_LOG_SUM_EXP_HPP - -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Calculates the log sum of exponetials without overflow. - * - * \f$\log (\exp(a) + \exp(b)) = m + \log(\exp(a-m) + \exp(b-m))\f$, - * - * where \f$m = max(a, b)\f$. - * - * - \f[ - \mbox{log\_sum\_exp}(x, y) = - \begin{cases} - \ln(\exp(x)+\exp(y)) & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] - \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} - \end{cases} - \f] - - \f[ - \frac{\partial\, \mbox{log\_sum\_exp}(x, y)}{\partial x} = - \begin{cases} - \frac{\exp(x)}{\exp(x)+\exp(y)} & \mbox{if } -\infty\leq x, y \leq \infty - \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} - \end{cases} - \f] - - \f[ - \frac{\partial\, \mbox{log\_sum\_exp}(x, y)}{\partial y} = - \begin{cases} - \frac{\exp(y)}{\exp(x)+\exp(y)} & \mbox{if } -\infty\leq x, y \leq \infty - \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} - \end{cases} - \f] - * - * @param a the first variable - * @param b the second variable - */ -template -inline return_type_t log_sum_exp(const T2& a, const T1& b) { - if (a == NEGATIVE_INFTY) { - return b; - } - if (a == INFTY && b == INFTY) { - return INFTY; - } - if (a > b) { - return a + log1p_exp(b - a); - } - return b + log1p_exp(a - b); -} - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/scal/fun/promote_elements.hpp b/stan/math/prim/scal/fun/promote_elements.hpp deleted file mode 100644 index 1282b9ad9a0..00000000000 --- a/stan/math/prim/scal/fun/promote_elements.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_PROMOTE_ELEMENTS_HPP -#define STAN_MATH_PRIM_SCAL_FUN_PROMOTE_ELEMENTS_HPP - -#include -namespace stan { -namespace math { - -/** - * Struct with static function for elementwise type promotion. - * - *

This base implementation promotes one scalar value to another. - * - * @tparam T type of promoted element - * @tparam S type of input element, must be assignable to T - */ -template -struct promote_elements { - /** - * Return input element. - * - * @param u input of type S, assignable to type T - * @returns input as type T - */ - inline static T promote(const S& u) { return u; } -}; - -/** - * Struct with static function for elementwise type promotion. - * - *

This specialization promotes scalar values of the same type. - * - * @tparam T type of elements - */ -template -struct promote_elements { - /** - * Return input element. - * - * @param u input of type T - * @returns input as type T - */ - inline static const T& promote(const T& u) { return u; } -}; - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/scal/fun/promote_scalar.hpp b/stan/math/prim/scal/fun/promote_scalar.hpp deleted file mode 100644 index 54c3bb5b3c5..00000000000 --- a/stan/math/prim/scal/fun/promote_scalar.hpp +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_PROMOTE_SCALAR_HPP -#define STAN_MATH_PRIM_SCAL_FUN_PROMOTE_SCALAR_HPP - -#include - -namespace stan { -namespace math { - -/** - * General struct to hold static function for promoting underlying - * scalar types. - * - * @tparam T return type of nested static function. - * @tparam S input type for nested static function, whose underlying - * scalar type must be assignable to T. - */ -template -struct promote_scalar_struct { - /** - * Return the value of the input argument promoted to the type - * specified by the template parameter. - * - * This is the base case for mismatching template parameter - * types in which the underlying scalar type of template - * parameter S is assignable to type T. - * - * @param x input of type S. - * @return input promoted to have scalars of type T. - */ - static T apply(S x) { return T(x); } -}; - -/** - * Struct to hold static function for promoting underlying scalar - * types. This specialization is for equal input and output types - * of function types. - * - * @tparam T input and return type of nested static function. - */ -template -struct promote_scalar_struct { - /** - * Return the unmodified input. - * - * @param x input of type T. - * @return input unmodified. - */ - static T apply(const T& x) { return x; } -}; - -/** - * This is the top-level function to call to promote the scalar - * types of an input of type S to type T. - * - * @tparam T scalar type of output. - * @tparam S input type. - * @param x input vector. - * @return input vector with scalars promoted to type T. - */ -template -typename promote_scalar_type::type promote_scalar(const S& x) { - return promote_scalar_struct::apply(x); -} - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/scal/fun/round.hpp b/stan/math/prim/scal/fun/round.hpp deleted file mode 100644 index 839a9b67b4f..00000000000 --- a/stan/math/prim/scal/fun/round.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_ROUND_HPP -#define STAN_MATH_PRIM_SCAL_FUN_ROUND_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Return the closest integer to the specified argument, with - * halfway cases rounded away from zero. - * - * @param x Argument. - * @return The rounded value of the argument. - */ -inline double round(double x) { return std::round(x); } - -/** - * Return the closest integer to the specified argument, with - * halfway cases rounded away from zero. - * - * @param x Argument. - * @return The rounded value of the argument. - */ -inline double round(int x) { return std::round(x); } - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/scal/fun/sqrt.hpp b/stan/math/prim/scal/fun/sqrt.hpp deleted file mode 100644 index 90c50b7414e..00000000000 --- a/stan/math/prim/scal/fun/sqrt.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_SQRT_HPP -#define STAN_MATH_PRIM_SCAL_FUN_SQRT_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Return the square root of the specified argument. This - * version is required to disambiguate sqrt(int). - * - * @param[in] x Argument. - * @return Natural exponential of argument. - */ -inline double sqrt(int x) { return std::sqrt(x); } - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/scal/fun/square.hpp b/stan/math/prim/scal/fun/square.hpp deleted file mode 100644 index cde68d0280b..00000000000 --- a/stan/math/prim/scal/fun/square.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_SQUARE_HPP -#define STAN_MATH_PRIM_SCAL_FUN_SQUARE_HPP - -#include - -namespace stan { -namespace math { - -/** - * Return the square of the specified argument. - * - *

\f$\mbox{square}(x) = x^2\f$. - * - *

The implementation of square(x) is just - * x * x. Given this, this method is mainly useful - * in cases where x is not a simple primitive type, - * particularly when it is an auto-dif type. - * - * @param x Input to square. - * @return Square of input. - */ -inline double square(double x) { return std::pow(x, 2); } - -} // namespace math -} // namespace stan - -#endif diff --git a/stan/math/prim/scal/fun/squared_distance.hpp b/stan/math/prim/scal/fun/squared_distance.hpp deleted file mode 100644 index e747d9d5e7e..00000000000 --- a/stan/math/prim/scal/fun/squared_distance.hpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_SQUARED_DISTANCE_HPP -#define STAN_MATH_PRIM_SCAL_FUN_SQUARED_DISTANCE_HPP - -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Returns the squared distance. - * - * @param x1 First vector. - * @param x2 Second vector. - * @return Dot product of the vectors. - * @throw std::domain_error If the vectors are not the same - * size or if they are both not vector dimensioned. - */ -template -inline return_type_t squared_distance(const T1& x1, const T2& x2) { - check_finite("squared_distance", "x1", x1); - check_finite("squared_distance", "x2", x2); - return square(x1 - x2); -} -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/scal/fun/sum.hpp b/stan/math/prim/scal/fun/sum.hpp deleted file mode 100644 index a1de989d256..00000000000 --- a/stan/math/prim/scal/fun/sum.hpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_SUM_HPP -#define STAN_MATH_PRIM_SCAL_FUN_SUM_HPP - -#include -namespace stan { -namespace math { - -/** - * Returns specified input value. - * - * @tparam T Type of element. - * @param v Specified value. - * @return Same value (the sum of one value). - */ -inline double sum(double v) { return v; } - -/** - * Returns specified input value. - * - * @tparam T Type of element. - * @param v Specified value. - * @return Same value (the sum of one value). - */ -inline int sum(int v) { return v; } - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/scal/fun/tgamma.hpp b/stan/math/prim/scal/fun/tgamma.hpp deleted file mode 100644 index d08741ed35e..00000000000 --- a/stan/math/prim/scal/fun/tgamma.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_TGAMMA_HPP -#define STAN_MATH_PRIM_SCAL_FUN_TGAMMA_HPP - -#include -#include -#include -#include - -namespace stan { -namespace math { - -/** - * Return the gamma function applied to the specified argument. - * - * @param x Argument. - * @return The gamma function applied to argument. - */ -inline double tgamma(double x) { - if (x == 0.0 || is_nonpositive_integer(x)) { - throw_domain_error("tgamma", "x", x, "x == 0 or negative integer"); - } - return std::tgamma(x); -} - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/scal/fun/trunc.hpp b/stan/math/prim/scal/fun/trunc.hpp deleted file mode 100644 index e6affc968a0..00000000000 --- a/stan/math/prim/scal/fun/trunc.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_TRUNC_HPP -#define STAN_MATH_PRIM_SCAL_FUN_TRUNC_HPP - -#include -#include - -namespace stan { -namespace math { - -/** - * Return the nearest integral value that is not larger in - * magnitude than the specified argument. - * - * @param[in] x Argument. - * @return The truncated argument. - */ -inline double trunc(double x) { return std::trunc(x); } - -/** - * Return the nearest integral value that is not larger in - * magnitude than the specified argument. - * - * @param[in] x Argument. - * @return The truncated argument. - */ -inline double trunc(int x) { return std::trunc(x); } - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/scal/fun/value_of.hpp b/stan/math/prim/scal/fun/value_of.hpp deleted file mode 100644 index 0d3b279b664..00000000000 --- a/stan/math/prim/scal/fun/value_of.hpp +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_VALUE_OF_HPP -#define STAN_MATH_PRIM_SCAL_FUN_VALUE_OF_HPP - -#include -namespace stan { -namespace math { - -/** - * Return the value of the specified scalar argument - * converted to a double value. - * - *

See the primitive_value function to - * extract values without casting to double. - * - *

This function is meant to cover the primitive types. For - * types requiring pass-by-reference, this template function - * should be specialized. - * - * @tparam T type of scalar. - * @param x scalar to convert to double - * @return value of scalar cast to double - */ -template -inline double value_of(const T x) { - return static_cast(x); -} - -/** - * Return the specified argument. - * - *

See value_of(T) for a polymorphic - * implementation using static casts. - * - *

This inline pass-through no-op should be compiled away. - * - * @param x value - * @return input value - */ -template <> -inline double value_of(double x) { - return x; -} - -/** - * Return the specified argument. - * - *

See value_of(T) for a polymorphic - * implementation using static casts. - * - *

This inline pass-through no-op should be compiled away. - * - * @param x value - * @return input value - */ -inline int value_of(int x) { return x; } - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/scal/fun/value_of_rec.hpp b/stan/math/prim/scal/fun/value_of_rec.hpp deleted file mode 100644 index f027a9c4a72..00000000000 --- a/stan/math/prim/scal/fun/value_of_rec.hpp +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef STAN_MATH_PRIM_SCAL_FUN_VALUE_OF_REC_HPP -#define STAN_MATH_PRIM_SCAL_FUN_VALUE_OF_REC_HPP - -#include -namespace stan { -namespace math { - -/** - * Return the value of the specified scalar argument - * converted to a double value. - * - *

See the primitive_value function to - * extract values without casting to double. - * - *

This function is meant to cover the primitive types. For - * types requiring pass-by-reference, this template function - * should be specialized. - * - * @tparam T Type of scalar. - * @param x Scalar to convert to double. - * @return Value of scalar cast to a double. - */ -template > -inline double value_of_rec(const T x) { - return static_cast(x); -} - -/** - * Return the specified argument. - * - *

See value_of(T) for a polymorphic - * implementation using static casts. - * - *

This inline pass-through no-op should be compiled away. - * - * @param x Specified value. - * @return Specified value. - */ -inline double value_of_rec(double x) { return x; } - -} // namespace math -} // namespace stan -#endif diff --git a/stan/math/prim/vectorize.hpp b/stan/math/prim/vectorize.hpp new file mode 100644 index 00000000000..8363ecfaf84 --- /dev/null +++ b/stan/math/prim/vectorize.hpp @@ -0,0 +1,6 @@ +#ifndef STAN_MATH_PRIM_VECTORIZE_HPP +#define STAN_MATH_PRIM_VECTORIZE_HPP + +#include + +#endif diff --git a/stan/math/prim/vectorize/apply_scalar_unary.hpp b/stan/math/prim/vectorize/apply_scalar_unary.hpp index d1ecceaee15..ed31037a207 100644 --- a/stan/math/prim/vectorize/apply_scalar_unary.hpp +++ b/stan/math/prim/vectorize/apply_scalar_unary.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_PRIM_VECTORIZE_APPLY_SCALAR_UNARY_HPP #define STAN_MATH_PRIM_VECTORIZE_APPLY_SCALAR_UNARY_HPP -#include +#include #include #include #include diff --git a/stan/math/rev.hpp b/stan/math/rev.hpp index 2779102afef..f4b8947dc9e 100644 --- a/stan/math/rev.hpp +++ b/stan/math/rev.hpp @@ -1,16 +1,14 @@ #ifndef STAN_MATH_REV_HPP #define STAN_MATH_REV_HPP -#include +#include #include #include #include -#include -#include -#include +#include #include #include diff --git a/stan/math/rev/core/build_vari_array.hpp b/stan/math/rev/core/build_vari_array.hpp index 57b58e00e78..f8c177dedd8 100644 --- a/stan/math/rev/core/build_vari_array.hpp +++ b/stan/math/rev/core/build_vari_array.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_REV_CORE_BUILD_VARI_ARRAY_HPP #define STAN_MATH_REV_CORE_BUILD_VARI_ARRAY_HPP -#include +#include #include #include diff --git a/stan/math/rev/core/matrix_vari.hpp b/stan/math/rev/core/matrix_vari.hpp index fff77429002..26bf74e1ed3 100644 --- a/stan/math/rev/core/matrix_vari.hpp +++ b/stan/math/rev/core/matrix_vari.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_REV_CORE_MATRIX_VARI_HPP #include -#include +#include #include #include diff --git a/stan/math/rev/core/operator_addition.hpp b/stan/math/rev/core/operator_addition.hpp index 52815082302..d20aa82c8e2 100644 --- a/stan/math/rev/core/operator_addition.hpp +++ b/stan/math/rev/core/operator_addition.hpp @@ -4,8 +4,8 @@ #include #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/core/operator_division.hpp b/stan/math/rev/core/operator_division.hpp index 0abc3910f96..879008535af 100644 --- a/stan/math/rev/core/operator_division.hpp +++ b/stan/math/rev/core/operator_division.hpp @@ -5,8 +5,8 @@ #include #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/core/operator_multiplication.hpp b/stan/math/rev/core/operator_multiplication.hpp index 4de5f3bff68..e68edbe4111 100644 --- a/stan/math/rev/core/operator_multiplication.hpp +++ b/stan/math/rev/core/operator_multiplication.hpp @@ -4,8 +4,8 @@ #include #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/core/operator_subtraction.hpp b/stan/math/rev/core/operator_subtraction.hpp index 0e56aed50e0..07e591436ec 100644 --- a/stan/math/rev/core/operator_subtraction.hpp +++ b/stan/math/rev/core/operator_subtraction.hpp @@ -5,8 +5,8 @@ #include #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/core/operator_unary_decrement.hpp b/stan/math/rev/core/operator_unary_decrement.hpp index 3f28556b344..49ac8b17d48 100644 --- a/stan/math/rev/core/operator_unary_decrement.hpp +++ b/stan/math/rev/core/operator_unary_decrement.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/core/operator_unary_increment.hpp b/stan/math/rev/core/operator_unary_increment.hpp index 10a6de198bd..e2fb40a1f00 100644 --- a/stan/math/rev/core/operator_unary_increment.hpp +++ b/stan/math/rev/core/operator_unary_increment.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/core/operator_unary_negative.hpp b/stan/math/rev/core/operator_unary_negative.hpp index dffaf362b96..084996c612a 100644 --- a/stan/math/rev/core/operator_unary_negative.hpp +++ b/stan/math/rev/core/operator_unary_negative.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/core/operator_unary_plus.hpp b/stan/math/rev/core/operator_unary_plus.hpp index 46b4cb2eef8..fd35497e045 100644 --- a/stan/math/rev/core/operator_unary_plus.hpp +++ b/stan/math/rev/core/operator_unary_plus.hpp @@ -1,10 +1,10 @@ #ifndef STAN_MATH_REV_CORE_OPERATOR_UNARY_PLUS_HPP #define STAN_MATH_REV_CORE_OPERATOR_UNARY_PLUS_HPP -#include -#include #include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/core/std_isinf.hpp b/stan/math/rev/core/std_isinf.hpp index 006105f4ddb..83b2d248984 100644 --- a/stan/math/rev/core/std_isinf.hpp +++ b/stan/math/rev/core/std_isinf.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_REV_CORE_STD_ISINF_HPP #define STAN_MATH_REV_CORE_STD_ISINF_HPP -#include +#include #include namespace std { diff --git a/stan/math/rev/fun.hpp b/stan/math/rev/fun.hpp index ffadb336b20..1deb92f9738 100644 --- a/stan/math/rev/fun.hpp +++ b/stan/math/rev/fun.hpp @@ -1,9 +1,9 @@ #ifndef STAN_MATH_REV_FUN_HPP #define STAN_MATH_REV_FUN_HPP -#include +#include -#include +#include #include #include diff --git a/stan/math/rev/fun/Eigen_NumTraits.hpp b/stan/math/rev/fun/Eigen_NumTraits.hpp index fe201cb9a60..79fbead7c81 100644 --- a/stan/math/rev/fun/Eigen_NumTraits.hpp +++ b/stan/math/rev/fun/Eigen_NumTraits.hpp @@ -2,9 +2,9 @@ #define STAN_MATH_REV_FUN_EIGEN_NUMTRAITS_HPP #include -#include #include #include +#include #include namespace Eigen { diff --git a/stan/math/rev/fun/LDLT_alloc.hpp b/stan/math/rev/fun/LDLT_alloc.hpp index ba8b1d5d77c..887a2260161 100644 --- a/stan/math/rev/fun/LDLT_alloc.hpp +++ b/stan/math/rev/fun/LDLT_alloc.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/LDLT_factor.hpp b/stan/math/rev/fun/LDLT_factor.hpp index 7aba32f5d7c..d01b01e4bb9 100644 --- a/stan/math/rev/fun/LDLT_factor.hpp +++ b/stan/math/rev/fun/LDLT_factor.hpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/Phi.hpp b/stan/math/rev/fun/Phi.hpp index 8172b2fa151..ed17cc0911b 100644 --- a/stan/math/rev/fun/Phi.hpp +++ b/stan/math/rev/fun/Phi.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/Phi_approx.hpp b/stan/math/rev/fun/Phi_approx.hpp index 62500dd84d9..090216bf9f9 100644 --- a/stan/math/rev/fun/Phi_approx.hpp +++ b/stan/math/rev/fun/Phi_approx.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/acosh.hpp b/stan/math/rev/fun/acosh.hpp index eeb28329ff9..3d4833445e5 100644 --- a/stan/math/rev/fun/acosh.hpp +++ b/stan/math/rev/fun/acosh.hpp @@ -2,8 +2,8 @@ #define STAN_MATH_REV_FUN_ACOSH_HPP #include -#include #include +#include #include namespace stan { diff --git a/stan/math/rev/fun/asinh.hpp b/stan/math/rev/fun/asinh.hpp index 863cc42c8e9..bbcfbb9f78a 100644 --- a/stan/math/rev/fun/asinh.hpp +++ b/stan/math/rev/fun/asinh.hpp @@ -2,8 +2,8 @@ #define STAN_MATH_REV_FUN_ASINH_HPP #include -#include #include +#include #include namespace stan { diff --git a/stan/math/rev/fun/atanh.hpp b/stan/math/rev/fun/atanh.hpp index 819e9550a43..e1c0383f68d 100644 --- a/stan/math/rev/fun/atanh.hpp +++ b/stan/math/rev/fun/atanh.hpp @@ -2,8 +2,8 @@ #define STAN_MATH_REV_FUN_ATANH_HPP #include -#include #include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/bessel_first_kind.hpp b/stan/math/rev/fun/bessel_first_kind.hpp index dc5a1d0d50e..51a6fec09d3 100644 --- a/stan/math/rev/fun/bessel_first_kind.hpp +++ b/stan/math/rev/fun/bessel_first_kind.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/bessel_second_kind.hpp b/stan/math/rev/fun/bessel_second_kind.hpp index 69da6848e61..ad120e80259 100644 --- a/stan/math/rev/fun/bessel_second_kind.hpp +++ b/stan/math/rev/fun/bessel_second_kind.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/beta.hpp b/stan/math/rev/fun/beta.hpp index a14da6e6c1f..28715ca1074 100644 --- a/stan/math/rev/fun/beta.hpp +++ b/stan/math/rev/fun/beta.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/binary_log_loss.hpp b/stan/math/rev/fun/binary_log_loss.hpp index b06db643bef..dc0ebaeff43 100644 --- a/stan/math/rev/fun/binary_log_loss.hpp +++ b/stan/math/rev/fun/binary_log_loss.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/cbrt.hpp b/stan/math/rev/fun/cbrt.hpp index 3d463ce22d3..554ff6a94d7 100644 --- a/stan/math/rev/fun/cbrt.hpp +++ b/stan/math/rev/fun/cbrt.hpp @@ -2,8 +2,8 @@ #define STAN_MATH_REV_FUN_CBRT_HPP #include -#include #include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/ceil.hpp b/stan/math/rev/fun/ceil.hpp index 9cd5d8e77f5..ccc03472805 100644 --- a/stan/math/rev/fun/ceil.hpp +++ b/stan/math/rev/fun/ceil.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/cholesky_decompose.hpp b/stan/math/rev/fun/cholesky_decompose.hpp index c6b42f5c732..ef9733498fa 100644 --- a/stan/math/rev/fun/cholesky_decompose.hpp +++ b/stan/math/rev/fun/cholesky_decompose.hpp @@ -6,10 +6,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #ifdef STAN_OPENCL #include diff --git a/stan/math/rev/fun/columns_dot_product.hpp b/stan/math/rev/fun/columns_dot_product.hpp index e8ae4a5e273..95c2d34ddf7 100644 --- a/stan/math/rev/fun/columns_dot_product.hpp +++ b/stan/math/rev/fun/columns_dot_product.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include #include diff --git a/stan/math/rev/fun/columns_dot_self.hpp b/stan/math/rev/fun/columns_dot_self.hpp index c666efc79b4..8d764e8e217 100644 --- a/stan/math/rev/fun/columns_dot_self.hpp +++ b/stan/math/rev/fun/columns_dot_self.hpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/cov_exp_quad.hpp b/stan/math/rev/fun/cov_exp_quad.hpp index d9b80902dc3..2fb9cf9db81 100644 --- a/stan/math/rev/fun/cov_exp_quad.hpp +++ b/stan/math/rev/fun/cov_exp_quad.hpp @@ -5,9 +5,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/stan/math/rev/fun/determinant.hpp b/stan/math/rev/fun/determinant.hpp index 1afde62af63..fdd3caf4b5f 100644 --- a/stan/math/rev/fun/determinant.hpp +++ b/stan/math/rev/fun/determinant.hpp @@ -1,11 +1,11 @@ #ifndef STAN_MATH_REV_FUN_DETERMINANT_HPP #define STAN_MATH_REV_FUN_DETERMINANT_HPP +#include #include -#include -#include #include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/digamma.hpp b/stan/math/rev/fun/digamma.hpp index 0f30dd2b868..fcfd499bd04 100644 --- a/stan/math/rev/fun/digamma.hpp +++ b/stan/math/rev/fun/digamma.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/divide.hpp b/stan/math/rev/fun/divide.hpp index 426402a7f73..8343bb38c66 100644 --- a/stan/math/rev/fun/divide.hpp +++ b/stan/math/rev/fun/divide.hpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/dot_product.hpp b/stan/math/rev/fun/dot_product.hpp index 5994bf5071c..41fc372af48 100644 --- a/stan/math/rev/fun/dot_product.hpp +++ b/stan/math/rev/fun/dot_product.hpp @@ -6,9 +6,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/stan/math/rev/fun/dot_self.hpp b/stan/math/rev/fun/dot_self.hpp index 71e1180e776..77177263935 100644 --- a/stan/math/rev/fun/dot_self.hpp +++ b/stan/math/rev/fun/dot_self.hpp @@ -4,8 +4,8 @@ #include #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/erf.hpp b/stan/math/rev/fun/erf.hpp index ae22696542a..7c675ad5e33 100644 --- a/stan/math/rev/fun/erf.hpp +++ b/stan/math/rev/fun/erf.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/erfc.hpp b/stan/math/rev/fun/erfc.hpp index 92c68ed2a7d..bb92da2a90d 100644 --- a/stan/math/rev/fun/erfc.hpp +++ b/stan/math/rev/fun/erfc.hpp @@ -1,10 +1,10 @@ #ifndef STAN_MATH_REV_FUN_ERFC_HPP #define STAN_MATH_REV_FUN_ERFC_HPP -#include -#include -#include #include +#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/exp2.hpp b/stan/math/rev/fun/exp2.hpp index 47dab02e826..17c6d5a3322 100644 --- a/stan/math/rev/fun/exp2.hpp +++ b/stan/math/rev/fun/exp2.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/expm1.hpp b/stan/math/rev/fun/expm1.hpp index 17214688ebe..65296858b71 100644 --- a/stan/math/rev/fun/expm1.hpp +++ b/stan/math/rev/fun/expm1.hpp @@ -2,8 +2,8 @@ #define STAN_MATH_REV_FUN_EXPM1_HPP #include -#include #include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/fabs.hpp b/stan/math/rev/fun/fabs.hpp index af8f5adb598..2c6ef20ccda 100644 --- a/stan/math/rev/fun/fabs.hpp +++ b/stan/math/rev/fun/fabs.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/falling_factorial.hpp b/stan/math/rev/fun/falling_factorial.hpp index fe2b0440614..08d54f6fd92 100644 --- a/stan/math/rev/fun/falling_factorial.hpp +++ b/stan/math/rev/fun/falling_factorial.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/fdim.hpp b/stan/math/rev/fun/fdim.hpp index 59ff5bb6285..c3db6ec2f0c 100644 --- a/stan/math/rev/fun/fdim.hpp +++ b/stan/math/rev/fun/fdim.hpp @@ -2,9 +2,9 @@ #define STAN_MATH_REV_FUN_FDIM_HPP #include -#include -#include #include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/floor.hpp b/stan/math/rev/fun/floor.hpp index fd679971784..c0a05a3a1b2 100644 --- a/stan/math/rev/fun/floor.hpp +++ b/stan/math/rev/fun/floor.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/fma.hpp b/stan/math/rev/fun/fma.hpp index bfed40ea69b..b0d09369fcf 100644 --- a/stan/math/rev/fun/fma.hpp +++ b/stan/math/rev/fun/fma.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/fmax.hpp b/stan/math/rev/fun/fmax.hpp index c78088d040e..845f224ae35 100644 --- a/stan/math/rev/fun/fmax.hpp +++ b/stan/math/rev/fun/fmax.hpp @@ -4,8 +4,8 @@ #include #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/fmin.hpp b/stan/math/rev/fun/fmin.hpp index 58c959476a5..75fb5dd06ec 100644 --- a/stan/math/rev/fun/fmin.hpp +++ b/stan/math/rev/fun/fmin.hpp @@ -3,9 +3,9 @@ #include #include -#include #include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/fmod.hpp b/stan/math/rev/fun/fmod.hpp index e240762d483..7b862c9154e 100644 --- a/stan/math/rev/fun/fmod.hpp +++ b/stan/math/rev/fun/fmod.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/gamma_p.hpp b/stan/math/rev/fun/gamma_p.hpp index 27a14749276..ebd8a52e8d5 100644 --- a/stan/math/rev/fun/gamma_p.hpp +++ b/stan/math/rev/fun/gamma_p.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/gamma_q.hpp b/stan/math/rev/fun/gamma_q.hpp index b967c9bea28..2bf66d25203 100644 --- a/stan/math/rev/fun/gamma_q.hpp +++ b/stan/math/rev/fun/gamma_q.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/gp_exp_quad_cov.hpp b/stan/math/rev/fun/gp_exp_quad_cov.hpp index 1542a72a2d9..d3fcb2a8b6a 100644 --- a/stan/math/rev/fun/gp_exp_quad_cov.hpp +++ b/stan/math/rev/fun/gp_exp_quad_cov.hpp @@ -5,9 +5,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/stan/math/rev/fun/gp_periodic_cov.hpp b/stan/math/rev/fun/gp_periodic_cov.hpp index bbf9b65a064..a592e316cb6 100644 --- a/stan/math/rev/fun/gp_periodic_cov.hpp +++ b/stan/math/rev/fun/gp_periodic_cov.hpp @@ -5,10 +5,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include diff --git a/stan/math/rev/fun/grad.hpp b/stan/math/rev/fun/grad.hpp index 79481b506d1..099e641337a 100644 --- a/stan/math/rev/fun/grad.hpp +++ b/stan/math/rev/fun/grad.hpp @@ -2,9 +2,9 @@ #define STAN_MATH_REV_FUN_GRAD_HPP #include -#include #include #include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/grad_inc_beta.hpp b/stan/math/rev/fun/grad_inc_beta.hpp index 9b254796949..f0a67f0a622 100644 --- a/stan/math/rev/fun/grad_inc_beta.hpp +++ b/stan/math/rev/fun/grad_inc_beta.hpp @@ -3,9 +3,6 @@ #include #include -#include -#include -#include #include #include #include @@ -15,6 +12,9 @@ #include #include #include +#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/hypot.hpp b/stan/math/rev/fun/hypot.hpp index 5ef48dc313f..93bb4bb97bd 100644 --- a/stan/math/rev/fun/hypot.hpp +++ b/stan/math/rev/fun/hypot.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/inc_beta.hpp b/stan/math/rev/fun/inc_beta.hpp index 19830ebd455..57d91ef06fc 100644 --- a/stan/math/rev/fun/inc_beta.hpp +++ b/stan/math/rev/fun/inc_beta.hpp @@ -3,10 +3,10 @@ #include #include -#include #include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/initialize_variable.hpp b/stan/math/rev/fun/initialize_variable.hpp index e89066cef5b..c774a0b46ca 100644 --- a/stan/math/rev/fun/initialize_variable.hpp +++ b/stan/math/rev/fun/initialize_variable.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/inv.hpp b/stan/math/rev/fun/inv.hpp index 93313475ddd..9cfe1b86cf4 100644 --- a/stan/math/rev/fun/inv.hpp +++ b/stan/math/rev/fun/inv.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/inv_Phi.hpp b/stan/math/rev/fun/inv_Phi.hpp index 40b9a24c0df..2bb6d5b2521 100644 --- a/stan/math/rev/fun/inv_Phi.hpp +++ b/stan/math/rev/fun/inv_Phi.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/inv_cloglog.hpp b/stan/math/rev/fun/inv_cloglog.hpp index 7cc4de63959..f9694b5c2fd 100644 --- a/stan/math/rev/fun/inv_cloglog.hpp +++ b/stan/math/rev/fun/inv_cloglog.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/inv_logit.hpp b/stan/math/rev/fun/inv_logit.hpp index 3512f5f084c..827f29f8249 100644 --- a/stan/math/rev/fun/inv_logit.hpp +++ b/stan/math/rev/fun/inv_logit.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/inv_sqrt.hpp b/stan/math/rev/fun/inv_sqrt.hpp index 91e9644f136..e6e5a557a83 100644 --- a/stan/math/rev/fun/inv_sqrt.hpp +++ b/stan/math/rev/fun/inv_sqrt.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/inv_square.hpp b/stan/math/rev/fun/inv_square.hpp index 30289a9cf80..af6a90dbfac 100644 --- a/stan/math/rev/fun/inv_square.hpp +++ b/stan/math/rev/fun/inv_square.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/inverse.hpp b/stan/math/rev/fun/inverse.hpp index b44c5d6bc3d..cc3588a3728 100644 --- a/stan/math/rev/fun/inverse.hpp +++ b/stan/math/rev/fun/inverse.hpp @@ -1,12 +1,12 @@ #ifndef STAN_MATH_REV_FUN_INVERSE_HPP #define STAN_MATH_REV_FUN_INVERSE_HPP -#include #include #include -#include #include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/is_inf.hpp b/stan/math/rev/fun/is_inf.hpp index 4aba9e89bd6..a5e61af64fa 100644 --- a/stan/math/rev/fun/is_inf.hpp +++ b/stan/math/rev/fun/is_inf.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/is_nan.hpp b/stan/math/rev/fun/is_nan.hpp index e352dee8113..065b39ad52c 100644 --- a/stan/math/rev/fun/is_nan.hpp +++ b/stan/math/rev/fun/is_nan.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/is_uninitialized.hpp b/stan/math/rev/fun/is_uninitialized.hpp index c7edde2c9b0..b7ecfd95c87 100644 --- a/stan/math/rev/fun/is_uninitialized.hpp +++ b/stan/math/rev/fun/is_uninitialized.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/lbeta.hpp b/stan/math/rev/fun/lbeta.hpp index 109511864b3..02b352dffcf 100644 --- a/stan/math/rev/fun/lbeta.hpp +++ b/stan/math/rev/fun/lbeta.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/ldexp.hpp b/stan/math/rev/fun/ldexp.hpp index e7ebba5b630..e95f8f8d397 100644 --- a/stan/math/rev/fun/ldexp.hpp +++ b/stan/math/rev/fun/ldexp.hpp @@ -1,7 +1,7 @@ #ifndef STAN_MATH_REV_FUN_LDEXP_HPP #define STAN_MATH_REV_FUN_LDEXP_HPP -#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/lgamma.hpp b/stan/math/rev/fun/lgamma.hpp index 721d7010270..af25ffaef26 100644 --- a/stan/math/rev/fun/lgamma.hpp +++ b/stan/math/rev/fun/lgamma.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/lmgamma.hpp b/stan/math/rev/fun/lmgamma.hpp index 401c895cd60..8e608f69205 100644 --- a/stan/math/rev/fun/lmgamma.hpp +++ b/stan/math/rev/fun/lmgamma.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/log10.hpp b/stan/math/rev/fun/log10.hpp index 25f5825969f..e5d246f6908 100644 --- a/stan/math/rev/fun/log10.hpp +++ b/stan/math/rev/fun/log10.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/log1m.hpp b/stan/math/rev/fun/log1m.hpp index 260c4301843..d8c4d3abbd0 100644 --- a/stan/math/rev/fun/log1m.hpp +++ b/stan/math/rev/fun/log1m.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/log1m_exp.hpp b/stan/math/rev/fun/log1m_exp.hpp index 03712f6bd6d..5c135cd8b3f 100644 --- a/stan/math/rev/fun/log1m_exp.hpp +++ b/stan/math/rev/fun/log1m_exp.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/log1m_inv_logit.hpp b/stan/math/rev/fun/log1m_inv_logit.hpp index e7af7312672..44a5d20fc19 100644 --- a/stan/math/rev/fun/log1m_inv_logit.hpp +++ b/stan/math/rev/fun/log1m_inv_logit.hpp @@ -2,8 +2,8 @@ #define STAN_MATH_REV_FUN_LOG1M_INV_LOGIT_HPP #include -#include -#include +#include +#include #include #include diff --git a/stan/math/rev/fun/log1p.hpp b/stan/math/rev/fun/log1p.hpp index ea5f1947da1..52ffea3210b 100644 --- a/stan/math/rev/fun/log1p.hpp +++ b/stan/math/rev/fun/log1p.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/log1p_exp.hpp b/stan/math/rev/fun/log1p_exp.hpp index f601ab5032f..762f8ee356a 100644 --- a/stan/math/rev/fun/log1p_exp.hpp +++ b/stan/math/rev/fun/log1p_exp.hpp @@ -3,8 +3,8 @@ #include #include -#include #include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/log2.hpp b/stan/math/rev/fun/log2.hpp index 3a254d6a454..ea83371f2f8 100644 --- a/stan/math/rev/fun/log2.hpp +++ b/stan/math/rev/fun/log2.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/log_determinant.hpp b/stan/math/rev/fun/log_determinant.hpp index cc79d7a6bd6..cbc27e95848 100644 --- a/stan/math/rev/fun/log_determinant.hpp +++ b/stan/math/rev/fun/log_determinant.hpp @@ -2,10 +2,10 @@ #define STAN_MATH_REV_FUN_LOG_DETERMINANT_HPP #include -#include -#include -#include #include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/log_determinant_ldlt.hpp b/stan/math/rev/fun/log_determinant_ldlt.hpp index 3ec12373b5c..1ff78a9c8b8 100644 --- a/stan/math/rev/fun/log_determinant_ldlt.hpp +++ b/stan/math/rev/fun/log_determinant_ldlt.hpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/log_determinant_spd.hpp b/stan/math/rev/fun/log_determinant_spd.hpp index 7eb46484de0..eb0979dc6e4 100644 --- a/stan/math/rev/fun/log_determinant_spd.hpp +++ b/stan/math/rev/fun/log_determinant_spd.hpp @@ -4,10 +4,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/log_diff_exp.hpp b/stan/math/rev/fun/log_diff_exp.hpp index d3c3d3fe817..978987ca5c9 100644 --- a/stan/math/rev/fun/log_diff_exp.hpp +++ b/stan/math/rev/fun/log_diff_exp.hpp @@ -4,9 +4,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/log_falling_factorial.hpp b/stan/math/rev/fun/log_falling_factorial.hpp index 16f733ad31e..b7bf742c864 100644 --- a/stan/math/rev/fun/log_falling_factorial.hpp +++ b/stan/math/rev/fun/log_falling_factorial.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/log_inv_logit.hpp b/stan/math/rev/fun/log_inv_logit.hpp index e234aaccf35..c6e79d603c7 100644 --- a/stan/math/rev/fun/log_inv_logit.hpp +++ b/stan/math/rev/fun/log_inv_logit.hpp @@ -2,10 +2,10 @@ #define STAN_MATH_REV_FUN_LOG_INV_LOGIT_HPP #include -#include -#include #include #include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/log_inv_logit_diff.hpp b/stan/math/rev/fun/log_inv_logit_diff.hpp index c5c4c0f0bd0..f3ded537e77 100644 --- a/stan/math/rev/fun/log_inv_logit_diff.hpp +++ b/stan/math/rev/fun/log_inv_logit_diff.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/log_mix.hpp b/stan/math/rev/fun/log_mix.hpp index c7890f26155..0936ffe337c 100644 --- a/stan/math/rev/fun/log_mix.hpp +++ b/stan/math/rev/fun/log_mix.hpp @@ -2,9 +2,9 @@ #define STAN_MATH_REV_FUN_LOG_MIX_HPP #include -#include -#include #include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/log_rising_factorial.hpp b/stan/math/rev/fun/log_rising_factorial.hpp index d3b41f3bf9d..efbc130c083 100644 --- a/stan/math/rev/fun/log_rising_factorial.hpp +++ b/stan/math/rev/fun/log_rising_factorial.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include #include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/log_softmax.hpp b/stan/math/rev/fun/log_softmax.hpp index 8a916d68ce2..58cf4c54273 100644 --- a/stan/math/rev/fun/log_softmax.hpp +++ b/stan/math/rev/fun/log_softmax.hpp @@ -1,13 +1,13 @@ #ifndef STAN_MATH_REV_FUN_LOG_SOFTMAX_HPP #define STAN_MATH_REV_FUN_LOG_SOFTMAX_HPP -#include -#include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include +#include #include #include diff --git a/stan/math/rev/fun/log_sum_exp.hpp b/stan/math/rev/fun/log_sum_exp.hpp index b24046b7880..0315ff31a68 100644 --- a/stan/math/rev/fun/log_sum_exp.hpp +++ b/stan/math/rev/fun/log_sum_exp.hpp @@ -5,10 +5,9 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include #include #include diff --git a/stan/math/rev/fun/logit.hpp b/stan/math/rev/fun/logit.hpp index cafaa2c0483..aef34021146 100644 --- a/stan/math/rev/fun/logit.hpp +++ b/stan/math/rev/fun/logit.hpp @@ -1,10 +1,9 @@ #ifndef STAN_MATH_REV_FUN_LOGIT_HPP #define STAN_MATH_REV_FUN_LOGIT_HPP -#include -#include #include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/matrix_exp_multiply.hpp b/stan/math/rev/fun/matrix_exp_multiply.hpp index 9182d1b90d8..6a17b2baa45 100644 --- a/stan/math/rev/fun/matrix_exp_multiply.hpp +++ b/stan/math/rev/fun/matrix_exp_multiply.hpp @@ -5,8 +5,8 @@ #include #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/matrix_power.hpp b/stan/math/rev/fun/matrix_power.hpp index e591cf63361..7fe4a00a1c8 100644 --- a/stan/math/rev/fun/matrix_power.hpp +++ b/stan/math/rev/fun/matrix_power.hpp @@ -1,12 +1,12 @@ #ifndef STAN_MATH_REV_FUN_MATRIX_POWER_HPP #define STAN_MATH_REV_FUN_MATRIX_POWER_HPP -#include #include #include #include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/mdivide_left.hpp b/stan/math/rev/fun/mdivide_left.hpp index 54e629cfb0f..1b30e5e9ab2 100644 --- a/stan/math/rev/fun/mdivide_left.hpp +++ b/stan/math/rev/fun/mdivide_left.hpp @@ -2,11 +2,11 @@ #define STAN_MATH_REV_FUN_MDIVIDE_LEFT_HPP #include -#include -#include -#include #include #include +#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/mdivide_left_ldlt.hpp b/stan/math/rev/fun/mdivide_left_ldlt.hpp index b248f42d3f2..6c7ba7c527b 100644 --- a/stan/math/rev/fun/mdivide_left_ldlt.hpp +++ b/stan/math/rev/fun/mdivide_left_ldlt.hpp @@ -6,8 +6,8 @@ #include #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/mdivide_left_spd.hpp b/stan/math/rev/fun/mdivide_left_spd.hpp index 3165203ac68..b00cbfea131 100644 --- a/stan/math/rev/fun/mdivide_left_spd.hpp +++ b/stan/math/rev/fun/mdivide_left_spd.hpp @@ -5,8 +5,8 @@ #include #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/mdivide_left_tri.hpp b/stan/math/rev/fun/mdivide_left_tri.hpp index 0c750eb17e3..a0ee3e3ba7a 100644 --- a/stan/math/rev/fun/mdivide_left_tri.hpp +++ b/stan/math/rev/fun/mdivide_left_tri.hpp @@ -5,8 +5,8 @@ #include #include #include -#include -#include +#include +#include #ifdef STAN_OPENCL #include #endif diff --git a/stan/math/rev/fun/modified_bessel_first_kind.hpp b/stan/math/rev/fun/modified_bessel_first_kind.hpp index bb64ab322be..2ca9fcce7d1 100644 --- a/stan/math/rev/fun/modified_bessel_first_kind.hpp +++ b/stan/math/rev/fun/modified_bessel_first_kind.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/modified_bessel_second_kind.hpp b/stan/math/rev/fun/modified_bessel_second_kind.hpp index 6037721a4e1..b6b639373b3 100644 --- a/stan/math/rev/fun/modified_bessel_second_kind.hpp +++ b/stan/math/rev/fun/modified_bessel_second_kind.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/multiply.hpp b/stan/math/rev/fun/multiply.hpp index cbb3d0a2f9f..ece1cf23147 100644 --- a/stan/math/rev/fun/multiply.hpp +++ b/stan/math/rev/fun/multiply.hpp @@ -3,9 +3,7 @@ #include #include -#include -#include -#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/multiply_log.hpp b/stan/math/rev/fun/multiply_log.hpp index 827865c877e..16c0dcb653a 100644 --- a/stan/math/rev/fun/multiply_log.hpp +++ b/stan/math/rev/fun/multiply_log.hpp @@ -4,9 +4,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/multiply_lower_tri_self_transpose.hpp b/stan/math/rev/fun/multiply_lower_tri_self_transpose.hpp index 5d3877d0a07..8061ecedd3c 100644 --- a/stan/math/rev/fun/multiply_lower_tri_self_transpose.hpp +++ b/stan/math/rev/fun/multiply_lower_tri_self_transpose.hpp @@ -2,11 +2,11 @@ #define STAN_MATH_REV_FUN_MULTIPLY_LOWER_TRI_SELF_TRANSPOSE_HPP #include -#include #include -#include #include #include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/ordered_constrain.hpp b/stan/math/rev/fun/ordered_constrain.hpp index 303b5829a8d..6d4a58cb135 100644 --- a/stan/math/rev/fun/ordered_constrain.hpp +++ b/stan/math/rev/fun/ordered_constrain.hpp @@ -2,11 +2,11 @@ #define STAN_MATH_REV_FUN_ORDERED_CONSTRAIN_HPP #include -#include #include +#include +#include #include #include -#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/owens_t.hpp b/stan/math/rev/fun/owens_t.hpp index 8e9f17568c0..665bb9dd507 100644 --- a/stan/math/rev/fun/owens_t.hpp +++ b/stan/math/rev/fun/owens_t.hpp @@ -3,10 +3,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/positive_ordered_constrain.hpp b/stan/math/rev/fun/positive_ordered_constrain.hpp index 77dce665b9e..400019295ec 100644 --- a/stan/math/rev/fun/positive_ordered_constrain.hpp +++ b/stan/math/rev/fun/positive_ordered_constrain.hpp @@ -2,11 +2,11 @@ #define STAN_MATH_REV_FUN_POSITIVE_ORDERED_CONSTRAIN_HPP #include -#include #include +#include +#include #include #include -#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/pow.hpp b/stan/math/rev/fun/pow.hpp index e00ada0ceef..350a9fce417 100644 --- a/stan/math/rev/fun/pow.hpp +++ b/stan/math/rev/fun/pow.hpp @@ -8,8 +8,8 @@ #include #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/primitive_value.hpp b/stan/math/rev/fun/primitive_value.hpp index 3c245cba5e3..9338ad595d5 100644 --- a/stan/math/rev/fun/primitive_value.hpp +++ b/stan/math/rev/fun/primitive_value.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/quad_form.hpp b/stan/math/rev/fun/quad_form.hpp index c2339b7bfc0..d26edabc2bb 100644 --- a/stan/math/rev/fun/quad_form.hpp +++ b/stan/math/rev/fun/quad_form.hpp @@ -3,11 +3,11 @@ #include #include -#include -#include -#include -#include #include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/quad_form_sym.hpp b/stan/math/rev/fun/quad_form_sym.hpp index 8b6dba90d7a..c81501efcf9 100644 --- a/stan/math/rev/fun/quad_form_sym.hpp +++ b/stan/math/rev/fun/quad_form_sym.hpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include diff --git a/stan/math/rev/fun/rising_factorial.hpp b/stan/math/rev/fun/rising_factorial.hpp index ea42dd473e5..98e7549694b 100644 --- a/stan/math/rev/fun/rising_factorial.hpp +++ b/stan/math/rev/fun/rising_factorial.hpp @@ -3,8 +3,8 @@ #include #include -#include -#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/round.hpp b/stan/math/rev/fun/round.hpp index e65e086aa6d..bd5f3865efc 100644 --- a/stan/math/rev/fun/round.hpp +++ b/stan/math/rev/fun/round.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/rows_dot_product.hpp b/stan/math/rev/fun/rows_dot_product.hpp index 326e414c8d1..a44625fdc86 100644 --- a/stan/math/rev/fun/rows_dot_product.hpp +++ b/stan/math/rev/fun/rows_dot_product.hpp @@ -2,11 +2,11 @@ #define STAN_MATH_REV_FUN_ROWS_DOT_PRODUCT_HPP #include -#include -#include #include #include #include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/sd.hpp b/stan/math/rev/fun/sd.hpp index ce599ec6243..326e5e9e7d1 100644 --- a/stan/math/rev/fun/sd.hpp +++ b/stan/math/rev/fun/sd.hpp @@ -4,9 +4,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/stan/math/rev/fun/simplex_constrain.hpp b/stan/math/rev/fun/simplex_constrain.hpp index 6816476775c..8147a9e2392 100644 --- a/stan/math/rev/fun/simplex_constrain.hpp +++ b/stan/math/rev/fun/simplex_constrain.hpp @@ -2,12 +2,12 @@ #define STAN_MATH_REV_FUN_SIMPLEX_CONSTRAIN_HPP #include -#include -#include #include +#include +#include +#include #include #include -#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/softmax.hpp b/stan/math/rev/fun/softmax.hpp index 0d404623a50..8808c32795f 100644 --- a/stan/math/rev/fun/softmax.hpp +++ b/stan/math/rev/fun/softmax.hpp @@ -2,12 +2,12 @@ #define STAN_MATH_REV_FUN_SOFTMAX_HPP #include -#include -#include -#include #include -#include +#include +#include +#include #include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/squared_distance.hpp b/stan/math/rev/fun/squared_distance.hpp index 79b2e83ed1f..eced808688e 100644 --- a/stan/math/rev/fun/squared_distance.hpp +++ b/stan/math/rev/fun/squared_distance.hpp @@ -4,9 +4,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/sum.hpp b/stan/math/rev/fun/sum.hpp index ea7aaf4dede..4d74957a7d0 100644 --- a/stan/math/rev/fun/sum.hpp +++ b/stan/math/rev/fun/sum.hpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/tcrossprod.hpp b/stan/math/rev/fun/tcrossprod.hpp index 5ee9279a854..6a8f72962c3 100644 --- a/stan/math/rev/fun/tcrossprod.hpp +++ b/stan/math/rev/fun/tcrossprod.hpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/tgamma.hpp b/stan/math/rev/fun/tgamma.hpp index cef875f07ad..e765d311919 100644 --- a/stan/math/rev/fun/tgamma.hpp +++ b/stan/math/rev/fun/tgamma.hpp @@ -2,9 +2,9 @@ #define STAN_MATH_REV_FUN_TGAMMA_HPP #include -#include -#include #include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/to_var.hpp b/stan/math/rev/fun/to_var.hpp index d6d366cb65c..19c7208c5f5 100644 --- a/stan/math/rev/fun/to_var.hpp +++ b/stan/math/rev/fun/to_var.hpp @@ -4,8 +4,8 @@ #include #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/trace_gen_inv_quad_form_ldlt.hpp b/stan/math/rev/fun/trace_gen_inv_quad_form_ldlt.hpp index 3e25d67d8a2..2b876e29703 100644 --- a/stan/math/rev/fun/trace_gen_inv_quad_form_ldlt.hpp +++ b/stan/math/rev/fun/trace_gen_inv_quad_form_ldlt.hpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/trace_gen_quad_form.hpp b/stan/math/rev/fun/trace_gen_quad_form.hpp index 0f3ed6aa7e4..1e4e938cf63 100644 --- a/stan/math/rev/fun/trace_gen_quad_form.hpp +++ b/stan/math/rev/fun/trace_gen_quad_form.hpp @@ -7,9 +7,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/trace_inv_quad_form_ldlt.hpp b/stan/math/rev/fun/trace_inv_quad_form_ldlt.hpp index 304cbac6fa6..9be8a21b3da 100644 --- a/stan/math/rev/fun/trace_inv_quad_form_ldlt.hpp +++ b/stan/math/rev/fun/trace_inv_quad_form_ldlt.hpp @@ -7,8 +7,8 @@ #include #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/trace_quad_form.hpp b/stan/math/rev/fun/trace_quad_form.hpp index 6dce553e2bd..e813087998b 100644 --- a/stan/math/rev/fun/trace_quad_form.hpp +++ b/stan/math/rev/fun/trace_quad_form.hpp @@ -6,10 +6,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/trigamma.hpp b/stan/math/rev/fun/trigamma.hpp index d4d30776e1e..4c9934b13c1 100644 --- a/stan/math/rev/fun/trigamma.hpp +++ b/stan/math/rev/fun/trigamma.hpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/trunc.hpp b/stan/math/rev/fun/trunc.hpp index 3639ab5baec..fc045954e29 100644 --- a/stan/math/rev/fun/trunc.hpp +++ b/stan/math/rev/fun/trunc.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/typedefs.hpp b/stan/math/rev/fun/typedefs.hpp index 95b52c34ec5..ff70539ae09 100644 --- a/stan/math/rev/fun/typedefs.hpp +++ b/stan/math/rev/fun/typedefs.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/unit_vector_constrain.hpp b/stan/math/rev/fun/unit_vector_constrain.hpp index 55c5e1415fa..bddf27de848 100644 --- a/stan/math/rev/fun/unit_vector_constrain.hpp +++ b/stan/math/rev/fun/unit_vector_constrain.hpp @@ -1,13 +1,13 @@ -#ifndef STAN_MATH_PRIM_MAT_FUN_UNIT_VECTOR_CONSTRAIN_HPP -#define STAN_MATH_PRIM_MAT_FUN_UNIT_VECTOR_CONSTRAIN_HPP +#ifndef STAN_MATH_PRIM_FUN_UNIT_VECTOR_CONSTRAIN_HPP +#define STAN_MATH_PRIM_FUN_UNIT_VECTOR_CONSTRAIN_HPP #include #include #include #include -#include -#include -#include +#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/fun/value_of_rec.hpp b/stan/math/rev/fun/value_of_rec.hpp index a80bbdf3fd3..c75d7a2e931 100644 --- a/stan/math/rev/fun/value_of_rec.hpp +++ b/stan/math/rev/fun/value_of_rec.hpp @@ -2,8 +2,8 @@ #define STAN_MATH_REV_FUN_VALUE_OF_REC_HPP #include -#include #include +#include namespace stan { namespace math { diff --git a/stan/math/rev/fun/variance.hpp b/stan/math/rev/fun/variance.hpp index e258ff518b1..fa30aae0946 100644 --- a/stan/math/rev/fun/variance.hpp +++ b/stan/math/rev/fun/variance.hpp @@ -4,8 +4,8 @@ #include #include #include -#include -#include +#include +#include #include namespace stan { diff --git a/stan/math/rev/functor/adj_jac_apply.hpp b/stan/math/rev/functor/adj_jac_apply.hpp index 4f3bb1255a1..2893f98ecf2 100644 --- a/stan/math/rev/functor/adj_jac_apply.hpp +++ b/stan/math/rev/functor/adj_jac_apply.hpp @@ -3,9 +3,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/stan/math/rev/functor/algebra_solver_fp.hpp b/stan/math/rev/functor/algebra_solver_fp.hpp index c9275d41218..96a248efd05 100644 --- a/stan/math/rev/functor/algebra_solver_fp.hpp +++ b/stan/math/rev/functor/algebra_solver_fp.hpp @@ -7,10 +7,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include diff --git a/stan/math/rev/functor/algebra_solver_newton.hpp b/stan/math/rev/functor/algebra_solver_newton.hpp index f82b2983308..83e87e429a3 100644 --- a/stan/math/rev/functor/algebra_solver_newton.hpp +++ b/stan/math/rev/functor/algebra_solver_newton.hpp @@ -6,8 +6,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/stan/math/rev/functor/algebra_solver_powell.hpp b/stan/math/rev/functor/algebra_solver_powell.hpp index 63ee32a4700..c8f7f9b59c0 100644 --- a/stan/math/rev/functor/algebra_solver_powell.hpp +++ b/stan/math/rev/functor/algebra_solver_powell.hpp @@ -5,8 +5,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/stan/math/rev/functor/algebra_system.hpp b/stan/math/rev/functor/algebra_system.hpp index b7c11a7861c..aa2de3b49c1 100644 --- a/stan/math/rev/functor/algebra_system.hpp +++ b/stan/math/rev/functor/algebra_system.hpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/stan/math/rev/functor/coupled_ode_system.hpp b/stan/math/rev/functor/coupled_ode_system.hpp index f2e688645f1..e65beb9548f 100644 --- a/stan/math/rev/functor/coupled_ode_system.hpp +++ b/stan/math/rev/functor/coupled_ode_system.hpp @@ -2,13 +2,13 @@ #define STAN_MATH_REV_FUNCTOR_COUPLED_ODE_SYSTEM_HPP #include -#include -#include -#include #include #include -#include +#include +#include +#include #include +#include #include namespace stan { diff --git a/stan/math/rev/functor/cvodes_integrator.hpp b/stan/math/rev/functor/cvodes_integrator.hpp index 22967efc601..3d4fb4f9d37 100644 --- a/stan/math/rev/functor/cvodes_integrator.hpp +++ b/stan/math/rev/functor/cvodes_integrator.hpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/stan/math/rev/functor/gradient.hpp b/stan/math/rev/functor/gradient.hpp index c0e942a76c5..e28d8c344a8 100644 --- a/stan/math/rev/functor/gradient.hpp +++ b/stan/math/rev/functor/gradient.hpp @@ -2,8 +2,8 @@ #define STAN_MATH_REV_FUNCTOR_GRADIENT_HPP #include -#include #include +#include #include namespace stan { diff --git a/stan/math/rev/functor/idas_forward_system.hpp b/stan/math/rev/functor/idas_forward_system.hpp index bc9d56b4a0b..7d41d131a42 100644 --- a/stan/math/rev/functor/idas_forward_system.hpp +++ b/stan/math/rev/functor/idas_forward_system.hpp @@ -5,9 +5,9 @@ #include #include #include -#include #include -#include +#include +#include #include #include #include diff --git a/stan/math/rev/functor/idas_system.hpp b/stan/math/rev/functor/idas_system.hpp index e4cea576529..9a2a498dabe 100644 --- a/stan/math/rev/functor/idas_system.hpp +++ b/stan/math/rev/functor/idas_system.hpp @@ -4,9 +4,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/stan/math/rev/functor/integrate_1d.hpp b/stan/math/rev/functor/integrate_1d.hpp index 527a3b365de..e61a2f1fbdc 100644 --- a/stan/math/rev/functor/integrate_1d.hpp +++ b/stan/math/rev/functor/integrate_1d.hpp @@ -6,9 +6,9 @@ #include #include #include -#include +#include +#include #include -#include #include #include #include diff --git a/stan/math/rev/functor/jacobian.hpp b/stan/math/rev/functor/jacobian.hpp index 2f7f69394a2..966a71c570d 100644 --- a/stan/math/rev/functor/jacobian.hpp +++ b/stan/math/rev/functor/jacobian.hpp @@ -2,8 +2,8 @@ #define STAN_MATH_REV_FUNCTOR_JACOBIAN_HPP #include -#include #include +#include #include #include diff --git a/stan/math/rev/functor/kinsol_data.hpp b/stan/math/rev/functor/kinsol_data.hpp index 01b525b7759..5dd9b288338 100644 --- a/stan/math/rev/functor/kinsol_data.hpp +++ b/stan/math/rev/functor/kinsol_data.hpp @@ -3,14 +3,12 @@ #include #include -#include -#include - +#include +#include #include #include #include #include - #include namespace stan { diff --git a/stan/math/rev/functor/kinsol_solve.hpp b/stan/math/rev/functor/kinsol_solve.hpp index 06e41c0c8ac..97a95b8b747 100644 --- a/stan/math/rev/functor/kinsol_solve.hpp +++ b/stan/math/rev/functor/kinsol_solve.hpp @@ -4,8 +4,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/stan/math/rev/functor/map_rect_concurrent.hpp b/stan/math/rev/functor/map_rect_concurrent.hpp index 5a5d265266e..f738ca7037e 100644 --- a/stan/math/rev/functor/map_rect_concurrent.hpp +++ b/stan/math/rev/functor/map_rect_concurrent.hpp @@ -2,7 +2,7 @@ #define STAN_MATH_REV_FUNCTOR_MAP_RECT_CONCURRENT_HPP #include -#include +#include #include #include #include diff --git a/stan/math/rev/functor/map_rect_reduce.hpp b/stan/math/rev/functor/map_rect_reduce.hpp index 61ce9a7d9af..38ce7d643d5 100644 --- a/stan/math/rev/functor/map_rect_reduce.hpp +++ b/stan/math/rev/functor/map_rect_reduce.hpp @@ -2,12 +2,11 @@ #define STAN_MATH_REV_FUNCTOR_MAP_RECT_REDUCE_HPP #include -#include -#include #include #include #include - +#include +#include #include namespace stan {