I had the following finitely presented group:
$$G=\langle a,b: 2a+4b=0, 3b=0\rangle$$
We can use elementary operations by rows and columns and scalar multiplication using integers, so
$$\begin{pmatrix} 2 & 4 \\ 0 & 3 \end{pmatrix} \rightarrow \begin{pmatrix} 2 & 0 \\ 0 & 3 \end{pmatrix} $$
But I also get $$\begin{pmatrix} 2 & 4 \\ 0 & 3 \end{pmatrix} \rightarrow \begin{pmatrix} 3 & 0 \\ 0 & 2 \end{pmatrix} $$
Now to use the theorem the elements of the diagonal must divide, I mean
$$ \begin{pmatrix} a & b \\ c & d \end{pmatrix} \rightarrow\begin{pmatrix} d_1 & 0 \\ 0 & d_2 \end{pmatrix}$$ with $d_1|d_2$.
To work it out, I multiply by $2$ and $3$, to get the desired form in each matrix
$$ \begin{pmatrix} 2 & 0 \\ 0 & 6 \end{pmatrix} \text{, }\begin{pmatrix} 3 & 0 \\ 0 & 6 \end{pmatrix}$$
Am I doing something wrong or this means that the finite presentation of the group gives us the groups $\mathbb{Z}_2 \times \mathbb{Z}_6$ and $\mathbb{Z}_3 \times \mathbb{Z}_6$?
Edit:
The algorithm I'm trying to use is the following:
Theorem: If $A$ is a abelian group with $n$ generators $\{ a_1,\ldots , a_n\}$ and $m$ relations, $r_{i1}a_1+\cdots +r_{in}a_n=0$, $i=1,\cdots ,m$, then we consider the matrix $R=(r_{ij})_{m \times n}$. If $R$ is similar to the diagonal matrix:
$$\begin{pmatrix} d_1 & & & & & \\ & \ddots & & & & \\ & & d_s & & & \\ & & & 0 & & \\ & & & & \ddots & \\ & & & & & 0 \end{pmatrix}$$
By row and column operations and multiplication by integers, with $d_j\mid d_{j+1}$, $d_1\neq 0$, then
$A \cong \mathbb{Z}_{d_1} \oplus \cdots \oplus \mathbb{Z}_{d_s} \oplus \mathbb{Z} \oplus \cdots \oplus \mathbb{Z} $ (the sum of the $\mathbb{Z}$'s is $m-s$).