What's the degree of freedom of this kind of matrix? We first have a unitary matrix $$\{a_{ij}\}\quad(n\times n)$$
I know how to calculate its degree of freedom, which is $n^2$ if we consider a real variable as one degree of freedom.
Now we have a matrix which is $$\{|a_{ij}|^2\}$$
where the $a_{ij}$ are the elements of the unitary matrix above. I wonder how to calculate its degree of freedom. 
 A: Here's a partial answer: I offer it in the hope that its method could help someone else to give you a full answer.
I suggest that a better posing of your question might be:
Given an $n\times n$ matrix of positive real numbers $r_{j\,k};\;j,\,k\in 1\cdots n$, how many can be freely chosen so that there exist real phases $\phi_{j\,k};\;j,\,k\in 1\cdots n$ such that the matrix whose elements are $r_{j\,k}\,\exp(i\,\phi_{j\,k})$ is unitary? What are the relationships between those that can be freely chosen and the rest?
Here is a conjecture whose justification I can't quite see how to make rigorous for the moment (which is why I said it's a partial answer).
Conjecture: The answer is $\frac{n\,(n-1)}{2}$
What I know for sure: The answer is at least $\frac{n\,(n-1)}{2}$ and at most $\frac{n\,(n+1)}{2}$
To see this, we work as follows.
All unitary matrices are of the form $e^H$, where $H$ is skew symmetric (this holds globally for the $U(N)$ Lie group example, but there are connected Lie groups which are not simply the exponentials of their algebras. However, the local (in neighbourhood of the identity) truth of the statement is enough for our purposes). The real Lie algebra $\mathfrak{u}(n)$ of $n\times n$ skew symmetric matrices allows for $n^2$ dimensional geodesic (exponential) co-ordinates for the Lie group $U(N)$ in some open neighbourhood $\mathcal{U}\subset U(N)$ of the identity matrix within $U(N)$.
Equally well, the magnitudes and phases of the $\frac{n\,(n-1)}{2}$ complex numbers above the leading diagonal of $H\in\mathfrak{u}(n)$ together with the $n$ imaginary leading diagonal elements of $H$ (again, a total of $n^2$ real numbers) serve as unique co-ordinates within the neighbourhood $\mathcal{U}$.
Now a lemma:
Lemma: There is a neighbourhood $\mathcal{V}\subseteq \mathcal{U}$ of the identity within $U(N)$ such that for any $\gamma\in\mathcal{V}$ the following $n^2$ real numbers serve as unique co-ordinates for the neighbourhood $\mathcal{V}$: (1) the real and imaginary parts of the $\frac{n\,(n-1)}{2}$ complex numbers above the leading diagonal in  $\gamma\in\mathcal{V}$ together with the $n$ phases of the elements along the leading diagonal of $\gamma$.
Proof: Consider $f:\mathbb{R}^{n^2}\to\mathbb{R}^{n^2}$ where $f$ maps the co-ordinates given by the $\frac{n\,(n-1)}{2}$ upper triangle real parts, $\frac{n\,(n-1)}{2}$ upper triangle imaginary parts together with the $n$ leading diagonal pure imaginaries in the Lie algebra element $g=\log \gamma$ onto the $\frac{n\,(n-1)}{2}$ upper triangle real parts, $\frac{n\,(n-1)}{2}$ upper triangle imaginary parts and $n$ leading diagonal phases of the element $\gamma$. This function is continuously differentiable and $\mathrm{d} f$ is invertible at the origin; indeed $\mathrm{d} f=\mathrm{id}$ there (given that $e^H = \mathrm{id} + H + O(H^2)$). Therefore, by the Inverse Function Theorem, there is some open neighbourhood of the origin wherein $f$ is invertible, so therefore there is always a Lie algebra member whose exponential has any set of magnitudes and phases in its upper triangle and any set of phases along its leading diagonal, as long as the magnitudes and leading diagonal phases are all small enough. $\;\square$
So now we know that for a unitary matrix near enough to the identity, we can choose any set of $\frac{n\,(n-1)}{2}$ magnitudes less than some nonzero maximum in its upper triangle, but not in its lower triangle, since the upper triangle together with the leading diagonal phases form a set of local co-ordinates near the identity. But at most we can choose the leading diagonal magnitudes, hence the correct answer lies between $\frac{n\,(n-1)}{2}$ and $\frac{n\,(n+1)}{2}$ (inclusive).
I suspect it is $\frac{n\,(n-1)}{2}$, because, to first order, the magnitudes of the leading diagnoal elements of a unitary matrix near the identity are unity, but maybe someone knows this for sure.
A: The matrix you have defined is made of non-negative entries, say $a_{ij}$, and they satisfy
$$\sum_{k=1}^n a_{ki} = \sum_{k=1}^n a_{ik} = 1,\qquad\forall i=1,\ldots,n.$$
Hence it is a doubly stochastic matrix and as such it has at most $(n-1)^2$ parameters: $n^2$ variables and $2n-1$ constraints. See also this link on MO for more details.
