Stan Math Library  2.20.0
reverse mode automatic differentiation
value_of.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_ARR_FUN_VALUE_OF_HPP
2 #define STAN_MATH_PRIM_ARR_FUN_VALUE_OF_HPP
3 
6 #include <vector>
7 #include <cstddef>
8 
9 namespace stan {
10 namespace math {
11 
20 template <typename T>
21 inline std::vector<typename child_type<T>::type> value_of(
22  const std::vector<T>& x) {
23  size_t size = x.size();
24  std::vector<typename child_type<T>::type> result(size);
25  for (size_t i = 0; i < size; i++)
26  result[i] = value_of(x[i]);
27  return result;
28 }
29 
41 inline const std::vector<double>& value_of(const std::vector<double>& x) {
42  return x;
43 }
44 
56 inline const std::vector<int>& value_of(const std::vector<int>& x) { return x; }
57 
58 } // namespace math
59 } // namespace stan
60 
61 #endif
T value_of(const fvar< T > &v)
Return the value of the specified variable.
Definition: value_of.hpp:17
int size(const std::vector< T > &x)
Return the size of the specified standard vector.
Definition: size.hpp:17

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