Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
check_cov_matrix.hpp
Go to the documentation of this file.
1 #ifndef STAN__MATH__ERROR_HANDLING__MATRIX__CHECK_COV_MATRIX_HPP
2 #define STAN__MATH__ERROR_HANDLING__MATRIX__CHECK_COV_MATRIX_HPP
3 
4 #include <sstream>
10 
11 namespace stan {
12  namespace math {
13 
27  // FIXME: update warnings
28  template <typename T_y, typename T_result>
29  inline bool check_cov_matrix(const char* function,
30  const Eigen::Matrix<T_y,Eigen::Dynamic,Eigen::Dynamic>& y,
31  const char* name,
32  T_result* result) {
33  check_size_match(function,
34  y.rows(), "Rows of covariance matrix",
35  y.cols(), "columns of covariance matrix",
36  result);
37  check_positive(function, y.rows(), "rows", result);
38  check_symmetric(function, y, name, result);
39  check_pos_definite(function, y, name, result);
40  return true;
41  }
42 
43  }
44 }
45 #endif
bool check_cov_matrix(const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
Return true if the specified matrix is a valid covariance matrix.
bool check_size_match(const char *function, T_size1 i, const char *name_i, T_size2 j, const char *name_j, T_result *result)
bool check_symmetric(const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
Return true if the specified matrix is symmetric.
bool check_pos_definite(const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result)
Return true if the specified matrix is positive definite.
bool check_positive(const char *function, const T_y &y, const char *name, T_result *result)

     [ Stan Home Page ] © 2011–2014, Stan Development Team.