shihao

Apache Commons Math 3.2 发布了,该版本要求 Java 5 的支持。包含众多新特性,详情请看发行说明

Commons Math 是 Apache 上一个轻量级自容器的数学和统计计算方法包,包含大多数常用的数值算法。

示例代码:

01 // Create a real matrix with two rows and three columns
02 double[][] matrixData = { {1d,2d,3d}, {2d,5d,3d}};
03 RealMatrix m = new Array2DRowRealMatrix(matrixData);
04  
05 // One more with three rows, two columns
06 double[][] matrixData2 = { {1d,2d}, {2d,5d}, {1d, 7d}};
07 RealMatrix n = new Array2DRowRealMatrix(matrixData2);
08  
09 // Note: The constructor copies  the input double[][] array.
10  
11 // Now multiply m by n
12 RealMatrix p = m.multiply(n);
13 System.out.println(p.getRowDimension());    // 2
14 System.out.println(p.getColumnDimension()); // 2
15  
16 // Invert p, using LU decomposition
17 RealMatrix pInverse = new LUDecompositionImpl(p).getSolver().getInverse();

分类:

技术点:

相关文章:

  • 2021-10-27
  • 2021-04-30
  • 2021-11-03
  • 2021-09-09
  • 2021-04-24
  • 2021-06-05
  • 2021-06-04
  • 2021-11-01
猜你喜欢
  • 2021-09-14
  • 2021-11-03
  • 2021-05-01
  • 2021-12-20
  • 2020-05-21
  • 2021-11-29
  • 2021-09-13
相关资源
相似解决方案