空空间二进制矩阵:Java [英] Null Space Binary Matrix : Java
问题描述
这是我的问题:如何计算二进制矩阵的内核?
要在Java中计算内核(或者你喜欢的Null空间),它是在Real Space中非常简单,已经有很多类,所以不需要再发明轮子,我们只需要使用它们!
double [] [] data = new double [3] [3];
// ...填充矩阵
SimpleMatrix m = new SimpleMatrix(data);
SimpleSVD svd = m.svd();
SimpleMatrix nullSpace = svd.nullSpace();
nullSpace.print();
问题是:全部这些课程只在Real领域工作,我需要在Z / 2Z(或者你喜欢的二进制空间)中进行,我不知道怎么做?
你知道Java中有什么好的API可以使用布尔矩阵吗?
或者你知道怎么做这个内核计算用布尔而不是真的...?
提前多多谢谢!
干杯!
二进制m-by-n矩阵A的内核被定义为二进制向量x的集合,使得Ax = 0。 / p>
空格上的加法是布尔XOR:0 + 0 = 1 + 1 = 0; 0 + 1 = 1 + 0 = 1.
空间上的乘法是布尔值AND:0 * 0 = 0 * 1 = 1 * 0 = 0; 1 * 1 = 1.
要计算A的内核基础,构造[A; I]然后执行基本列操作以获得[B; C]其中B是列梯形式。 B列零列下面的C列是内核基础。
此过程在此处有更详细的描述: http://en.wikipedia.org/wiki/Kernel_(matrix)#Basis 请注意,所描述的算法适用于二进制的情况,即使它没有在维基百科页面上提及。
如果你找到一个已经做到这一点的库,我会感到惊讶,这对于实现,所以我建议你自己编写代码,而不是寻找现有的解决方案。
Here is my question: How to calcul the Kernel of a Binary Matrix ??
To calcul the Kernel (or Null Space if you prefer) in Java, it's pretty simple in the Real Space, there is already a lot of classes, so don't need to invent the wheel again, we just have to use them !
double[][] data = new double[3][3];
// ... fill the Matrix
SimpleMatrix m = new SimpleMatrix(data);
SimpleSVD svd = m.svd();
SimpleMatrix nullSpace = svd.nullSpace();
nullSpace.print();
(Theses classes came from : http://efficient-java-matrix-library.googlecode.com/svn-history/r244/javadoc/ver0.14/org/ejml/data/package-summary.html )
The problem is : all theses classes work only in the Real space, and I need to do it in Z/2Z (or in the Binary space if you prefer) and I don't have the idea of how to do it ?
Do you know any good API in Java to work with Boolean Matrix ?
Or do you have any idea of how to do this kernel calcul with booleans and not real... ?
Thanks a lot in advance !
Cheers !
The kernel of binary m-by-n matrix A is defined to be the set of binary vectors x such that Ax = 0.
Addition on the space is Boolean XOR: 0 + 0 = 1 + 1 = 0; 0 + 1 = 1 + 0 = 1.
Multiplication on the space is Boolean AND: 0 * 0 = 0 * 1 = 1 * 0 = 0; 1 * 1 = 1.
To compute the kernel basis for A, construct [A; I] and then perform elementary column operations to obtain [B; C] where B is in column echelon form. The columns of C underneath zero-columns of B are the kernel basis.
The process is described in more detail here: http://en.wikipedia.org/wiki/Kernel_(matrix)#Basis Note that the described algorithm will work for the binary case as well, even though it is not mentioned on the Wikipedia page.
I'd be surprised if you find a library that already does this, and it's trivial to implement, so I advise just coding it up yourself rather than looking for an existing solution.
这篇关于空空间二进制矩阵:Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!