Stan Math Library  2.15.0
reverse mode automatic differentiation
value_of.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_FUN_VALUE_OF_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_VALUE_OF_HPP
3 
7 
8 namespace stan {
9  namespace math {
10 
23  template <typename T, int R, int C>
24  inline Eigen::Matrix<typename child_type<T>::type, R, C>
25  value_of(const Eigen::Matrix<T, R, C>& M) {
26  Eigen::Matrix<typename child_type<T>::type, R, C> Md(M.rows(), M.cols());
27  for (int j = 0; j < M.cols(); j++)
28  for (int i = 0; i < M.rows(); i++)
29  Md(i, j) = value_of(M(i, j));
30  return Md;
31  }
32 
44  template <int R, int C>
45  inline typename Eigen::Matrix<double, R, C>
46  value_of(const Eigen::Matrix<double, R, C>& x) {
47  return x;
48  }
49  }
50 }
51 
52 #endif
T value_of(const fvar< T > &v)
Return the value of the specified variable.
Definition: value_of.hpp:16

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