Consider a real square matrix $A$ of size $n\times n$. Under which conditions on $A$ does there exist a row-stochastic matrix $U$ (non-negative, rowsums = 1), such that $A'=U^{-1}AU$ is a non-negative matrix? In other words, does there exist a row-stochastic matrix $U$ such that the linear system $AU = UA'$ will have a solution with non-negative $A'$? Geometrically, we are asking: When are the columns of the product $AU$ inside the cone generated by the columns of $U$.

If $U$ exists, how can you determine it? If there is no analytic solution, I'd also be happy with a numerical procedure that converges to $U$.

Consider the following examples for $n=2$:

a) the trivial case: Let $A$ be already non-negative, then $U$ can be the identity and we are done. If all entries of $A$ are strictly positive we have an infinite number of possible matrices $U$. The cone spanned by the columns of $U$ only needs to contain the columns of $A$.

b) only one solution: consider $A=\left( \begin{array}{cc} -1/2 & 1\\\ 1/4 & 1/2\end{array}\right)$ which can be transformed with $U=\left( \begin{array}{cc} 1 & 0\\\ 1/2 & 1/2\end{array}\right)$ into $U^{-1}AU = A'=\left( \begin{array}{cc} 0 & 1/2\\\ 1 & 0\end{array}\right)$

c) no solution: consider $A=\left( \begin{array}{cc} -1/2 & 1\\\ 1/4 & 1/8\end{array}\right)$ for which one cannot find an appropriate $U$.

Thanks for any suggestions!