I'm working on a hash function and I was wondering if there is a function which can tansform a matrix into a natural being bijective. For example:
$A=\begin{bmatrix} 0&0&1\\ 2&0&1\\ 0&1&2 \end{bmatrix}$
I'm trying to find a way to tranform that matrix into $\Bbb N$ with a bijective function. This function has its domain in all the combinations that can be done with the numbers in $A$ (four $0$'s, three $1$'s and two $2$'s) and the image has to be $\{0,\dots, \#\text{Combinations}\}$.
Thanks in advance.
Note: reading the question carefully, it seems to differ from the title. I have answer the title.
An injective function from $3\times 3$ matrices to $\mathbb{N}$ is $$f(M)=2^{m_{1,1}}3^{m_{1,2}}5^{m_{1,3}}7^{m_{2,1}}11^{m_{2,2}}13^{m_{2,3}}17^{m_{3,1}}19^{m_{3,2}}23^{m_{3,3}}$$ where $m_{i,j}$ denotes the $(i,j)$ entry of $M$.
An explicit bijective function would be rather messy, but it must exist due to the Cantor-Schroder-Bernstein theorem, and the fact that there are plenty of injective funtions going the other way. For example, $$g(a)=\left(\begin{matrix}a&0&0\\0&0&0\\0&0&0\end{matrix}\right)$$
If you really want an explicit bijection, you can try to generalize the construction in this answer.