Exact integer nullspace of integer matrix?

时间:2016-08-31 17:25:25

标签: julia linear-algebra

nullspace(A) finds a basis for the null-space of a matrix A. The returned vectors have floating-point coordinates. If the matrix A is an integer-matrix, the basis can be found in integer coordinates.

For example, in Mathematica,

NullSpace[RandomInteger[{-10, 10}, {3, 4}]]

always returns integer vectors.

Is there a way to compute an integer basis for an integer matrix in Julia?

Update: I get build errors with Nemo.jl (see comments to Dan Getz's answer). In the mean time, is there an alternative?

1 个答案:

答案 0 :(得分:7)

Nemo.jl是朱莉娅的代数包。它具有很多功能,还应该允许计算零空间。一种方法是:

using Nemo   # install with Pkg.add("Nemo")

S = MatrixSpace(ZZ, 3, 4)
mm = rand(-10:10,3,4)
m = S(mm)
(bmat,d) = nullspace(m)

之后d是nullspace的维度,bmat在其列中有基础。

希望这会有所帮助(我很乐意看到可能使用其他代数包的替代解决方案)。