code: def _step4(state):
      """
      Find a noncovered zero and prime it. If there is no starred zero
      in the row containing this primed zero, Go to Step 5. Otherwise,
      cover this row and uncover the column containing the starred
      zero. Continue in this manner until there are no uncovered zeros
      left. Save the smallest uncovered value and Go to Step 6.
      """
      # We convert to int as numpy operations are faster on int
      C = (state.C == 0).astype(int)
      covered_C = C * state.row_uncovered[:, np.newaxis]
      covered_C *= np.asarray(state.col_uncovered, dtype=int)
      n = state.C.shape[0]
      m = state.C.shape[1]
  
      while True:
          # Find an uncovered zero
          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
              # Find the first starred element in the row
              star_col = np.argmax(state.marked[row] == 1)
              if state.marked[row, star_col] != 1:
                  # Could not find one
                  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] * (
                      np.asarray(state.row_uncovered, dtype=int)
                  )
                  covered_C[row] = 0
  
file_path: catboost/contrib/python/scipy/py2/scipy/optimize/_hungarian.py
imports: import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: _step4(state) and returns: _step6, _step5