Skip to content

Commit

Permalink
Merge remote-tracking branch 'stan-dev/develop' into bugfix/1496-pois…
Browse files Browse the repository at this point in the history
…son-phi-cutoff
  • Loading branch information
martinmodrak committed Mar 15, 2020
2 parents ce9e525 + 2963923 commit 56a4d22
Show file tree
Hide file tree
Showing 31 changed files with 109 additions and 294 deletions.
7 changes: 4 additions & 3 deletions stan/math/prim/fun/acos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -36,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.
Expand Down
7 changes: 4 additions & 3 deletions stan/math/prim/fun/asin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -36,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
Expand Down
25 changes: 4 additions & 21 deletions stan/math/prim/fun/asinh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -36,12 +17,14 @@ inline double asinh(int x) { return std::asinh(x); }
struct asinh_fun {
template <typename T>
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
Expand Down
5 changes: 3 additions & 2 deletions stan/math/prim/fun/atan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,7 +24,8 @@ struct atan_fun {
};

/**
* Vectorized version of atan().
* 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
* @param x container
Expand Down
8 changes: 2 additions & 6 deletions stan/math/prim/fun/atanh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
24 changes: 4 additions & 20 deletions stan/math/prim/fun/cbrt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -35,12 +17,14 @@ inline double cbrt(int x) { return std::cbrt(x); }
struct cbrt_fun {
template <typename T>
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
Expand Down
7 changes: 4 additions & 3 deletions stan/math/prim/fun/ceil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -36,7 +37,7 @@ inline auto ceil(const T& x) {
}

/**
* Version of 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
Expand Down
7 changes: 4 additions & 3 deletions stan/math/prim/fun/cos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -36,7 +37,7 @@ inline auto cos(const T& x) {
}

/**
* Version of 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
Expand Down
7 changes: 4 additions & 3 deletions stan/math/prim/fun/cosh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -36,7 +37,7 @@ inline typename apply_scalar_unary<cosh_fun, T>::return_t cosh(const T& x) {
}

/**
* Version of 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
Expand Down
27 changes: 4 additions & 23 deletions stan/math/prim/fun/erf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <code>erf(int)</code>.
*
* @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
Expand All @@ -38,12 +17,14 @@ inline double erf(int x) { return std::erf(x); }
struct erf_fun {
template <typename T>
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
Expand Down
28 changes: 5 additions & 23 deletions stan/math/prim/fun/erfc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <code>erfc(int)</code>.
*
* @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
Expand All @@ -38,12 +18,14 @@ inline double erfc(int x) { return std::erfc(x); }
struct erfc_fun {
template <typename T>
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
Expand Down
15 changes: 3 additions & 12 deletions stan/math/prim/fun/exp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,7 @@ namespace stan {
namespace math {

/**
* Return the natural exponential of the specified argument. This
* version is required to disambiguate <code>exp(int)</code>.
*
* @param[in] x Argument.
* @return Natural exponential of argument.
*/
inline double exp(int x) { return std::exp(x); }

/**
* Structure to wrap <code>exp()</code> so that it can be
* Structure to wrap `exp()` so that it can be
* vectorized.
*/
struct exp_fun {
Expand All @@ -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.
*
Expand All @@ -51,7 +42,7 @@ inline auto exp(const T& x) {
}

/**
* Version of 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.
Expand Down
Loading

0 comments on commit 56a4d22

Please sign in to comment.