Does anyone have knowledge of packages for Smith Normal Form (e.g., SmithNormalForm.jl)?
I did a simple test of SmithNormalForm.jl:
Apart from the example in the GitHub page,… function smith seems to work:
rectangular matrices
matrices with integer and floating point numbers
Long time ago, I used Maple to find the Smith form of rectangular linear pencils , and am looking for this possibility in Julia. I specifically tried with:
apply smith to a matrix of rational numbers – this did not work (a little surprising, since it worked with floats…)
apply smith to a matrix s*I - A where s is defined as @variables s using the Symbolics.jl package
Neither 1 nor 2 work.
The Smith form of a linear matrix pencil is of some interest in control theory.
→ is there a way to update the algorithms such that both rational numbers and Symbolics.jl variables work?
For a matrix with rational entries (or entries in an arbitrary field), the Smith normal form is rather simple. It is just the matrix here: Matrix equivalence - Wikipedia. It is uniquely determined by the rank of the matrix.
For task 2):
julia> using Nemo
julia> Qx, x = QQ["x"];
julia> M = matrix(Qx, [1 2; 4 5])
[1 2]
[4 5]
julia> snf(x*identity_matrix(Qx, 2) - M)
[1 0]
[0 x^2 - 6*x - 3]
julia> elementary_divisors(x * identity_matrix(Qx, 2) - M) # also known as invariant factors sometimes
2-element Vector{QQPolyRingElem}:
1
x^2 - 6*x - 3
I have a package, NormalForms.jl, providing Smith and Hermite normal forms as subtypes of LinearAlgebra.Factorization, and it’s under active development. As of now, it is written specifically for integer matrix operations. However, I’m sure 1) could be implemented in the package pretty easily. As for 2), I’ve never used Symbolics.jl, but if I can find maintainers who are familiar with it, I’d also be happy to integrate this functionality too.
I will open issues relating to this on the repo and you are welcome to file a PR if you are interested in contributing.