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

◆ cov_matrix_free() [1/2]

template<typename T , require_eigen_t< T > * = nullptr>
Eigen::Matrix< value_type_t< T >, Eigen::Dynamic, 1 > stan::math::cov_matrix_free ( const T &  y)

The covariance matrix derived from the symmetric view of the lower-triangular view of the K by K specified matrix is freed to return a vector of size K + (K choose 2).

This is the inverse of the cov_matrix_constrain() function so that for any finite vector x of size K

  • (K choose 2),

x == cov_matrix_free(cov_matrix_constrain(x, K)).

In order for this round-trip to work (and really for this function to work), the symmetric view of its lower-triangular view must be positive definite.

Template Parameters
Ttype of the matrix (must be derived from Eigen::MatrixBase)
Parameters
yMatrix of dimensions K by K such that he symmetric view of the lower-triangular view is positive definite.
Returns
Vector of size K plus (K choose 2) in (-inf, inf) that produces
Exceptions
std::domain_errorif y is not square, has zero dimensionality, or has a non-positive diagonal element.

Definition at line 38 of file cov_matrix_free.hpp.