1#ifndef STAN_MATH_PRIM_FUN_LOG_SUM_EXP_SIGNED_HPP
2#define STAN_MATH_PRIM_FUN_LOG_SUM_EXP_SIGNED_HPP
26template <
typename T1,
typename T2,
27 require_all_stan_scalar_t<T1, T2>* =
nullptr>
32 if (a_sign == b_sign) {
35 bool a_larger = (a > b);
37 a_larger ? a_sign : b_sign);
std::tuple< return_type_t< T1, T2 >, int > log_sum_exp_signed(const T1 &a, int a_sign, const T2 &b, int b_sign)
Calculates the log sum of exponentials without overflow, accounting for the signs of the inputs.
fvar< T > log_diff_exp(const fvar< T > &x1, const fvar< T > &x2)
fvar< T > log_sum_exp(const fvar< T > &x1, const fvar< T > &x2)
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...