@Simd 0000, 0001 (all of those having 1 one), 0011 (two ones in one row), 0101 (two ones in one column), 0110 (two ones diagonally), 0111 (all having 3 ones), 1111
@Simd Handling both looks hard. I'd first generate inequivalent matrices with respect to row permutations only (which is easy: iterate over "combinations with replacement" of size n out of 0000... through 1111...), sort their columns, and remove duplicates out of them