Generalizations of Some Criteria for P-Matrices and M-Matrices