Stan Math Library  2.14.0
reverse mode automatic differentiation
to_var.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_ARR_FUN_TO_VAR_HPP
2 #define STAN_MATH_REV_ARR_FUN_TO_VAR_HPP
3 
4 #include <stan/math/rev/core.hpp>
6 #include <vector>
7 
8 namespace stan {
9  namespace math {
10 
19  inline std::vector<var>
20  to_var(const std::vector<double>& v) {
21  std::vector<var> var_vector(v.size());
22  for (size_t n = 0; n < v.size(); n++)
23  var_vector[n] = v[n];
24  return var_vector;
25  }
26 
35  inline std::vector<var>
36  to_var(const std::vector<var>& v) {
37  return v;
38  }
39 
40  }
41 }
42 #endif
std::vector< var > to_var(const std::vector< double > &v)
Converts argument to an automatic differentiation variable.
Definition: to_var.hpp:20

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