Computing Smith Normal Form of $\left(\begin{smallmatrix} 1 & c_{12} & c_{13} \\ 0 & 1 & c_{23} \\ 0 & 0 & 1 \\ \end{smallmatrix}\right)$ I think this is a simple question, I am looking for a program which computes the Smith normal form or rational canonical form of a matrix. Not something fancy, I want just to compute the Smith normal form of the following matrix
$$
\begin{pmatrix}
1 & c_{12} & c_{13} \\
0 &   1    & c_{23} \\
0 &   0    &   1    \\
\end{pmatrix},
$$
where the entries are from an arbitrary field. Can you help me please?
 A: PARI GP has such a function. From its documentation:

matsnf(X,{flag = 0})
If X is a (singular or non-singular) matrix outputs the vector of elementary divisors of X, i.e. the diagonal of the Smith normal form of X, normalized so that d_n | d_{n-1} | ... | d_1.
The binary digits of flag mean:
1 (complete output): if set, outputs [U,V,D], where U and V are two unimodular matrices such that UXV is the diagonal matrix D. Otherwise output only the diagonal of D. If X is not a square matrix, then D will be a square diagonal matrix padded with zeros on the left or the top.
2 (generic input): if set, allows polynomial entries, in which case the input matrix must be square. Otherwise, assume that X has integer coefficients with arbitrary shape.
4 (cleanup): if set, cleans up the output. This means that elementary divisors equal to 1 will be deleted, i.e. outputs a shortened vector D' instead of D. If complete output was required, returns [U',V',D'] so that U'XV' = D' holds. If this flag is set, X is allowed to be of the form `vector of elementary divisors' or [U,V,D] as would normally be output with the cleanup flag unset.
The library syntax is GEN matsnf0(GEN X, long flag).

