Skip to content

Commit a937b12

Browse files
committed
Explicit typing
1 parent 6545ad6 commit a937b12

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

stan/math/fwd/fun/hypergeometric_1F0.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ namespace math {
2525
* @param[in] z Scalar z argument
2626
* @return Hypergeometric 1F0 function
2727
*/
28-
template <typename Ta, typename Tz, require_any_fvar_t<Ta, Tz>* = nullptr>
29-
auto hypergeometric_1f0(const Ta& a, const Tz& z) {
30-
using FvarT = return_type_t<Ta, Tz>;
31-
32-
auto a_val = value_of(a);
33-
auto z_val = value_of(z);
28+
template <typename Ta, typename Tz,
29+
typename FvarT = return_type_t<Ta, Tz>,
30+
require_all_stan_scalar_t<Ta, Tz>* = nullptr,
31+
require_any_fvar_t<Ta, Tz>* = nullptr>
32+
FvarT hypergeometric_1f0(const Ta& a, const Tz& z) {
33+
partials_type_t<Ta> a_val = value_of(a);
34+
partials_type_t<Tz> z_val = value_of(z);
3435
FvarT rtn = FvarT(hypergeometric_1f0(a_val, z_val), 0.0);
3536
if (!is_constant_all<Ta>::value) {
3637
rtn.d_ += forward_as<FvarT>(a).d() * -rtn.val() * log1m(z_val);

stan/math/prim/fun/hypergeometric_1F0.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ namespace math {
2727
* @param[in] z Scalar z argument
2828
* @return Hypergeometric 1F0 function
2929
*/
30-
template <typename Ta, typename Tz, require_all_arithmetic_t<Ta, Tz>* = nullptr>
31-
auto hypergeometric_1f0(const Ta& a, const Tz& z) {
30+
template <typename Ta, typename Tz,
31+
require_all_arithmetic_t<Ta, Tz>* = nullptr>
32+
double hypergeometric_1f0(const Ta& a, const Tz& z) {
3233
constexpr const char* function = "hypergeometric_1f0";
33-
check_less("hypergeometric_1f0", "abs(z)", std::abs(z), 1.0);
34+
check_less("hypergeometric_1f0", "abs(z)", std::fabs(z), 1.0);
3435

3536
return boost::math::hypergeometric_1F0(a, z, boost_policy_t<>());
3637
}

stan/math/rev/fun/hypergeometric_1F0.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ namespace math {
2828
* @param[in] z Scalar z argument
2929
* @return Hypergeometric 1F0 function
3030
*/
31-
template <typename Ta, typename Tz, require_any_var_t<Ta, Tz>* = nullptr>
31+
template <typename Ta, typename Tz,
32+
require_all_stan_scalar_t<Ta, Tz>* = nullptr,
33+
require_any_var_t<Ta, Tz>* = nullptr>
3234
var hypergeometric_1f0(const Ta& a, const Tz& z) {
3335
double a_val = value_of(a);
3436
double z_val = value_of(z);

0 commit comments

Comments
 (0)