In my research project, we're exploring the decomposition of Gaussian integer-valued square matrices as a cross-product of other Gaussian integer matrices (GIM) with the same dimension. One of the most classic problems that we futilely also dipped our toes in is the correlation of how a shared factor of all determinants in a set $\textbf{S}$ is preserved under matrix addition. We came up with the equation that exists a factorization of the sum of the matrices in set $\textbf{S}$ if and only if, there exists a matrix $E_R$ such that the following product of matrices is in GIM.
\begin{equation} \exists E_R: \left( \sum_{i=1}^k L_i D_1 \left(\left(\sum_{j=1}^k R_j\right) - R_i + E_R \right) \right) \left(D_1 \left(\left(\sum_{i=1}^k R_i\right) + E_R \right) \right)^{-1} \in \text{GIM} \end{equation}
Where $D_1$ is a predetermined diagonal GIM matrix. Furthermore, the set of $k$ with elements $L_i$ and $k$ large set with elements $R_i$ are also given where $L_i, R_i \in \text{GIM}$.
This concoction above is deducted from the steps down below:
The Gaussian integers form a Principle ideal domain which means that GIM has a Smith normal form. In other words, there exists invertible matrices $J$, $K$: $A = JDK$.
Thus from a lemma in my paper where the greatest common factor where the elements in $\textbf{S}$ are in their Smith normal decomposition's reduced form and can't be solely left or right factored, the greatest common divisor has an equivalence class where a common diagonal is part of, leads to the down below equation.
$$\sum_{A_i\in \textbf{S}} A_i = \left(\sum_{i=1}^{|\textbf{S}|=k}L_i + E_L \right)D_1\left(\sum_{i=1}^kR_i + E_R \right) $$
Where $L_i, R_i$ are the left, and right factors of the greatest common divisor $D_1$ of the $i$'th matrix in $\text{S}$ respectively. And $E_L, E_R$ are error correction matrices; the variable part of the equation.
Back to the problem at hand. The only solutions I have been able to find are when there exists a common left or right factorization among all elements in $\textbf{S}$. My mathematics knowledge is limited to below masters-level understanding so many articles have fallen way beyond deaf's ear. Any suggestions on possible steps to proceed forward or other possible tools to tackle the problem / solutions?