Automatic Differentiation
 
Loading...
Searching...
No Matches
identity_constrain.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_REV_CONSTRAINT_IDENTITY_CONSTRAIN_HPP
2#define STAN_MATH_REV_CONSTRAINT_IDENTITY_CONSTRAIN_HPP
3
8namespace stan {
9namespace math {
10
22template <typename T, typename... Types,
23 require_eigen_vt<std::is_arithmetic, T>* = nullptr,
24 require_any_var_matrix_t<T, Types...>* = nullptr>
25inline auto identity_constrain(T&& x, Types&&... /* args */) {
26 return var_value<plain_type_t<T>>(x);
27}
28
29template <typename T, typename... Types, require_eigen_vt<is_var, T>* = nullptr,
30 require_any_var_matrix_t<T, Types...>* = nullptr>
31inline auto identity_constrain(T&& x, Types&&... /* args */) {
32 return to_var_value(x);
33}
34
35template <typename T, typename... Types, require_var_matrix_t<T>* = nullptr,
36 require_any_var_matrix_t<T, Types...>* = nullptr>
37inline auto identity_constrain(T&& x, Types&&... /* args */) {
38 return x;
39}
40
41} // namespace math
42} // namespace stan
43
44#endif
require_any_t< is_var_matrix< std::decay_t< Types > >... > require_any_var_matrix_t
Require any of the types satisfy is_var_matrix.
var_value< Eigen::Matrix< double, T::RowsAtCompileTime, T::ColsAtCompileTime > > to_var_value(const T &a)
Converts an Eigen matrix (or vector or row_vector) or expression of vars into var_value.
auto identity_constrain(T &&x, Types &&...)
Returns the result of applying the identity constraint transform to the input.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...