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.
There is an answer to this question here along with code to compute
count(m,n,s)asanswer(n,m,s)(though the order of the size parameters does not matter). Foranswer(2,2,2)the result is 7; the rows of each matrix are shown below: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
umaton that page.