#ifndef STAN__MATH__PRIM__MAT__ERR__CHECK_COV_MATRIX_HPP
#define STAN__MATH__PRIM__MAT__ERR__CHECK_COV_MATRIX_HPP

#include <stan/math/prim/mat/fun/Eigen.hpp>
#include <stan/math/prim/mat/err/check_pos_definite.hpp>

namespace stan {
  namespace math {
    using Eigen::Dynamic;
    /**
     * Return <code>true</code> if the specified matrix is a valid
     * covariance matrix. 
     *
     * A valid covariance matrix is a square, symmetric matrix that is
     * positive definite.
     *
     * @tparam T Type of scalar.
     *
     * @param function Function name (for error messages)
     * @param name Variable name (for error messages)
     * @param y Matrix to test
     *
     * @return <code>true</code> if the matrix is a valid covariance matrix
     * @throw <code>std::invalid_argument</code> if the matrix is not square
     *   or if the matrix is 0x0
     * @throw <code>std::domain_error</code> if the matrix is not symmetric,
     *   if the matrix is not positive definite,
     *   or if any element of the matrix is nan
     */
    template <typename T_y>
    inline bool
    check_cov_matrix(const char* function,
                     const char* name,
                     const Eigen::Matrix<T_y, Dynamic, Dynamic>& y) {
      check_pos_definite(function, name, y);
      return true;
    }

  }
}
#endif
