Positivity in Smith Normal Forms Given $M\in\Bbb Z_{+,t}^{n\times n}$ where $\Bbb Z_{+,t}=\{0,1,2,3,4,\dots,t\}$, when does there not exist $U,S,V\in\Bbb Z_{+,t}^{n\times n}$ where $U,V$ is unimodular while $S$ is diagonal such that $M=USV$?
In case it is unachievable what would be minimum $r$ such that there exists $r$ such non-negative triple, $\{U_i,S_i,V_i\}_{i=1}^r$ with $U_i,S_i,V_i\in\Bbb Z_{+,t}^{n\times n}$, such that $M=\sum_{i=1}^rU_iS_iV_i$?
 A: The only case where such $U,V$ do not exist is when $M$ is (square and) invertible and has negative determinant; clearly in that case having $U,V$ would lead to an easy contradiction.
But if that condition is not met, the Smith normal form has at least one zero row or column. In computing the Smith normal form, the diagonal entries are only imposed up to sign, and one can make do with unimodular row and column operations while choosing all diagonal entries to be positive, except possibly the final one if it is in the lower right hand corner of the matrix. (I know this for a fact, since I have programmed it in a computational system that may then uses the diagonal entries to compute the determinant of the original matrix (if square); this is only valid if one restricts to unimodular operations.) But if the final invariant factor is not the last entry of the matrix, one can multiply a pair of rows or a pair of columns by $-1$ to cast off a possible negative sign on the final nonzero entry.
