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