def partial_check_positive_definite(C):
 if (C.ndim == 1):
  d = C
 else:
  d = np.diag(C)
 (i,) = np.nonzero(np.logical_or(np.isnan(d), (d <= 0)))
 if len(i):
  raise PositiveDefiniteError('Simple check failed. Diagonal contains negatives', i)

def partial_check_positive_definite ( C ) : if ( C . ndim == 1 ) : d = C else : d = np . diag ( C ) ( i , ) = np . nonzero ( np . logical_or ( np . isnan ( d ) , ( d <= 0 ) ) ) if len ( i ) : raise PositiveDefiniteError ( 'Simple check failed. Diagonal contains negatives' , i )
simple but partial check for positive definiteness .