Commit 3ed8e071 authored by Emmanuel Bourg's avatar Emmanuel Bourg

Merge tag 'upstream/3.6'

Upstream version 3.6
parents 0f658e50 ce59910f
Apache Commons Math
Copyright 2001-2015 The Apache Software Foundation
Copyright 2001-2016 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (
The Apache Commons Math team is pleased to announce the commons-math3-3.5 release!
The Apache Commons Math team is pleased to announce the commons-math3-3.6 release!
The Apache Commons Math project is a library of lightweight, self-contained mathematics
and statistics components addressing the most common practical problems not immediately
......@@ -7,27 +7,108 @@ available in the Java programming language or commons-lang.
Changes in this version include:
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.
o Added a RotationConvention enumerate to allow specifying the semantics
or axis/angle for rotations. This enumerate has two values:
o Added a field-based version of Ordinary Differential Equations framework.
This allows integrating ode that refer to RealField elements instead of
primitive double, hence opening the way to use DerivativeStructure to
compute partial differential without using variational equations, or to solve
ode with extended precision using Dfp. Issue: MATH-1288.
o Added a nth order Brent solver for general real fields, replacing the former
solver that was restricted to Dfp fields only.
o New "Range" inner class of "o.a.c.m.util.IntegerSequence". Issue: MATH-1286.
o "AggregateSummaryStatistics" can now aggregate any kind of
"StatisticalSummary". Issue: MATH-837.
o Deep copy of "Network" (package "") to allow evaluation of
of intermediate states during training. Issue: MATH-1278.
o Added negative zero support in FastMath.pow. Issue: MATH-1273. Thanks to Qualtagh.
o Various SOFM visualizations (in package ""):
Unified distance matrix, hit histogram, smoothed data histograms,
topographic error, quantization error. Issue: MATH-1270.
o New interfaces to be implemented by algorithms that visualizes properties
of a "NeuronSquareMesh2D" (package ""). Issue: MATH-1268.
o Reimplemented pow(double, double) in FastMath, for better accuracy in
integral power cases and trying to fix erroneous JIT optimization again.
o Added a pow(double, long) method in FastMath.
o "NeuronSquareMesh2D" (package "") implements "Iterable". Issue: MATH-1265.
o "MapUtils" (package ""): Method to sort units according to distance
from a given vector. Issue: MATH-1264.
o Accessor (class ""). Issue: MATH-1263.
o New "IntegerSequence" class (in package "o.a.c.m.util") with "Incrementor" inner class. Issue: MATH-1259.
o "Neuron" class (package ""): added methods that can be used
to assess concurrency performance. Issue: MATH-1250.
o Method "cosAngle" in "o.a.c.m.util.MathArrays". Issue: MATH-1244.
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.
o Improved performance and accuracy of 2-sample KolmogorovSmirnov tests. Issue: MATH-1310.
o Detect start failures with multi-step ODE integrators. Issue: MATH-1297.
o Fixed stability issues with Adams-Bashforth and Adams-Moulton ODE integrators.
The integrators did not estimate the local error properly and were sometimes
stuck attempting to reduce indefinitely the step size as they thought the
error was too high. Thanks to Julien Queyrel.
o Increased default value for number of allowed evaluations in
"o.a.c.m.optim.univariate.BracketFinder". Issue: MATH-1295. Thanks to Luke Lindsay.
o Fixed potential race condition in PolynomialUtils#buildPolynomial in
case polynomials are generated from multiple threads. Furthermore, the
synchronization is now performed on the coefficient list instead of the class. Issue: MATH-1294. Thanks to Kamil Włodarczyk.
o Fixed FastMath.exp that potentially returned NaN for non-NaN argument. Issue: MATH-1269.
o Updated reference in ZipfDistribution's javadoc. Issue: MATH-1285. Thanks to Pim van der Hoorn.
o Fixed "Gamma#gamma(double)" for negative values smaller than -20. Issue: MATH-1283. Thanks to Jean Noel Delavalade.
o Fixed javadoc of methods {floorDiv,floorMod} in class "FastMath". Issue: MATH-1237. Thanks to Ken Williams.
o Check precondition (class "o.a.c.m.random.EmpiricalDistribution"). Issue: MATH-1279.
o Fixed incorrect Kendall's tau coefficient calculation due to internal integer overflow. Issue: MATH-1277. Thanks to Marc Rosen.
o Fixed split/side inconsistencies in BSP trees. Issue: MATH-1266.
o Avoid overflow in "Fraction" (multiplication or division by an int). Issue: MATH-1261. Thanks to Osamu Ikeuchi.
o Added check for equal array lengths to distance measure functions. Issue: MATH-1258. Thanks to Gunel Jahangirova.
o Better accuracy in computation of cumulative probability of "NormalDistribution"
(package "o.a.c.m.distribution"). Issue: MATH-1257. Thanks to Bill Murphy.
o Boundary check to construct an "Interval" (package "o.a.c.m.geometry.euclidean.oned"). Issue: MATH-1256.
o Wrong neighbourhood size in class "KohonenUpdateAction" (package ""). Issue: MATH-1255.
o ResizableDoubleArray constructor does not work with double array of size 1. Issue: MATH-1252. Thanks to John Bay.
o Fixed initial value of "number of calls" counter in class "KohonenUpdateAction"
(package ""). Issue: MATH-1251.
o Removed unnecessary allocations in "BigFraction" (package "o.a.c.m.fraction"). Issue: MATH-1248. Thanks to Chris Popp.
o Fixed error in computing discrete distribution of D statistics for small-sample
2-sample Kolmogorov-Smirnov tests. Error was causing incorrect p-values returned
by exactP and monteCarloP methods (used by default for small, mid-size samples). Issue: MATH-1245.
o "KolmogorovSmirnovTest#ksSum(...)" returned wrong result in case the provided
t-parameters was zero. This affected the calculation of "approximateP(...)" for
identical samples. Issue: MATH-1240.
o Improved performance to calculate the two-sample Kolmogorov-Smirnov test
via monte carlo simulation ("KolmogorovSmirnovTets#monteCarloP(...)"). Issue: MATH-1242. Thanks to Otmar Ertl.
o A "StackOverflowException" was thrown when passing Double.NaN or infinity
to "Gamma#digamma(double)" or "Gamma#trigamma(double)". Now the input value
is propagated to the output if it is not a real number. Issue: MATH-1241. Thanks to Aleksei Dievskii.
o Improved performance of calculating the two-sample Kolmogorov-Smirnov
test statistic. Issue: MATH-1232. Thanks to Otmar Ertl.
o Fixed error message for unknown parameter name in ODE. Issue: MATH-1232.
o Fixed wrong event detection in case of close events pairs. Issue: MATH-1226.
o Fix potential branching errors in "FastMath#pow(double, double)" when
passing special values, i.e. infinity, due to erroneous JIT optimization.
o Fixed equals/hashcode contract failure for Dfp. Issue: MATH-1118.
o Fixed wrong splitting of huge number in extended accuracy algorithms. Issue: MATH-1223.
o Improve performance of "BetaDistribution#sample()" by using Cheng's algorithm. Issue: MATH-1153. Thanks to Sergei Lebedev.
o Computation of 2-sample Kolmogorov-Smirnov statistic in case of ties
was not correct. Issue: MATH-1197.
o Added Laguerre complex solve methods taking maxEval parameters. Issue: MATH-1213.
o Modified 2-sample KolmogorovSmirnovTest to handle ties in sample data. By default,
ties are broken by adding random jitter to input data. Also added bootstrap method
analogous to ks.boot in R Matching package. Issue: MATH-1246.
o Added bootstrap method to KolmogorovSmirnov test. Issue: MATH-1246.
o Added constructors taking sample data as arguments to enumerated real and integer distributions. Issue: MATH-1287.
o Improved performance of sampling and inverse cumulative probability calculation
for geometric distributions. Issue: MATH-1276.
o Representation of Kolmogorov-Smirnov statistic as integral value. Issue: MATH-1274.
o Faster generation of Zipf distributed random numbers by using rejection-inversion sampling. Issue: MATH-1220.
o Improved performance of sort-in-place methods by avoiding boxing. Issue: MATH-990.
o Refactored implementation of the "miscrosphere projection"
interpolation algorithm.
New classes: "MicrosphereProjectionInterpolator",
"InterpolatingMicrosphere" and "InterpolatingMicrosphere2D"
replace "MicrosphereInterpolator" and "MicrosphereInterpolatingFunction".
(package "o.a.c.m.analysis.interpolation"). Issue: MATH-1243.
Have fun!
......@@ -30,12 +30,12 @@
<!-- ========== External Dependencies ===================================== -->
<property name="repository" value = "${user.home}/.m2/repository"/>
<!-- Junit -->
<property name="junit.version" value="4.8.2"/>
<property name="junit.home" value="/usr/share/junit"/>
<property name="junit.jar" value="${junit.home}/junit-${junit.version}.jar"/>
<property name="junit.version" value="4.11"/>
<property name="junit.jar" value="$junit-{junit.version}.jar"/>
<property name="hamcrest.jar" value="hamcrest-core-1.3.jar"/>
<!-- ========== Component Declarations ==================================== -->
......@@ -50,7 +50,7 @@
<property name="component.title" value="Commons MATH"/>
<!-- The current version number of this component -->
<property name="component.version" value="3.5"/>
<property name="component.version" value="3.6"/>
<!-- The base directory for component sources -->
<property name="source.home" value="src/main/java"/>
......@@ -111,6 +111,7 @@
<!-- External dependency classpath -->
<path id="downloaded.lib.classpath">
<pathelement location="${download.lib.dir}/junit-${junit.version}.jar"/>
<pathelement location="${download.lib.dir}/${hamcrest.jar}"/>
<!-- ========== Test Execution Defaults =================================== -->
......@@ -121,6 +122,7 @@
<pathelement location="${build.home}/classes"/>
<pathelement location="${build.home}/test-classes"/>
<pathelement location="${junit.jar}"/>
<pathelement location="${hamcrest.jar}"/>
<path refid="downloaded.lib.classpath"/>
......@@ -247,7 +249,7 @@
bottom="Copyright (c) 2003-${current.year} Apache Software Foundation"
additionalparam="-header &apos;&lt;script type=&quot;text/javascript&quot; src=&quot;;&gt;&lt;/script&gt;&apos;"
<link href=""/>
<link href=""/>
......@@ -343,9 +345,10 @@
<!-- ========== Download Dependencies =========================================== -->
<target name="download-dependencies"
depends="check-availability" unless="">
depends="check-availability" unless="">
<echo message="doing download-dependencies..." />
<antcall target="download-junit" />
<antcall target="download-hamcrest" />
<target name="check-availability">
......@@ -360,6 +363,14 @@
usetimestamp="true" ignoreerrors="true"
<target name="download-hamcrest" unless="hamcrest.found">
<echo message="Downloading hamcrest..."/>
<mkdir dir="${download.lib.dir}" />
<get dest="${download.lib.dir}/${hamcrest.jar}"
usetimestamp="true" ignoreerrors="true"
......@@ -25,8 +25,6 @@
<module name="TreeWalker">
<property name="cacheFile" value="target/checkstyle-cachefile"/>
<!-- Operator must be at end of wrapped line -->
<module name="OperatorWrap">
<property name="option" value="eol"/>
......@@ -45,14 +43,9 @@
<module name="JavadocMethod">
<property name="allowUndeclaredRTE" value="true"/>
<property name="allowThrowsTagsForSubclasses" value="true"/>
<property name="validateThrows" value="false"/>
<!-- Allow declaration of detailed exception set -->
<module name="RedundantThrows">
<property name="allowUnchecked" value="true"/>
<property name="allowSubclasses" value="true"/>
<!-- Require field javadoc -->
<module name="JavadocVariable"/>
......@@ -193,6 +186,11 @@
<property name="onCommentFormat" value="CHECKSTYLE\: resume DeclarationOrder"/>
<property name="checkFormat" value="DeclarationOrder"/>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE\: stop RedundantModifier"/>
<property name="onCommentFormat" value="CHECKSTYLE\: resume RedundantModifier"/>
<property name="checkFormat" value="RedundantModifier"/>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE\: stop all"/>
<property name="onCommentFormat" value="CHECKSTYLE\: resume all"/>
......@@ -23,6 +23,13 @@
<!-- the following field is unused but cannot be suppressed as it is protected -->
<!-- and some user class may require it -->
<Class name="org.apache.commons.math3.analysis.integration.BaseAbstractUnivariateIntegrator" />
<!-- the following equality tests are part of the reference algorithms -->
<!-- which already know about limited precision of the double numbers -->
......@@ -163,6 +170,21 @@
<Bug pattern="DLS_DEAD_LOCAL_STORE" />
<!-- Spurious: Findbugs confused by FastMath.PI - 1.0e-10 -->
<Class name="org.apache.commons.math3.geometry.euclidean.threed.Plane" />
<Method name="isSimilarTo" params="org.apache.commons.math3.geometry.euclidean.threed.Plane" returns="boolean" />
<!-- Spurious: Findbugs confused by constant 1.570796251296997 which is a
intentionally slightly offset from PI/2 as per Cody Waite arguments reduction -->
<Class name="org.apache.commons.math3.util.FastMath$CodyWaite" />
<Method name="&lt;init>" params="double" returns="void" />
<!-- the following expositions of internal representation are intentional and documented -->
<Class name="org.apache.commons.math3.stat.regression.RegressionResults"/>
<?xml version="1.0"?>
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
<ruleset name="commons-math-customized"
This ruleset checks the code for discouraged programming constructs.
<rule ref="rulesets/java/basic.xml"/>
<rule ref="rulesets/java/braces.xml"/>
<rule ref="rulesets/java/comments.xml">
<exclude name="CommentSize"/>
<rule ref="rulesets/java/comments.xml/CommentSize">
<property name="maxLines" value="200"/>
<property name="maxLineLength" value="256"/>
<rule ref="rulesets/java/empty.xml"/>
<rule ref="rulesets/java/finalizers.xml"/>
<rule ref="rulesets/java/imports.xml"/>
<rule ref="rulesets/java/typeresolution.xml">
<!-- TODO: we should reactivate this rule -->
<exclude name="CloneMethodMustImplementCloneable"/>
<!-- TODO: we should reactivate this ruleset -->
<!-- <rule ref="rulesets/java/clone.xml"/> -->
<rule ref="rulesets/java/unnecessary.xml">
<!-- In many places in Apache Commons Math, there are complex boolean expressions.
We do use extra parentheses there as most people do not recall operator precedence,
this means even if the parentheses are useless for the compiler, we don't consider
them useless for the developer. This is the reason why we disable this rule. -->
<exclude name="UselessParentheses"/>
<!-- At several places in the optimization package, we set up public "optimize" methods
that simply call their base class optimize method. This is intentional and allows
to update the javadoc and make sure the additional parameters implemented at the
lower class level are properly documented. These new parameters are really taken
into accound despite we merely call super.optimize because the top level optimze
methods call a protected parseOptimizationData method implemented in the specialized
class. This is the reason why we disable this rule. -->
<exclude name="UselessOverridingMethod"/>
......@@ -19,12 +19,12 @@
<name>Apache Commons Math</name>
......@@ -82,6 +82,11 @@
<email>rdonkin at apache dot org</email>
<name>Otmar Ertl</name>
<email>oertl at apache dot org</email>
<name>Luc Maisonobe</name>
......@@ -251,6 +256,9 @@
<name>Piotr Kochanski</name>
<name>Sergei Lebedev</name>
<name>Bob MacCallum</name>
......@@ -344,6 +352,9 @@
<name>Xiaogang Zhang</name>
<name>Chris Popp</name>
......@@ -363,9 +374,9 @@
<!-- This value must reflect the current name of the base package. -->
<!-- do not use snapshot suffix here -->
<commons.release.desc>(requires Java 1.5+)</commons.release.desc>
......@@ -379,13 +390,13 @@
<!-- Temporary fix to support Java 8 -->