예제 #1
0
 inline bool check_multiplicable(const char* function,
                                 const char* name1,
                                 const T1& y1,
                                 const char* name2,
                                 const T2& y2) {
   check_positive_size(function, name1, "rows()", y1.rows());
   check_positive_size(function, name2, "cols()", y2.cols());
   check_size_match(function,
                    "Columns of ", name1, y1.cols(),
                    "Rows of ", name2, y2.rows());
   check_positive_size(function, name1, "cols()", y1.cols());
   return true;
 }
예제 #2
0
    inline void check_pos_definite(const char* function, const char* name,
                                   const Eigen::Matrix<T_y, -1, -1>& y) {
      check_symmetric(function, name, y);
      check_positive_size(function, name, "rows", y.rows());
      if (y.rows() == 1 && !(y(0, 0) > CONSTRAINT_TOLERANCE))
        domain_error(function, name, "is not positive definite.", "");

      Eigen::LDLT<Eigen::MatrixXd> cholesky = value_of_rec(y).ldlt();
      if (cholesky.info() != Eigen::Success
          || !cholesky.isPositive()
          || (cholesky.vectorD().array() <= 0.0).any())
        domain_error(function, name, "is not positive definite.", "");
      check_not_nan(function, name, y);
    }