Skip to content

Commit

Permalink
Docstring duplication and edits
Browse files Browse the repository at this point in the history
  • Loading branch information
WardBrian committed Nov 14, 2024
1 parent c15aeae commit 9a6a4ec
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 2 deletions.
10 changes: 10 additions & 0 deletions stan/math/prim/fun/acosh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ inline auto acosh(const T& x) {
return apply_scalar_unary<acosh_fun, T>::apply(x);
}

/**
* Return the elementwise application of <code>acosh()</code> 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 <typename Container,
require_container_bt<std::is_arithmetic, Container>* = nullptr>
inline auto acosh(const Container& x) {
Expand Down
8 changes: 8 additions & 0 deletions stan/math/prim/fun/asinh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ inline auto asinh(const T& x) {
return apply_scalar_unary<asinh_fun, T>::apply(x);
}

/**
* 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.
*/
template <typename Container,
require_container_bt<std::is_arithmetic, Container>* = nullptr>
inline auto asinh(const Container& x) {
Expand Down
10 changes: 10 additions & 0 deletions stan/math/prim/fun/atanh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ inline auto atanh(const T& x) {
return apply_scalar_unary<atanh_fun, T>::apply(x);
}

/**
* Return the elementwise application of <code>atanh()</code> 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 <typename Container,
require_container_bt<std::is_arithmetic, Container>* = nullptr>
inline auto atanh(const Container& x) {
Expand Down
13 changes: 13 additions & 0 deletions stan/math/prim/fun/inv_cloglog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ inline auto inv_cloglog(const T x) {
return 1. - std::exp(-std::exp(x));
}

/**
* The inverse complementary log-log function.
*
* The function is defined by
*
* <code>inv_cloglog(x) = 1 - exp(-exp(x))</code>.
*
* This function can be used to implement the inverse link
* function for complementary-log-log regression.
*
* @param x Argument.
* @return Inverse complementary log-log of the argument.
*/
template <typename T, require_complex_t<T>* = nullptr>
inline auto inv_cloglog(const T& x) {
return 1. - exp(-exp(x));
Expand Down
5 changes: 4 additions & 1 deletion stan/math/prim/meta/is_container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,15 @@ template <template <class...> class TypeCheck, class... Check>
using require_not_container_st
= require_not_t<container_type_check_base<is_container, scalar_type_t,
TypeCheck, Check...>>;
/*! @} */

/*! \brief Require type satisfies @ref is_container */
/*! and holds a base type that satisfies @ref is_autodiff */
/*! @tparam T the type to check */
template <typename T>
using require_ad_container_t
= require_all_t<stan::math::disjunction<is_eigen<T>, is_std_vector<T>>,
is_autodiff<base_type_t<T>>>;
/*! @} */

} // namespace stan

Expand Down
3 changes: 2 additions & 1 deletion stan/math/prim/meta/is_real.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
namespace stan {

/**
* Checks if decayed type is a var, fvar, or arithmetic
* Checks if decayed type is a var, fvar, or arithmetic. This
* is equivalent to @ref is_stan_scalar, except for excluding std::complex
* @tparam The type to check
* @ingroup type_trait
*/
Expand Down

0 comments on commit 9a6a4ec

Please sign in to comment.