整数矩阵的确切整数零空间? [英] Exact integer nullspace of integer matrix?
问题描述
nullspace(A)
为矩阵 A
的空空间找到一个基.返回的向量具有浮点坐标.如果矩阵 A
是整数矩阵,则可以在整数坐标中找到基.
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.
例如,在Mathematica中,
NullSpace[RandomInteger[{-10, 10}, {3, 4}]]
总是返回整数向量.
有没有办法在 Julia 中计算整数矩阵的整数基?
Is there a way to compute an integer basis for an integer matrix in Julia?
更新: Nemo.jl
出现构建错误(请参阅 Dan Getz 回答的评论).同时,还有其他选择吗?
Update: I get build errors with Nemo.jl
(see comments to Dan Getz's answer). In the mean time, is there an alternative?
推荐答案
Nemo.jl 是 Julia 中的代数包.它有很多功能,还应该允许计算空空间.一种方法是:
Nemo.jl is a package for algebra in Julia. It has a lot of functionality and should also allow to compute the null space. One way to go about it would be:
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
是空空间的维度,bmat
在其列中有一个基础.
After which d
is the dimension of the nullspace and bmat
has a basis in its columns.
希望这会有所帮助(我很高兴看到可能使用其他代数包的替代解决方案).
Hope this helps (I would be happy to see alternative solutions possibly using other algebra packages).
这篇关于整数矩阵的确切整数零空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!