Compute the number of unique, non-equivalent configurations of a matrix

145 Views Asked by At

Consider a matrix $\mathbf{A}$ of size $m\times n$. Each element of this matrix, denoted here as $a_{ij}$, is a non-negative integer from $0$ to $s$, i.e. $a_{ij}\in\{0,1,2,...,s\}$. The problem is to compute the number of unique, non-equivalent configurations of $\mathbf{A}$. Equivalency is defined as: for a given configuration of $\mathbf{A}$, if by swapping any two rows or columns a given number of times we arrive at some other configuration, then these two configurations are equivalent. For example, considering $m=n=s=2$, the following matrices:

$$ \begin{equation} \begin{bmatrix} 0 & 0 \\ 0 & 1 \end{bmatrix}, \begin{bmatrix} 0 & 0 \\ 1 & 0 \end{bmatrix}, \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix}, \begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix} \end{equation} $$ are all equivalent since:

  • From the first matrix we can obtain the second by swapping the columns.
  • From the first matrix we can obtain the third by swapping the rows.
  • From the first matrix we can obtain the fourth by swapping the rows and columns.

Again, the objective is to compute the number of unique, non-equivalent configurations of $\mathbf{A}$ considering the general parameters $m$, $n$, and $s$.


My background is mechanical engineering and I've never formally studied combinatorics, so, any help is greatly appreciated and I apologize for my naiveness.

1

There are 1 best solutions below

0
On

There is an answer to this question here along with code to compute count(m,n,s) as answer(n,m,s) (though the order of the size parameters does not matter). For answer(2,2,2) the result is 7; the rows of each matrix are shown below:

([0, 0], [0, 0])
[[1, 0], [0, 0]]
[[0, 0], [1, 1]]
[[0, 1], [0, 1]]
[[0, 1], [1, 0]]
[[0, 1], [1, 1]]
([1, 1], [1, 1])

Note: the code I reference does not compute the matrices, only counts them. I have code at this SymPy page that will enumerate the matrices for a given set of elements -- see umat on that page.