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

◆ check_pos_definite() [1/3]

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

Check if the specified square, symmetric matrix is positive definite.

This computes an LDLT decomposition to establish positive definiteness, so it can be expensive. If an LDLT or LLT decomposition is available, that should be tested instead.

Template Parameters
EigMatA type derived from EigenBase with dynamic rows and columns
Parameters
functionfunction name (for error messages)
namevariable name (for error messages)
ymatrix to test
Exceptions
std::invalid_argumentif the matrix is not square or if the matrix has 0 size.
std::domain_errorif the matrix is not symmetric, if it is not positive definite, or if any element is NaN

Definition at line 34 of file check_pos_definite.hpp.