Automatic Differentiation
 
Loading...
Searching...
No Matches
positive_free.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_CONSTRAINT_POSITIVE_FREE_HPP
2#define STAN_MATH_PRIM_CONSTRAINT_POSITIVE_FREE_HPP
3
7#include <cmath>
8
9namespace stan {
10namespace math {
11
28template <typename T>
29inline auto positive_free(T&& y) {
30 auto&& y_ref = to_ref(std::forward<T>(y));
31 check_positive("positive_free", "Positive variable", y_ref);
32 return log(std::forward<decltype(y_ref)>(y_ref));
33}
34
35} // namespace math
36} // namespace stan
37#endif
fvar< T > log(const fvar< T > &x)
Definition log.hpp:18
auto positive_free(T &&y)
Return the unconstrained value corresponding to the specified positive-constrained value.
void check_positive(const char *function, const char *name, const T_y &y)
Check if y is positive.
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
Definition to_ref.hpp:18
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...