I have a large array of zeros and ones and I need to count instances of 0 1     1 0     0 0     1 10 1,    1 0,    1 1,    0 0And I would like to exclude all other $2 \times 2$ submatrices... such as 0 1     1 10 0,    1 0,    etc.In the space of $2 \times 2$ binary matrices has $2^4 = 16$ elements, and I could like to single out these 4 matrices.  I can't use a linear condition since0 1     0 0   0 10 1  +  1 1 = 1 0It is possible to explicitly write a boolean that checks these explicitly, but then I lose the wonderful numpy quickness...
detecting special $2 \times 2$ matrices in a large array of zeros and ones
matrices;numpy