Stan Math Library
2.20.0
reverse mode automatic differentiation
stan
math
prim
scal
fun
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
4
#include <
stan/math/prim/meta.hpp
>
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
stan
Definition:
log_sum_exp.hpp:8
meta.hpp
stan::math::exp
fvar< T > exp(const fvar< T > &x)
Definition:
exp.hpp:11
stan::math::positive_constrain
T positive_constrain(const T &x)
Return the positive value for the specified unconstrained input.
Definition:
positive_constrain.hpp:21
[
Stan Home Page
]
© 2011–2018, Stan Development Team.