def _step1(state):
 state.C -= state.C.min(axis=1)[:, np.newaxis]
 for (i, j) in zip(*np.where((state.C == 0))):
  if (state.col_uncovered[j] and state.row_uncovered[i]):
   state.marked[(i, j)] = 1
   state.col_uncovered[j] = False
   state.row_uncovered[i] = False
 state._clear_covers()
 return _step3

def _step1 ( state ) : state . C -= state . C . min ( axis = 1 ) [ : , np . newaxis ] for ( i , j ) in zip ( * np . where ( ( state . C == 0 ) ) ) : if ( state . col_uncovered [ j ] and state . row_uncovered [ i ] ) : state . marked [ ( i , j ) ] = 1 state . col_uncovered [ j ] = False state . row_uncovered [ i ] = False state . _clear_covers ( ) return _step3
steps 1 and 2 in the wikipedia page .