整数矩阵的确切整数空空间? [英] 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屋!