Apache Commons Math 3.5 发布,此版本是个小版本发布,主要是一些 bug 修复和新特性,现有特性的修改都向后兼容,允许替代 v3.4.1 JAR 文件。
值得关注的特性:DescriptiveStatistics SummaryStatistics 新增 getQuadraticMean 方法;还有大量的 bug 修复;最低要求 Java 5。强烈建议所有用户升级到最新版本!
请注意,这个版本标记弃用的大量的类和方法会在下一个重大版本 4.0 全部移除!
这是一个小更新版本,改进包括:
New features:
o Added a way to build polyhedrons sets from a list of vertices and
facets specified using vertices indices.
o Simplified “FastMath#exp(double)” in order to avoid a potential
Java 1.5 JIT bug when calling with negative infinity as argument. Issue: MATH-1198.
o Added method “getQuadraticMean()” to “DescriptiveStatistics”
and “SummaryStatistics” which calculates the root mean square. Issue: MATH-1199.
Fixed Bugs:
o Moved FastMathTestPerformance out of the main test tree, as is is
a benchmark rather than a test. Issue: MATH-1195.
o Fixed ignored method parameters in QRDecomposition protected methods. Issue: MATH-1191.
o Fixed wrong selection of line/polyhedron intersection point. Issue: MATH-1211. Thanks to Mike Zimmerman.
o Improved fix for corner cases in BSP-tree merging, when cut sub-hyperplanes vanish. Issue: MATH-1162.
o Fixed link to algorithm description in “PoissonDistribution#sample()”. Issue: MATH-1209. Thanks to Jonathan Ogilvie.
o EmpiricalDistribution cumulativeProbability can return NaN when evaluated within a constant bin. Issue: MATH-1208.
o EmpiricalDistribution getKernel fails for buckets with only multiple instances of the same value. Issue: MATH-1203.
o “UnivariateSolverUtils#bracket(…)” sometimes failed to bracket
if a reached the lower bound. Issue: MATH-1204.
Changes:
o Added Laguerre complex solve methods taking maxEval parameters. Issue: MATH-1213.
完整改进请看发行说明:
http://www.apache.org/dist/commons/math/RELEASE-NOTES.txt
下载:
http://commons.apache.org/proper/commons-math/download_math.cgi
Commons Math 是 Apache 上一个轻量级自容器的数学和统计计算方法包,包含大多数常用的数值算法。
示例代码:
// Create a real matrix with two rows and three columns
double[][] matrixData = { {1d,2d,3d}, {2d,5d,3d}};
RealMatrix m = new Array2DRowRealMatrix(matrixData);
// One more with three rows, two columns
double[][] matrixData2 = { {1d,2d}, {2d,5d}, {1d, 7d}};
RealMatrix n = new Array2DRowRealMatrix(matrixData2);
// Note: The constructor copies the input double[][] array.
// Now multiply m by n
RealMatrix p = m.multiply(n);
System.out.println(p.getRowDimension()); // 2
System.out.println(p.getColumnDimension()); // 2
// Invert p, using LU decomposition
RealMatrix pInverse = new LUDecompositionImpl(p).getSolver().getInverse();