Suppose we have a vector of probabilities $\mathbf{p}=(p\_1,...,p\_n)$, where $p\_i>0$ for $i=1,...n$ and $\sum p\_i=1$. Define new vector $\mathbf{r}=(r\_1,...,r\_{n-1})$ in a following way:


$r\_i=\log(p\_i/p\_n)$


This defines the transformation $T:(0,1)^n\to\mathbb{R}^{n-1}$, $\mathbf{r}=T\mathbf{p}$. This transformation can be called multinomial transformation (or to be more precise inverse multinomial transformation), since similar formula is used in http://en.wikipedia.org/wiki/Multinomial\_logit>multinomial logit model. 


This transformation is useful for modelling, since resulting $r\_i$ can be any real number, and there is an easy way to transform $r\_i$ back to probabilities:


$p\_n=\dfrac{1}{1+\sum \exp(r\_i)},$


$p\_i=\exp(r\_i)p\_n$.


My question is whether there exists a similar transformation for matrices. Suppose we have two probability vectors $\mathbf{p}=(p\_1,...,p\_n)$, $\mathbf{q}=(q\_1,...q\_m)$ and $n\times m$ matrix $P=(p\_{ij})$, satisfying 


$\sum p\_i=1$, $\sum q\_i=1$


$\sum\_{j=1}^m p\_{ij}=p\_i$, for each $i=1,...,n$, (1)


$\sum\_{i=1}^n p\_{ij}=q\_j$, for each $j=1,...,m$, (2)


(what we actualy have is a bivariate discrete probability distribution with given marginal distributions).


Now what I am looking for is a transformation which transforms $p\_{ij}$ to unbounded real numbers, but such that the inverse would satisfy constraints (1) and (2). In effect I am looking for the bijection from subset of $(0,1)^{nm}$ to $R^{k}$, where $k$ should be $(n-1)(m-1)$. 


I suspect that maybe copulas can be involved here, or some properties of stochastic matrices. If somebody could give me any pointers I would be very grateful.



Multinomial transformation for matrices
At the suggestion of the original poster, I am summarizing an alternate answer that has a few strengths relative to my original answer. It is related to the question and answer at [this MathOverflow Question](https://mathoverflow.net/questions/156983/injectivity-of-matrix-fingerprint/157174). 


For any matrix $A$, define
$$ L\_A(i,j)=\log\left(\frac{A\_{i,j}A\_{i+1,j+1}}{A\_{i+1,j}A\_{i,j+1}} \right)$$


Let $S$ be the set of $n\times m$ matrices with fixed row and columns sums $p\_i$ and $q\_j$ and positive entries.
Let $Q:S\rightarrow R^{(n-1)\times (m-1)}$ be the map where the $(i,j)$-th entry of $Q(A)$ is $L\_A(i,j)$.


Then $Q$ is a bijection between $S$ and $R^{(n-1)\times (m-1)}$. Moreover, the inverse is efficiently computable. Mpiktas wrote an [R package called retacoro](https://github.com/mpiktas/retacoro) that appears to recover the inverse through gradient descent. Alternately, the inversion of this projection can be expressed as a [geometric program](https://en.wikipedia.org/wiki/Geometric_programming), and geometric programs can be solved in polynomial time (and efficiently in practice).


Establishing the bijectivity of $Q$ and defining the geometric program precisely seem a bit long for a MathOverflow post. I'll post a more detailed description to ArXiv and put a link here when I'm done.


