Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ grad_2F1_impl()

template<bool calc_a1, bool calc_a2, bool calc_b1, bool calc_z, typename T1 , typename T2 , typename T3 , typename T_z , typename ScalarT = return_type_t<T1, T2, T3, T_z>, typename TupleT = std::tuple<ScalarT, ScalarT, ScalarT, ScalarT>>
TupleT stan::math::internal::grad_2F1_impl ( const T1 &  a1,
const T2 &  a2,
const T3 &  b1,
const T_z &  z,
double  precision = 1e-14,
int  max_steps = 1e6 
)

Implementation function to calculate the gradients of the hypergeometric function, 2F1.

Calculate the gradients of the hypergeometric function (2F1) as the power series stopping when the series converges to within precision or throwing when the function takes max_steps steps.

This power-series representation converges for all gradients under the same conditions as the 2F1 function itself. As with the hypergeometric_2F1 function, if the parameters do not meet convergence criteria then the gradients are calculated using Euler's transformation.

Template Parameters
calc_a1boolean for whether to calculate gradients w.r.t a1
calc_a2boolean for whether to calculate gradients w.r.t a2
calc_b1boolean for whether to calculate gradients w.r.t b1
calc_zboolean for whether to calculate gradients w.r.t z
T1scalar type of a1
T2scalar type of a2
T3scalar type of b1
T_zscalar type of z
Parameters
[in]a1see generalized hypergeometric function definition
[in]a2see generalized hypergeometric function definition
[in]b1see generalized hypergeometric function definition
[in]zsee generalized hypergeometric function definition
[in]precisionmagnitude of the increment of the infinite sum to truncate the sum
[in]max_stepsnumber of steps to take
Returns
Four-element tuple containing gradients w.r.t. to each parameter, as indicated by the calc_* booleans

Definition at line 170 of file grad_2F1.hpp.