Stan Math Library  2.6.3
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
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 
13  namespace math {
14  using Eigen::Dynamic;
38  template <typename T_y>
39  bool
40  check_cholesky_factor_corr(const char* function,
41  const char* name,
42  const Eigen::Matrix<T_y, Dynamic, Dynamic>& y) {
43  check_square(function, name, y);
44  check_lower_triangular(function, name, y);
45  for (int i = 0; i < y.rows(); ++i)
46  check_positive(function, name, y(i, i));
47  for (int i = 0; i < y.rows(); ++i) {
48  Eigen::Matrix<T_y, Dynamic, 1>
49  y_i = y.row(i).transpose();
50  check_unit_vector(function, name, y_i);
51  }
52  return true;
53  }
54 
55  }
56 }
57 #endif
bool check_unit_vector(const char *function, const char *name, const Eigen::Matrix< T_prob, Dynamic, 1 > &theta)
Return true if the specified vector is unit vector.
bool check_cholesky_factor_corr(const char *function, const char *name, const Eigen::Matrix< T_y, Dynamic, Dynamic > &y)
Return true if the specified matrix is a valid Cholesky factor of a correlation matrix.
bool check_positive(const char *function, const char *name, const T_y &y)
Return true if y is positive.
bool check_lower_triangular(const char *function, const char *name, const Eigen::Matrix< T_y, Dynamic, Dynamic > &y)
Return true if the specified matrix is lower triangular.
bool check_square(const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Return true if the specified matrix is square.

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