JunpengGao233 / HermiteNormalForm.jl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HermiteNormalForm

Stable Dev Build Status Coverage

This package implements the Hermite norm form. It can be used to compute the unimodular extension of an integer matrix. In the following example, we compute the unimodular matrix Uinv which shares rows with the given rectangular matrix A.

Reference: https://math.stackexchange.com/a/4397337/662983

julia> using HermiteNormalForm, LinearAlgebra

julia> A = [
        -2  -1   0   3   0
        -3   0  -2  -1   1
         3  -1   1  -3  -1
       ];

julia> H, U = hnf(A); @assert all(isone, diag(H))

julia> Uinv = Int.(inv(U.//1))
5×5 Matrix{Int64}:
 -2  -1   0   3   0
 -3   0  -2  -1   1
  3  -1   1  -3  -1
 -7   0  -4   0   0
  3   0   2   1   0

julia> Int(det(Uinv.//1))
1

About

License:MIT License


Languages

Language:Julia 100.0%