Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ cholesky_corr_factor() [1/2]

template<CorrOrder Order, typename EigVec , typename LogCoshVec , require_all_eigen_vector_t< EigVec, LogCoshVec > * = nullptr>
Eigen::Matrix< value_type_t< EigVec >, Eigen::Dynamic, Eigen::Dynamic > stan::math::internal::cholesky_corr_factor ( EigVec &&  y,
LogCoshVec &&  log_cosh_y,
Eigen::Index  K 
)
inline

Return the Cholesky factor of a correlation matrix from unconstrained values y, whose partial correlations are tanh(y).

Each element is L(row, col) = tanh(y_col) exp(-acc) with acc the sum of log(cosh(y)) over the earlier columns of the row, which has no cancellation.

Template Parameters
Orderorder of the partial correlations in y
EigVectype of the vector
LogCoshVectype of the vector of log(cosh(y))
Parameters
yunconstrained values, K (K - 1) / 2 of them
log_cosh_ylog_cosh(y), shared with the log Jacobian
Knumber of rows
Returns
Cholesky factor of a correlation matrix

Definition at line 117 of file cholesky_corr_constrain.hpp.