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

◆ check_corr_matrix() [1/2]

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

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
MatType inheriting from 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 34 of file check_corr_matrix.hpp.