1#ifndef STAN_MATH_REV_FUN_TO_VAR_VALUE_HPP
2#define STAN_MATH_REV_FUN_TO_VAR_VALUE_HPP
20template <
typename T, require_eigen_vt<is_var, T>* =
nullptr>
22 Eigen::Matrix<double, T::RowsAtCompileTime, T::ColsAtCompileTime>>
27 [res, a_arena]()
mutable { a_arena.adj() += res.adj(); });
37template <
typename T, require_var_t<T>* =
nullptr>
39 return std::forward<T>(a);
51 std::vector<decltype(to_var_value(std::declval<T>()))> out;
52 out.reserve(a.size());
53 for (
size_t i = 0; i < a.size(); ++i) {
Equivalent to Eigen::Matrix, except that the data is stored on AD stack.
void reverse_pass_callback(F &&functor)
Puts a callback on the autodiff stack to be called in reverse pass.
var_value< Eigen::Matrix< double, T::RowsAtCompileTime, T::ColsAtCompileTime > > to_var_value(const T &a)
Converts an Eigen matrix (or vector or row_vector) or expression of vars into var_value.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...