Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
check_pos_definite.hpp
Go to the documentation of this file.
1 #ifndef STAN__AGRAD__REV__ERROR_HANDLING__MATRIX__CHECK_POS_DEFINITE_HPP
2 #define STAN__AGRAD__REV__ERROR_HANDLING__MATRIX__CHECK_POS_DEFINITE_HPP
3 
5 #include <stan/agrad/rev/var.hpp>
9 
10 namespace stan {
11 
12  namespace agrad {
13 
14  template <typename T_result, class Policy>
15  inline bool check_pos_definite(const char* function,
16  const Eigen::Matrix<var,Eigen::Dynamic,Eigen::Dynamic>& y,
17  const char* name,
18  T_result* result,
19  const Policy&) {
20  using Eigen::Matrix;
21  using Eigen::Dynamic;
23  typedef typename index_type<Matrix<double,Dynamic,Dynamic> >::type size_type;
24  Matrix<double,Dynamic,Dynamic> y_d(y.rows(),y.cols());
25  for (size_type i = 0; i < y_d.rows(); i++)
26  for (size_type j = 0; j < y_d.cols(); j++)
27  y_d(i,j) = y(i,j).val();
28  return stan::math::check_pos_definite(function,y_d,name,result,Policy());
29  }
30 
31  }
32 
33 }
34 
35 #endif
Primary template class for the metaprogram to compute the index type of a container.
Definition: index_type.hpp:21
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >::Index size_type
Definition: typedefs.hpp:14
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_pos_definite(const char *function, const Eigen::Matrix< var, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result, const Policy &)

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