Stan Math Library  2.20.0
reverse mode automatic differentiation
check_cholesky_factor_corr.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_ERR_CHECK_CHOLESKY_FACTOR_CORR_HPP
2 #define STAN_MATH_PRIM_MAT_ERR_CHECK_CHOLESKY_FACTOR_CORR_HPP
3 
10 
11 namespace stan {
12 namespace math {
13 
30 template <typename T_y>
32  const char* function, const char* name,
33  const Eigen::Matrix<T_y, Eigen::Dynamic, Eigen::Dynamic>& y) {
34  check_square(function, name, y);
35  check_lower_triangular(function, name, y);
36  for (int i = 0; i < y.rows(); ++i)
37  check_positive(function, name, y(i, i));
38  for (int i = 0; i < y.rows(); ++i) {
39  Eigen::Matrix<T_y, Eigen::Dynamic, 1> y_i = y.row(i).transpose();
40  check_unit_vector(function, name, y_i);
41  }
42 }
43 
44 } // namespace math
45 } // namespace stan
46 #endif
void check_lower_triangular(const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Check if the specified matrix is lower triangular.
void check_square(const char *function, const char *name, const matrix_cl &y)
Check if the matrix_cl is square.
void check_unit_vector(const char *function, const char *name, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)
Check if the specified vector is unit vector.
void check_cholesky_factor_corr(const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Check if the specified matrix is a valid Cholesky factor of a correlation matrix. ...
void check_positive(const char *function, const char *name, const T_y &y)
Check if y is positive.

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