Stan Math Library  2.20.0
reverse mode automatic differentiation
positive_constrain.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_POSITIVE_CONSTRAIN_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_POSITIVE_CONSTRAIN_HPP
3 
5 #include <cmath>
6 
7 namespace stan {
8 namespace math {
9 
20 template <typename T>
21 inline T positive_constrain(const T& x) {
22  using std::exp;
23  return exp(x);
24 }
25 
42 template <typename T>
43 inline T positive_constrain(const T& x, T& lp) {
44  using std::exp;
45  lp += x;
46  return exp(x);
47 }
48 
49 } // namespace math
50 
51 } // namespace stan
52 
53 #endif
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:11
T positive_constrain(const T &x)
Return the positive value for the specified unconstrained input.

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