Stan Math Library  2.20.0
reverse mode automatic differentiation
primitive_value.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_PRIMITIVE_VALUE_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_PRIMITIVE_VALUE_HPP
3 
6 #include <type_traits>
7 
8 namespace stan {
9 namespace math {
10 
26 template <typename T>
27 inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type
29  return x;
30 }
31 
42 template <typename T>
43 inline typename std::enable_if<!std::is_arithmetic<T>::value, double>::type
44 primitive_value(const T& x) {
45  return value_of(x);
46 }
47 
48 } // namespace math
49 } // namespace stan
50 #endif
T value_of(const fvar< T > &v)
Return the value of the specified variable.
Definition: value_of.hpp:17
double primitive_value(const fvar< T > &v)
Return the primitive value of the specified forward-mode autodiff variable.

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