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

◆ check_corr_matrix() [2/2]

template<typename StdVec , require_std_vector_t< StdVec > * = nullptr>
void stan::math::check_corr_matrix ( const char *  function,
const char *  name,
const StdVec &  y 
)

Throw an exception if the specified matrix is not a valid correlation matrix.

A valid correlation matrix is symmetric positive definite, has a unit diagonal (all 1 values), and has all values between -1 and 1 (inclusive).

Template Parameters
StdVecA standard vector with inner type either inheriting from Eigen::MatrixBase with neither rows or columns defined at compile time to be equal to 1 or a var_value with the var's inner type inheriting from Eigen::MatrixBase with neither rows or columns defined at compile time to be equal to 1.
Parameters
functionName of the function this was called from
nameName of the variable
yMatrix to test
Exceptions
`std::invalid_argument`if the matrix is not square
`std::domain_error`if the matrix is non-symmetric, diagonals not near 1, not positive definite, or any of the elements are NaN

Definition at line 76 of file check_corr_matrix.hpp.