You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2021/06/03 17:32:41 UTC

[commons-math] branch master updated (7ef0099 -> 8f39a41)

This is an automated email from the ASF dual-hosted git repository.

erans pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git.


    from 7ef0099  Adapt to new API ("Commons Numbers").
     new 1b7f10e  Moved "ComplexFormat" class to "util" package.
     new 076fe24  Draft of release notes.
     new 8f39a41  MATH-1599: Class removed (out-of-scope).

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/math4/legacy/complex/package-info.java |  22 ----
 .../legacy/random/SynchronizedRandomGenerator.java | 134 ---------------------
 .../legacy/{complex => util}/ComplexFormat.java    |   2 +-
 .../org/apache/commons/math4/legacy/TestUtils.java |   7 +-
 .../random/SynchronizedRandomGeneratorTest.java    | 120 ------------------
 .../ComplexFormatAbstractTest.java                 |   2 +-
 .../{complex => util}/ComplexFormatTest.java       |   2 +-
 .../{complex => util}/FrenchComplexFormatTest.java |   2 +-
 src/changes/changes.xml                            |   9 +-
 9 files changed, 16 insertions(+), 284 deletions(-)
 delete mode 100644 commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/complex/package-info.java
 delete mode 100644 commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/random/SynchronizedRandomGenerator.java
 rename commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/{complex => util}/ComplexFormat.java (99%)
 delete mode 100644 commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/random/SynchronizedRandomGeneratorTest.java
 rename commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/{complex => util}/ComplexFormatAbstractTest.java (99%)
 rename commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/{complex => util}/ComplexFormatTest.java (95%)
 rename commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/{complex => util}/FrenchComplexFormatTest.java (95%)

[commons-math] 01/03: Moved "ComplexFormat" class to "util" package.

Posted by er...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git

commit 1b7f10eed7ad4548b85e1449686206332ab4a78c
Author: Gilles Sadowski <gi...@gmail.com>
AuthorDate: Thu Jun 3 18:42:58 2021 +0200

    Moved "ComplexFormat" class to "util" package.
---
 .../commons/math4/legacy/complex/package-info.java | 22 ----------------------
 .../legacy/{complex => util}/ComplexFormat.java    |  2 +-
 .../org/apache/commons/math4/legacy/TestUtils.java |  7 ++++---
 .../ComplexFormatAbstractTest.java                 |  2 +-
 .../{complex => util}/ComplexFormatTest.java       |  2 +-
 .../{complex => util}/FrenchComplexFormatTest.java |  2 +-
 6 files changed, 8 insertions(+), 29 deletions(-)

diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/complex/package-info.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/complex/package-info.java
deleted file mode 100644
index 72fd1f8..0000000
--- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/complex/package-info.java
+++ /dev/null
@@ -1,22 +0,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
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Complex number type implementations have been moved to
- * <a href="http://commons.apache.org/numbers">Commons Numbers</a>.
- */
-package org.apache.commons.math4.legacy.complex;
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/complex/ComplexFormat.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/util/ComplexFormat.java
similarity index 99%
rename from commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/complex/ComplexFormat.java
rename to commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/util/ComplexFormat.java
index 66334ed..3098a5e 100644
--- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/complex/ComplexFormat.java
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/util/ComplexFormat.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math4.legacy.complex;
+package org.apache.commons.math4.legacy.util;
 
 import java.text.FieldPosition;
 import java.text.NumberFormat;
diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/TestUtils.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/TestUtils.java
index 03bffb1..6465482 100644
--- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/TestUtils.java
+++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/TestUtils.java
@@ -23,17 +23,18 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.text.DecimalFormat;
 
+import org.junit.Assert;
+
 import org.apache.commons.numbers.complex.Complex;
 import org.apache.commons.numbers.core.Precision;
 import org.apache.commons.statistics.distribution.ContinuousDistribution;
 import org.apache.commons.math4.legacy.core.FieldElement;
-import org.apache.commons.math4.legacy.complex.ComplexFormat;
+import org.apache.commons.math4.legacy.core.jdkmath.AccurateMath;
+import org.apache.commons.math4.legacy.util.ComplexFormat;
 import org.apache.commons.math4.legacy.linear.FieldMatrix;
 import org.apache.commons.math4.legacy.linear.RealMatrix;
 import org.apache.commons.math4.legacy.linear.RealVector;
 import org.apache.commons.math4.legacy.stat.inference.ChiSquareTest;
-import org.apache.commons.math4.legacy.core.jdkmath.AccurateMath;
-import org.junit.Assert;
 
 /**
  */
diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/complex/ComplexFormatAbstractTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/util/ComplexFormatAbstractTest.java
similarity index 99%
rename from commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/complex/ComplexFormatAbstractTest.java
rename to commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/util/ComplexFormatAbstractTest.java
index 3ffc5d6..6504160 100644
--- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/complex/ComplexFormatAbstractTest.java
+++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/util/ComplexFormatAbstractTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math4.legacy.complex;
+package org.apache.commons.math4.legacy.util;
 
 import java.text.FieldPosition;
 import java.text.NumberFormat;
diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/complex/ComplexFormatTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/util/ComplexFormatTest.java
similarity index 95%
rename from commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/complex/ComplexFormatTest.java
rename to commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/util/ComplexFormatTest.java
index cf880d2..9af9741 100644
--- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/complex/ComplexFormatTest.java
+++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/util/ComplexFormatTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math4.legacy.complex;
+package org.apache.commons.math4.legacy.util;
 
 import java.util.Locale;
 
diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/complex/FrenchComplexFormatTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/util/FrenchComplexFormatTest.java
similarity index 95%
rename from commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/complex/FrenchComplexFormatTest.java
rename to commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/util/FrenchComplexFormatTest.java
index 08c7bb9..9aa3afd 100644
--- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/complex/FrenchComplexFormatTest.java
+++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/util/FrenchComplexFormatTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math4.legacy.complex;
+package org.apache.commons.math4.legacy.util;
 
 import java.util.Locale;
 

[commons-math] 02/03: Draft of release notes.

Posted by er...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git

commit 076fe24409fb17c9b9eb640dc25ac5d007459162
Author: Gilles Sadowski <gi...@gmail.com>
AuthorDate: Thu Jun 3 19:12:44 2021 +0200

    Draft of release notes.
---
 src/changes/changes.xml | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 68f4c05..b4b1900 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -67,7 +67,7 @@ Functionality still within Commons Math has been modularized and
  partly refactored.
  This is a work-in-progress (help welcome).
  Codes for which the refactoring has not been undertaken (or was
- deemed incomplete) have been moved to a 'legacy' module.
+ deemed incomplete) have been moved to 'legacy' modules.
 
 The minimum version of the Java platform required to compile and use
  Commons Math is Java 8.
@@ -77,6 +77,13 @@ Users are encouraged to upgrade to this version, and to the new
  Note that the new artefacts can be used together with v3.6.1 as the
  Java packages are different; ugrading can thus be performed
  incrementally.
+For codes that are now located in the 'commons-math-legacy' module,
+ upgrading will be a matter of changing the top-level package name:
+ From 'org.apache.commons.math3' to 'org.apache.commons.math4.legacy'.
+ Codes that are now located in the 'commons-math-legacy-core' module
+ comprise classes that moved from package 'org.apache.commons.math3'
+ and package 'org.apache.commons.math3.util' (e.g. 'MathArrays') over
+ to package 'org.apache.commons.math4.legacy.core'.
 
 Caveat:
  Although hundreds of issues have been fixed (see 'git log' and the

[commons-math] 03/03: MATH-1599: Class removed (out-of-scope).

Posted by er...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git

commit 8f39a414c112fe1ca59b1aa8b4b45485b04d74b8
Author: Gilles Sadowski <gi...@gmail.com>
AuthorDate: Thu Jun 3 19:29:40 2021 +0200

    MATH-1599: Class removed (out-of-scope).
---
 .../legacy/random/SynchronizedRandomGenerator.java | 134 ---------------------
 .../random/SynchronizedRandomGeneratorTest.java    | 120 ------------------
 2 files changed, 254 deletions(-)

diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/random/SynchronizedRandomGenerator.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/random/SynchronizedRandomGenerator.java
deleted file mode 100644
index a364f8a..0000000
--- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/random/SynchronizedRandomGenerator.java
+++ /dev/null
@@ -1,134 +0,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
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.legacy.random;
-
-/**
- * Any {@link RandomGenerator} implementation can be thread-safe if it
- * is used through an instance of this class.
- * This is achieved by enclosing calls to the methods of the actual
- * generator inside the overridden {@code synchronized} methods of this
- * class.
- *
- * @since 3.1
- * @deprecated As of 4.0. No replacement.
- */
-@Deprecated
-public class SynchronizedRandomGenerator implements RandomGenerator {
-    /** Object to which all calls will be delegated. */
-    private final RandomGenerator wrapped;
-
-    /**
-     * Creates a synchronized wrapper for the given {@code RandomGenerator}
-     * instance.
-     *
-     * @param rng Generator whose methods will be called through
-     * their corresponding overridden synchronized version.
-     * To ensure thread-safety, the wrapped generator <em>must</em>
-     * not be used directly.
-     */
-    public SynchronizedRandomGenerator(RandomGenerator rng) {
-        wrapped = rng;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public synchronized void setSeed(int seed) {
-        wrapped.setSeed(seed);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public synchronized void setSeed(int[] seed) {
-        wrapped.setSeed(seed);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public synchronized void setSeed(long seed) {
-        wrapped.setSeed(seed);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public synchronized void nextBytes(byte[] bytes) {
-        wrapped.nextBytes(bytes);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public synchronized int nextInt() {
-        return wrapped.nextInt();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public synchronized int nextInt(int n) {
-        return wrapped.nextInt(n);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public synchronized long nextLong() {
-        return wrapped.nextLong();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public synchronized boolean nextBoolean() {
-        return wrapped.nextBoolean();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public synchronized float nextFloat() {
-        return wrapped.nextFloat();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public synchronized double nextDouble() {
-        return wrapped.nextDouble();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public synchronized double nextGaussian() {
-        return wrapped.nextGaussian();
-    }
-}
diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/random/SynchronizedRandomGeneratorTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/random/SynchronizedRandomGeneratorTest.java
deleted file mode 100644
index 6c56da8..0000000
--- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/random/SynchronizedRandomGeneratorTest.java
+++ /dev/null
@@ -1,120 +0,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
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.legacy.random;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-
-import org.apache.commons.rng.simple.RandomSource;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class SynchronizedRandomGeneratorTest {
-    private final int numberOfThreads = 5;
-    private final int numberOfGenerators = 5;
-    private final int numberOfSamples = 100000;
-
-    @Test
-    public void testAdapter() {
-        final int seed = 12345;
-        final RandomGenerator orig = new RngAdaptor(RandomSource.MT, seed);
-        final RandomGenerator wrap
-            = new SynchronizedRandomGenerator(new RngAdaptor(RandomSource.MT, seed));
-
-        final int bSize = 67;
-        final byte[] bOrig = new byte[bSize];
-        final byte[] bWrap = new byte[bSize];
-
-        for (int i = 0; i < 100; i++) {
-            orig.nextBytes(bOrig);
-            wrap.nextBytes(bWrap);
-            for (int k = 0; k < bSize; k++) {
-                Assert.assertEquals(bOrig[k], bWrap[k]);
-            }
-
-            Assert.assertEquals(orig.nextInt(), wrap.nextInt());
-
-            final int range = (i + 1) * 89;
-            Assert.assertEquals(orig.nextInt(range), wrap.nextInt(range));
-
-            Assert.assertEquals(orig.nextLong(), wrap.nextLong());
-            Assert.assertEquals(orig.nextBoolean(), wrap.nextBoolean());
-            Assert.assertEquals(orig.nextFloat(), wrap.nextFloat(), 0);
-            Assert.assertEquals(orig.nextDouble(), wrap.nextDouble(), 0);
-            Assert.assertEquals(orig.nextGaussian(), wrap.nextGaussian(), 0);
-
-        }
-    }
-
-    @Test
-    public void testMath899Sync() throws Throwable {
-        try {
-            // Running the test several times in order to decrease the
-            // probability that a non-thread-safe code did not trigger
-            // a concurrency problem.
-            for (int i = 0; i < 10; i++) {
-                doTestMath899(true, numberOfThreads, numberOfGenerators, numberOfSamples);
-            }
-        } catch (InterruptedException e) {
-            Assert.fail(e.getMessage());
-        } catch (ExecutionException e) {
-            throw e.getCause();
-        }
-    }
-
-    /**
-     * @param sync Whether to use a synchronizing wrapper.
-     */
-    private double[] doTestMath899(final boolean sync,
-                                   final int numThreads,
-                                   final int numGenerators,
-                                   final int numSamples)
-        throws InterruptedException,
-               ExecutionException {
-        final RandomGenerator rng = new RngAdaptor(RandomSource.MT);
-        final RandomGenerator wrapper = sync ? new SynchronizedRandomGenerator(rng) : rng;
-
-        final List<Callable<Double>> tasks = new ArrayList<>();
-        for (int i = 0; i < numGenerators; i++) {
-            tasks.add(new Callable<Double>() {
-                    @Override
-                    public Double call() {
-                        Double lastValue = 0d;
-                        for (int j = 0; j < numSamples; j++) {
-                            lastValue = wrapper.nextGaussian();
-                        }
-                        return lastValue;
-                    }
-                });
-        }
-
-        final ExecutorService exec = Executors.newFixedThreadPool(numThreads);
-        final List<Future<Double>> results = exec.invokeAll(tasks);
-
-        final double[] values = new double[numGenerators];
-        for (int i = 0; i < numGenerators; i++) {
-            values[i] = results.get(i).get();
-        }
-        exec.shutdown();
-        return values;
-    }
-}