Stan  1.0
probability, sampling & optimization
matrix_error_handling.hpp
Go to the documentation of this file.
1 #ifndef __STAN__AGRAD__MATRIX_ERROR_HANDLING_HPP__
2 #define __STAN__AGRAD__MATRIX_ERROR_HANDLING_HPP__
3 
4 // global include
5 #include <stan/agrad/matrix.hpp>
6 
7 namespace stan {
8  namespace agrad {
9 
10  template <typename T_result, class Policy>
11  inline bool check_pos_definite(const char* function,
12  const Eigen::Matrix<var,Eigen::Dynamic,Eigen::Dynamic>& y,
13  const char* name,
14  T_result* result,
15  const Policy&) {
16  typedef
18  size_type;
19  Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic> y_d(y.rows(),y.cols());
20  for (size_type i = 0; i < y_d.rows(); i++)
21  for (size_type j = 0; j < y_d.cols(); j++)
22  y_d(i,j) = y(i,j).val();
23  return stan::math::check_pos_definite(function,y_d,name,result,Policy());
24  }
25 
26  }
27 }
28 #endif
internal::traits< Derived >::Index size_type
bool check_pos_definite(const char *function, const Eigen::Matrix< var, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result, const Policy &)
bool check_pos_definite(const char *function, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y, const char *name, T_result *result, const Policy &)
Return true if the specified matrix is positive definite.
Probability, optimization and sampling library.
Definition: agrad.cpp:6

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