Stan Math Library: stan/math/prim/scal/fun/primitive_value.hpp Source File

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
4 #include <boost/utility/enable_if.hpp>
5 #include <boost/type_traits/is_arithmetic.hpp>
6 #include <stan/math/prim/scal/fun/value_of.hpp>
7
8 namespace stan {
9
10 namespace math {
11
27 template <typename T>
28 inline
29 typename boost::enable_if<boost::is_arithmetic<T>, T>::type
30 primitive_value(T x) {
31 return x;
32 }
33
44 template <typename T>
45 inline
46 typename boost::disable_if<boost::is_arithmetic<T>, double>::type
47 primitive_value(const T& x) {
48 using stan::math::value_of;
49 return value_of(x);
50 }
51
52 }
53
54 }
55
56 #endif
stan
Definition: log_sum_exp.hpp:8
stan::math::value_of
T value_of(const fvar< T > &v)
Return the value of the specified variable.
Definition: value_of.hpp:16
stan::math::primitive_value
double primitive_value(const fvar< T > &v)
Return the primitive value of the specified forward-mode autodiff variable.
Definition: primitive_value.hpp:22
value_of.hpp

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