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

◆ log_mix() [8/12]

template<typename T_theta_cl , typename T_lambda_cl , require_all_prim_or_rev_kernel_expression_t< T_theta_cl, T_lambda_cl > * = nullptr>
auto stan::math::log_mix ( const T_theta_cl &  theta,
const T_lambda_cl &  lambda 
)
inline

Return the log mixture density with specified mixing proportions and log densities.

\[ \frac{\partial }{\partial p_x} \log\left(\exp^{\log\left(p_1\right)+d_1}+\cdot\cdot\cdot+ \exp^{\log\left(p_n\right)+d_n}\right) =\frac{e^{d_x}}{e^{d_1}p_1+\cdot\cdot\cdot+e^{d_m}p_m} \]

\[ \frac{\partial }{\partial d_x} \log\left(\exp^{\log\left(p_1\right)+d_1}+\cdot\cdot\cdot+ \exp^{\log\left(p_n\right)+d_n}\right) =\frac{e^{d_x}p_x}{e^{d_1}p_1+\cdot\cdot\cdot+e^{d_m}p_m} \]

Template Parameters
T_thetaType of theta.
T_lamType of lambda.
Parameters
thetastd/row/col vector of mixing proportions in [0, 1].
lambdastd/row/col vector of log densities.
Returns
log mixture of densities in specified proportion

Definition at line 39 of file log_mix.hpp.