def _dual_gap(emp_cov, precision_, alpha):
 gap = np.sum((emp_cov * precision_))
 gap -= precision_.shape[0]
 gap += (alpha * (np.abs(precision_).sum() - np.abs(np.diag(precision_)).sum()))
 return gap

def _dual_gap ( emp_cov , precision_ , alpha ) : gap = np . sum ( ( emp_cov * precision_ ) ) gap -= precision_ . shape [ 0 ] gap += ( alpha * ( np . abs ( precision_ ) . sum ( ) - np . abs ( np . diag ( precision_ ) ) . sum ( ) ) ) return gap
expression of the dual gap convergence criterion the specific definition is given in duchi "projected subgradient methods for learning sparse gaussians" .