1#ifndef STAN_MATH_PRIM_CONSTRAINT_COV_MATRIX_FREE_HPP
2#define STAN_MATH_PRIM_CONSTRAINT_COV_MATRIX_FREE_HPP
37template <
typename T, require_eigen_t<T>* =
nullptr>
39 const auto& y_ref =
to_ref(y);
46 Eigen::Matrix<value_type_t<T>, Eigen::Dynamic, 1> x((K * (K + 1)) / 2);
49 Eigen::LLT<plain_type_t<T>> llt(y_ref.rows());
53 for (
int m = 0; m < K; ++m) {
54 x.segment(i, m) = L.row(m).head(m);
56 x.coeffRef(i++) =
log(L.coeff(m, m));
68template <
typename T, require_std_vector_t<T>* =
nullptr>
void check_square(const char *function, const char *name, const T_y &y)
Check if the specified matrix is square.
fvar< T > log(const fvar< T > &x)
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, 1 > cov_matrix_free(const T &y)
The covariance matrix derived from the symmetric view of the lower-triangular view of the K by K spec...
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
void check_nonzero_size(const char *function, const char *name, const T_y &y)
Check if the specified matrix/vector is of non-zero size.
void check_positive(const char *function, const char *name, const T_y &y)
Check if y is positive.
typename plain_type< T >::type plain_type_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...