![](/img/trans.png)
[英]How to find the inverse of a matrix using Apache Commons Math library in Java?
[英]Constructing zero matrix in apache commons library in java
我一直在通過apache通用核心數學庫的文檔進行搜索以尋找該答案,但是還沒有找到答案。.http ://commons.apache.org/proper/commons-math/apidocs/org/apache/ commons / math4 / linear / RealMatrix.html
我們如何構造或初始化具有默認值的矩陣。
所以,我知道我們可以做到這一點
RealMatrix X = new BlockRealMatrix(numRows, numCols);
or
double[][] matrixData = { {1d,2d,3d}, {2d,5d,3d}};
RealMatrix m = MatrixUtils.createRealMatrix(matrixData);
但是,我該如何構造一個矩陣並將其初始化為所有(例如)2 ..(在我的情況下為0),而不是顯式創建double[][]
謝謝
沒有一種方法可以將所有值設置為某個默認值。 為了初始化矩陣,可以使用各種方法,所有這些方法都需要遍歷維度。 setColumn
和setRow
允許設置整個列或行的值,該值可能接近所搜索的值。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.