Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion stan/math/fwd/fun.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include <stan/math/fwd/fun/fmod.hpp>
#include <stan/math/fwd/fun/gamma_p.hpp>
#include <stan/math/fwd/fun/gamma_q.hpp>
#include <stan/math/fwd/fun/grad_inc_beta.hpp>
#include <stan/math/fwd/fun/hypergeometric_1F0.hpp>
#include <stan/math/fwd/fun/hypergeometric_2F1.hpp>
#include <stan/math/fwd/fun/hypergeometric_pFq.hpp>
Expand Down
57 changes: 0 additions & 57 deletions stan/math/fwd/fun/grad_inc_beta.hpp

This file was deleted.

1 change: 0 additions & 1 deletion stan/math/prim/fun.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@
#include <stan/math/prim/fun/gp_periodic_cov.hpp>
#include <stan/math/prim/fun/grad_2F1.hpp>
#include <stan/math/prim/fun/grad_F32.hpp>
#include <stan/math/prim/fun/grad_inc_beta.hpp>
#include <stan/math/prim/fun/grad_pFq.hpp>
#include <stan/math/prim/fun/grad_reg_inc_beta.hpp>
#include <stan/math/prim/fun/grad_reg_inc_gamma.hpp>
Expand Down
45 changes: 0 additions & 45 deletions stan/math/prim/fun/grad_inc_beta.hpp

This file was deleted.

31 changes: 23 additions & 8 deletions stan/math/prim/fun/grad_reg_inc_beta.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
#define STAN_MATH_PRIM_FUN_GRAD_REG_INC_BETA_HPP

#include <stan/math/prim/meta.hpp>
#include <stan/math/prim/fun/beta.hpp>
#include <stan/math/prim/fun/grad_inc_beta.hpp>
#include <stan/math/prim/fun/inc_beta.hpp>
#include <stan/math/prim/fun/grad_2F1.hpp>
#include <cmath>

namespace stan {
Expand All @@ -16,6 +15,9 @@ namespace math {
* <code>ibeta(a, b, z)</code>, with respect to the arguments
* <code>a</code> and <code>b</code>.
*
* Uses the equivalence to a hypergeometric function. See
* http://dlmf.nist.gov/8.17#ii
*
* @tparam T type of arguments
* @param[out] g1 partial derivative of <code>ibeta(a, b, z)</code>
* with respect to <code>a</code>
Expand All @@ -34,12 +36,25 @@ void grad_reg_inc_beta(T& g1, T& g2, const T& a, const T& b, const T& z,
const T& digammaA, const T& digammaB,
const T& digammaSum, const T& betaAB) {
using std::exp;
T dBda = 0;
T dBdb = 0;
grad_inc_beta(dBda, dBdb, a, b, z);
T b1 = beta(a, b) * inc_beta(a, b, z);
g1 = (dBda - b1 * (digammaA - digammaSum)) / betaAB;
g2 = (dBdb - b1 * (digammaB - digammaSum)) / betaAB;

T c1 = log(z);
T c2 = log1m(z);
T c3 = betaAB * inc_beta(a, b, z);
T C = exp(a * c1 + b * c2) / a;
T dF1 = 0;
T dF2 = 0;
T dF3 = 0;
T dFz = 0;
if (value_of_rec(C)) {
std::forward_as_tuple(dF1, dF2, dF3, dFz)
= grad_2F1<true>(a + b, 1.0, a + 1, z);
}

T dBda = (c1 - 1.0 / a) * c3 + C * (dF1 + dF3);
T dBdb = c2 * c3 + C * dF1;

g1 = (dBda - c3 * (digammaA - digammaSum)) / betaAB;
g2 = (dBdb - c3 * (digammaB - digammaSum)) / betaAB;
}

} // namespace math
Expand Down
1 change: 0 additions & 1 deletion stan/math/rev/fun.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
#include <stan/math/rev/fun/generalized_inverse.hpp>
#include <stan/math/rev/fun/gp_periodic_cov.hpp>
#include <stan/math/rev/fun/grad.hpp>
#include <stan/math/rev/fun/grad_inc_beta.hpp>
#include <stan/math/rev/fun/hypergeometric_1F0.hpp>
#include <stan/math/rev/fun/hypergeometric_2F1.hpp>
#include <stan/math/rev/fun/hypergeometric_pFq.hpp>
Expand Down
58 changes: 0 additions & 58 deletions stan/math/rev/fun/grad_inc_beta.hpp

This file was deleted.