Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
value_of.hpp
Go to the documentation of this file.
1 #ifndef STAN__AGRAD__REV__MATRIX__VALUE_OF_HPP
2 #define STAN__AGRAD__REV__MATRIX__VALUE_OF_HPP
3 
5 #include <stan/agrad/rev/var.hpp>
6 
7 namespace stan {
8  namespace agrad {
15  template<int R,int C>
16  inline const Eigen::Matrix<double,R,C> &value_of(const Eigen::Matrix<double,R,C> &M) {
17  return M;
18  }
19 
26  template<int R,int C>
27  inline Eigen::Matrix<double,R,C> value_of(const Eigen::Matrix<var,R,C> &M) {
28  int i,j;
29  Eigen::Matrix<double,R,C> Md(M.rows(),M.cols());
30  for (j = 0; j < M.cols(); j++)
31  for (i = 0; i < M.rows(); i++)
32  Md(i,j) = M(i,j).vi_->val_;
33  return Md;
34  }
35  }
36 }
37 
38 #endif
T value_of(const fvar< T > &v)
Return the value of the specified variable.
Definition: value_of.hpp:16

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