Automatic Differentiation
 
Loading...
Searching...
No Matches
gamma_p.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_GAMMA_P_HPP
2#define STAN_MATH_PRIM_FUN_GAMMA_P_HPP
3
9#include <boost/math/special_functions/gamma.hpp>
10
11namespace stan {
12namespace math {
13
67inline double gamma_p(double z, double a) {
68 if (is_nan(z)) {
69 return not_a_number();
70 }
71 if (is_nan(a)) {
72 return not_a_number();
73 }
74 check_positive("gamma_p", "first argument (z)", z);
75 check_nonnegative("gamma_p", "second argument (a)", a);
76 return boost::math::gamma_p(z, a, boost_policy_t<>());
77}
78
89template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
90inline auto gamma_p(const T1& a, const T2& b) {
92 a, b, [&](const auto& c, const auto& d) { return gamma_p(c, d); });
93}
94
95} // namespace math
96} // namespace stan
97#endif
bool is_nan(T &&x)
Returns 1 if the input's value is NaN and 0 otherwise.
Definition is_nan.hpp:22
void check_nonnegative(const char *function, const char *name, const T_y &y)
Check if y is non-negative.
static constexpr double not_a_number()
Return (quiet) not-a-number.
fvar< T > gamma_p(const fvar< T > &x1, const fvar< T > &x2)
Definition gamma_p.hpp:18
void check_positive(const char *function, const char *name, const T_y &y)
Check if y is positive.
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.
auto apply_scalar_binary(const T1 &x, const T2 &y, const F &f)
Base template function for vectorization of binary scalar functions defined by applying a functor to ...
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...