Skip to content

Commit 01940dd

Browse files
spinkneysyclik
authored andcommitted
explicit type
1 parent f8f8256 commit 01940dd

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

stan/math/prim/prob/gamma_lccdf.hpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@
88
#include <stan/math/prim/fun/fma.hpp>
99
#include <stan/math/prim/fun/gamma_p.hpp>
1010
#include <stan/math/prim/fun/grad_reg_lower_inc_gamma.hpp>
11-
#include <stan/math/prim/fun/log.hpp>
11+
// #include <stan/math/prim/fun/lgamma.hpp>
12+
// #include <stan/math/prim/fun/log.hpp>
1213
#include <stan/math/prim/fun/log1m.hpp>
1314
#include <stan/math/prim/fun/max_size.hpp>
1415
#include <stan/math/prim/fun/scalar_seq_view.hpp>
1516
#include <stan/math/prim/fun/size.hpp>
1617
#include <stan/math/prim/fun/size_zero.hpp>
1718
#include <stan/math/prim/fun/value_of.hpp>
1819
#include <stan/math/prim/functor/partials_propagator.hpp>
20+
1921
#include <stan/math/fwd/fun/lgamma.hpp>
2022
#include <stan/math/fwd/fun/log.hpp>
2123
#include <stan/math/fwd/fun/value_of.hpp>
@@ -26,6 +28,19 @@ namespace math {
2628

2729
namespace internal {
2830

31+
/**
32+
* Compute log(Q(a,x)) using continued fraction expansion for upper incomplete
33+
* gamma function, where Q(a,x) = Gamma(a,x) / Gamma(a) is the regularized
34+
* upper incomplete gamma function.
35+
*
36+
* @tparam T_a Type of shape parameter a; can be either double or fvar<double>
37+
* for forward-mode automatic differentiation
38+
* @param a Shape parameter
39+
* @param x Value at which to evaluate
40+
* @param max_steps Maximum number of continued fraction iterations
41+
* @param precision Convergence threshold
42+
* @return log(Q(a,x)) with same type as T_a
43+
*/
2944
template <typename T_a>
3045
inline auto log_q_gamma_cf(const T_a& a, const double x, int max_steps = 250,
3146
double precision = 1e-16) {

0 commit comments

Comments
 (0)