1#ifndef STAN_MATH_PRIM_CONSTRAINT_COV_MATRIX_CONSTRAIN_LKJ_HPP
2#define STAN_MATH_PRIM_CONSTRAINT_COV_MATRIX_CONSTRAIN_LKJ_HPP
33template <
typename T, require_eigen_vector_t<T>* =
nullptr>
34inline Eigen::Matrix<value_type_t<T>, Eigen::Dynamic, Eigen::Dynamic>
36 size_t k_choose_2 = (k * (k - 1)) / 2;
37 const auto& x_ref =
to_ref(x);
57template <
typename T, require_eigen_vector_t<T>* =
nullptr>
58inline Eigen::Matrix<value_type_t<T>, Eigen::Dynamic, Eigen::Dynamic>
60 size_t k_choose_2 = (k * (k - 1)) / 2;
61 const auto& x_ref = x;
86template <
bool Jacobian,
typename T, require_not_std_vector_t<T>* =
nullptr>
116template <
bool Jacobian,
typename T, require_std_vector_t<T>* =
nullptr>
119 return apply_vector_unary<T>::apply(x, [&lp, k](
auto&& v) {
120 return cov_matrix_constrain_lkj<Jacobian>(v, k, lp);
typename return_type< Ts... >::type return_type_t
Convenience type for the return type of the specified template parameters.
Eigen::Matrix< value_type_t< T_CPCs >, Eigen::Dynamic, Eigen::Dynamic > read_cov_matrix(const T_CPCs &CPCs, const T_sds &sds, value_type_t< T_CPCs > &log_prob)
A generally worse alternative to call prior to evaluating the density of an elliptical distribution.
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, Eigen::Dynamic > cov_matrix_constrain_lkj(const T &x, size_t k)
Return the covariance matrix of the specified dimensionality derived from constraining the specified ...
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
plain_type_t< T > corr_constrain(const T &x)
Return the result of transforming the specified scalar or container of values to have a valid correla...
auto positive_constrain(const T &x)
Return the positive value for the specified unconstrained input.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...