1#ifndef STAN_MATH_PRIM_CONSTRAINT_CORR_MATRIX_CONSTRAIN_HPP
2#define STAN_MATH_PRIM_CONSTRAINT_CORR_MATRIX_CONSTRAIN_HPP
42template <
typename T, require_eigen_col_vector_t<T>* =
nullptr>
43inline Eigen::Matrix<value_type_t<T>, Eigen::Dynamic, Eigen::Dynamic>
45 Eigen::Index k_choose_2 = (k * (k - 1)) / 2;
46 decltype(
auto) x_ref =
to_ref(std::forward<T>(x));
48 "k_choose_2", k_choose_2);
50 internal::cholesky_corr_factor<internal::CorrOrder::column>(
76template <
typename T,
typename Lp, require_eigen_col_vector_t<T>* =
nullptr,
77 require_convertible_t<return_type_t<T>, Lp>* =
nullptr>
78inline Eigen::Matrix<value_type_t<T>, Eigen::Dynamic, Eigen::Dynamic>
80 Eigen::Index k_choose_2 = (k * (k - 1)) / 2;
81 decltype(
auto) x_ref =
to_ref(std::forward<T>(x));
83 "k_choose_2", k_choose_2);
88 internal::cholesky_corr_factor<internal::CorrOrder::column>(
89 x_ref, log_cosh_x, k));
105template <
typename T, require_std_vector_t<T>* =
nullptr>
128template <
typename T,
typename Lp, require_std_vector_t<T>* =
nullptr,
129 require_convertible_t<return_type_t<T>, Lp>* =
nullptr>
157template <
bool Jacobian,
typename T,
typename Lp,
160 if constexpr (Jacobian) {
require_t< std::is_convertible< std::decay_t< T >, std::decay_t< S > > > require_convertible_t
Require types T and S satisfies std::is_convertible.
auto corr_matrix_log_jacobian_coefficients(Eigen::Index K)
Return a lazy expression of the coefficients c for which the log absolute Jacobian determinant of cor...
Eigen::Matrix< value_type_t< EigMat >, EigMat::RowsAtCompileTime, EigMat::RowsAtCompileTime > multiply_lower_tri_self_transpose(const EigMat &m)
fvar< T > log_cosh(const fvar< T > &x)
Return the natural logarithm of the hyperbolic cosine of the argument.
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, Eigen::Dynamic > corr_matrix_constrain(T &&x, Eigen::Index k)
Return the correlation matrix of the specified dimensionality derived from the specified vector of un...
void check_size_match(const char *function, const char *name_i, T_size1 i, const char *name_j, T_size2 j)
Check if the provided sizes match.
auto dot_product(const T_a &a, const T_b &b)
Returns the dot product of the specified vectors.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...