Artificial intelligent assistant

Is there a criterion for such black/white stone game? Black and white stones arranged as $m$ row and $n$ columns. At each move, you could choose either one row or one column, and reverse each stone's color -- turn white stones to black, and black stones to white. To determine if the beginning situation could be turned into a matrix of all-white stones, is there a criterion for that?

Clearly the order of operations is immaterial, and no row or column has to be reversed more than once. In effect, then, you're asking if a given matrix of $+1$'s and $-1$'s can be factored as the product of a column vector and a row vector of $+1$'s and $-1$'s. It's easy to see that this is possible just in case any two rows of the matrix are either equal or opposite, and that means that each $2\times2$ submatrix has an even number of each sign, i.e., there is no $2\times2$ submatrix with an odd number of black stones.

The procedure for getting rid of the black stones is very simple: pick a row and make it all-white with column reversals, then reverse all the black rows.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 69e60f469da10f815fb37052dd29b0da