Stan Math Library  2.20.0
reverse mode automatic differentiation
tgamma.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_TGAMMA_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_TGAMMA_HPP
3 
7 #include <cmath>
8 
9 namespace stan {
10 namespace math {
11 
18 inline double tgamma(double x) {
19  if (x == 0.0 || is_nonpositive_integer(x))
20  domain_error("tgamma", "x", x, "x == 0 or negative integer");
21  return std::tgamma(x);
22 }
23 
24 } // namespace math
25 } // namespace stan
26 #endif
bool is_nonpositive_integer(T x)
Returns true if the input is a nonpositive integer and false otherwise.
var tgamma(const var &a)
Return the Gamma function applied to the specified variable (C99).
Definition: tgamma.hpp:56
void domain_error(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
Throw a domain error with a consistently formatted message.
fvar< T > tgamma(const fvar< T > &x)
Return the result of applying the gamma function to the specified argument.
Definition: tgamma.hpp:21

     [ Stan Home Page ] © 2011–2018, Stan Development Team.