1 #ifndef STAN_MATH_REV_MAT_FUN_LOG_SUM_EXP_HPP 2 #define STAN_MATH_REV_MAT_FUN_LOG_SUM_EXP_HPP 19 template <
int R,
int C>
21 const double max = x.val().maxCoeff();
27 template <
int R,
int C>
31 Eigen::Map<vector_vi> vis_map(
vis_,
size_);
32 vis_map.adj().array() +=
adj_ * (vis_map.val().array() -
val_).
exp();
42 template <
int R,
int C>
fvar< T > log(const fvar< T > &x)
double log_sum_exp_as_double(const std::vector< var > &x)
Independent (input) and dependent (output) variables for gradients.
fvar< T > log_sum_exp(const std::vector< fvar< T > > &v)
const double val_
The value of this variable.
fvar< T > exp(const fvar< T > &x)
void chain()
Apply the chain rule to this variable based on the variables on which it depends. ...
int max(const std::vector< int > &x)
Returns the maximum coefficient in the specified column vector.
double adj_
The adjoint of this variable, which is the partial derivative of this variable with respect to the ro...
log_sum_exp_matrix_vari(const Eigen::Matrix< var, R, C > &x)