MATH-1443: Depend on "Commons Statistics".
This commit is contained in:
parent
b2d4b2ac3a
commit
06bc5ac61a
|
@ -20,8 +20,8 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.apache.commons.math4.analysis.UnivariateFunction;
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.math4.distribution.UniformRealDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.statistics.distribution.UniformContinuousDistribution;
|
||||
import org.apache.commons.math4.exception.DimensionMismatchException;
|
||||
import org.apache.commons.math4.exception.NonMonotonicSequenceException;
|
||||
import org.apache.commons.math4.exception.NullArgumentException;
|
||||
|
@ -214,8 +214,8 @@ public class AkimaSplineInterpolatorTest
|
|||
}
|
||||
|
||||
final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 1234567L); // "tol" depends on the seed.
|
||||
final RealDistribution.Sampler distX =
|
||||
new UniformRealDistribution(xValues[0], xValues[xValues.length - 1]).createSampler(rng);
|
||||
final ContinuousDistribution.Sampler distX =
|
||||
new UniformContinuousDistribution(xValues[0], xValues[xValues.length - 1]).createSampler(rng);
|
||||
|
||||
double sumError = 0;
|
||||
for ( int i = 0; i < numberOfSamples; i++ )
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
package org.apache.commons.math4.analysis.interpolation;
|
||||
|
||||
import org.apache.commons.math4.analysis.BivariateFunction;
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.math4.distribution.UniformRealDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.statistics.distribution.UniformContinuousDistribution;
|
||||
import org.apache.commons.math4.exception.DimensionMismatchException;
|
||||
import org.apache.commons.math4.exception.MathIllegalArgumentException;
|
||||
import org.apache.commons.math4.exception.OutOfRangeException;
|
||||
|
@ -362,8 +362,8 @@ public final class BicubicInterpolatingFunctionTest {
|
|||
}
|
||||
|
||||
final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 1234567L);
|
||||
final RealDistribution.Sampler distX = new UniformRealDistribution(xValues[0], xValues[xValues.length - 1]).createSampler(rng);
|
||||
final RealDistribution.Sampler distY = new UniformRealDistribution(yValues[0], yValues[yValues.length - 1]).createSampler(rng);
|
||||
final ContinuousDistribution.Sampler distX = new UniformContinuousDistribution(xValues[0], xValues[xValues.length - 1]).createSampler(rng);
|
||||
final ContinuousDistribution.Sampler distY = new UniformContinuousDistribution(yValues[0], yValues[yValues.length - 1]).createSampler(rng);
|
||||
|
||||
double sumError = 0;
|
||||
for (int i = 0; i < numberOfSamples; i++) {
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
package org.apache.commons.math4.analysis.interpolation;
|
||||
|
||||
import org.apache.commons.math4.analysis.BivariateFunction;
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.math4.distribution.UniformRealDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.statistics.distribution.UniformContinuousDistribution;
|
||||
import org.apache.commons.math4.exception.DimensionMismatchException;
|
||||
import org.apache.commons.math4.exception.MathIllegalArgumentException;
|
||||
import org.apache.commons.rng.UniformRandomProvider;
|
||||
|
@ -148,8 +148,8 @@ public final class BicubicInterpolatorTest {
|
|||
double x, y;
|
||||
|
||||
final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C);
|
||||
final RealDistribution.Sampler distX = new UniformRealDistribution(xval[0], xval[xval.length - 1]).createSampler(rng);
|
||||
final RealDistribution.Sampler distY = new UniformRealDistribution(yval[0], yval[yval.length - 1]).createSampler(rng);
|
||||
final ContinuousDistribution.Sampler distX = new UniformContinuousDistribution(xval[0], xval[xval.length - 1]).createSampler(rng);
|
||||
final ContinuousDistribution.Sampler distY = new UniformContinuousDistribution(yval[0], yval[yval.length - 1]).createSampler(rng);
|
||||
|
||||
int count = 0;
|
||||
while (true) {
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
package org.apache.commons.math4.analysis.interpolation;
|
||||
|
||||
import org.apache.commons.math4.analysis.BivariateFunction;
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.math4.distribution.UniformRealDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.statistics.distribution.UniformContinuousDistribution;
|
||||
import org.apache.commons.math4.exception.DimensionMismatchException;
|
||||
import org.apache.commons.math4.exception.InsufficientDataException;
|
||||
import org.apache.commons.math4.exception.NonMonotonicSequenceException;
|
||||
|
@ -252,8 +252,8 @@ public final class PiecewiseBicubicSplineInterpolatingFunctionTest {
|
|||
}
|
||||
|
||||
final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 1234567L);
|
||||
final RealDistribution.Sampler distX = new UniformRealDistribution(xValues[0], xValues[xValues.length - 1]).createSampler(rng);
|
||||
final RealDistribution.Sampler distY = new UniformRealDistribution(yValues[0], yValues[yValues.length - 1]).createSampler(rng);
|
||||
final ContinuousDistribution.Sampler distX = new UniformContinuousDistribution(xValues[0], xValues[xValues.length - 1]).createSampler(rng);
|
||||
final ContinuousDistribution.Sampler distY = new UniformContinuousDistribution(yValues[0], yValues[yValues.length - 1]).createSampler(rng);
|
||||
|
||||
double sumError = 0;
|
||||
for (int i = 0; i < numberOfSamples; i++) {
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
package org.apache.commons.math4.analysis.interpolation;
|
||||
|
||||
import org.apache.commons.math4.analysis.BivariateFunction;
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.math4.distribution.UniformRealDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.statistics.distribution.UniformContinuousDistribution;
|
||||
import org.apache.commons.math4.exception.DimensionMismatchException;
|
||||
import org.apache.commons.math4.exception.InsufficientDataException;
|
||||
import org.apache.commons.math4.exception.NonMonotonicSequenceException;
|
||||
|
@ -159,8 +159,8 @@ public final class PiecewiseBicubicSplineInterpolatorTest {
|
|||
double x, y;
|
||||
|
||||
final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 1234567L);
|
||||
final RealDistribution.Sampler distX = new UniformRealDistribution(xval[0], xval[xval.length - 1]).createSampler(rng);
|
||||
final RealDistribution.Sampler distY = new UniformRealDistribution(yval[0], yval[yval.length - 1]).createSampler(rng);
|
||||
final ContinuousDistribution.Sampler distX = new UniformContinuousDistribution(xval[0], xval[xval.length - 1]).createSampler(rng);
|
||||
final ContinuousDistribution.Sampler distY = new UniformContinuousDistribution(yval[0], yval[yval.length - 1]).createSampler(rng);
|
||||
|
||||
final int numSamples = 50;
|
||||
final double tol = 2e-14;
|
||||
|
@ -211,8 +211,8 @@ public final class PiecewiseBicubicSplineInterpolatorTest {
|
|||
double x, y;
|
||||
|
||||
final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 1234567L);
|
||||
final RealDistribution.Sampler distX = new UniformRealDistribution(xval[0], xval[xval.length - 1]).createSampler(rng);
|
||||
final RealDistribution.Sampler distY = new UniformRealDistribution(yval[0], yval[yval.length - 1]).createSampler(rng);
|
||||
final ContinuousDistribution.Sampler distX = new UniformContinuousDistribution(xval[0], xval[xval.length - 1]).createSampler(rng);
|
||||
final ContinuousDistribution.Sampler distY = new UniformContinuousDistribution(yval[0], yval[yval.length - 1]).createSampler(rng);
|
||||
|
||||
final int numSamples = 50;
|
||||
final double tol = 5e-13;
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
package org.apache.commons.math4.analysis.interpolation;
|
||||
|
||||
import org.apache.commons.math4.analysis.TrivariateFunction;
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.math4.distribution.UniformRealDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.statistics.distribution.UniformContinuousDistribution;
|
||||
import org.apache.commons.math4.exception.DimensionMismatchException;
|
||||
import org.apache.commons.math4.exception.MathIllegalArgumentException;
|
||||
import org.apache.commons.rng.UniformRandomProvider;
|
||||
|
@ -381,9 +381,9 @@ public final class TricubicInterpolatingFunctionTest {
|
|||
}
|
||||
|
||||
final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 1234568L);
|
||||
final RealDistribution.Sampler distX = new UniformRealDistribution(xValues[0], xValues[xValues.length - 1]).createSampler(rng);
|
||||
final RealDistribution.Sampler distY = new UniformRealDistribution(yValues[0], yValues[yValues.length - 1]).createSampler(rng);
|
||||
final RealDistribution.Sampler distZ = new UniformRealDistribution(zValues[0], zValues[zValues.length - 1]).createSampler(rng);
|
||||
final ContinuousDistribution.Sampler distX = new UniformContinuousDistribution(xValues[0], xValues[xValues.length - 1]).createSampler(rng);
|
||||
final ContinuousDistribution.Sampler distY = new UniformContinuousDistribution(yValues[0], yValues[yValues.length - 1]).createSampler(rng);
|
||||
final ContinuousDistribution.Sampler distZ = new UniformContinuousDistribution(zValues[0], zValues[zValues.length - 1]).createSampler(rng);
|
||||
|
||||
double sumError = 0;
|
||||
for (int i = 0; i < numberOfSamples; i++) {
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.io.IOException;
|
|||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.math4.TestUtils;
|
||||
import org.apache.commons.math4.analysis.UnivariateFunction;
|
||||
import org.apache.commons.math4.analysis.integration.BaseAbstractUnivariateIntegrator;
|
||||
|
@ -329,7 +330,7 @@ public abstract class RealDistributionAbstractTest {
|
|||
@Test
|
||||
public void testSampler() {
|
||||
final int sampleSize = 1000;
|
||||
final RealDistribution.Sampler sampler =
|
||||
final ContinuousDistribution.Sampler sampler =
|
||||
distribution.createSampler(RandomSource.create(RandomSource.WELL_19937_C, 123456789L));
|
||||
final double[] sample = AbstractRealDistribution.sample(sampleSize, sampler);
|
||||
final double[] quartiles = TestUtils.getDistributionQuartiles(distribution);
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
package org.apache.commons.math4.filter;
|
||||
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.math4.distribution.NormalDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.statistics.distribution.NormalDistribution;
|
||||
import org.apache.commons.math4.filter.DefaultMeasurementModel;
|
||||
import org.apache.commons.math4.filter.DefaultProcessModel;
|
||||
import org.apache.commons.math4.filter.KalmanFilter;
|
||||
|
@ -126,7 +126,7 @@ public class KalmanFilterTest {
|
|||
RealVector pNoise = new ArrayRealVector(1);
|
||||
RealVector mNoise = new ArrayRealVector(1);
|
||||
|
||||
final RealDistribution.Sampler rand = new NormalDistribution().createSampler(RandomSource.create(RandomSource.WELL_19937_C));
|
||||
final ContinuousDistribution.Sampler rand = new NormalDistribution(0, 1).createSampler(RandomSource.create(RandomSource.WELL_19937_C));
|
||||
|
||||
// iterate 60 steps
|
||||
for (int i = 0; i < 60; i++) {
|
||||
|
@ -215,7 +215,7 @@ public class KalmanFilterTest {
|
|||
double[] expectedInitialState = new double[] { 0.0, 0.0 };
|
||||
assertVectorEquals(expectedInitialState, filter.getStateEstimation());
|
||||
|
||||
final RealDistribution.Sampler rand = new NormalDistribution().createSampler(RandomSource.create(RandomSource.WELL_19937_C));
|
||||
final ContinuousDistribution.Sampler rand = new NormalDistribution(0, 1).createSampler(RandomSource.create(RandomSource.WELL_19937_C));
|
||||
|
||||
RealVector tmpPNoise = new ArrayRealVector(
|
||||
new double[] { FastMath.pow(dt, 2d) / 2d, dt });
|
||||
|
@ -392,7 +392,7 @@ public class KalmanFilterTest {
|
|||
final MeasurementModel mm = new DefaultMeasurementModel(H, R);
|
||||
final KalmanFilter filter = new KalmanFilter(pm, mm);
|
||||
|
||||
final RealDistribution.Sampler dist = new NormalDistribution(0, measurementNoise).createSampler(RandomSource.create(RandomSource.WELL_19937_C, 1001));
|
||||
final ContinuousDistribution.Sampler dist = new NormalDistribution(0, measurementNoise).createSampler(RandomSource.create(RandomSource.WELL_19937_C, 1001));
|
||||
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
// get the "real" cannonball position
|
||||
|
|
|
@ -20,8 +20,8 @@ import java.util.Random;
|
|||
|
||||
import org.apache.commons.math4.TestUtils;
|
||||
import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.math4.distribution.UniformRealDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.statistics.distribution.UniformContinuousDistribution;
|
||||
import org.apache.commons.math4.exception.ConvergenceException;
|
||||
import org.apache.commons.math4.fitting.PolynomialCurveFitter;
|
||||
import org.apache.commons.math4.fitting.WeightedObservedPoints;
|
||||
|
@ -36,8 +36,8 @@ import org.junit.Test;
|
|||
public class PolynomialCurveFitterTest {
|
||||
@Test
|
||||
public void testFit() {
|
||||
final RealDistribution.Sampler rng
|
||||
= new UniformRealDistribution(-100, 100).createSampler(RandomSource.create(RandomSource.WELL_512_A,
|
||||
final ContinuousDistribution.Sampler rng
|
||||
= new UniformContinuousDistribution(-100, 100).createSampler(RandomSource.create(RandomSource.WELL_512_A,
|
||||
64925784252L));
|
||||
final double[] coeff = { 12.9, -3.4, 2.1 }; // 12.9 - 3.4 x + 2.1 x^2
|
||||
final PolynomialFunction f = new PolynomialFunction(coeff);
|
||||
|
|
|
@ -21,8 +21,8 @@ import java.util.Random;
|
|||
import org.apache.commons.math4.TestUtils;
|
||||
import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
|
||||
import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.math4.distribution.UniformRealDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.statistics.distribution.UniformContinuousDistribution;
|
||||
import org.apache.commons.math4.fitting.SimpleCurveFitter;
|
||||
import org.apache.commons.math4.fitting.WeightedObservedPoints;
|
||||
import org.apache.commons.rng.simple.RandomSource;
|
||||
|
@ -35,8 +35,8 @@ public class SimpleCurveFitterTest {
|
|||
@Test
|
||||
public void testPolynomialFit() {
|
||||
final Random randomizer = new Random(53882150042L);
|
||||
final RealDistribution.Sampler rng
|
||||
= new UniformRealDistribution(-100, 100).createSampler(RandomSource.create(RandomSource.WELL_512_A,
|
||||
final ContinuousDistribution.Sampler rng
|
||||
= new UniformContinuousDistribution(-100, 100).createSampler(RandomSource.create(RandomSource.WELL_512_A,
|
||||
64925784253L));
|
||||
|
||||
final double[] coeff = { 12.9, -3.4, 2.1 }; // 12.9 - 3.4 x + 2.1 x^2
|
||||
|
|
|
@ -262,7 +262,7 @@ public class LevenbergMarquardtOptimizerTest
|
|||
final double ySigma = 15;
|
||||
final double radius = 111.111;
|
||||
// The test is extremely sensitive to the seed.
|
||||
final long seed = 59321761414L;
|
||||
final long seed = 59321761419L;
|
||||
final RandomCirclePointGenerator factory
|
||||
= new RandomCirclePointGenerator(xCenter, yCenter, radius,
|
||||
xSigma, ySigma,
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
*/
|
||||
package org.apache.commons.math4.fitting.leastsquares;
|
||||
|
||||
import org.apache.commons.math4.distribution.NormalDistribution;
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.math4.distribution.UniformRealDistribution;
|
||||
import org.apache.commons.statistics.distribution.NormalDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.statistics.distribution.UniformContinuousDistribution;
|
||||
import org.apache.commons.math4.geometry.euclidean.twod.Cartesian2D;
|
||||
import org.apache.commons.rng.UniformRandomProvider;
|
||||
import org.apache.commons.rng.simple.RandomSource;
|
||||
|
@ -30,11 +30,11 @@ import org.apache.commons.math4.util.MathUtils;
|
|||
*/
|
||||
public class RandomCirclePointGenerator {
|
||||
/** RNG for the x-coordinate of the center. */
|
||||
private final RealDistribution.Sampler cX;
|
||||
private final ContinuousDistribution.Sampler cX;
|
||||
/** RNG for the y-coordinate of the center. */
|
||||
private final RealDistribution.Sampler cY;
|
||||
private final ContinuousDistribution.Sampler cY;
|
||||
/** RNG for the parametric position of the point. */
|
||||
private final RealDistribution.Sampler tP;
|
||||
private final ContinuousDistribution.Sampler tP;
|
||||
/** Radius of the circle. */
|
||||
private final double radius;
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class RandomCirclePointGenerator {
|
|||
this.radius = radius;
|
||||
cX = new NormalDistribution(x, xSigma).createSampler(rng);
|
||||
cY = new NormalDistribution(y, ySigma).createSampler(rng);
|
||||
tP = new UniformRealDistribution(0, MathUtils.TWO_PI).createSampler(rng);
|
||||
tP = new UniformContinuousDistribution(0, MathUtils.TWO_PI).createSampler(rng);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,9 +19,9 @@ package org.apache.commons.math4.fitting.leastsquares;
|
|||
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import org.apache.commons.math4.distribution.NormalDistribution;
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.math4.distribution.UniformRealDistribution;
|
||||
import org.apache.commons.statistics.distribution.NormalDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.statistics.distribution.UniformContinuousDistribution;
|
||||
import org.apache.commons.rng.UniformRandomProvider;
|
||||
import org.apache.commons.rng.simple.RandomSource;
|
||||
|
||||
|
@ -34,9 +34,9 @@ public class RandomStraightLinePointGenerator {
|
|||
/** Intercept. */
|
||||
private final double intercept;
|
||||
/** RNG for the x-coordinate. */
|
||||
private final RealDistribution.Sampler x;
|
||||
private final ContinuousDistribution.Sampler x;
|
||||
/** RNG for the error on the y-coordinate. */
|
||||
private final RealDistribution.Sampler error;
|
||||
private final ContinuousDistribution.Sampler error;
|
||||
|
||||
/**
|
||||
* The generator will create a cloud of points whose x-coordinates
|
||||
|
@ -65,7 +65,7 @@ public class RandomStraightLinePointGenerator {
|
|||
slope = a;
|
||||
intercept = b;
|
||||
error = new NormalDistribution(0, sigma).createSampler(rng);
|
||||
x = new UniformRealDistribution(lo, hi).createSampler(rng);
|
||||
x = new UniformContinuousDistribution(lo, hi).createSampler(rng);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,8 +20,8 @@ package org.apache.commons.math4.linear;
|
|||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.math4.distribution.NormalDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.statistics.distribution.NormalDistribution;
|
||||
import org.apache.commons.math4.exception.MathUnsupportedOperationException;
|
||||
import org.apache.commons.math4.linear.ArrayRealVector;
|
||||
import org.apache.commons.math4.linear.EigenDecomposition;
|
||||
|
@ -470,7 +470,7 @@ public class EigenDecompositionTest {
|
|||
public void testNormalDistributionUnsymmetricMatrix() {
|
||||
for (int run = 0; run < 100; run++) {
|
||||
Random r = new Random(System.currentTimeMillis());
|
||||
RealDistribution.Sampler dist
|
||||
ContinuousDistribution.Sampler dist
|
||||
= new NormalDistribution(0.0, r.nextDouble() * 5).createSampler(RandomSource.create(RandomSource.WELL_512_A,
|
||||
64925784252L));
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ package org.apache.commons.math4.linear;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.math4.distribution.NormalDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.statistics.distribution.NormalDistribution;
|
||||
import org.apache.commons.math4.linear.HessenbergTransformer;
|
||||
import org.apache.commons.math4.linear.MatrixUtils;
|
||||
import org.apache.commons.math4.linear.NonSquareMatrixException;
|
||||
|
@ -114,7 +114,7 @@ public class HessenbergTransformerTest {
|
|||
public void testRandomDataNormalDistribution() {
|
||||
for (int run = 0; run < 100; run++) {
|
||||
Random r = new Random(System.currentTimeMillis());
|
||||
RealDistribution.Sampler dist
|
||||
ContinuousDistribution.Sampler dist
|
||||
= new NormalDistribution(0.0, r.nextDouble() * 5).createSampler(RandomSource.create(RandomSource.WELL_512_A,
|
||||
64925784252L));
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ package org.apache.commons.math4.linear;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.math4.distribution.NormalDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.statistics.distribution.NormalDistribution;
|
||||
import org.apache.commons.math4.linear.MatrixUtils;
|
||||
import org.apache.commons.math4.linear.NonSquareMatrixException;
|
||||
import org.apache.commons.math4.linear.RealMatrix;
|
||||
|
@ -118,7 +118,7 @@ public class SchurTransformerTest {
|
|||
public void testRandomDataNormalDistribution() {
|
||||
for (int run = 0; run < 100; run++) {
|
||||
Random r = new Random(System.currentTimeMillis());
|
||||
RealDistribution.Sampler dist
|
||||
ContinuousDistribution.Sampler dist
|
||||
= new NormalDistribution(0.0, r.nextDouble() * 5).createSampler(RandomSource.create(RandomSource.WELL_512_A,
|
||||
64925784252L));
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.apache.commons.math4.stat.correlation;
|
||||
|
||||
import org.apache.commons.math4.TestUtils;
|
||||
import org.apache.commons.math4.distribution.TDistribution;
|
||||
import org.apache.commons.statistics.distribution.TDistribution;
|
||||
import org.apache.commons.math4.exception.MathIllegalArgumentException;
|
||||
import org.apache.commons.math4.linear.BlockRealMatrix;
|
||||
import org.apache.commons.math4.linear.RealMatrix;
|
||||
|
|
|
@ -21,11 +21,11 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
|
||||
import org.apache.commons.math4.TestUtils;
|
||||
import org.apache.commons.math4.distribution.IntegerDistribution;
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.statistics.distribution.DiscreteDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.math4.distribution.AbstractRealDistribution;
|
||||
import org.apache.commons.math4.distribution.UniformIntegerDistribution;
|
||||
import org.apache.commons.math4.distribution.UniformRealDistribution;
|
||||
import org.apache.commons.statistics.distribution.UniformDiscreteDistribution;
|
||||
import org.apache.commons.statistics.distribution.UniformContinuousDistribution;
|
||||
import org.apache.commons.numbers.core.Precision;
|
||||
import org.apache.commons.rng.simple.RandomSource;
|
||||
import org.junit.Assert;
|
||||
|
@ -282,11 +282,11 @@ public class AggregateSummaryStatisticsTest {
|
|||
* @return array of random double values
|
||||
*/
|
||||
private double[] generateSample() {
|
||||
final IntegerDistribution.Sampler size =
|
||||
new UniformIntegerDistribution(10, 100).createSampler(RandomSource.create(RandomSource.WELL_512_A,
|
||||
final DiscreteDistribution.Sampler size =
|
||||
new UniformDiscreteDistribution(10, 100).createSampler(RandomSource.create(RandomSource.WELL_512_A,
|
||||
327652));
|
||||
final RealDistribution.Sampler randomData
|
||||
= new UniformRealDistribution(-100, 100).createSampler(RandomSource.create(RandomSource.WELL_512_A,
|
||||
final ContinuousDistribution.Sampler randomData
|
||||
= new UniformContinuousDistribution(-100, 100).createSampler(RandomSource.create(RandomSource.WELL_512_A,
|
||||
64925784252L));;
|
||||
final int sampleSize = size.sample();
|
||||
final double[] out = AbstractRealDistribution.sample(sampleSize, randomData);
|
||||
|
@ -314,8 +314,8 @@ public class AggregateSummaryStatisticsTest {
|
|||
if (i == 4 || cur == length - 1) {
|
||||
next = length - 1;
|
||||
} else {
|
||||
final IntegerDistribution.Sampler sampler =
|
||||
new UniformIntegerDistribution(cur, length - 1).createSampler(RandomSource.create(RandomSource.WELL_512_A));
|
||||
final DiscreteDistribution.Sampler sampler =
|
||||
new UniformDiscreteDistribution(cur, length - 1).createSampler(RandomSource.create(RandomSource.WELL_512_A));
|
||||
next = sampler.sample();
|
||||
}
|
||||
final int subLength = next - cur + 1;
|
||||
|
|
|
@ -20,10 +20,10 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.commons.math4.TestUtils;
|
||||
import org.apache.commons.math4.distribution.IntegerDistribution;
|
||||
import org.apache.commons.math4.distribution.NormalDistribution;
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.math4.distribution.UniformIntegerDistribution;
|
||||
import org.apache.commons.statistics.distribution.DiscreteDistribution;
|
||||
import org.apache.commons.statistics.distribution.NormalDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.statistics.distribution.UniformDiscreteDistribution;
|
||||
import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
|
||||
import org.apache.commons.math4.stat.descriptive.WeightedEvaluation;
|
||||
import org.apache.commons.math4.util.FastMath;
|
||||
|
@ -179,8 +179,8 @@ public abstract class UnivariateStatisticAbstractTest {
|
|||
|
||||
// Fill weights array with random int values between 1 and 5
|
||||
int[] intWeights = new int[len];
|
||||
final IntegerDistribution.Sampler weightDist =
|
||||
new UniformIntegerDistribution(1, 5).createSampler(RandomSource.create(RandomSource.WELL_512_A,
|
||||
final DiscreteDistribution.Sampler weightDist =
|
||||
new UniformDiscreteDistribution(1, 5).createSampler(RandomSource.create(RandomSource.WELL_512_A,
|
||||
234878544L));
|
||||
for (int i = 0; i < len; i++) {
|
||||
intWeights[i] = weightDist.sample();
|
||||
|
@ -190,7 +190,7 @@ public abstract class UnivariateStatisticAbstractTest {
|
|||
// Fill values array with random data from N(mu, sigma)
|
||||
// and fill valuesList with values from values array with
|
||||
// values[i] repeated weights[i] times, each i
|
||||
final RealDistribution.Sampler valueDist =
|
||||
final ContinuousDistribution.Sampler valueDist =
|
||||
new NormalDistribution(mu, sigma).createSampler(RandomSource.create(RandomSource.WELL_512_A,
|
||||
64925784252L));
|
||||
List<Double> valuesList = new ArrayList<>();
|
||||
|
|
|
@ -18,9 +18,9 @@ package org.apache.commons.math4.stat.descriptive.rank;
|
|||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.math4.distribution.AbstractRealDistribution;
|
||||
import org.apache.commons.math4.distribution.NormalDistribution;
|
||||
import org.apache.commons.statistics.distribution.NormalDistribution;
|
||||
import org.apache.commons.math4.exception.MathIllegalArgumentException;
|
||||
import org.apache.commons.math4.exception.NotANumberException;
|
||||
import org.apache.commons.math4.exception.NullArgumentException;
|
||||
|
@ -587,7 +587,7 @@ public class PercentileTest extends UnivariateStatisticAbstractTest{
|
|||
|
||||
@Test
|
||||
public void testStoredVsDirect() {
|
||||
final RealDistribution.Sampler sampler =
|
||||
final ContinuousDistribution.Sampler sampler =
|
||||
new NormalDistribution(4000, 50).createSampler(RandomSource.create(RandomSource.JDK,
|
||||
Long.MAX_VALUE));
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ import org.apache.commons.math4.random.CorrelatedRandomVectorGenerator;
|
|||
import org.apache.commons.math4.random.GaussianRandomGenerator;
|
||||
import org.apache.commons.rng.UniformRandomProvider;
|
||||
import org.apache.commons.rng.simple.RandomSource;
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.math4.distribution.NormalDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.statistics.distribution.NormalDistribution;
|
||||
import org.apache.commons.math4.stat.correlation.Covariance;
|
||||
import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
|
||||
import org.apache.commons.math4.stat.regression.GLSMultipleLinearRegression;
|
||||
|
@ -223,7 +223,7 @@ public class GLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
|
|||
@Test
|
||||
public void testGLSEfficiency() {
|
||||
final UniformRandomProvider rg = RandomSource.create(RandomSource.MT, 123456789L);
|
||||
final RealDistribution.Sampler gauss = new NormalDistribution().createSampler(rg);
|
||||
final ContinuousDistribution.Sampler gauss = new NormalDistribution(0, 1).createSampler(rg);
|
||||
|
||||
// Assume model has 16 observations (will use Longley data). Start by generating
|
||||
// non-constant variances for the 16 error terms.
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
package org.apache.commons.math4.util;
|
||||
|
||||
import org.apache.commons.numbers.angle.PlaneAngleRadians;
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.math4.distribution.UniformRealDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.statistics.distribution.UniformContinuousDistribution;
|
||||
import org.apache.commons.math4.exception.MathArithmeticException;
|
||||
import org.apache.commons.math4.exception.NotFiniteNumberException;
|
||||
import org.apache.commons.math4.exception.NullArgumentException;
|
||||
|
@ -103,8 +103,8 @@ public final class MathUtilsTest {
|
|||
|
||||
// Generate 10 distinct random values
|
||||
for (int i = 0; i < 10; i++) {
|
||||
final RealDistribution.Sampler u
|
||||
= new UniformRealDistribution(i + 0.5, i + 0.75).createSampler(random);
|
||||
final ContinuousDistribution.Sampler u
|
||||
= new UniformContinuousDistribution(i + 0.5, i + 0.75).createSampler(random);
|
||||
original[i] = u.sample();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
*/
|
||||
package org.apache.commons.math4.util;
|
||||
|
||||
import org.apache.commons.math4.distribution.IntegerDistribution;
|
||||
import org.apache.commons.math4.distribution.UniformIntegerDistribution;
|
||||
import org.apache.commons.statistics.distribution.DiscreteDistribution;
|
||||
import org.apache.commons.statistics.distribution.UniformDiscreteDistribution;
|
||||
import org.apache.commons.math4.exception.MathIllegalArgumentException;
|
||||
import org.apache.commons.math4.exception.NullArgumentException;
|
||||
import org.apache.commons.rng.simple.RandomSource;
|
||||
|
@ -322,8 +322,8 @@ public class ResizableDoubleArrayTest extends DoubleArrayAbstractTest {
|
|||
ResizableDoubleArray eDA2 = new ResizableDoubleArray(2);
|
||||
Assert.assertEquals("Initial number of elements should be 0", 0, eDA2.getNumElements());
|
||||
|
||||
final IntegerDistribution.Sampler randomData =
|
||||
new UniformIntegerDistribution(100, 1000).createSampler(RandomSource.create(RandomSource.WELL_19937_C));
|
||||
final DiscreteDistribution.Sampler randomData =
|
||||
new UniformDiscreteDistribution(100, 1000).createSampler(RandomSource.create(RandomSource.WELL_19937_C));
|
||||
final int iterations = randomData.sample();
|
||||
|
||||
for( int i = 0; i < iterations; i++) {
|
||||
|
@ -344,9 +344,9 @@ public class ResizableDoubleArrayTest extends DoubleArrayAbstractTest {
|
|||
ResizableDoubleArray eDA3 = new ResizableDoubleArray(3, 3.0, 3.5);
|
||||
Assert.assertEquals("Initial number of elements should be 0", 0, eDA3.getNumElements() );
|
||||
|
||||
final IntegerDistribution.Sampler randomData =
|
||||
new UniformIntegerDistribution(100, 3000).createSampler(RandomSource.create(RandomSource.WELL_19937_C));
|
||||
;
|
||||
final DiscreteDistribution.Sampler randomData =
|
||||
new UniformDiscreteDistribution(100, 3000).createSampler(RandomSource.create(RandomSource.WELL_19937_C));
|
||||
|
||||
final int iterations = randomData.sample();
|
||||
|
||||
for( int i = 0; i < iterations; i++) {
|
||||
|
|
Loading…
Reference in New Issue