2014-03-28 114 views

回答

0

你應該看看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))。 –

0

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

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);