How to transfer the following matrix into Smith normal form? $$\left[\begin{matrix} 2 & -2b & 0 \\ 0 & 2 & -2c \\ -2a & 0 & 2 \end{matrix}\right]$$ The final answer is $$\left[\begin{matrix} 2 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 2|abc-1| \end{matrix}\right]$$
But how we get it?
\begin{align} &\begin{bmatrix} 2 & -2b & 0 \\ 0 & 2 & -2c \\ -2a & 0 & 2 \end{bmatrix}\xrightarrow{r_3\leftarrow r_3+ar_1} \begin{bmatrix} 2 & -2b & 0 \\ 0 & 2 & -2c \\ 0 & -2ab & 2 \end{bmatrix}\xrightarrow{c_2\leftarrow c_2+bc_1\;\:} \begin{bmatrix} 2 & 0 & 0 \\ 0 & 2 & -2c \\ 0 & -2ab & 2 \end{bmatrix} \\[1.5ex] {}\xrightarrow{r_3\leftarrow r_3+abr_2} &\begin{bmatrix} 2 & 0 & 0 \\ 0 & 2 & -2c \\ 0 & 0 & 2-2abc \end{bmatrix} \xrightarrow{c_3\leftarrow c_3+cc_2} \begin{bmatrix} 2 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 2(1-abc) \end{bmatrix} \end{align} Possibly change the sign of the last row.