Automatic Differentiation
 
Loading...
Searching...
No Matches
is_cholesky_factor.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_ERR_IS_CHOLESKY_FACTOR_HPP
2#define STAN_MATH_PRIM_ERR_IS_CHOLESKY_FACTOR_HPP
3
10
11namespace stan {
12namespace math {
13
28template <typename EigMat, require_eigen_matrix_dynamic_t<EigMat>* = nullptr>
29inline bool is_cholesky_factor(const EigMat& y) {
30 const auto& y_ref = to_ref(y);
31 return is_less_or_equal(y_ref.cols(), y_ref.rows())
32 && is_positive(y_ref.cols()) && is_lower_triangular(y_ref)
33 && is_positive(y_ref.diagonal());
34}
35
36} // namespace math
37} // namespace stan
38#endif
bool is_lower_triangular(const EigMat &y)
Return true is matrix is lower triangular.
bool is_positive(const T_y &y)
Return true if y is positive.
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
Definition to_ref.hpp:17
bool is_less_or_equal(const T_y &y, const T_high &high)
Return true if y is less or equal to high.
bool is_cholesky_factor(const EigMat &y)
Return true if y is a valid Cholesky factor, if number of rows is not less than the number of columns...
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...