All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
corr_constrain.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_SCAL_FUN_CORR_CONSTRAIN_HPP
#define STAN_MATH_PRIM_SCAL_FUN_CORR_CONSTRAIN_HPP
#include <stan/math/prim/scal/fun/log1m.hpp>
#include <cmath>
namespace stan {
namespace math {
template <typename T>
inline
T corr_constrain(const T x) {
return tanh(x);
}
template <typename T>
inline
T corr_constrain(const T x, T& lp) {
using stan::math::log1m;
T tanh_x = tanh(x);
lp += log1m(tanh_x * tanh_x);
return tanh_x;
}
}
}
#endif
stan::math::tanh
fvar< T > tanh(const fvar< T > &x)
Definition: tanh.hpp:14
log1m.hpp
stan::math::log1m
fvar< T > log1m(const fvar< T > &x)
Definition: log1m.hpp:16
stan::math::corr_constrain
T corr_constrain(const T x)
Return the result of transforming the specified scalar to have a valid correlation value between -1 a...
Definition: corr_constrain.hpp:25

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