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?
答案 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
在其列中有基础。
希望这会有所帮助(我很乐意看到可能使用其他代数包的替代解决方案)。