<commit_before>#ifndef STAN_MATH_PRIM_SCAL_FUN_GRAD_2F1_HPP
#define STAN_MATH_PRIM_SCAL_FUN_GRAD_2F1_HPP

#include <stan/math/prim/scal/err/domain_error.hpp>
#include <stan/math/prim/scal/fun/is_nan.hpp>
#include <cmath>

namespace stan {
  namespace math {

    // Gradient of the hypergeometric function 2F1(a, b | c | z)
    // with respect to a and c
    /**
     * Gradient of the hypergeometric function, 2F1(a1, a2, b1, z)
     * with respect to a1 and b1 only.
     *
     * The generalized hypergeometric function is a power series. This
     * implementation computes gradient by computing the power series
     * directly stopping when the series converges to within
     * <code>precision</code> or takes <code>max_steps</code>.
     *
     * If more than <code>max_steps</code> are taken without
     * converging, the function will throw a domain_error.
     *
     * @tparam T type of arguments and result
     * @param[out] gradA11 output argument for partial w.r.t. a1
     * @param[out] gradB1 output argument for partial w.r.t. b1
     * @param[in] a1 a1, see generalized hypergeometric function definition.
     * @param[in] a2 a2, see generalized hypergeometric function definition.
     * @param[in] b1 b1, see generalized hypergeometric function definition.
     * @param[in] z z, see generalized hypergeometric function definition.
     * @param[in] precision precision of the infinite sum. defaults to 1e-6
     * @param[in] max_steps number of steps to take. defaults to 10000
     * @throw @throws std::domain_error if not converged after max_steps
     *
     */
    template<typename T>
    void grad_2F1(T& gradA1, T& gradB1, const T& a1, const T& a2,
      const T& b1, const T& z, T precision = 1e-6, int max_steps = 1e5) {
      using std::fabs;
<commit_msg>Doc fix, checked doc compiles.<commit_after>#ifndef STAN_MATH_PRIM_SCAL_FUN_GRAD_2F1_HPP
#define STAN_MATH_PRIM_SCAL_FUN_GRAD_2F1_HPP

#include <stan/math/prim/scal/err/domain_error.hpp>
#include <stan/math/prim/scal/fun/is_nan.hpp>
#include <cmath>

namespace stan {
  namespace math {

    /**
     * Gradient of the hypergeometric function, 2F1(a1, a2, b1, z)
     * with respect to a1 and b1 only.
     *
     * The generalized hypergeometric function is a power series. This
     * implementation computes gradient by computing the power series
     * directly stopping when the series converges to within
     * <code>precision</code> or takes <code>max_steps</code>.
     *
     * If more than <code>max_steps</code> are taken without
     * converging, the function will throw a domain_error.
     *
     * @tparam T type of arguments and result
     * @param[out] gradA1 output argument for partial w.r.t. a1
     * @param[out] gradB1 output argument for partial w.r.t. b1
     * @param[in] a1 a1, see generalized hypergeometric function definition.
     * @param[in] a2 a2, see generalized hypergeometric function definition.
     * @param[in] b1 b1, see generalized hypergeometric function definition.
     * @param[in] z z, see generalized hypergeometric function definition.
     * @param[in] precision precision of the infinite sum. defaults to 1e-6
     * @param[in] max_steps number of steps to take. defaults to 10000
     * @throw throws std::domain_error if not converged after max_steps
     *
     */
    template<typename T>
    void grad_2F1(T& gradA1, T& gradB1, const T& a1, const T& a2,
      const T& b1, const T& z, T precision = 1e-6, int max_steps = 1e5) {
      using std::fabs;

{'fraction_non_alphanumeric': 0.08911739502999143, 'fraction_numerical': 0.02313624678663239, 'mean_word_length': 3.275946275946276, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3613044', 'n_tokens_mistral': 1170, 'n_tokens_neox': 1116, 'n_words': 385}