Automatic Differentiation
 
Loading...
Searching...
No Matches
digamma.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_DIGAMMA_HPP
2#define STAN_MATH_PRIM_FUN_DIGAMMA_HPP
3
7#include <boost/math/special_functions/digamma.hpp>
8
9namespace stan {
10namespace math {
11
47template <typename T, require_arithmetic_t<T>* = nullptr>
48inline double digamma(T&& x) {
49 return boost::math::digamma(x, boost_policy_t<>());
50}
51
61 template <typename T>
62 static inline auto fun(T&& x) {
63 return digamma(std::forward<T>(x));
64 }
65};
66
75template <typename T,
77 require_container_t<T>* = nullptr,
79inline auto digamma(T&& x) {
80 return apply_scalar_unary<digamma_fun, T>::apply(std::forward<T>(x));
81}
82
83} // namespace math
84} // namespace stan
85
86#endif
require_t< is_container< std::decay_t< T > > > require_container_t
Require type satisfies is_container.
require_not_t< is_nonscalar_prim_or_rev_kernel_expression< std::decay_t< T > > > require_not_nonscalar_prim_or_rev_kernel_expression_t
Require type does not satisfy is_nonscalar_prim_or_rev_kernel_expression.
require_not_t< is_var_matrix< std::decay_t< T > > > require_not_var_matrix_t
Require type does not satisfy is_var_matrix.
boost::math::policies::policy< boost::math::policies::overflow_error< boost::math::policies::errno_on_error >, boost::math::policies::pole_error< boost::math::policies::errno_on_error >, boost::math::policies::promote_double< false >, boost::math::policies::digits2< B > > boost_policy_t
Boost policy that overrides the defaults to match the built-in C++ standard library functions.
fvar< T > digamma(const fvar< T > &x)
Return the derivative of the log gamma function at the specified argument.
Definition digamma.hpp:23
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Base template class for vectorization of unary scalar functions defined by a template class F to a sc...
static auto fun(T &&x)
Definition digamma.hpp:62
Structure to wrap digamma() so it can be vectorized.
Definition digamma.hpp:60