1 #ifndef STAN_MATH_PRIM_MAT_FUN_CORR_MATRIX_FREE_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_CORR_MATRIX_FREE_HPP
7 #include <boost/throw_exception.hpp>
37 Eigen::Matrix<T, Eigen::Dynamic, 1>
46 size_type k = y.rows();
51 size_type k_choose_2 = (k * (k-1)) / 2;
52 Array<T, Dynamic, 1> x(k_choose_2);
53 Array<T, Dynamic, 1> sds(k);
56 throw std::runtime_error(
"factor_cov_matrix failed on y");
57 for (size_type i = 0; i < k; ++i) {
61 s <<
"all standard deviations must be zero."
62 <<
" found log(sd[" << i <<
"])=" << sds[i] << std::endl;
63 BOOST_THROW_EXCEPTION(std::runtime_error(s.str()));
fvar< T > fabs(const fvar< T > &x)
const double CONSTRAINT_TOLERANCE
The tolerance for checking arithmetic bounds In rank and in simplexes.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >::Index size_type
Type for sizes and indexes in an Eigen matrix with double e.
Primary template class for the metaprogram to compute the index type of a container.
bool factor_cov_matrix(const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &Sigma, Eigen::Array< T, Eigen::Dynamic, 1 > &CPCs, Eigen::Array< T, Eigen::Dynamic, 1 > &sds)
This function is intended to make starting values, given a covariance matrix Sigma.
void domain_error(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
Throw a domain error with a consistently formatted message.
Eigen::Matrix< T, Eigen::Dynamic, 1 > corr_matrix_free(const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &y)
Return the vector of unconstrained partial correlations that define the specified correlation matrix ...