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
2 changes: 1 addition & 1 deletion stan/math/fwd/fun/pow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr,
require_any_fvar_t<base_type_t<T1>, base_type_t<T2>>* = nullptr>
inline auto pow(const T1& a, const T2& b) {
return apply_scalar_binary(
a, b, [](const auto& c, const auto& d) { return stan::math::pow(c, d); });
[](const auto& c, const auto& d) { return stan::math::pow(c, d); }, a, b);
}

} // namespace math
Expand Down
2 changes: 1 addition & 1 deletion stan/math/fwd/functor/finite_diff.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ template <typename FuncTangent, typename InputArg,
require_st_fvar<InputArg>* = nullptr>
inline auto aggregate_tangent(const FuncTangent& tangent, const InputArg& arg) {
return sum(apply_scalar_binary(
tangent, arg, [](const auto& x, const auto& y) { return x * y.d_; }));
[](const auto& x, const auto& y) { return x * y.d_; }, tangent, arg));
}
} // namespace internal

Expand Down
2 changes: 1 addition & 1 deletion stan/math/prim/fun/atan2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr,
require_all_not_var_matrix_t<T1, T2>* = nullptr>
inline auto atan2(const T1& a, const T2& b) {
return apply_scalar_binary(
a, b, [](const auto& c, const auto& d) { return atan2(c, d); });
[](const auto& c, const auto& d) { return atan2(c, d); }, a, b);
}

} // namespace math
Expand Down
6 changes: 3 additions & 3 deletions stan/math/prim/fun/bessel_first_kind.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ inline T2 bessel_first_kind(int v, const T2 z) {
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr,
require_not_var_matrix_t<T2>* = nullptr>
inline auto bessel_first_kind(const T1& a, const T2& b) {
return apply_scalar_binary(a, b, [&](const auto& c, const auto& d) {
return bessel_first_kind(c, d);
});
return apply_scalar_binary(
[](const auto& c, const auto& d) { return bessel_first_kind(c, d); }, a,
b);
}

} // namespace math
Expand Down
6 changes: 3 additions & 3 deletions stan/math/prim/fun/bessel_second_kind.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ inline T2 bessel_second_kind(int v, const T2 z) {
*/
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
inline auto bessel_second_kind(const T1& a, const T2& b) {
return apply_scalar_binary(a, b, [&](const auto& c, const auto& d) {
return bessel_second_kind(c, d);
});
return apply_scalar_binary(
[](const auto& c, const auto& d) { return bessel_second_kind(c, d); }, a,
b);
}

} // namespace math
Expand Down
2 changes: 1 addition & 1 deletion stan/math/prim/fun/beta.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr,
require_all_not_var_matrix_t<T1, T2>* = nullptr>
inline auto beta(const T1& a, const T2& b) {
return apply_scalar_binary(
a, b, [](const auto& c, const auto& d) { return beta(c, d); });
[](const auto& c, const auto& d) { return beta(c, d); }, a, b);
}

} // namespace math
Expand Down
5 changes: 2 additions & 3 deletions stan/math/prim/fun/binary_log_loss.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ inline T binary_log_loss(int y, const T& y_hat) {
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr,
require_not_var_matrix_t<T2>* = nullptr>
inline auto binary_log_loss(const T1& a, const T2& b) {
return apply_scalar_binary(a, b, [&](const auto& c, const auto& d) {
return binary_log_loss(c, d);
});
return apply_scalar_binary(
[](const auto& c, const auto& d) { return binary_log_loss(c, d); }, a, b);
}

} // namespace math
Expand Down
8 changes: 5 additions & 3 deletions stan/math/prim/fun/binomial_coefficient_log.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,11 @@ inline return_type_t<T_n, T_k> binomial_coefficient_log(const T_n n,
*/
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
inline auto binomial_coefficient_log(const T1& a, const T2& b) {
return apply_scalar_binary(a, b, [&](const auto& c, const auto& d) {
return binomial_coefficient_log(c, d);
});
return apply_scalar_binary(
[](const auto& c, const auto& d) {
return binomial_coefficient_log(c, d);
},
a, b);
}

} // namespace math
Expand Down
2 changes: 1 addition & 1 deletion stan/math/prim/fun/choose.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ inline int choose(int n, int k) {
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
inline auto choose(const T1& a, const T2& b) {
return apply_scalar_binary(
a, b, [&](const auto& c, const auto& d) { return choose(c, d); });
[](const auto& c, const auto& d) { return choose(c, d); }, a, b);
}

} // namespace math
Expand Down
6 changes: 3 additions & 3 deletions stan/math/prim/fun/falling_factorial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ inline return_type_t<T> falling_factorial(const T& x, int n) {
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr,
require_all_not_var_matrix_t<T1, T2>* = nullptr>
inline auto falling_factorial(const T1& a, const T2& b) {
return apply_scalar_binary(a, b, [&](const auto& c, const auto& d) {
return falling_factorial(c, d);
});
return apply_scalar_binary(
[](const auto& c, const auto& d) { return falling_factorial(c, d); }, a,
b);
}

} // namespace math
Expand Down
2 changes: 1 addition & 1 deletion stan/math/prim/fun/fdim.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ inline double fdim(T1 x, T2 y) {
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
inline auto fdim(const T1& a, const T2& b) {
return apply_scalar_binary(
a, b, [&](const auto& c, const auto& d) { return fdim(c, d); });
[](const auto& c, const auto& d) { return fdim(c, d); }, a, b);
}

} // namespace math
Expand Down
2 changes: 1 addition & 1 deletion stan/math/prim/fun/fmax.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ inline double fmax(T1 x, T2 y) {
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
inline auto fmax(const T1& a, const T2& b) {
return apply_scalar_binary(
a, b, [&](const auto& c, const auto& d) { return fmax(c, d); });
[](const auto& c, const auto& d) { return fmax(c, d); }, a, b);
}

} // namespace math
Expand Down
2 changes: 1 addition & 1 deletion stan/math/prim/fun/fmin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ inline double fmin(T1 x, T2 y) {
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
inline auto fmin(const T1& a, const T2& b) {
return apply_scalar_binary(
a, b, [&](const auto& c, const auto& d) { return fmin(c, d); });
[](const auto& c, const auto& d) { return fmin(c, d); }, a, b);
}

} // namespace math
Expand Down
10 changes: 6 additions & 4 deletions stan/math/prim/fun/fmod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ inline double fmod(const T1& a, const T2& b) {
*/
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
inline auto fmod(const T1& a, const T2& b) {
return apply_scalar_binary(a, b, [&](const auto& c, const auto& d) {
using std::fmod;
return fmod(c, d);
});
return apply_scalar_binary(
[](const auto& c, const auto& d) {
using std::fmod;
return fmod(c, d);
},
a, b);
}

} // namespace math
Expand Down
2 changes: 1 addition & 1 deletion stan/math/prim/fun/gamma_p.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ inline double gamma_p(double z, double a) {
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
inline auto gamma_p(const T1& a, const T2& b) {
return apply_scalar_binary(
a, b, [&](const auto& c, const auto& d) { return gamma_p(c, d); });
[](const auto& c, const auto& d) { return gamma_p(c, d); }, a, b);
}

} // namespace math
Expand Down
2 changes: 1 addition & 1 deletion stan/math/prim/fun/gamma_q.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ inline double gamma_q(double x, double a) { return boost::math::gamma_q(x, a); }
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
inline auto gamma_q(const T1& a, const T2& b) {
return apply_scalar_binary(
a, b, [&](const auto& c, const auto& d) { return gamma_q(c, d); });
[](const auto& c, const auto& d) { return gamma_q(c, d); }, a, b);
}

} // namespace math
Expand Down
2 changes: 1 addition & 1 deletion stan/math/prim/fun/hypot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr,
T1, T2>* = nullptr>
inline auto hypot(const T1& a, const T2& b) {
return apply_scalar_binary(
a, b, [&](const auto& c, const auto& d) { return hypot(c, d); });
[](const auto& c, const auto& d) { return hypot(c, d); }, a, b);
}

} // namespace math
Expand Down
2 changes: 1 addition & 1 deletion stan/math/prim/fun/lbeta.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ return_type_t<T1, T2> lbeta(const T1 a, const T2 b) {
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
inline auto lbeta(const T1& a, const T2& b) {
return apply_scalar_binary(
a, b, [&](const auto& c, const auto& d) { return lbeta(c, d); });
[](const auto& c, const auto& d) { return lbeta(c, d); }, a, b);
}

} // namespace math
Expand Down
2 changes: 1 addition & 1 deletion stan/math/prim/fun/ldexp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr,
T1, T2>* = nullptr>
inline auto ldexp(const T1& a, const T2& b) {
return apply_scalar_binary(
a, b, [&](const auto& c, const auto& d) { return ldexp(c, d); });
[](const auto& c, const auto& d) { return ldexp(c, d); }, a, b);
}

} // namespace math
Expand Down
2 changes: 1 addition & 1 deletion stan/math/prim/fun/lmgamma.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ inline return_type_t<T> lmgamma(int k, T x) {
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
inline auto lmgamma(const T1& a, const T2& b) {
return apply_scalar_binary(
a, b, [&](const auto& c, const auto& d) { return lmgamma(c, d); });
[](const auto& c, const auto& d) { return lmgamma(c, d); }, a, b);
}

} // namespace math
Expand Down
2 changes: 1 addition & 1 deletion stan/math/prim/fun/lmultiply.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr,
require_all_not_var_matrix_t<T1, T2>* = nullptr>
inline auto lmultiply(const T1& a, const T2& b) {
return apply_scalar_binary(
a, b, [&](const auto& c, const auto& d) { return lmultiply(c, d); });
[](const auto& c, const auto& d) { return lmultiply(c, d); }, a, b);
}

} // namespace math
Expand Down
2 changes: 1 addition & 1 deletion stan/math/prim/fun/log_diff_exp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ inline return_type_t<T1, T2> log_diff_exp(const T1 x, const T2 y) {
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
inline auto log_diff_exp(const T1& a, const T2& b) {
return apply_scalar_binary(
a, b, [&](const auto& c, const auto& d) { return log_diff_exp(c, d); });
[](const auto& c, const auto& d) { return log_diff_exp(c, d); }, a, b);
}

} // namespace math
Expand Down
6 changes: 3 additions & 3 deletions stan/math/prim/fun/log_falling_factorial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ inline return_type_t<T1, T2> log_falling_factorial(const T1 x, const T2 n) {
*/
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
inline auto log_falling_factorial(const T1& a, const T2& b) {
return apply_scalar_binary(a, b, [&](const auto& c, const auto& d) {
return log_falling_factorial(c, d);
});
return apply_scalar_binary(
[](const auto& c, const auto& d) { return log_falling_factorial(c, d); },
a, b);
}

} // namespace math
Expand Down
6 changes: 3 additions & 3 deletions stan/math/prim/fun/log_inv_logit_diff.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ inline return_type_t<T1, T2> log_inv_logit_diff(const T1& x, const T2& y) {
*/
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
inline auto log_inv_logit_diff(const T1& a, const T2& b) {
return apply_scalar_binary(a, b, [&](const auto& c, const auto& d) {
return log_inv_logit_diff(c, d);
});
return apply_scalar_binary(
[](const auto& c, const auto& d) { return log_inv_logit_diff(c, d); }, a,
b);
}

} // namespace math
Expand Down
8 changes: 5 additions & 3 deletions stan/math/prim/fun/log_modified_bessel_first_kind.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,11 @@ inline return_type_t<T1, T2, double> log_modified_bessel_first_kind(
*/
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
inline auto log_modified_bessel_first_kind(const T1& a, const T2& b) {
return apply_scalar_binary(a, b, [&](const auto& c, const auto& d) {
return log_modified_bessel_first_kind(c, d);
});
return apply_scalar_binary(
[](const auto& c, const auto& d) {
return log_modified_bessel_first_kind(c, d);
},
a, b);
}

} // namespace math
Expand Down
6 changes: 3 additions & 3 deletions stan/math/prim/fun/log_rising_factorial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ inline return_type_t<T1, T2> log_rising_factorial(const T1& x, const T2& n) {
*/
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
inline auto log_rising_factorial(const T1& a, const T2& b) {
return apply_scalar_binary(a, b, [&](const auto& c, const auto& d) {
return log_rising_factorial(c, d);
});
return apply_scalar_binary(
[](const auto& c, const auto& d) { return log_rising_factorial(c, d); },
a, b);
}

} // namespace math
Expand Down
2 changes: 1 addition & 1 deletion stan/math/prim/fun/log_sum_exp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ inline auto log_sum_exp(const T& x) {
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
inline auto log_sum_exp(const T1& a, const T2& b) {
return apply_scalar_binary(
a, b, [](const auto& c, const auto& d) { return log_sum_exp(c, d); });
[](const auto& c, const auto& d) { return log_sum_exp(c, d); }, a, b);
}

} // namespace math
Expand Down
8 changes: 5 additions & 3 deletions stan/math/prim/fun/modified_bessel_first_kind.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ inline double modified_bessel_first_kind(int v, int z) {
*/
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
inline auto modified_bessel_first_kind(const T1& a, const T2& b) {
return apply_scalar_binary(a, b, [&](const auto& c, const auto& d) {
return modified_bessel_first_kind(c, d);
});
return apply_scalar_binary(
[](const auto& c, const auto& d) {
return modified_bessel_first_kind(c, d);
},
a, b);
}

} // namespace math
Expand Down
8 changes: 5 additions & 3 deletions stan/math/prim/fun/modified_bessel_second_kind.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ inline T2 modified_bessel_second_kind(int v, const T2 z) {
*/
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
inline auto modified_bessel_second_kind(const T1& a, const T2& b) {
return apply_scalar_binary(a, b, [&](const auto& c, const auto& d) {
return modified_bessel_second_kind(c, d);
});
return apply_scalar_binary(
[](const auto& c, const auto& d) {
return modified_bessel_second_kind(c, d);
},
a, b);
}

} // namespace math
Expand Down
2 changes: 1 addition & 1 deletion stan/math/prim/fun/multiply_log.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr,
require_all_not_var_matrix_t<T1, T2>* = nullptr>
inline auto multiply_log(const T1& a, const T2& b) {
return apply_scalar_binary(
a, b, [&](const auto& c, const auto& d) { return multiply_log(c, d); });
[](const auto& c, const auto& d) { return multiply_log(c, d); }, a, b);
}

} // namespace math
Expand Down
2 changes: 1 addition & 1 deletion stan/math/prim/fun/owens_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr,
require_all_not_var_and_matrix_types<T1, T2>* = nullptr>
inline auto owens_t(const T1& a, const T2& b) {
return apply_scalar_binary(
a, b, [](const auto& c, const auto& d) { return owens_t(c, d); });
[](const auto& c, const auto& d) { return owens_t(c, d); }, a, b);
}

} // namespace math
Expand Down
2 changes: 1 addition & 1 deletion stan/math/prim/fun/pow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr,
inline auto pow(const T1& a, const T2& b) {
return apply_scalar_binary(
// Qualified pow since only Arithmetic types are accepted here
a, b, [](const auto& c, const auto& d) { return stan::math::pow(c, d); });
[](const auto& c, const auto& d) { return stan::math::pow(c, d); }, a, b);
}
} // namespace math
} // namespace stan
Expand Down
6 changes: 3 additions & 3 deletions stan/math/prim/fun/rising_factorial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ inline return_type_t<T> rising_factorial(const T& x, int n) {
*/
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr>
inline auto rising_factorial(const T1& a, const T2& b) {
return apply_scalar_binary(a, b, [&](const auto& c, const auto& d) {
return rising_factorial(c, d);
});
return apply_scalar_binary(
[](const auto& c, const auto& d) { return rising_factorial(c, d); }, a,
b);
}

} // namespace math
Expand Down
8 changes: 4 additions & 4 deletions stan/math/prim/fun/select.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ inline ReturnT select(const bool c, const T_true& y_true,
return y_true;
} else {
return apply_scalar_binary(
y_true, y_false,
[](const auto& y_true_inner, const auto& y_false_inner) {
return y_false_inner;
});
},
y_true, y_false);
}
}

Expand Down Expand Up @@ -119,10 +119,10 @@ inline ReturnT select(const bool c, const T_true y_true,
const T_false y_false) {
if (c) {
return apply_scalar_binary(
y_true, y_false,
[](const auto& y_true_inner, const auto& y_false_inner) {
return y_true_inner;
});
},
y_true, y_false);
} else {
return y_false;
}
Expand Down
6 changes: 3 additions & 3 deletions stan/math/prim/fun/to_complex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ constexpr inline std::complex<stan::real_return_t<T, S>> to_complex(
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr,
require_all_st_stan_scalar<T1, T2>* = nullptr>
inline auto to_complex(const T1& re, const T2& im) {
return apply_scalar_binary(re, im, [&](const auto& c, const auto& d) {
return stan::math::to_complex(c, d);
});
return apply_scalar_binary(
[](const auto& c, const auto& d) { return stan::math::to_complex(c, d); },
re, im);
}

} // namespace math
Expand Down
Loading