Stan Math Library
2.20.0
reverse mode automatic differentiation
stan
math
prim
scal
fun
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
4
#include <
stan/math/prim/meta.hpp
>
5
#include <
stan/math/prim/scal/err/domain_error.hpp
>
6
#include <
stan/math/prim/scal/fun/is_nonpositive_integer.hpp
>
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
stan
Definition:
log_sum_exp.hpp:8
meta.hpp
stan::math::is_nonpositive_integer
bool is_nonpositive_integer(T x)
Returns true if the input is a nonpositive integer and false otherwise.
Definition:
is_nonpositive_integer.hpp:17
stan::math::tgamma
var tgamma(const var &a)
Return the Gamma function applied to the specified variable (C99).
Definition:
tgamma.hpp:56
stan::math::domain_error
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.
Definition:
domain_error.hpp:27
is_nonpositive_integer.hpp
domain_error.hpp
stan::math::tgamma
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.