| Stan Math Library 2.12.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

value_of_rec.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_FUN_VALUE_OF_REC_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_VALUE_OF_REC_HPP
3
4 #include <stan/math/prim/scal/fun/value_of_rec.hpp>
5 #include <stan/math/prim/mat/fun/Eigen.hpp>
6
7 namespace stan {
8 namespace math {
9
22 template <typename T, int R, int C>
23 inline Eigen::Matrix<double, R, C>
24 value_of_rec(const Eigen::Matrix<T, R, C>& M) {
25 Eigen::Matrix<double, R, C> Md(M.rows(), M.cols());
26 for (int j = 0; j < M.cols(); j++)
27 for (int i = 0; i < M.rows(); i++)
28 Md(i, j) = value_of_rec(M(i, j));
29 return Md;
30 }
31
43 template <int R, int C>
44 inline typename Eigen::Matrix<double, R, C>
45 value_of_rec(const Eigen::Matrix<double, R, C>& x) {
46 return x;
47 }
48 }
49 }
50
51 #endif
stan
Definition: log_sum_exp.hpp:8
stan::math::value_of_rec
double value_of_rec(const fvar< T > &v)
Return the value of the specified variable.
Definition: value_of_rec.hpp:21
Eigen.hpp
value_of_rec.hpp

[ Stan Home Page ] © 2011–2016, Stan Development Team.