Stan Math Library  2.10.0
reverse mode automatic differentiation
to_fvar.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_FWD_ARR_FUN_TO_FVAR_HPP
2 #define STAN_MATH_FWD_ARR_FUN_TO_FVAR_HPP
3 
4 #include <stan/math/fwd/core.hpp>
6 #include <vector>
7 
8 namespace stan {
9  namespace math {
10 
11  template<typename T>
12  inline
13  std::vector<fvar<T> >
14  to_fvar(const std::vector<T>& v) {
15  std::vector<fvar<T> > x(v.size());
16  for (size_t i = 0; i < v.size(); ++i)
17  x[i] = T(v[i]);
18  return x;
19  }
20 
21  template<typename T>
22  inline
23  std::vector<fvar<T> >
24  to_fvar(const std::vector<T>& v, const std::vector<T>& d) {
25  std::vector<fvar<T> > x(v.size());
26  for (size_t i = 0; i < v.size(); ++i)
27  x[i] = fvar<T>(v[i], d[i]);
28  return x;
29  }
30 
31  template<typename T>
32  inline
33  std::vector<fvar<T> >
34  to_fvar(const std::vector<fvar<T> >& v) {
35  return v;
36  }
37 
38  }
39 }
40 #endif
std::vector< fvar< T > > to_fvar(const std::vector< T > &v)
Definition: to_fvar.hpp:14

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