The Smith normal form decomposition over integer domain implementation in Julia.
For Julia 1.1+, add BoffinStuff registry in the package manager, and proceed with the installation:
pkg> registry add https://github.com/wildart/BoffinStuff.git
pkg> add SmithNormalForm
julia> using SmithNormalForm, LinearAlgebra
julia> M = [2 4 4; -6 6 12; 10 -4 -16]
3×3 Array{Int64,2}:
2 4 4
-6 6 12
10 -4 -16
julia> F = smith(M)
Smith normal form:
[2 0 0; 0 6 0; 0 0 12]
julia> F.S
3×3 Array{Int64,2}:
1 0 0
-3 1 0
5 -2 1
julia> F.T
3×3 Array{Int64,2}:
1 2 2
0 3 4
0 1 1
julia> diagm(F)
3×3 Array{Int64,2}:
2 0 0
0 6 0
0 0 12
julia> F.S*diagm(F)*F.T
3×3 Array{Int64,2}:
2 4 4
-6 6 12
10 -4 -16