# Smith Normal Form

After executing the following for computing the snf (or Smith normal form) of a matrix I got two different results.

In the second case I expected to get integer transformation matrices.

The code below can be run in sagecell.

```
sage: B = matrix([[1143, 2361, -1995, 2694],
[-342, -704, 595, -806],
[-454, -936, 791, -1070],
[-521, -1077, 910, -1228]])
sage: C = matrix(QQ, [[1143, 2361, -1995, 2694],
[-342, -704, 595, -806],
[-454, -936, 791, -1070],
[-521, -1077, 910, -1228]])
sage: print(type(C), "\n", type(B))
<class 'sage.matrix.matrix_rational_dense.Matrix_rational_dense'>
<class 'sage.matrix.matrix_integer_dense.Matrix_integer_dense'>
sage: print(C == B)
True
sage: show(B.smith_form())
([1 0 0 0] [ 0 1 0 0]
[0 1 0 0] [-5 -1 -3 -8]
[0 0 0 0] [19 3 10 31]
[0 0 0 0], [ 7 0 5 11],
[ 0 0 1 0]
[ 4505 -53 1549031 112]
[ 5715 -60 1963950 142]
[ 284 2 96814 7])
sage: show(C.smith_form())
([1 0 0 0] [ 1/1143 0 0 0]
[0 1 0 0] [ 19/155 127/310 0 0]
[0 0 0 0] [ 8/45 -11/15 1 0]
[0 0 0 0], [ 5/9 1/3 0 1],
[ 1 -787/381 7/62 -71/31]
[ 0 1 49/62 -1/31]
[ 0 0 1 0]
[ 0 0 0 1])
```