The following code
using IntegerSmithNormalForm
X = BigInt[ 3 2 -4 0 -2 6 -5 -3 6 9;
-7 5 -7 7 -9 8 9 4 1 5;
5 -3 -6 -1 0 1 4 3 -4 9;
-6 9 8 2 8 8 -8 4 -3 5;
-8 8 9 4 6 -4 5 1 -1 5;
1 -2 4 -6 6 -8 1 2 5 2;
-5 -6 -5 2 -9 7 -7 -6 3 2;
2 0 -9 0 8 1 7 -1 -9 -3;
-2 -1 9 -3 -8 -4 -8 4 -5 0;
-5 -5 -1 9 -4 -8 -1 -9 1 0 ];
P,D,Q = snf(Int64.(X)); println(D==P*Int64.(X)*Q, " ", big.(D)==big.(P)*X*big.(Q))
shows that the results are correct in Int64 arithmetic with overflows, but incorrect in the exact BigInt arithmetic. Running the command with exact integers gives an error:
P,D,Q = snf(X); println(D==P*X*Q)
ERROR: MethodError: no method matching addRow(::LinearAlgebra.Adjoint{BigInt, Matrix{BigInt}}, ::Int64, ::Int64, ::Int64)
The function `addRow` exists, but no method is defined for this combination of argument types.
Closest candidates are:
addRow(::AbstractMatrix{E}, ::Any, ::Any, ::E) where E
@ IntegerSmithNormalForm ~/.julia/packages/IntegerSmithNormalForm/6WZhT/src/IntegerSmithNormalForm.jl:67
Stacktrace:
[1] snf!(A::Matrix{BigInt})
@ IntegerSmithNormalForm ~/.julia/packages/IntegerSmithNormalForm/6WZhT/src/IntegerSmithNormalForm.jl:197
[2] snf(A::Matrix{BigInt})
@ IntegerSmithNormalForm ~/.julia/packages/IntegerSmithNormalForm/6WZhT/src/IntegerSmithNormalForm.jl:238
[3] top-level scope
@ REPL[5]:1
In SNF, the matrix entries typically become enormous during the computation. Without support for BigInt, the results are useless.
The following code
shows that the results are correct in
Int64arithmetic with overflows, but incorrect in the exactBigIntarithmetic. Running the command with exact integers gives an error:In SNF, the matrix entries typically become enormous during the computation. Without support for
BigInt, the results are useless.