This is an automated email from the ASF dual-hosted git repository. aherbert pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/commons-math.git from ab9b0b0c2 Use a LinkedHashMap to respect the order of the input data new a97523700 Compare candidate to all list points new 870926d38 Disable PMD in legacy module new 979503619 Fix javadoc <p> tag The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: commons-math-legacy/pom.xml | 3 +++ .../optim/nonlinear/scalar/noderiv/SimplexOptimizer.java | 14 ++++++++++---- .../math4/legacy/stat/descriptive/SummaryStatistics.java | 4 ++-- 3 files changed, 15 insertions(+), 6 deletions(-)
This is an automated email from the ASF dual-hosted git repository. aherbert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-math.git commit 870926d389457a373c06b26e3b8f210a803a42d0 Author: Alex Herbert <ah...@apache.org> AuthorDate: Sat Oct 22 23:37:46 2022 +0100 Disable PMD in legacy module Currently the build reports 4629 PMD violations. --- commons-math-legacy/pom.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/commons-math-legacy/pom.xml b/commons-math-legacy/pom.xml index d8ab07ec1..25a96106b 100644 --- a/commons-math-legacy/pom.xml +++ b/commons-math-legacy/pom.xml @@ -41,6 +41,9 @@ <!-- Workaround to avoid duplicating config files. --> <math.parent.dir>${basedir}/..</math.parent.dir> <math.jira.component>legacy</math.jira.component> + + <!-- Disable PMD to reduce build verbosity. --> + <pmd.skip>true</pmd.skip> </properties> <dependencies>
This is an automated email from the ASF dual-hosted git repository. aherbert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-math.git commit a97523700aca6679244607c29f6f7841f2cdd56d Author: Alex Herbert <ah...@apache.org> AuthorDate: Sat Oct 22 23:24:24 2022 +0100 Compare candidate to all list points --- .../optim/nonlinear/scalar/noderiv/SimplexOptimizer.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java index 2a714b691..20d5eee8a 100644 --- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java +++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java @@ -386,6 +386,10 @@ public class SimplexOptimizer extends MultivariateOptimizer { * Stores the given {@code candidate} if its fitness is better than * that of the last (assumed to be the worst) point in {@code list}. * + * <p>If the list is below the maximum size then the {@code candidate} + * is added if it is not already in the list. The list is sorted + * when it reaches the maximum size. + * * @param candidate Point to be stored. * @param comp Fitness comparator. * @param list Starting points (modified in-place). @@ -406,12 +410,14 @@ public class SimplexOptimizer extends MultivariateOptimizer { if (Arrays.equals(pPoint, candidatePoint)) { // Point was already stored. return; - } else { - // Store candidate. - list.add(candidate); - return; } } + // Store candidate. + list.add(candidate); + // Sort the list when required + if (list.size() == max) { + Collections.sort(list, comp); + } } else { final int last = max - 1; if (comp.compare(candidate, list.get(last)) < 0) {
tag Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository. aherbert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-math.git commit 979503619139c06e11e0a1ebde0602694fa16a88 Author: Alex Herbert <ah...@apache.org> AuthorDate: Sat Oct 22 23:38:33 2022 +0100 Fix javadoc <p> tag --- .../commons/math4/legacy/stat/descriptive/SummaryStatistics.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/descriptive/SummaryStatistics.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/descriptive/SummaryStatistics.java index 9ed87a508..ff90ddf03 100644 --- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/descriptive/SummaryStatistics.java +++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/descriptive/SummaryStatistics.java @@ -316,8 +316,8 @@ public class SummaryStatistics implements StatisticalSummary { * among the values that have been added. * <p> * Returns <code>Double.NaN</code> if no data values have been added and - * returns <code>0</code> if there is just one value in the data set.</p> - * <p> + * returns <code>0</code> if there is just one value in the data set. + * </p> * @return second central moment statistic * @since 2.0 */