Automatic Differentiation
 
Loading...
Searching...
No Matches
to_vector.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_REV_FUN_TO_VECTOR_HPP
2#define STAN_MATH_REV_FUN_TO_VECTOR_HPP
3
7
8namespace stan {
9namespace math {
10
19template <typename EigMat, require_eigen_t<EigMat>* = nullptr>
20inline auto to_vector(const var_value<EigMat>& x) {
21 using view_type = Eigen::Map<Eigen::Matrix<double, Eigen::Dynamic, 1>>;
23 view_type(x.vi_->val_.data(), x.rows() * x.cols()),
24 view_type(x.vi_->adj_.data(), x.rows() * x.cols())));
25}
26
27} // namespace math
28} // namespace stan
29#endif
A vari_view is used to read from a slice of a vari_value with an inner eigen type.
Definition vari.hpp:206
auto to_vector(T_x &&x)
Returns input matrix reshaped into a vector.
Definition to_vector.hpp:21
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...