I'm a programmer and I'm trying to create a program where I need to calculate how random or disordered a matrix is. I read this answer here: Entropy of matrix but it did not really help me.
What I'm trying to do is that if I have a kind of binary matrix (of only 0s and 1s), I want to calculate how disordered (or ordered) it is. I'm looking to quantify the word disorder of a matrix. I know it is possible by calculating entropy of the matrix, but I'm not sure at all how to implement such algorithm.
For example, a matrix consisting of only 0s and 1s should return entropy as 0. Matrix like:
1 0 1
0 1 0
1 0 1
0 1 0
should also have low entropy. Matrix like:
1 0 1
1 1 1
1 1 0
1 0 1
1 1 1
1 1 0
should have slightly higher entropy than previous. How do I quantify all these arrangements? (Order of matrix is not fixed).