Integral matrices with integral inverses using Sherman-Morrison formula - with Julia code

This blog post is on how to make a square matrix with integer entries so that its inverse contains only integer entries. This kind of matrices might be useful for demonstrating Gaussian-Jordan elimination for solving a linear system without any fractions coming up in between. Generation of linear systems with unimodular coefficient matrix is coded in Julia.
Integral matrices with integral inverses using Sherman-Morrison formula
Can you provide your valuable feedback.

3 Likes

are you sure you need to use global?

If I comment that line #global u,v,p
the following message comes:

u = [-3; -2; 4]
v = [0; 4; 0]
ERROR: LoadError: UndefVarError: u not defined
Stacktrace:
[1] getVectors
@ IntegerMatrices.jl:47 [inlined]
[2] getCoefficientMatrix(n::Int64, lim::Int64)
@ Main IntegerMatrices.jl:59
[3] top-level scope
@ IntegerMatrices.jl:118
[4] include(fname::String)
@ Base.MainInclude .\client.jl:444
[5] top-level scope
@ REPL[1]:1

you can pass it as parameters

like function getVectors(n,lim,u,v,p)?
What is the advantage?