发现使用EJML.jar

问题描述:

任何一个可以帮助我一个矩阵的逆拿到代码中查找使用EJML.jar发现使用EJML.jar

此链接https://code.google.com/p/efficient-java-matrix-library/downloads/list 包含这个文件的源代码矩阵的逆:ejml -0.24-src.zip 希望这个作品!

+0

今天,你可以找到在Github上的源代码:[https://github.com/lessthanoptimal/ejml](https://github.com/ lessthanoptimal/ejml) –

你应该看看API文档。你可以在以下link找到所有的功能和类。下面的代码将(内部)将矩阵转换为其反值。

Random rand = new Random(); 

DenseMatrix64F a = RandomMatrices.createRandom(4,4, -1, 1, rand); 

// where 4,4 is the matrix size and -1,1 the range where rand has to get 
// the random values to populate it. 

invert(a); 

//The inverse gets stored in a 

我希望它能解决您的问题。

+0

'''CCommonOps.invert(CDenseMatrix64F A)'''([Source](https://github.com/lessthanoptimal/ejml/blob/master/main/denseC64/src/org/ejml/ops) /CCommonOps.java#L499-509))如果可以反转矩阵则返回true,否则返回false。 –

+0

根据我的理解,'invert(a);'确实返回一个布尔值。但是,我认为它代表了反演是否成功完成。在可能的情况下,矩阵'a'仍然反转;否则,返回'false'布尔值。 ([来源](http://ejml.org/javadoc/org/ejml/ops/CCommonOps.html))。 –

今天,你可以使用下面的代码:

double data[][] = new double[][]{ 
     { 90, 60, 90 }, 
     { 90, 90, 30 }, 
     { 60, 60, 60 } 
}; 

SimpleMatrix m = new SimpleMatrix(data); 
SimpleMatrix inverted = m.invert(); 

System.out.println(inverted);