| Stan Math Library 2.12.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
4 #include <stan/math/prim/mat/fun/Eigen.hpp>
5 #include <stan/math/prim/scal/err/check_positive.hpp>
6 #include <stan/math/prim/mat/err/check_lower_triangular.hpp>
7 #include <stan/math/prim/mat/err/check_square.hpp>
8 #include <stan/math/prim/mat/err/constraint_tolerance.hpp>
9 #include <stan/math/prim/mat/err/check_unit_vector.hpp>
10
11 namespace stan {
12 namespace math {
36 template <typename T_y>
37 bool
38 check_cholesky_factor_corr(
39 const char* function,
40 const char* name,
41 const Eigen::Matrix<T_y, Eigen::Dynamic, Eigen::Dynamic>& y
42 ) {
43 using Eigen::Dynamic;
44 check_square(function, name, y);
45 check_lower_triangular(function, name, y);
46 for (int i = 0; i < y.rows(); ++i)
47 check_positive(function, name, y(i, i));
48 for (int i = 0; i < y.rows(); ++i) {
49 Eigen::Matrix<T_y, Dynamic, 1>
50 y_i = y.row(i).transpose();
51 check_unit_vector(function, name, y_i);
52 }
53 return true;
54 }
55
56 }
57 }
58 #endif
check_positive.hpp
stan
Definition: log_sum_exp.hpp:8
constraint_tolerance.hpp
check_lower_triangular.hpp
stan::math::check_lower_triangular
bool check_lower_triangular(const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Return true if the specified matrix is lower triangular.
Definition: check_lower_triangular.hpp:33
check_unit_vector.hpp
stan::math::check_positive
bool check_positive(const char *function, const char *name, const T_y &y)
Return true if y is positive.
Definition: check_positive.hpp:66
Eigen.hpp
stan::math::check_cholesky_factor_corr
bool check_cholesky_factor_corr(const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Return true if the specified matrix is a valid Cholesky factor of a correlation matrix.
Definition: check_cholesky_factor_corr.hpp:38
stan::math::check_unit_vector
bool check_unit_vector(const char *function, const char *name, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)
Return true if the specified vector is unit vector.
Definition: check_unit_vector.hpp:35
stan::math::check_square
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.
Definition: check_square.hpp:28
check_square.hpp

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