def _step4(state):
 C = (state.C == 0).astype(np.int)
 covered_C = (C * state.row_uncovered[:, np.newaxis])
 covered_C *= astype(state.col_uncovered, dtype=np.int, copy=False)
 n = state.C.shape[0]
 m = state.C.shape[1]
 while True:
  (row, col) = np.unravel_index(np.argmax(covered_C), (n, m))
  if (covered_C[(row, col)] == 0):
   return _step6
  else:
   state.marked[(row, col)] = 2
   star_col = np.argmax((state.marked[row] == 1))
   if (not (state.marked[(row, star_col)] == 1)):
    state.Z0_r = row
    state.Z0_c = col
    return _step5
   else:
    col = star_col
    state.row_uncovered[row] = False
    state.col_uncovered[col] = True
    covered_C[:, col] = (C[:, col] * astype(state.row_uncovered, dtype=np.int, copy=False))
    covered_C[row] = 0

def _step4 ( state ) : C = ( state . C == 0 ) . astype ( np . int ) covered_C = ( C * state . row_uncovered [ : , np . newaxis ] ) covered_C *= astype ( state . col_uncovered , dtype = np . int , copy = False ) n = state . C . shape [ 0 ] m = state . C . shape [ 1 ] while True : ( row , col ) = np . unravel_index ( np . argmax ( covered_C ) , ( n , m ) ) if ( covered_C [ ( row , col ) ] == 0 ) : return _step6 else : state . marked [ ( row , col ) ] = 2 star_col = np . argmax ( ( state . marked [ row ] == 1 ) ) if ( not ( state . marked [ ( row , star_col ) ] == 1 ) ) : state . Z0_r = row state . Z0_c = col return _step5 else : col = star_col state . row_uncovered [ row ] = False state . col_uncovered [ col ] = True covered_C [ : , col ] = ( C [ : , col ] * astype ( state . row_uncovered , dtype = np . int , copy = False ) ) covered_C [ row ] = 0
find a noncovered zero and prime it .