def check_pd(matrix):
    """ A symmetric matrix (M) is PD if it has a Cholesky decomposition, i.e.
    M = R.T dot R, where R is upper triangular with positive diagonal entries
    """
    try:
        np.linalg.cholesky(matrix)
        return True
    except np.linalg.LinAlgError:
        return False
A symmetric matrix (M) is PD if it has a Cholesky decomposition, i.e.
    M = R.T dot R, where R is upper triangular with positive diagonal entries