From 47a04d424bd73a7bea320775087e15640e3135ec Mon Sep 17 00:00:00 2001 From: rok-cesnovar Date: Fri, 6 Mar 2020 11:56:45 +0100 Subject: [PATCH 1/8] remove nan check for atanh(int) --- stan/math/prim/fun/atanh.hpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/stan/math/prim/fun/atanh.hpp b/stan/math/prim/fun/atanh.hpp index 8a309ea9c12..c04730015ea 100644 --- a/stan/math/prim/fun/atanh.hpp +++ b/stan/math/prim/fun/atanh.hpp @@ -36,12 +36,8 @@ inline double atanh(double x) { * @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); - } + check_bounded("atanh", "x", x, -1, 1); + return std::atanh(x); } /** From a7f5fde15d2c65bdbb29e856029f67e3cf509030 Mon Sep 17 00:00:00 2001 From: rok-cesnovar Date: Fri, 6 Mar 2020 18:18:57 +0100 Subject: [PATCH 2/8] remove nan check for log1p(int) --- stan/math/prim/fun/log1p.hpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/stan/math/prim/fun/log1p.hpp b/stan/math/prim/fun/log1p.hpp index c21b826dd7f..a01e0ea9892 100644 --- a/stan/math/prim/fun/log1p.hpp +++ b/stan/math/prim/fun/log1p.hpp @@ -45,12 +45,8 @@ inline double log1p(double x) { * @throw std::domain_error If argument is less than -1. */ inline double log1p(int x) { - if (is_nan(x)) { - return x; - } else { - check_greater_or_equal("log1p", "x", x, -1); - return std::log1p(x); - } + check_greater_or_equal("log1p", "x", x, -1); + return std::log1p(x); } /** From 987b7332f2ef94a1b8f4d829f31a6867112a9a5a Mon Sep 17 00:00:00 2001 From: rok-cesnovar Date: Fri, 6 Mar 2020 18:21:39 +0100 Subject: [PATCH 3/8] remove fun(int) and fun(double) for function that only call std:: --- stan/math/prim/fun/acos.hpp | 5 +++-- stan/math/prim/fun/asin.hpp | 5 +++-- stan/math/prim/fun/asinh.hpp | 27 +++++---------------------- stan/math/prim/fun/atan.hpp | 5 +++-- stan/math/prim/fun/cbrt.hpp | 24 ++++-------------------- stan/math/prim/fun/ceil.hpp | 5 +++-- stan/math/prim/fun/cos.hpp | 5 +++-- stan/math/prim/fun/cosh.hpp | 5 +++-- stan/math/prim/fun/erf.hpp | 27 ++++----------------------- stan/math/prim/fun/erfc.hpp | 28 +++++----------------------- stan/math/prim/fun/exp.hpp | 11 +---------- stan/math/prim/fun/exp2.hpp | 29 ++++++----------------------- stan/math/prim/fun/expm1.hpp | 23 ++++------------------- stan/math/prim/fun/fabs.hpp | 5 +++-- stan/math/prim/fun/floor.hpp | 5 +++-- stan/math/prim/fun/inv.hpp | 9 ++++----- stan/math/prim/fun/inv_sqrt.hpp | 13 +++++-------- stan/math/prim/fun/inv_square.hpp | 6 ++---- stan/math/prim/fun/log.hpp | 11 +---------- stan/math/prim/fun/log2.hpp | 20 ++------------------ stan/math/prim/fun/round.hpp | 19 +------------------ stan/math/prim/fun/sqrt.hpp | 9 --------- stan/math/prim/fun/trunc.hpp | 21 ++------------------- 23 files changed, 70 insertions(+), 247 deletions(-) diff --git a/stan/math/prim/fun/acos.hpp b/stan/math/prim/fun/acos.hpp index 3b9b0557b88..7aefbcfcd31 100644 --- a/stan/math/prim/fun/acos.hpp +++ b/stan/math/prim/fun/acos.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap acos() so it can be vectorized. + * Structure to wrap acos() so it can be vectorized. * * @tparam T type of variable * @param x variable @@ -24,7 +24,8 @@ struct acos_fun { }; /** - * Vectorized version of acos(). + * Returns the elementwise acos() of the input, + * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container * @param x container diff --git a/stan/math/prim/fun/asin.hpp b/stan/math/prim/fun/asin.hpp index 71c133adad6..ceb14b6427d 100644 --- a/stan/math/prim/fun/asin.hpp +++ b/stan/math/prim/fun/asin.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap asin() so it can be vectorized. + * Structure to wrap asin() so it can be vectorized. * * @tparam T type of argument * @param x argument @@ -24,7 +24,8 @@ struct asin_fun { }; /** - * Vectorized version of asin(). + * Returns the elementwise asin() of the input, + * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container * @param x container diff --git a/stan/math/prim/fun/asinh.hpp b/stan/math/prim/fun/asinh.hpp index 83e301b0ca2..a362f70e0c9 100644 --- a/stan/math/prim/fun/asinh.hpp +++ b/stan/math/prim/fun/asinh.hpp @@ -8,26 +8,7 @@ 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. + * Structure to wrap asinh() so it can be vectorized. * * @tparam T argument scalar type * @param x argument @@ -36,13 +17,15 @@ inline double asinh(int x) { return std::asinh(x); } struct asinh_fun { template static inline T fun(const T& x) { + using std::asinh; return asinh(x); } }; /** - * Vectorized version of asinh(). - * + * Returns the elementwise asinh() of the input, + * which may be a scalar or any Stan container of numeric scalars. + * * @tparam T type of container * @param x container * @return Inverse hyperbolic sine of each value in the container. diff --git a/stan/math/prim/fun/atan.hpp b/stan/math/prim/fun/atan.hpp index 51a787f21bc..0dcd10b2382 100644 --- a/stan/math/prim/fun/atan.hpp +++ b/stan/math/prim/fun/atan.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap atan() so it can be vectorized. + * Structure to wrap atan() so it can be vectorized. * * @tparam T type of variable * @param x variable @@ -24,7 +24,8 @@ struct atan_fun { }; /** - * Vectorized version of atan(). + * Returns the elementwise atan()of the input, + * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container * @param x container diff --git a/stan/math/prim/fun/cbrt.hpp b/stan/math/prim/fun/cbrt.hpp index b9903202bb4..256c77ca21d 100644 --- a/stan/math/prim/fun/cbrt.hpp +++ b/stan/math/prim/fun/cbrt.hpp @@ -8,25 +8,7 @@ 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. + * Structure to wrap cbrt() so it can be vectorized. * * @tparam T type of variable * @param x variable @@ -35,12 +17,14 @@ inline double cbrt(int x) { return std::cbrt(x); } struct cbrt_fun { template static inline T fun(const T& x) { + using std::cbrt; return cbrt(x); } }; /** - * Vectorized version of cbrt(). + * Returns the elementwise cbrt() of the input, + * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container * @param x container diff --git a/stan/math/prim/fun/ceil.hpp b/stan/math/prim/fun/ceil.hpp index ef8c23354f5..0cab2a81616 100644 --- a/stan/math/prim/fun/ceil.hpp +++ b/stan/math/prim/fun/ceil.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap ceil() so it can be vectorized. + * Structure to wrap ceil() so it can be vectorized. * * @tparam T type of variable * @param x variable @@ -24,7 +24,8 @@ struct ceil_fun { }; /** - * Vectorized version of ceil(). + * Returns the elementwise ceil() of the input, + * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container * @param x container diff --git a/stan/math/prim/fun/cos.hpp b/stan/math/prim/fun/cos.hpp index cce0ddef2da..48b4bfe3f51 100644 --- a/stan/math/prim/fun/cos.hpp +++ b/stan/math/prim/fun/cos.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap cos() so it can be vectorized. + * Structure to wrap cos() so it can be vectorized. * * @tparam T type of variable * @param x angle in radians @@ -24,7 +24,8 @@ struct cos_fun { }; /** - * Vectorized version of cos(). + * Returns the elementwise cos() of the input, + * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container * @param x angles in radians diff --git a/stan/math/prim/fun/cosh.hpp b/stan/math/prim/fun/cosh.hpp index 80aecfcc275..7adec2eb567 100644 --- a/stan/math/prim/fun/cosh.hpp +++ b/stan/math/prim/fun/cosh.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap cosh() so it can be vectorized. + * Structure to wrap cosh() so it can be vectorized. * * @tparam T type of argument * @param x angle in radians @@ -24,7 +24,8 @@ struct cosh_fun { }; /** - * Vectorized version of cosh(). + * Returns the elementwise cosh() of the input, + * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container * @param x angles in radians diff --git a/stan/math/prim/fun/erf.hpp b/stan/math/prim/fun/erf.hpp index 1226ad0a275..abea712f739 100644 --- a/stan/math/prim/fun/erf.hpp +++ b/stan/math/prim/fun/erf.hpp @@ -8,28 +8,7 @@ namespace stan { namespace math { /** - * Return the error function of the specified value. - * - * \f[ - * \mbox{erf}(x) = \frac{2}{\sqrt{\pi}} \int_0^x e^{-t^2} dt - * \f] - * - * @param[in] x Argument. - * @return Error function of the argument. - */ -inline double erf(double x) { return std::erf(x); } - -/** - * Return the error function of the specified argument. This - * version is required to disambiguate erf(int). - * - * @param[in] x Argument. - * @return Error function of the argument. - */ -inline double erf(int x) { return std::erf(x); } - -/** - * Structure to wrap erf() so it can be vectorized. + * Structure to wrap erf() so it can be vectorized. * * @tparam T type of variable * @param x variable @@ -38,12 +17,14 @@ inline double erf(int x) { return std::erf(x); } struct erf_fun { template static inline T fun(const T& x) { + using std::erf; return erf(x); } }; /** - * Vectorized version of erf(). + * Returns the elementwise erf() of the input, + * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container * @param x container diff --git a/stan/math/prim/fun/erfc.hpp b/stan/math/prim/fun/erfc.hpp index 3a14ad3a330..ca3f4c84609 100644 --- a/stan/math/prim/fun/erfc.hpp +++ b/stan/math/prim/fun/erfc.hpp @@ -8,28 +8,8 @@ namespace stan { namespace math { /** - * Return the complementary error function of the specified value. - * - * \f[ - * \mbox{erfc}(x) = 1 - \frac{2}{\sqrt{\pi}} \int_0^x e^{-t^2} dt - * \f] - * - * @param[in] x Argument. - * @return Complementary error function of the argument. - */ -inline double erfc(double x) { return std::erfc(x); } - -/** - * Return the error function of the specified argument. This - * version is required to disambiguate erfc(int). - * - * @param[in] x Argument. - * @return Complementary error function value of the argument. - */ -inline double erfc(int x) { return std::erfc(x); } - -/** - * Structure to wrap erfc() so that it can be vectorized. + * Structure to wrap the erfc() + * so that it can be vectorized. * * @tparam T type of variable * @param x variable @@ -38,12 +18,14 @@ inline double erfc(int x) { return std::erfc(x); } struct erfc_fun { template static inline T fun(const T& x) { + using std::erfc; return erfc(x); } }; /** - * Vectorized version of erfc(). + * Returns the elementwise erfc() of the input, + * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container * @param x container diff --git a/stan/math/prim/fun/exp.hpp b/stan/math/prim/fun/exp.hpp index d1ac2eaa717..5dd613cc586 100644 --- a/stan/math/prim/fun/exp.hpp +++ b/stan/math/prim/fun/exp.hpp @@ -8,15 +8,6 @@ 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. @@ -37,7 +28,7 @@ struct exp_fun { }; /** - * Return the elementwise exponentiation of the specified argument, + * Return the elementwise exp() of the specified argument, * which may be a scalar or any Stan container of numeric scalars. * The return type is the same as the argument type. * diff --git a/stan/math/prim/fun/exp2.hpp b/stan/math/prim/fun/exp2.hpp index 938beae292f..980b2a6d0ee 100644 --- a/stan/math/prim/fun/exp2.hpp +++ b/stan/math/prim/fun/exp2.hpp @@ -8,24 +8,7 @@ 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. + * Structure to wrap exp2() so it can be vectorized. */ struct exp2_fun { /** @@ -37,21 +20,21 @@ struct exp2_fun { */ template static inline T fun(const T& x) { + using std::exp2; return exp2(x); } }; /** - * Return the elementwise application of exp2() 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. + * Return the elementwise exp2() of the specified argument, + * which may be a scalar or any Stan container of numeric scalars. + * The return type is the same as the argument type. * * @tparam T type of container * @param x container * @return Elementwise exp2 of members of container. */ -template > +template inline auto exp2(const T& x) { return apply_scalar_unary::apply(x); } diff --git a/stan/math/prim/fun/expm1.hpp b/stan/math/prim/fun/expm1.hpp index 9a80def3c4d..32ed889073e 100644 --- a/stan/math/prim/fun/expm1.hpp +++ b/stan/math/prim/fun/expm1.hpp @@ -7,24 +7,6 @@ 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. * @@ -35,12 +17,15 @@ inline double expm1(int x) { return std::expm1(x); } struct expm1_fun { template static inline T fun(const T& x) { + using std::expm1; return expm1(x); } }; /** - * Vectorized version of expm1(). + * Return the elementwise expm1() of the specified argument, + * which may be a scalar or any Stan container of numeric scalars. + * The return type is the same as the argument type. * * @tparam T type of container * @param x container diff --git a/stan/math/prim/fun/fabs.hpp b/stan/math/prim/fun/fabs.hpp index 233488b2769..c2707f4ac9b 100644 --- a/stan/math/prim/fun/fabs.hpp +++ b/stan/math/prim/fun/fabs.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap fabs() so that it can be vectorized. + * Structure to wrap fabs() so that it can be vectorized. * * @tparam T type of variable * @param x variable @@ -24,7 +24,8 @@ struct fabs_fun { }; /** - * Vectorized version of fabs(). + * Returns the elementwise fabs() of the input, + * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container * @param x container diff --git a/stan/math/prim/fun/floor.hpp b/stan/math/prim/fun/floor.hpp index 88fd6c37c83..6444c90893a 100644 --- a/stan/math/prim/fun/floor.hpp +++ b/stan/math/prim/fun/floor.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap floor() so that it can be vectorized. + * Structure to wrap floor() so that it can be vectorized. * * @tparam T type of variable * @param x variable @@ -24,7 +24,8 @@ struct floor_fun { }; /** - * Vectorized version of floor(). + * Returns the elementwise floor() of the input, + * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container * @param x container diff --git a/stan/math/prim/fun/inv.hpp b/stan/math/prim/fun/inv.hpp index 2238d59cf7f..93c9b73a9f2 100644 --- a/stan/math/prim/fun/inv.hpp +++ b/stan/math/prim/fun/inv.hpp @@ -7,10 +7,8 @@ namespace stan { namespace math { -inline double inv(double x) { return 1.0 / x; } - /** - * Structure to wrap inv() so that it can be vectorized. + * Structure to wrap 1.0 / x so that it can be vectorized. * * @tparam T type of variable * @param x variable @@ -19,12 +17,13 @@ inline double inv(double x) { return 1.0 / x; } struct inv_fun { template static inline T fun(const T& x) { - return inv(x); + return 1.0 / x;; } }; /** - * Vectorized version of inv(). + * Return the elementwise 1.0 / x of the specified argument, + * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container * @param x container diff --git a/stan/math/prim/fun/inv_sqrt.hpp b/stan/math/prim/fun/inv_sqrt.hpp index ed619de5919..5f614fe2463 100644 --- a/stan/math/prim/fun/inv_sqrt.hpp +++ b/stan/math/prim/fun/inv_sqrt.hpp @@ -10,13 +10,8 @@ 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. + * Structure to wrap 1 / sqrt(x) so that it can be vectorized. * * @tparam T type of variable * @param x variable @@ -25,12 +20,14 @@ inline double inv_sqrt(double x) { struct inv_sqrt_fun { template static inline T fun(const T& x) { - return inv_sqrt(x); + using std::sqrt; + return inv(sqrt(x)); } }; /** - * Vectorized version of inv_sqrt(). + * Return the elementwise 1 / sqrt(x) of the specified argument, + * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container * @param x container diff --git a/stan/math/prim/fun/inv_square.hpp b/stan/math/prim/fun/inv_square.hpp index 92ad939d4fb..d7d0b121e9f 100644 --- a/stan/math/prim/fun/inv_square.hpp +++ b/stan/math/prim/fun/inv_square.hpp @@ -9,14 +9,12 @@ namespace stan { namespace math { -inline double inv_square(double x) { return inv(square(x)); } - /** - * Vectorized version of inv_square(). + * Returns 1 / square(x). * * @tparam T type of container * @param x container - * @return 1 / the square of each value in x. + * @return 1 / square(x) of each value in x. */ template inline auto inv_square(const T& x) { diff --git a/stan/math/prim/fun/log.hpp b/stan/math/prim/fun/log.hpp index e29f05bc96a..954e0c89eb1 100644 --- a/stan/math/prim/fun/log.hpp +++ b/stan/math/prim/fun/log.hpp @@ -9,16 +9,7 @@ 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. + * Structure to wrap log() so that it can be vectorized. */ struct log_fun { /** diff --git a/stan/math/prim/fun/log2.hpp b/stan/math/prim/fun/log2.hpp index 107aa817883..b040d17e901 100644 --- a/stan/math/prim/fun/log2.hpp +++ b/stan/math/prim/fun/log2.hpp @@ -3,28 +3,11 @@ #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. * @@ -45,6 +28,7 @@ struct log2_fun { */ template static inline T fun(const T& x) { + using std::log2; return log2(x); } }; @@ -59,7 +43,7 @@ struct log2_fun { * @param x container * @return elementwise log2 of container elements */ -template > +template inline auto log2(const T& x) { return apply_scalar_unary::apply(x); } diff --git a/stan/math/prim/fun/round.hpp b/stan/math/prim/fun/round.hpp index cbc95916ea4..4051904699f 100644 --- a/stan/math/prim/fun/round.hpp +++ b/stan/math/prim/fun/round.hpp @@ -8,24 +8,6 @@ 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. * @@ -36,6 +18,7 @@ inline double round(int x) { return std::round(x); } struct round_fun { template static inline T fun(const T& x) { + using std::round; return round(x); } }; diff --git a/stan/math/prim/fun/sqrt.hpp b/stan/math/prim/fun/sqrt.hpp index 2b397a586d4..42ee5257ea8 100644 --- a/stan/math/prim/fun/sqrt.hpp +++ b/stan/math/prim/fun/sqrt.hpp @@ -8,15 +8,6 @@ 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 Square root of x. - */ -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/fun/trunc.hpp b/stan/math/prim/fun/trunc.hpp index 4a8f1eeee0f..b0a2633bf0c 100644 --- a/stan/math/prim/fun/trunc.hpp +++ b/stan/math/prim/fun/trunc.hpp @@ -8,25 +8,7 @@ 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. + * Structure to wrap trunc() so it can be vectorized. */ struct trunc_fun { /** @@ -39,6 +21,7 @@ struct trunc_fun { */ template static inline T fun(const T& x) { + using std::trunc; return trunc(x); } }; From 4bef707c2dd31f7d19a27f8c794f4f997570023a Mon Sep 17 00:00:00 2001 From: Stan Jenkins Date: Fri, 6 Mar 2020 17:38:00 +0000 Subject: [PATCH 4/8] [Jenkins] auto-formatting by clang-format version 5.0.0-3~16.04.1 (tags/RELEASE_500/final) --- stan/math/prim/fun/asinh.hpp | 2 +- stan/math/prim/fun/inv.hpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/stan/math/prim/fun/asinh.hpp b/stan/math/prim/fun/asinh.hpp index a362f70e0c9..4f9161e021b 100644 --- a/stan/math/prim/fun/asinh.hpp +++ b/stan/math/prim/fun/asinh.hpp @@ -25,7 +25,7 @@ struct asinh_fun { /** * Returns the elementwise asinh() of the input, * which may be a scalar or any Stan container of numeric scalars. - * + * * @tparam T type of container * @param x container * @return Inverse hyperbolic sine of each value in the container. diff --git a/stan/math/prim/fun/inv.hpp b/stan/math/prim/fun/inv.hpp index 93c9b73a9f2..3ace0006b78 100644 --- a/stan/math/prim/fun/inv.hpp +++ b/stan/math/prim/fun/inv.hpp @@ -17,7 +17,8 @@ namespace math { struct inv_fun { template static inline T fun(const T& x) { - return 1.0 / x;; + return 1.0 / x; + ; } }; From b5330f8c10c9b67a88eaa0a089cbc7ec492eb523 Mon Sep 17 00:00:00 2001 From: rok-cesnovar Date: Fri, 6 Mar 2020 18:40:53 +0100 Subject: [PATCH 5/8] remove stray semicolon --- stan/math/prim/fun/inv.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/stan/math/prim/fun/inv.hpp b/stan/math/prim/fun/inv.hpp index 3ace0006b78..0e051b31504 100644 --- a/stan/math/prim/fun/inv.hpp +++ b/stan/math/prim/fun/inv.hpp @@ -18,7 +18,6 @@ struct inv_fun { template static inline T fun(const T& x) { return 1.0 / x; - ; } }; From ad978ecdc13f3ddf1e2158d436a28cfdf10b4554 Mon Sep 17 00:00:00 2001 From: rok-cesnovar Date: Fri, 6 Mar 2020 19:31:38 +0100 Subject: [PATCH 6/8] change to \c --- stan/math/prim/fun/acos.hpp | 4 ++-- stan/math/prim/fun/asin.hpp | 4 ++-- stan/math/prim/fun/asinh.hpp | 4 ++-- stan/math/prim/fun/atan.hpp | 4 ++-- stan/math/prim/fun/cbrt.hpp | 4 ++-- stan/math/prim/fun/ceil.hpp | 6 +++--- stan/math/prim/fun/cos.hpp | 6 +++--- stan/math/prim/fun/cosh.hpp | 6 +++--- stan/math/prim/fun/erf.hpp | 4 ++-- stan/math/prim/fun/erfc.hpp | 4 ++-- stan/math/prim/fun/exp.hpp | 6 +++--- stan/math/prim/fun/exp2.hpp | 4 ++-- stan/math/prim/fun/expm1.hpp | 4 ++-- stan/math/prim/fun/fabs.hpp | 8 ++++---- stan/math/prim/fun/floor.hpp | 6 +++--- stan/math/prim/fun/inv.hpp | 4 ++-- stan/math/prim/fun/inv_sqrt.hpp | 8 ++++---- stan/math/prim/fun/inv_square.hpp | 4 ++-- stan/math/prim/fun/log.hpp | 4 ++-- stan/math/prim/fun/log2.hpp | 4 ++-- stan/math/prim/fun/round.hpp | 6 +++--- stan/math/prim/fun/sqrt.hpp | 6 +++--- stan/math/prim/fun/trunc.hpp | 4 ++-- 23 files changed, 57 insertions(+), 57 deletions(-) diff --git a/stan/math/prim/fun/acos.hpp b/stan/math/prim/fun/acos.hpp index 7aefbcfcd31..f315746eb8f 100644 --- a/stan/math/prim/fun/acos.hpp +++ b/stan/math/prim/fun/acos.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap acos() so it can be vectorized. + * Structure to wrap \c acos() so it can be vectorized. * * @tparam T type of variable * @param x variable @@ -24,7 +24,7 @@ struct acos_fun { }; /** - * Returns the elementwise acos() of the input, + * Returns the elementwise \c acos() of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container diff --git a/stan/math/prim/fun/asin.hpp b/stan/math/prim/fun/asin.hpp index ceb14b6427d..483ed851851 100644 --- a/stan/math/prim/fun/asin.hpp +++ b/stan/math/prim/fun/asin.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap asin() so it can be vectorized. + * Structure to wrap \c asin() so it can be vectorized. * * @tparam T type of argument * @param x argument @@ -24,7 +24,7 @@ struct asin_fun { }; /** - * Returns the elementwise asin() of the input, + * Returns the elementwise \c asin() of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container diff --git a/stan/math/prim/fun/asinh.hpp b/stan/math/prim/fun/asinh.hpp index 4f9161e021b..c35e221dd1c 100644 --- a/stan/math/prim/fun/asinh.hpp +++ b/stan/math/prim/fun/asinh.hpp @@ -8,7 +8,7 @@ namespace stan { namespace math { /** - * Structure to wrap asinh() so it can be vectorized. + * Structure to wrap \c asinh() so it can be vectorized. * * @tparam T argument scalar type * @param x argument @@ -23,7 +23,7 @@ struct asinh_fun { }; /** - * Returns the elementwise asinh() of the input, + * Returns the elementwise \c asinh() of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container diff --git a/stan/math/prim/fun/atan.hpp b/stan/math/prim/fun/atan.hpp index 0dcd10b2382..23f496b1dfb 100644 --- a/stan/math/prim/fun/atan.hpp +++ b/stan/math/prim/fun/atan.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap atan() so it can be vectorized. + * Structure to wrap \c atan() so it can be vectorized. * * @tparam T type of variable * @param x variable @@ -24,7 +24,7 @@ struct atan_fun { }; /** - * Returns the elementwise atan()of the input, + * Returns the elementwise \c atan() of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container diff --git a/stan/math/prim/fun/cbrt.hpp b/stan/math/prim/fun/cbrt.hpp index 256c77ca21d..5a3b6d27c83 100644 --- a/stan/math/prim/fun/cbrt.hpp +++ b/stan/math/prim/fun/cbrt.hpp @@ -8,7 +8,7 @@ namespace stan { namespace math { /** - * Structure to wrap cbrt() so it can be vectorized. + * Structure to wrap \c cbrt() so it can be vectorized. * * @tparam T type of variable * @param x variable @@ -23,7 +23,7 @@ struct cbrt_fun { }; /** - * Returns the elementwise cbrt() of the input, + * Returns the elementwise \c cbrt() of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container diff --git a/stan/math/prim/fun/ceil.hpp b/stan/math/prim/fun/ceil.hpp index 0cab2a81616..26826f25775 100644 --- a/stan/math/prim/fun/ceil.hpp +++ b/stan/math/prim/fun/ceil.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap ceil() so it can be vectorized. + * Structure to wrap \c ceil() so it can be vectorized. * * @tparam T type of variable * @param x variable @@ -24,7 +24,7 @@ struct ceil_fun { }; /** - * Returns the elementwise ceil() of the input, + * Returns the elementwise \c ceil() of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container @@ -37,7 +37,7 @@ inline auto ceil(const T& x) { } /** - * Version of ceil() that accepts Eigen Matrix or matrix expressions. + * Version of \c ceil() that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/cos.hpp b/stan/math/prim/fun/cos.hpp index 48b4bfe3f51..aecaddb23ac 100644 --- a/stan/math/prim/fun/cos.hpp +++ b/stan/math/prim/fun/cos.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap cos() so it can be vectorized. + * Structure to wrap \c cos() so it can be vectorized. * * @tparam T type of variable * @param x angle in radians @@ -24,7 +24,7 @@ struct cos_fun { }; /** - * Returns the elementwise cos() of the input, + * Returns the elementwise \c cos() of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container @@ -37,7 +37,7 @@ inline auto cos(const T& x) { } /** - * Version of cos() that accepts Eigen Matrix or matrix expressions. + * Version of \c cos() that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/cosh.hpp b/stan/math/prim/fun/cosh.hpp index 7adec2eb567..956cefd3e7e 100644 --- a/stan/math/prim/fun/cosh.hpp +++ b/stan/math/prim/fun/cosh.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap cosh() so it can be vectorized. + * Structure to wrap \c cosh() so it can be vectorized. * * @tparam T type of argument * @param x angle in radians @@ -24,7 +24,7 @@ struct cosh_fun { }; /** - * Returns the elementwise cosh() of the input, + * Returns the elementwise \c cosh() of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container @@ -37,7 +37,7 @@ inline typename apply_scalar_unary::return_t cosh(const T& x) { } /** - * Version of cosh() that accepts Eigen Matrix or matrix expressions. + * Version of \c cosh() that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/erf.hpp b/stan/math/prim/fun/erf.hpp index abea712f739..b433a934055 100644 --- a/stan/math/prim/fun/erf.hpp +++ b/stan/math/prim/fun/erf.hpp @@ -8,7 +8,7 @@ namespace stan { namespace math { /** - * Structure to wrap erf() so it can be vectorized. + * Structure to wrap \c erf() so it can be vectorized. * * @tparam T type of variable * @param x variable @@ -23,7 +23,7 @@ struct erf_fun { }; /** - * Returns the elementwise erf() of the input, + * Returns the elementwise \c erf() of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container diff --git a/stan/math/prim/fun/erfc.hpp b/stan/math/prim/fun/erfc.hpp index ca3f4c84609..a959ef42bbd 100644 --- a/stan/math/prim/fun/erfc.hpp +++ b/stan/math/prim/fun/erfc.hpp @@ -8,7 +8,7 @@ namespace stan { namespace math { /** - * Structure to wrap the erfc() + * Structure to wrap the \c erfc() * so that it can be vectorized. * * @tparam T type of variable @@ -24,7 +24,7 @@ struct erfc_fun { }; /** - * Returns the elementwise erfc() of the input, + * Returns the elementwise \c erfc() of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container diff --git a/stan/math/prim/fun/exp.hpp b/stan/math/prim/fun/exp.hpp index 5dd613cc586..e327f846d2d 100644 --- a/stan/math/prim/fun/exp.hpp +++ b/stan/math/prim/fun/exp.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap exp() so that it can be + * Structure to wrap \c exp() so that it can be * vectorized. */ struct exp_fun { @@ -28,7 +28,7 @@ struct exp_fun { }; /** - * Return the elementwise exp() of the specified argument, + * Return the elementwise \c exp() of the specified argument, * which may be a scalar or any Stan container of numeric scalars. * The return type is the same as the argument type. * @@ -42,7 +42,7 @@ inline auto exp(const T& x) { } /** - * Version of exp() that accepts Eigen Matrix or matrix expressions. + * Version of \c exp() that accepts Eigen Matrix or matrix expressions. * @tparam Derived derived type of x * @param x Matrix or matrix expression * @return Elementwise application of exponentiation to the argument. diff --git a/stan/math/prim/fun/exp2.hpp b/stan/math/prim/fun/exp2.hpp index 980b2a6d0ee..6cc830b6e58 100644 --- a/stan/math/prim/fun/exp2.hpp +++ b/stan/math/prim/fun/exp2.hpp @@ -8,7 +8,7 @@ namespace stan { namespace math { /** - * Structure to wrap exp2() so it can be vectorized. + * Structure to wrap \c exp2() so it can be vectorized. */ struct exp2_fun { /** @@ -26,7 +26,7 @@ struct exp2_fun { }; /** - * Return the elementwise exp2() of the specified argument, + * Return the elementwise \c exp2() of the specified argument, * which may be a scalar or any Stan container of numeric scalars. * The return type is the same as the argument type. * diff --git a/stan/math/prim/fun/expm1.hpp b/stan/math/prim/fun/expm1.hpp index 32ed889073e..4bf4a43d0ea 100644 --- a/stan/math/prim/fun/expm1.hpp +++ b/stan/math/prim/fun/expm1.hpp @@ -8,7 +8,7 @@ namespace stan { namespace math { /** - * Structure to wrap expm1() so that it can be vectorized. + * Structure to wrap \c expm1() so that it can be vectorized. * * @tparam T type of variable * @param x variable @@ -23,7 +23,7 @@ struct expm1_fun { }; /** - * Return the elementwise expm1() of the specified argument, + * Return the elementwise \c expm1() of the specified argument, * which may be a scalar or any Stan container of numeric scalars. * The return type is the same as the argument type. * diff --git a/stan/math/prim/fun/fabs.hpp b/stan/math/prim/fun/fabs.hpp index c2707f4ac9b..3a066c43653 100644 --- a/stan/math/prim/fun/fabs.hpp +++ b/stan/math/prim/fun/fabs.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap fabs() so that it can be vectorized. + * Structure to wrap \c fabs() so that it can be vectorized. * * @tparam T type of variable * @param x variable @@ -24,7 +24,7 @@ struct fabs_fun { }; /** - * Returns the elementwise fabs() of the input, + * Returns the elementwise \c fabs() of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container @@ -37,7 +37,7 @@ inline typename apply_scalar_unary::return_t fabs(const T& x) { } /** - * Version of fabs() that accepts Eigen Matrix or matrix expressions. + * Version of \c fabs() that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression @@ -50,7 +50,7 @@ inline auto fabs(const Eigen::MatrixBase& x) { } /** - * Version of fabs() that accepts Eigen Array or array expressions. + * Version of \c fabs() that accepts Eigen Array or array expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/floor.hpp b/stan/math/prim/fun/floor.hpp index 6444c90893a..a2fda6ec08b 100644 --- a/stan/math/prim/fun/floor.hpp +++ b/stan/math/prim/fun/floor.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap floor() so that it can be vectorized. + * Structure to wrap \c floor() so that it can be vectorized. * * @tparam T type of variable * @param x variable @@ -24,7 +24,7 @@ struct floor_fun { }; /** - * Returns the elementwise floor() of the input, + * Returns the elementwise \c floor() of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container @@ -37,7 +37,7 @@ inline auto floor(const T& x) { } /** - * Version of floor() that accepts Eigen Matrix or matrix expressions. + * Version of \c floor() that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/inv.hpp b/stan/math/prim/fun/inv.hpp index 0e051b31504..4006d177e4a 100644 --- a/stan/math/prim/fun/inv.hpp +++ b/stan/math/prim/fun/inv.hpp @@ -35,7 +35,7 @@ inline auto inv(const T& x) { } /** - * Version of inv() that accepts Eigen Matrix or matrix expressions. + * Version of \c inv() that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression @@ -48,7 +48,7 @@ inline auto inv(const Eigen::MatrixBase& x) { } /** - * Version of inv() that accepts Eigen Array or array expressions. + * Version of \c inv() that accepts Eigen Array or array expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/inv_sqrt.hpp b/stan/math/prim/fun/inv_sqrt.hpp index 5f614fe2463..337b0360e9e 100644 --- a/stan/math/prim/fun/inv_sqrt.hpp +++ b/stan/math/prim/fun/inv_sqrt.hpp @@ -11,7 +11,7 @@ namespace stan { namespace math { /** - * Structure to wrap 1 / sqrt(x) so that it can be vectorized. + * Structure to wrap \code{1 / sqrt(x)} so that it can be vectorized. * * @tparam T type of variable * @param x variable @@ -26,7 +26,7 @@ struct inv_sqrt_fun { }; /** - * Return the elementwise 1 / sqrt(x) of the specified argument, + * Return the elementwise \code{1 / sqrt(x)} of the specified argument, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container @@ -39,7 +39,7 @@ inline auto inv_sqrt(const T& x) { } /** - * Version of inv_sqrt() that accepts Eigen Matrix or matrix expressions. + * Version of \c inv_sqrt() that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression @@ -52,7 +52,7 @@ inline auto inv_sqrt(const Eigen::MatrixBase& x) { } /** - * Version of inv_sqrt() that accepts Eigen Array or array expressions. + * Version of \c inv_sqrt() that accepts Eigen Array or array expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/inv_square.hpp b/stan/math/prim/fun/inv_square.hpp index d7d0b121e9f..03d84eef767 100644 --- a/stan/math/prim/fun/inv_square.hpp +++ b/stan/math/prim/fun/inv_square.hpp @@ -10,11 +10,11 @@ namespace stan { namespace math { /** - * Returns 1 / square(x). + * Returns \code{1 / square(x)}. * * @tparam T type of container * @param x container - * @return 1 / square(x) of each value in x. + * @return \code{1 / square(x)} of each value in x. */ template inline auto inv_square(const T& x) { diff --git a/stan/math/prim/fun/log.hpp b/stan/math/prim/fun/log.hpp index 954e0c89eb1..f969a4596d7 100644 --- a/stan/math/prim/fun/log.hpp +++ b/stan/math/prim/fun/log.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap log() so that it can be vectorized. + * Structure to wrap \c log() so that it can be vectorized. */ struct log_fun { /** @@ -41,7 +41,7 @@ inline auto log(const T& x) { } /** - * Version of log() that accepts Eigen Matrix or matrix expressions. + * Version of \c log() that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/log2.hpp b/stan/math/prim/fun/log2.hpp index b040d17e901..832e4a5cae9 100644 --- a/stan/math/prim/fun/log2.hpp +++ b/stan/math/prim/fun/log2.hpp @@ -16,7 +16,7 @@ namespace math { inline double log2() { return LOG_TWO; } /** - * Structure to wrap log2() so it can be vectorized. + * Structure to wrap \c log2() so it can be vectorized. */ struct log2_fun { /** @@ -34,7 +34,7 @@ struct log2_fun { }; /** - * Return the elementwise application of log2() to + * Return the elementwise application of \c log2() 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. diff --git a/stan/math/prim/fun/round.hpp b/stan/math/prim/fun/round.hpp index 4051904699f..57ccdf96ce2 100644 --- a/stan/math/prim/fun/round.hpp +++ b/stan/math/prim/fun/round.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap round() so it can be vectorized. + * Structure to wrap \c round() so it can be vectorized. * * @tparam T type of argument * @param x argument variable @@ -24,7 +24,7 @@ struct round_fun { }; /** - * Vectorized version of round. + * Vectorized version of \c round(). * * @tparam T type of container * @param x container @@ -36,7 +36,7 @@ inline auto round(const T& x) { } /** - * Version of round() that accepts Eigen Matrix or matrix expressions. + * Version of \c round() that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/sqrt.hpp b/stan/math/prim/fun/sqrt.hpp index 42ee5257ea8..727f0649833 100644 --- a/stan/math/prim/fun/sqrt.hpp +++ b/stan/math/prim/fun/sqrt.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap sqrt() so that it can be vectorized. + * Structure to wrap \c sqrt() so that it can be vectorized. * * @tparam T type of variable * @param x variable @@ -24,7 +24,7 @@ struct sqrt_fun { }; /** - * Vectorized version of sqrt(). + * Vectorized version of \c sqrt(). * * @tparam T type of container * @param x container @@ -36,7 +36,7 @@ inline auto sqrt(const T& x) { } /** - * Version of sqrt() that accepts Eigen Matrix or matrix expressions. + * Version of \c sqrt() that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/trunc.hpp b/stan/math/prim/fun/trunc.hpp index b0a2633bf0c..5636d18e0ad 100644 --- a/stan/math/prim/fun/trunc.hpp +++ b/stan/math/prim/fun/trunc.hpp @@ -8,7 +8,7 @@ namespace stan { namespace math { /** - * Structure to wrap trunc() so it can be vectorized. + * Structure to wrap \c trunc() so it can be vectorized. */ struct trunc_fun { /** @@ -27,7 +27,7 @@ struct trunc_fun { }; /** - * Return the elementwise application of trunc() to + * Return the elementwise application of \c trunc() 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. From e45f023a8ec56eba5c279515ca935889757793d7 Mon Sep 17 00:00:00 2001 From: rok-cesnovar Date: Sat, 7 Mar 2020 12:22:15 +0100 Subject: [PATCH 7/8] fix exp and log test --- test/unit/math/prim/fun/exp_test.cpp | 2 +- test/unit/math/prim/fun/log_test.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/math/prim/fun/exp_test.cpp b/test/unit/math/prim/fun/exp_test.cpp index 292f72baf10..806a2ef345f 100644 --- a/test/unit/math/prim/fun/exp_test.cpp +++ b/test/unit/math/prim/fun/exp_test.cpp @@ -3,8 +3,8 @@ TEST(MathFunctions, expInt) { using stan::math::exp; - using std::exp; EXPECT_FLOAT_EQ(std::exp(3), exp(3)); + EXPECT_FLOAT_EQ(std::exp(3.1), exp(3.1)); EXPECT_FLOAT_EQ(std::exp(3.0), exp(3.0)); } diff --git a/test/unit/math/prim/fun/log_test.cpp b/test/unit/math/prim/fun/log_test.cpp index f7163dbcf1a..b431a1fa4ea 100644 --- a/test/unit/math/prim/fun/log_test.cpp +++ b/test/unit/math/prim/fun/log_test.cpp @@ -3,8 +3,8 @@ TEST(MathFunctions, logInt) { using stan::math::log; - using std::log; EXPECT_FLOAT_EQ(std::log(3), log(3)); + EXPECT_FLOAT_EQ(std::log(3.1), log(3.1)); EXPECT_FLOAT_EQ(std::log(3.0), log(3.0)); } From cfcbb882ab9bcf90c40736cad9ef7b423a90b67d Mon Sep 17 00:00:00 2001 From: rok-cesnovar Date: Sat, 7 Mar 2020 18:48:47 +0100 Subject: [PATCH 8/8] fix sqrt and change \c with ` ` --- stan/math/prim/fun/acos.hpp | 6 +++--- stan/math/prim/fun/asin.hpp | 6 +++--- stan/math/prim/fun/asinh.hpp | 4 ++-- stan/math/prim/fun/cbrt.hpp | 4 ++-- stan/math/prim/fun/ceil.hpp | 6 +++--- stan/math/prim/fun/cos.hpp | 6 +++--- stan/math/prim/fun/cosh.hpp | 6 +++--- stan/math/prim/fun/erf.hpp | 4 ++-- stan/math/prim/fun/erfc.hpp | 4 ++-- stan/math/prim/fun/exp.hpp | 6 +++--- stan/math/prim/fun/exp2.hpp | 4 ++-- stan/math/prim/fun/expm1.hpp | 4 ++-- stan/math/prim/fun/fabs.hpp | 6 +++--- stan/math/prim/fun/floor.hpp | 6 +++--- stan/math/prim/fun/inv.hpp | 2 +- stan/math/prim/fun/inv_sqrt.hpp | 6 +++--- stan/math/prim/fun/inv_square.hpp | 4 ++-- stan/math/prim/fun/log.hpp | 4 ++-- stan/math/prim/fun/log2.hpp | 4 ++-- stan/math/prim/fun/round.hpp | 6 +++--- stan/math/prim/fun/sqrt.hpp | 6 +++--- stan/math/prim/fun/tan.hpp | 6 +++--- stan/math/prim/fun/tanh.hpp | 6 +++--- stan/math/prim/fun/trigamma.hpp | 4 ++-- stan/math/prim/fun/trunc.hpp | 4 ++-- test/unit/math/prim/fun/sqrt_test.cpp | 2 +- 26 files changed, 63 insertions(+), 63 deletions(-) diff --git a/stan/math/prim/fun/acos.hpp b/stan/math/prim/fun/acos.hpp index f315746eb8f..90d0e43b2db 100644 --- a/stan/math/prim/fun/acos.hpp +++ b/stan/math/prim/fun/acos.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap \c acos() so it can be vectorized. + * Structure to wrap `acos()` so it can be vectorized. * * @tparam T type of variable * @param x variable @@ -24,7 +24,7 @@ struct acos_fun { }; /** - * Returns the elementwise \c acos() of the input, + * Returns the elementwise `acos()` of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container @@ -37,7 +37,7 @@ inline auto acos(const T& x) { } /** - * Version of acos() that accepts Eigen Matrix or matrix expressions. + * Version of `acos()` that accepts Eigen Matrix or matrix expressions. * @tparam Derived derived type of x * @param x Matrix or matrix expression * @return Arc cosine of each variable in the container, in radians. diff --git a/stan/math/prim/fun/asin.hpp b/stan/math/prim/fun/asin.hpp index 483ed851851..5dd22611672 100644 --- a/stan/math/prim/fun/asin.hpp +++ b/stan/math/prim/fun/asin.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap \c asin() so it can be vectorized. + * Structure to wrap `asin()` so it can be vectorized. * * @tparam T type of argument * @param x argument @@ -24,7 +24,7 @@ struct asin_fun { }; /** - * Returns the elementwise \c asin() of the input, + * Returns the elementwise `asin()` of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container @@ -37,7 +37,7 @@ inline auto asin(const T& x) { } /** - * Version of asin() that accepts Eigen Matrix or matrix expressions. + * Version of `asin()` that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/asinh.hpp b/stan/math/prim/fun/asinh.hpp index c35e221dd1c..7f3fe63476a 100644 --- a/stan/math/prim/fun/asinh.hpp +++ b/stan/math/prim/fun/asinh.hpp @@ -8,7 +8,7 @@ namespace stan { namespace math { /** - * Structure to wrap \c asinh() so it can be vectorized. + * Structure to wrap `asinh()` so it can be vectorized. * * @tparam T argument scalar type * @param x argument @@ -23,7 +23,7 @@ struct asinh_fun { }; /** - * Returns the elementwise \c asinh() of the input, + * Returns the elementwise `asinh()` of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container diff --git a/stan/math/prim/fun/cbrt.hpp b/stan/math/prim/fun/cbrt.hpp index 5a3b6d27c83..dd180a3b0fe 100644 --- a/stan/math/prim/fun/cbrt.hpp +++ b/stan/math/prim/fun/cbrt.hpp @@ -8,7 +8,7 @@ namespace stan { namespace math { /** - * Structure to wrap \c cbrt() so it can be vectorized. + * Structure to wrap `cbrt()` so it can be vectorized. * * @tparam T type of variable * @param x variable @@ -23,7 +23,7 @@ struct cbrt_fun { }; /** - * Returns the elementwise \c cbrt() of the input, + * Returns the elementwise `cbrt()` of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container diff --git a/stan/math/prim/fun/ceil.hpp b/stan/math/prim/fun/ceil.hpp index 26826f25775..a1122e5df6b 100644 --- a/stan/math/prim/fun/ceil.hpp +++ b/stan/math/prim/fun/ceil.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap \c ceil() so it can be vectorized. + * Structure to wrap `ceil()` so it can be vectorized. * * @tparam T type of variable * @param x variable @@ -24,7 +24,7 @@ struct ceil_fun { }; /** - * Returns the elementwise \c ceil() of the input, + * Returns the elementwise `ceil()` of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container @@ -37,7 +37,7 @@ inline auto ceil(const T& x) { } /** - * Version of \c ceil() that accepts Eigen Matrix or matrix expressions. + * Version of `ceil()` that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/cos.hpp b/stan/math/prim/fun/cos.hpp index aecaddb23ac..c19fc462b62 100644 --- a/stan/math/prim/fun/cos.hpp +++ b/stan/math/prim/fun/cos.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap \c cos() so it can be vectorized. + * Structure to wrap `cos()` so it can be vectorized. * * @tparam T type of variable * @param x angle in radians @@ -24,7 +24,7 @@ struct cos_fun { }; /** - * Returns the elementwise \c cos() of the input, + * Returns the elementwise `cos()` of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container @@ -37,7 +37,7 @@ inline auto cos(const T& x) { } /** - * Version of \c cos() that accepts Eigen Matrix or matrix expressions. + * Version of `cos()` that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/cosh.hpp b/stan/math/prim/fun/cosh.hpp index 956cefd3e7e..bee7a5789e3 100644 --- a/stan/math/prim/fun/cosh.hpp +++ b/stan/math/prim/fun/cosh.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap \c cosh() so it can be vectorized. + * Structure to wrap `cosh()` so it can be vectorized. * * @tparam T type of argument * @param x angle in radians @@ -24,7 +24,7 @@ struct cosh_fun { }; /** - * Returns the elementwise \c cosh() of the input, + * Returns the elementwise `cosh()` of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container @@ -37,7 +37,7 @@ inline typename apply_scalar_unary::return_t cosh(const T& x) { } /** - * Version of \c cosh() that accepts Eigen Matrix or matrix expressions. + * Version of `cosh()` that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/erf.hpp b/stan/math/prim/fun/erf.hpp index b433a934055..21083fe5288 100644 --- a/stan/math/prim/fun/erf.hpp +++ b/stan/math/prim/fun/erf.hpp @@ -8,7 +8,7 @@ namespace stan { namespace math { /** - * Structure to wrap \c erf() so it can be vectorized. + * Structure to wrap `erf()` so it can be vectorized. * * @tparam T type of variable * @param x variable @@ -23,7 +23,7 @@ struct erf_fun { }; /** - * Returns the elementwise \c erf() of the input, + * Returns the elementwise `erf()` of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container diff --git a/stan/math/prim/fun/erfc.hpp b/stan/math/prim/fun/erfc.hpp index a959ef42bbd..8368c1741d8 100644 --- a/stan/math/prim/fun/erfc.hpp +++ b/stan/math/prim/fun/erfc.hpp @@ -8,7 +8,7 @@ namespace stan { namespace math { /** - * Structure to wrap the \c erfc() + * Structure to wrap the `erfc()` * so that it can be vectorized. * * @tparam T type of variable @@ -24,7 +24,7 @@ struct erfc_fun { }; /** - * Returns the elementwise \c erfc() of the input, + * Returns the elementwise `erfc()` of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container diff --git a/stan/math/prim/fun/exp.hpp b/stan/math/prim/fun/exp.hpp index e327f846d2d..ae3dc1b9c09 100644 --- a/stan/math/prim/fun/exp.hpp +++ b/stan/math/prim/fun/exp.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap \c exp() so that it can be + * Structure to wrap `exp()` so that it can be * vectorized. */ struct exp_fun { @@ -28,7 +28,7 @@ struct exp_fun { }; /** - * Return the elementwise \c exp() of the specified argument, + * Return the elementwise `exp()` of the specified argument, * which may be a scalar or any Stan container of numeric scalars. * The return type is the same as the argument type. * @@ -42,7 +42,7 @@ inline auto exp(const T& x) { } /** - * Version of \c exp() that accepts Eigen Matrix or matrix expressions. + * Version of `exp()` that accepts Eigen Matrix or matrix expressions. * @tparam Derived derived type of x * @param x Matrix or matrix expression * @return Elementwise application of exponentiation to the argument. diff --git a/stan/math/prim/fun/exp2.hpp b/stan/math/prim/fun/exp2.hpp index 6cc830b6e58..486f085ba12 100644 --- a/stan/math/prim/fun/exp2.hpp +++ b/stan/math/prim/fun/exp2.hpp @@ -8,7 +8,7 @@ namespace stan { namespace math { /** - * Structure to wrap \c exp2() so it can be vectorized. + * Structure to wrap `exp2()` so it can be vectorized. */ struct exp2_fun { /** @@ -26,7 +26,7 @@ struct exp2_fun { }; /** - * Return the elementwise \c exp2() of the specified argument, + * Return the elementwise `exp2()` of the specified argument, * which may be a scalar or any Stan container of numeric scalars. * The return type is the same as the argument type. * diff --git a/stan/math/prim/fun/expm1.hpp b/stan/math/prim/fun/expm1.hpp index 4bf4a43d0ea..b2821f601e9 100644 --- a/stan/math/prim/fun/expm1.hpp +++ b/stan/math/prim/fun/expm1.hpp @@ -8,7 +8,7 @@ namespace stan { namespace math { /** - * Structure to wrap \c expm1() so that it can be vectorized. + * Structure to wrap `expm1()` so that it can be vectorized. * * @tparam T type of variable * @param x variable @@ -23,7 +23,7 @@ struct expm1_fun { }; /** - * Return the elementwise \c expm1() of the specified argument, + * Return the elementwise `expm1()` of the specified argument, * which may be a scalar or any Stan container of numeric scalars. * The return type is the same as the argument type. * diff --git a/stan/math/prim/fun/fabs.hpp b/stan/math/prim/fun/fabs.hpp index 3a066c43653..f73651f30b2 100644 --- a/stan/math/prim/fun/fabs.hpp +++ b/stan/math/prim/fun/fabs.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap \c fabs() so that it can be vectorized. + * Structure to wrap `fabs()` so that it can be vectorized. * * @tparam T type of variable * @param x variable @@ -24,7 +24,7 @@ struct fabs_fun { }; /** - * Returns the elementwise \c fabs() of the input, + * Returns the elementwise `fabs()` of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container @@ -37,7 +37,7 @@ inline typename apply_scalar_unary::return_t fabs(const T& x) { } /** - * Version of \c fabs() that accepts Eigen Matrix or matrix expressions. + * Version of `fabs()` that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/floor.hpp b/stan/math/prim/fun/floor.hpp index a2fda6ec08b..96cda54802c 100644 --- a/stan/math/prim/fun/floor.hpp +++ b/stan/math/prim/fun/floor.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap \c floor() so that it can be vectorized. + * Structure to wrap `floor()` so that it can be vectorized. * * @tparam T type of variable * @param x variable @@ -24,7 +24,7 @@ struct floor_fun { }; /** - * Returns the elementwise \c floor() of the input, + * Returns the elementwise `floor()` of the input, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container @@ -37,7 +37,7 @@ inline auto floor(const T& x) { } /** - * Version of \c floor() that accepts Eigen Matrix or matrix expressions. + * Version of `floor()` that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/inv.hpp b/stan/math/prim/fun/inv.hpp index 4006d177e4a..523567815c3 100644 --- a/stan/math/prim/fun/inv.hpp +++ b/stan/math/prim/fun/inv.hpp @@ -48,7 +48,7 @@ inline auto inv(const Eigen::MatrixBase& x) { } /** - * Version of \c inv() that accepts Eigen Array or array expressions. + * Version of `inv()` that accepts Eigen Array or array expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/inv_sqrt.hpp b/stan/math/prim/fun/inv_sqrt.hpp index 337b0360e9e..a693313fde2 100644 --- a/stan/math/prim/fun/inv_sqrt.hpp +++ b/stan/math/prim/fun/inv_sqrt.hpp @@ -11,7 +11,7 @@ namespace stan { namespace math { /** - * Structure to wrap \code{1 / sqrt(x)} so that it can be vectorized. + * Structure to wrap `1 / sqrt(x)}` so that it can be vectorized. * * @tparam T type of variable * @param x variable @@ -26,7 +26,7 @@ struct inv_sqrt_fun { }; /** - * Return the elementwise \code{1 / sqrt(x)} of the specified argument, + * Return the elementwise `1 / sqrt(x)}` of the specified argument, * which may be a scalar or any Stan container of numeric scalars. * * @tparam T type of container @@ -39,7 +39,7 @@ inline auto inv_sqrt(const T& x) { } /** - * Version of \c inv_sqrt() that accepts Eigen Matrix or matrix expressions. + * Version of `inv_sqrt()` that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/inv_square.hpp b/stan/math/prim/fun/inv_square.hpp index 03d84eef767..edc5d256b7c 100644 --- a/stan/math/prim/fun/inv_square.hpp +++ b/stan/math/prim/fun/inv_square.hpp @@ -10,11 +10,11 @@ namespace stan { namespace math { /** - * Returns \code{1 / square(x)}. + * Returns `1 / square(x)`. * * @tparam T type of container * @param x container - * @return \code{1 / square(x)} of each value in x. + * @return `1 / square(x)` of each value in x. */ template inline auto inv_square(const T& x) { diff --git a/stan/math/prim/fun/log.hpp b/stan/math/prim/fun/log.hpp index f969a4596d7..22b4a4e1a5d 100644 --- a/stan/math/prim/fun/log.hpp +++ b/stan/math/prim/fun/log.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap \c log() so that it can be vectorized. + * Structure to wrap `log()` so that it can be vectorized. */ struct log_fun { /** @@ -41,7 +41,7 @@ inline auto log(const T& x) { } /** - * Version of \c log() that accepts Eigen Matrix or matrix expressions. + * Version of `log()` that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/log2.hpp b/stan/math/prim/fun/log2.hpp index 832e4a5cae9..a2129a168a3 100644 --- a/stan/math/prim/fun/log2.hpp +++ b/stan/math/prim/fun/log2.hpp @@ -16,7 +16,7 @@ namespace math { inline double log2() { return LOG_TWO; } /** - * Structure to wrap \c log2() so it can be vectorized. + * Structure to wrap `log2()` so it can be vectorized. */ struct log2_fun { /** @@ -34,7 +34,7 @@ struct log2_fun { }; /** - * Return the elementwise application of \c log2() to + * Return the elementwise application of `log2()` 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. diff --git a/stan/math/prim/fun/round.hpp b/stan/math/prim/fun/round.hpp index 57ccdf96ce2..645adfc9305 100644 --- a/stan/math/prim/fun/round.hpp +++ b/stan/math/prim/fun/round.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap \c round() so it can be vectorized. + * Structure to wrap `round()` so it can be vectorized. * * @tparam T type of argument * @param x argument variable @@ -24,7 +24,7 @@ struct round_fun { }; /** - * Vectorized version of \c round(). + * Vectorized version of `round()`. * * @tparam T type of container * @param x container @@ -36,7 +36,7 @@ inline auto round(const T& x) { } /** - * Version of \c round() that accepts Eigen Matrix or matrix expressions. + * Version of `round()` that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/sqrt.hpp b/stan/math/prim/fun/sqrt.hpp index 727f0649833..91a7af63a49 100644 --- a/stan/math/prim/fun/sqrt.hpp +++ b/stan/math/prim/fun/sqrt.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap \c sqrt() so that it can be vectorized. + * Structure to wrap `sqrt()` so that it can be vectorized. * * @tparam T type of variable * @param x variable @@ -24,7 +24,7 @@ struct sqrt_fun { }; /** - * Vectorized version of \c sqrt(). + * Vectorized version of `sqrt()`. * * @tparam T type of container * @param x container @@ -36,7 +36,7 @@ inline auto sqrt(const T& x) { } /** - * Version of \c sqrt() that accepts Eigen Matrix or matrix expressions. + * Version of `sqrt()` that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/tan.hpp b/stan/math/prim/fun/tan.hpp index 88048922084..06599bbfe77 100644 --- a/stan/math/prim/fun/tan.hpp +++ b/stan/math/prim/fun/tan.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap tan() so that it can be vectorized. + * Structure to wrap `tan()` so that it can be vectorized. * * @tparam T type of argument * @param x angle in radians @@ -24,7 +24,7 @@ struct tan_fun { }; /** - * Vectorized version of tan(). + * Vectorized version of `tan()`. * * @tparam T type of container * @param x angles in radians @@ -36,7 +36,7 @@ inline auto tan(const T& x) { } /** - * Version of tan() that accepts Eigen Matrix or matrix expressions. + * Version of `tan()` that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/tanh.hpp b/stan/math/prim/fun/tanh.hpp index 966aaad3a1c..2e19615e841 100644 --- a/stan/math/prim/fun/tanh.hpp +++ b/stan/math/prim/fun/tanh.hpp @@ -9,7 +9,7 @@ namespace stan { namespace math { /** - * Structure to wrap tanh() so that it can be vectorized. + * Structure to wrap `tanh()` so that it can be vectorized. * * @tparam T type of argument * @param x angle in radians @@ -24,7 +24,7 @@ struct tanh_fun { }; /** - * Vectorized version of tanh(). + * Vectorized version of `tanh()`. * * @tparam T type of container * @param x angles in radians @@ -36,7 +36,7 @@ inline auto tanh(const T& x) { } /** - * Version of tanh() that accepts Eigen Matrix or matrix expressions. + * Version of `tanh()` that accepts Eigen Matrix or matrix expressions. * * @tparam Derived derived type of x * @param x Matrix or matrix expression diff --git a/stan/math/prim/fun/trigamma.hpp b/stan/math/prim/fun/trigamma.hpp index 5155c5a9e32..108eaa6c555 100644 --- a/stan/math/prim/fun/trigamma.hpp +++ b/stan/math/prim/fun/trigamma.hpp @@ -128,7 +128,7 @@ 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. + * Structure to wrap `trigamma()` so it can be vectorized. */ struct trigamma_fun { /** @@ -146,7 +146,7 @@ struct trigamma_fun { }; /** - * Return the elementwise application of trigamma() to + * 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. diff --git a/stan/math/prim/fun/trunc.hpp b/stan/math/prim/fun/trunc.hpp index 5636d18e0ad..13580c7180d 100644 --- a/stan/math/prim/fun/trunc.hpp +++ b/stan/math/prim/fun/trunc.hpp @@ -8,7 +8,7 @@ namespace stan { namespace math { /** - * Structure to wrap \c trunc() so it can be vectorized. + * Structure to wrap `trunc()` so it can be vectorized. */ struct trunc_fun { /** @@ -27,7 +27,7 @@ struct trunc_fun { }; /** - * Return the elementwise application of \c trunc() to + * Return the elementwise application of `trunc()` 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. diff --git a/test/unit/math/prim/fun/sqrt_test.cpp b/test/unit/math/prim/fun/sqrt_test.cpp index 9896911dbf5..bdb17fdcd91 100644 --- a/test/unit/math/prim/fun/sqrt_test.cpp +++ b/test/unit/math/prim/fun/sqrt_test.cpp @@ -3,8 +3,8 @@ TEST(MathFunctions, sqrtInt) { using stan::math::sqrt; - using std::sqrt; EXPECT_FLOAT_EQ(std::sqrt(3.0), sqrt(3)); + EXPECT_FLOAT_EQ(std::sqrt(3.1), sqrt(3.1)); EXPECT_TRUE(stan::math::is_nan(sqrt(-2))); }