From e875e6d59875be86fb8de8df7642c370b652eb76 Mon Sep 17 00:00:00 2001 From: Luc Maisonobe Date: Mon, 22 Sep 2014 18:07:54 +0200 Subject: [PATCH] Fixed lots of warnings due to missing @Deprecated annotations. --- .../linear/SingularValueDecomposition.java | 3 - ...MultiStartMultivariateVectorOptimizer.java | 1 + .../vector/MultivariateVectorOptimizer.java | 1 + .../commons/math3/random/ValueServer.java | 10 +-- .../math3/util/ResizableDoubleArray.java | 2 +- .../integration/gauss/HermiteTest.java | 3 - ...icubicSplineInterpolatingFunctionTest.java | 1 - .../KolmogorovSmirnovDistributionTest.java | 1 + ...ateNormalMixtureModelDistributionTest.java | 6 +- .../math3/fitting/CurveFitterTest.java | 1 + .../fitting/GaussianCurveFitterTest.java | 7 +- .../math3/fitting/GaussianFitterTest.java | 1 + .../fitting/HarmonicCurveFitterTest.java | 13 ++-- .../math3/fitting/HarmonicFitterTest.java | 3 +- .../fitting/PolynomialCurveFitterTest.java | 10 +-- .../math3/fitting/PolynomialFitterTest.java | 2 + ...ractLeastSquaresOptimizerAbstractTest.java | 2 +- .../fitting/leastsquares/EvaluationTest.java | 2 +- .../EvaluationTestValidation.java | 2 - .../LevenbergMarquardtOptimizerTest.java | 42 ----------- .../fitting/leastsquares/MinpackTest.java | 18 ----- .../math3/linear/BlockFieldMatrixTest.java | 2 +- .../math3/linear/FieldMatrixImplTest.java | 2 +- .../neuralnet/OffsetFeatureInitializer.java | 4 -- .../ml/neuralnet/oned/NeuronStringTest.java | 15 ++-- .../sofm/KohonenTrainingTaskTest.java | 71 ++++--------------- .../sofm/TravellingSalesmanSolver.java | 3 - .../twod/NeuronSquareMesh2DTest.java | 17 +++-- .../sampling/DummyStepInterpolatorTest.java | 3 - ...nLinearConjugateGradientOptimizerTest.java | 1 - ...iStartMultivariateVectorOptimizerTest.java | 1 + ...ractLeastSquaresOptimizerAbstractTest.java | 2 + .../AbstractLeastSquaresOptimizerTest.java | 2 + ...ctLeastSquaresOptimizerTestValidation.java | 6 +- .../vector/jacobian/CircleProblem.java | 2 + .../vector/jacobian/CircleVectorial.java | 2 + .../jacobian/GaussNewtonOptimizerTest.java | 2 + .../LevenbergMarquardtOptimizerTest.java | 43 +---------- .../vector/jacobian/MinpackTest.java | 2 + .../jacobian/RandomCirclePointGenerator.java | 1 + .../RandomStraightLinePointGenerator.java | 2 + .../jacobian/StatisticalReferenceDataset.java | 2 + .../StatisticalReferenceDatasetFactory.java | 2 + .../vector/jacobian/StraightLineProblem.java | 2 + .../optim/univariate/BrentOptimizerTest.java | 2 - ...DifferentiableMultiStartOptimizerTest.java | 1 + ...entiableVectorMultiStartOptimizerTest.java | 1 + .../MultivariateMultiStartOptimizerTest.java | 1 + .../optimization/PointValuePairTest.java | 1 + .../PointVectorValuePairTest.java | 1 + .../optimization/SimplePointCheckerTest.java | 1 + .../optimization/SimpleValueCheckerTest.java | 1 + .../SimpleVectorValueCheckerTest.java | 1 + .../direct/BOBYQAOptimizerTest.java | 1 + .../direct/CMAESOptimizerTest.java | 1 + ...ultivariateFunctionMappingAdapterTest.java | 1 + ...ultivariateFunctionPenaltyAdapterTest.java | 1 + .../direct/PowellOptimizerTest.java | 1 + .../SimplexOptimizerMultiDirectionalTest.java | 1 + .../SimplexOptimizerNelderMeadTest.java | 1 + .../optimization/fitting/CurveFitterTest.java | 1 + .../fitting/GaussianFitterTest.java | 2 +- .../fitting/HarmonicFitterTest.java | 2 +- .../fitting/PolynomialFitterTest.java | 4 +- ...ractLeastSquaresOptimizerAbstractTest.java | 1 + .../AbstractLeastSquaresOptimizerTest.java | 2 +- ...ctLeastSquaresOptimizerTestValidation.java | 5 +- .../optimization/general/CircleProblem.java | 1 + .../optimization/general/CircleScalar.java | 1 + .../optimization/general/CircleVectorial.java | 1 + .../general/GaussNewtonOptimizerTest.java | 1 + .../LevenbergMarquardtOptimizerTest.java | 1 + .../optimization/general/MinpackTest.java | 2 +- ...nLinearConjugateGradientOptimizerTest.java | 1 + .../general/RandomCirclePointGenerator.java | 1 + .../RandomStraightLinePointGenerator.java | 2 + .../general/StatisticalReferenceDataset.java | 1 + .../StatisticalReferenceDatasetFactory.java | 1 + .../general/StraightLineProblem.java | 1 + .../linear/SimplexSolverTest.java | 1 + .../linear/SimplexTableauTest.java | 1 + .../univariate/BracketFinderTest.java | 2 +- .../univariate/BrentOptimizerTest.java | 3 +- .../SimpleUnivariateValueCheckerTest.java | 1 + .../UnivariateMultiStartOptimizerTest.java | 1 + .../random/EmpiricalDistributionTest.java | 2 - .../commons/math3/special/BetaTest.java | 2 +- .../stat/clustering/DBSCANClustererTest.java | 1 + .../clustering/EuclideanDoublePointTest.java | 1 + .../clustering/EuclideanIntegerPointTest.java | 1 + .../KMeansPlusPlusClustererTest.java | 1 + .../commons/math3/util/MathUtilsTest.java | 4 +- .../math3/util/ResizableDoubleArrayTest.java | 52 +++++++------- 93 files changed, 165 insertions(+), 276 deletions(-) diff --git a/src/main/java/org/apache/commons/math3/linear/SingularValueDecomposition.java b/src/main/java/org/apache/commons/math3/linear/SingularValueDecomposition.java index cb670aebf..89c0afd2a 100644 --- a/src/main/java/org/apache/commons/math3/linear/SingularValueDecomposition.java +++ b/src/main/java/org/apache/commons/math3/linear/SingularValueDecomposition.java @@ -267,7 +267,6 @@ public class SingularValueDecomposition { // Main iteration loop for the singular values. final int pp = p - 1; - int iter = 0; while (p > 0) { int k; int kase; @@ -429,7 +428,6 @@ public class SingularValueDecomposition { } } e[p - 2] = f; - iter++; } break; // Convergence. @@ -466,7 +464,6 @@ public class SingularValueDecomposition { } k++; } - iter = 0; p--; } break; diff --git a/src/main/java/org/apache/commons/math3/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizer.java b/src/main/java/org/apache/commons/math3/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizer.java index 237befe01..10950574a 100644 --- a/src/main/java/org/apache/commons/math3/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizer.java +++ b/src/main/java/org/apache/commons/math3/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizer.java @@ -38,6 +38,7 @@ import org.apache.commons.math3.optim.PointVectorValuePair; * * @since 3.0 */ +@Deprecated public class MultiStartMultivariateVectorOptimizer extends BaseMultiStartMultivariateOptimizer { /** Underlying optimizer. */ diff --git a/src/main/java/org/apache/commons/math3/optim/nonlinear/vector/MultivariateVectorOptimizer.java b/src/main/java/org/apache/commons/math3/optim/nonlinear/vector/MultivariateVectorOptimizer.java index 3f04b4725..c79defa40 100644 --- a/src/main/java/org/apache/commons/math3/optim/nonlinear/vector/MultivariateVectorOptimizer.java +++ b/src/main/java/org/apache/commons/math3/optim/nonlinear/vector/MultivariateVectorOptimizer.java @@ -31,6 +31,7 @@ import org.apache.commons.math3.linear.RealMatrix; * * @since 3.1 */ +@Deprecated public abstract class MultivariateVectorOptimizer extends BaseMultivariateOptimizer { /** Target values for the model function at optimum. */ diff --git a/src/main/java/org/apache/commons/math3/random/ValueServer.java b/src/main/java/org/apache/commons/math3/random/ValueServer.java index 767cdc2ee..975d2d8f6 100644 --- a/src/main/java/org/apache/commons/math3/random/ValueServer.java +++ b/src/main/java/org/apache/commons/math3/random/ValueServer.java @@ -87,13 +87,13 @@ public class ValueServer { private BufferedReader filePointer = null; /** RandomDataImpl to use for random data generation. */ - private final RandomDataImpl randomData; + private final RandomDataGenerator randomData; // Data generation modes ====================================== /** Creates new ValueServer */ public ValueServer() { - randomData = new RandomDataImpl(); + randomData = new RandomDataGenerator(); } /** @@ -106,7 +106,7 @@ public class ValueServer { */ @Deprecated public ValueServer(RandomDataImpl randomData) { - this.randomData = randomData; + this.randomData = randomData.getDelegate(); } /** @@ -117,7 +117,7 @@ public class ValueServer { * @param generator source of random data */ public ValueServer(RandomGenerator generator) { - this.randomData = new RandomDataImpl(generator); + this.randomData = new RandomDataGenerator(generator); } /** @@ -215,7 +215,7 @@ public class ValueServer { * @throws ZeroException if URL contains no data */ public void computeDistribution(int binCount) throws NullArgumentException, IOException, ZeroException { - empiricalDistribution = new EmpiricalDistribution(binCount, randomData); + empiricalDistribution = new EmpiricalDistribution(binCount, randomData.getRandomGenerator()); empiricalDistribution.load(valuesFileURL); mu = empiricalDistribution.getSampleStats().getMean(); sigma = empiricalDistribution.getSampleStats().getStandardDeviation(); diff --git a/src/main/java/org/apache/commons/math3/util/ResizableDoubleArray.java b/src/main/java/org/apache/commons/math3/util/ResizableDoubleArray.java index a988691af..468ed74ca 100644 --- a/src/main/java/org/apache/commons/math3/util/ResizableDoubleArray.java +++ b/src/main/java/org/apache/commons/math3/util/ResizableDoubleArray.java @@ -411,7 +411,7 @@ public class ResizableDoubleArray implements DoubleArray, Serializable { numElements = 0; startIndex = 0; - if (data != null) { + if (data != null && data.length > 1) { addElements(data); } } diff --git a/src/test/java/org/apache/commons/math3/analysis/integration/gauss/HermiteTest.java b/src/test/java/org/apache/commons/math3/analysis/integration/gauss/HermiteTest.java index 519117073..659ac7871 100644 --- a/src/test/java/org/apache/commons/math3/analysis/integration/gauss/HermiteTest.java +++ b/src/test/java/org/apache/commons/math3/analysis/integration/gauss/HermiteTest.java @@ -32,8 +32,6 @@ public class HermiteTest { public void testNormalDistribution() { final double oneOverSqrtPi = 1 / FastMath.sqrt(Math.PI); - final double mu = 12345.6789; - final double sigma = 987.654321; // By defintion, Gauss-Hermite quadrature readily provides the // integral of the normal distribution density. final int numPoints = 1; @@ -87,7 +85,6 @@ public class HermiteTest { public void testNormalVariance() { final double twoOverSqrtPi = 2 / FastMath.sqrt(Math.PI); - final double mu = 12345.6789; final double sigma = 987.654321; final double sigma2 = sigma * sigma; final int numPoints = 5; diff --git a/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java b/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java index 8b40669b8..8c78aed00 100644 --- a/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java +++ b/src/test/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java @@ -595,7 +595,6 @@ public final class BicubicSplineInterpolatingFunctionTest { = new UniformRealDistribution(rng, yval[0], yval[yval.length - 1]); final double tol = 224; - double max = 0; for (int i = 0; i < sz; i++) { x = distX.sample(); for (int j = 0; j < sz; j++) { diff --git a/src/test/java/org/apache/commons/math3/distribution/KolmogorovSmirnovDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/KolmogorovSmirnovDistributionTest.java index d5fcaa0e4..53f4ff86d 100644 --- a/src/test/java/org/apache/commons/math3/distribution/KolmogorovSmirnovDistributionTest.java +++ b/src/test/java/org/apache/commons/math3/distribution/KolmogorovSmirnovDistributionTest.java @@ -24,6 +24,7 @@ import org.junit.Test; * Test cases for {@link KolmogorovSmirnovDistribution}. * */ +@Deprecated public class KolmogorovSmirnovDistributionTest { private static final double TOLERANCE = 10e-10; diff --git a/src/test/java/org/apache/commons/math3/distribution/MultivariateNormalMixtureModelDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/MultivariateNormalMixtureModelDistributionTest.java index 03df01220..12a23c2ee 100644 --- a/src/test/java/org/apache/commons/math3/distribution/MultivariateNormalMixtureModelDistributionTest.java +++ b/src/test/java/org/apache/commons/math3/distribution/MultivariateNormalMixtureModelDistributionTest.java @@ -58,8 +58,7 @@ public class MultivariateNormalMixtureModelDistributionTest { { -1.1, 2.0 } }, { { 3.5, 1.5 }, { 1.5, 3.5 } } }; - final MultivariateNormalMixtureModelDistribution d - = create(weights, means, covariances); + create(weights, means, covariances); } @Test(expected=NotPositiveException.class) @@ -71,8 +70,7 @@ public class MultivariateNormalMixtureModelDistributionTest { { -1.1, 2.0 } }, { { 3.5, 1.5 }, { 1.5, 3.5 } } }; - final MultivariateNormalMixtureModelDistribution d - = create(negativeWeights, means, covariances); + create(negativeWeights, means, covariances); } /** diff --git a/src/test/java/org/apache/commons/math3/fitting/CurveFitterTest.java b/src/test/java/org/apache/commons/math3/fitting/CurveFitterTest.java index 7f07e3de6..d08e9426e 100644 --- a/src/test/java/org/apache/commons/math3/fitting/CurveFitterTest.java +++ b/src/test/java/org/apache/commons/math3/fitting/CurveFitterTest.java @@ -22,6 +22,7 @@ import org.apache.commons.math3.util.FastMath; import org.junit.Assert; import org.junit.Test; +@Deprecated public class CurveFitterTest { @Test public void testMath303() { diff --git a/src/test/java/org/apache/commons/math3/fitting/GaussianCurveFitterTest.java b/src/test/java/org/apache/commons/math3/fitting/GaussianCurveFitterTest.java index 3437e9e03..153274b7f 100644 --- a/src/test/java/org/apache/commons/math3/fitting/GaussianCurveFitterTest.java +++ b/src/test/java/org/apache/commons/math3/fitting/GaussianCurveFitterTest.java @@ -210,10 +210,9 @@ public class GaussianCurveFitterTest { final double[] init = { 3.5e6, 4.2, 0.1 }; GaussianCurveFitter fitter = GaussianCurveFitter.create(); - double[] parameters = fitter - .withMaxIterations(maxIter) - .withStartPoint(init) - .fit(createDataset(DATASET1).toList()); + fitter.withMaxIterations(maxIter) + .withStartPoint(init) + .fit(createDataset(DATASET1).toList()); } @Test diff --git a/src/test/java/org/apache/commons/math3/fitting/GaussianFitterTest.java b/src/test/java/org/apache/commons/math3/fitting/GaussianFitterTest.java index b7fd32d91..ddec57daf 100644 --- a/src/test/java/org/apache/commons/math3/fitting/GaussianFitterTest.java +++ b/src/test/java/org/apache/commons/math3/fitting/GaussianFitterTest.java @@ -26,6 +26,7 @@ import org.junit.Test; * * @since 2.2 */ +@Deprecated public class GaussianFitterTest { /** Good data. */ protected static final double[][] DATASET1 = new double[][] { diff --git a/src/test/java/org/apache/commons/math3/fitting/HarmonicCurveFitterTest.java b/src/test/java/org/apache/commons/math3/fitting/HarmonicCurveFitterTest.java index 9b797ea67..9f6a15c8d 100644 --- a/src/test/java/org/apache/commons/math3/fitting/HarmonicCurveFitterTest.java +++ b/src/test/java/org/apache/commons/math3/fitting/HarmonicCurveFitterTest.java @@ -16,18 +16,17 @@ */ package org.apache.commons.math3.fitting; -import java.util.Random; -import java.util.List; import java.util.ArrayList; -import org.apache.commons.math3.optim.nonlinear.vector.jacobian.LevenbergMarquardtOptimizer; +import java.util.List; +import java.util.Random; + import org.apache.commons.math3.analysis.function.HarmonicOscillator; -import org.apache.commons.math3.exception.NumberIsTooSmallException; import org.apache.commons.math3.exception.MathIllegalStateException; +import org.apache.commons.math3.exception.NumberIsTooSmallException; import org.apache.commons.math3.util.FastMath; import org.apache.commons.math3.util.MathUtils; - -import org.junit.Test; import org.junit.Assert; +import org.junit.Test; public class HarmonicCurveFitterTest { /** @@ -92,7 +91,7 @@ public class HarmonicCurveFitterTest { } final HarmonicCurveFitter fitter = HarmonicCurveFitter.create(); - final double[] fitted = fitter.fit(points.toList()); + fitter.fit(points.toList()); // This test serves to cover the part of the code of "guessAOmega" // when the algorithm using integrals fails. diff --git a/src/test/java/org/apache/commons/math3/fitting/HarmonicFitterTest.java b/src/test/java/org/apache/commons/math3/fitting/HarmonicFitterTest.java index 50cb3ba7a..8a6dceac8 100644 --- a/src/test/java/org/apache/commons/math3/fitting/HarmonicFitterTest.java +++ b/src/test/java/org/apache/commons/math3/fitting/HarmonicFitterTest.java @@ -17,16 +17,17 @@ package org.apache.commons.math3.fitting; import java.util.Random; + import org.apache.commons.math3.optim.nonlinear.vector.jacobian.LevenbergMarquardtOptimizer; import org.apache.commons.math3.analysis.function.HarmonicOscillator; import org.apache.commons.math3.exception.NumberIsTooSmallException; import org.apache.commons.math3.exception.MathIllegalStateException; import org.apache.commons.math3.util.FastMath; import org.apache.commons.math3.util.MathUtils; - import org.junit.Test; import org.junit.Assert; +@Deprecated public class HarmonicFitterTest { @Test(expected=NumberIsTooSmallException.class) public void testPreconditions1() { diff --git a/src/test/java/org/apache/commons/math3/fitting/PolynomialCurveFitterTest.java b/src/test/java/org/apache/commons/math3/fitting/PolynomialCurveFitterTest.java index 3681caea3..6b8dfa264 100644 --- a/src/test/java/org/apache/commons/math3/fitting/PolynomialCurveFitterTest.java +++ b/src/test/java/org/apache/commons/math3/fitting/PolynomialCurveFitterTest.java @@ -17,15 +17,15 @@ package org.apache.commons.math3.fitting; import java.util.Random; + +import org.apache.commons.math3.TestUtils; import org.apache.commons.math3.analysis.polynomials.PolynomialFunction; -import org.apache.commons.math3.exception.ConvergenceException; -import org.apache.commons.math3.optim.nonlinear.vector.MultivariateVectorOptimizer; -import org.apache.commons.math3.util.FastMath; import org.apache.commons.math3.distribution.RealDistribution; import org.apache.commons.math3.distribution.UniformRealDistribution; -import org.apache.commons.math3.TestUtils; -import org.junit.Test; +import org.apache.commons.math3.exception.ConvergenceException; +import org.apache.commons.math3.util.FastMath; import org.junit.Assert; +import org.junit.Test; /** * Test for class {@link PolynomialCurveFitter}. diff --git a/src/test/java/org/apache/commons/math3/fitting/PolynomialFitterTest.java b/src/test/java/org/apache/commons/math3/fitting/PolynomialFitterTest.java index e9fe61f03..a0531570c 100644 --- a/src/test/java/org/apache/commons/math3/fitting/PolynomialFitterTest.java +++ b/src/test/java/org/apache/commons/math3/fitting/PolynomialFitterTest.java @@ -17,6 +17,7 @@ package org.apache.commons.math3.fitting; import java.util.Random; + import org.apache.commons.math3.analysis.polynomials.PolynomialFunction; import org.apache.commons.math3.analysis.polynomials.PolynomialFunction.Parametric; import org.apache.commons.math3.exception.ConvergenceException; @@ -36,6 +37,7 @@ import org.junit.Assert; * Test for class {@link CurveFitter} where the function to fit is a * polynomial. */ +@Deprecated public class PolynomialFitterTest { @Test public void testFit() { diff --git a/src/test/java/org/apache/commons/math3/fitting/leastsquares/AbstractLeastSquaresOptimizerAbstractTest.java b/src/test/java/org/apache/commons/math3/fitting/leastsquares/AbstractLeastSquaresOptimizerAbstractTest.java index 6ff34aa7c..bb9c9ac7c 100644 --- a/src/test/java/org/apache/commons/math3/fitting/leastsquares/AbstractLeastSquaresOptimizerAbstractTest.java +++ b/src/test/java/org/apache/commons/math3/fitting/leastsquares/AbstractLeastSquaresOptimizerAbstractTest.java @@ -556,7 +556,7 @@ public abstract class AbstractLeastSquaresOptimizerAbstractTest { return true; } }); - Optimum optimum = optimizer.optimize(builder.build()); + optimizer.optimize(builder.build()); Assert.assertThat(checked[0], is(true)); } diff --git a/src/test/java/org/apache/commons/math3/fitting/leastsquares/EvaluationTest.java b/src/test/java/org/apache/commons/math3/fitting/leastsquares/EvaluationTest.java index 8e03fdfc1..9cfbe0bab 100644 --- a/src/test/java/org/apache/commons/math3/fitting/leastsquares/EvaluationTest.java +++ b/src/test/java/org/apache/commons/math3/fitting/leastsquares/EvaluationTest.java @@ -295,7 +295,7 @@ public class EvaluationTest { try { // Should throw. - final Evaluation eval = p.evaluate(dummy); + p.evaluate(dummy); Assert.fail("Exception expected"); } catch (RuntimeException e) { // Expecting exception. diff --git a/src/test/java/org/apache/commons/math3/fitting/leastsquares/EvaluationTestValidation.java b/src/test/java/org/apache/commons/math3/fitting/leastsquares/EvaluationTestValidation.java index 9d79988f8..eaa7b8d37 100644 --- a/src/test/java/org/apache/commons/math3/fitting/leastsquares/EvaluationTestValidation.java +++ b/src/test/java/org/apache/commons/math3/fitting/leastsquares/EvaluationTestValidation.java @@ -201,7 +201,6 @@ public class EvaluationTestValidation { // Number of observations. final int numObs = 10; // number of parameters. - final int numParams = 2; // Create a single set of observations. final Point2D.Double[] obs = lineGenerator.generate(numObs); @@ -218,7 +217,6 @@ public class EvaluationTestValidation { // Dummy optimizer (to compute the chi-square). final LeastSquaresProblem lsp = builder(problem).build(); - final double[] init = { slope, offset }; // Get chi-square of the best parameters set for the given set of // observations. final double bestChi2N = getChi2N(lsp, regress); diff --git a/src/test/java/org/apache/commons/math3/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java b/src/test/java/org/apache/commons/math3/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java index 96831fcea..b2c8f54a7 100644 --- a/src/test/java/org/apache/commons/math3/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java +++ b/src/test/java/org/apache/commons/math3/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java @@ -288,48 +288,6 @@ public class LevenbergMarquardtOptimizerTest Assert.assertThat(optimum.getEvaluations(), is(2)); } - //TODO delete or use - private static class QuadraticProblem { - private List x; - private List y; - - public QuadraticProblem() { - x = new ArrayList(); - y = new ArrayList(); - } - - public void addPoint(double x, double y) { - this.x.add(x); - this.y.add(y); - } - - public MultivariateVectorFunction getModelFunction() { - return new MultivariateVectorFunction() { - public double[] value(double[] variables) { - double[] values = new double[x.size()]; - for (int i = 0; i < values.length; ++i) { - values[i] = (variables[0] * x.get(i) + variables[1]) * x.get(i) + variables[2]; - } - return values; - } - }; - } - - public MultivariateMatrixFunction getModelFunctionJacobian() { - return new MultivariateMatrixFunction() { - public double[][] value(double[] params) { - double[][] jacobian = new double[x.size()][3]; - for (int i = 0; i < jacobian.length; ++i) { - jacobian[i][0] = x.get(i) * x.get(i); - jacobian[i][1] = x.get(i); - jacobian[i][2] = 1.0; - } - return jacobian; - } - }; - } - } - private static class BevingtonProblem { private List time; private List count; diff --git a/src/test/java/org/apache/commons/math3/fitting/leastsquares/MinpackTest.java b/src/test/java/org/apache/commons/math3/fitting/leastsquares/MinpackTest.java index c0ed21ac0..b91140bec 100644 --- a/src/test/java/org/apache/commons/math3/fitting/leastsquares/MinpackTest.java +++ b/src/test/java/org/apache/commons/math3/fitting/leastsquares/MinpackTest.java @@ -610,7 +610,6 @@ public class MinpackTest { } private static class LinearFullRankFunction extends MinpackFunction { - private static final long serialVersionUID = -9030323226268039536L; public LinearFullRankFunction(int m, int n, double x0, double theoreticalStartCost, @@ -649,7 +648,6 @@ public class MinpackTest { } private static class LinearRank1Function extends MinpackFunction { - private static final long serialVersionUID = 8494863245104608300L; public LinearRank1Function(int m, int n, double x0, double theoreticalStartCost, @@ -684,7 +682,6 @@ public class MinpackTest { } private static class LinearRank1ZeroColsAndRowsFunction extends MinpackFunction { - private static final long serialVersionUID = -3316653043091995018L; public LinearRank1ZeroColsAndRowsFunction(int m, int n, double x0) { super(m, buildArray(n, x0), @@ -728,7 +725,6 @@ public class MinpackTest { } private static class RosenbrockFunction extends MinpackFunction { - private static final long serialVersionUID = 2893438180956569134L; public RosenbrockFunction(double[] startParams, double theoreticalStartCost) { super(2, startParams, 0.0, buildArray(2, 1.0)); } @@ -748,7 +744,6 @@ public class MinpackTest { } private static class HelicalValleyFunction extends MinpackFunction { - private static final long serialVersionUID = 220613787843200102L; public HelicalValleyFunction(double[] startParams, double theoreticalStartCost) { super(3, startParams, 0.0, new double[] { 1.0, 0.0, 0.0 }); @@ -794,7 +789,6 @@ public class MinpackTest { } private static class PowellSingularFunction extends MinpackFunction { - private static final long serialVersionUID = 7298364171208142405L; public PowellSingularFunction(double[] startParams, double theoreticalStartCost) { @@ -834,7 +828,6 @@ public class MinpackTest { } private static class FreudensteinRothFunction extends MinpackFunction { - private static final long serialVersionUID = 2892404999344244214L; public FreudensteinRothFunction(double[] startParams, double theoreticalStartCost, @@ -865,7 +858,6 @@ public class MinpackTest { } private static class BardFunction extends MinpackFunction { - private static final long serialVersionUID = 5990442612572087668L; public BardFunction(double x0, double theoreticalStartCost, @@ -914,7 +906,6 @@ public class MinpackTest { } private static class KowalikOsborneFunction extends MinpackFunction { - private static final long serialVersionUID = -4867445739880495801L; public KowalikOsborneFunction(double[] startParams, double theoreticalStartCost, @@ -970,7 +961,6 @@ public class MinpackTest { } private static class MeyerFunction extends MinpackFunction { - private static final long serialVersionUID = -838060619150131027L; public MeyerFunction(double[] startParams, double theoreticalStartCost, @@ -1021,7 +1011,6 @@ public class MinpackTest { } private static class WatsonFunction extends MinpackFunction { - private static final long serialVersionUID = -9034759294980218927L; public WatsonFunction(int n, double x0, double theoreticalStartCost, @@ -1092,7 +1081,6 @@ public class MinpackTest { } private static class Box3DimensionalFunction extends MinpackFunction { - private static final long serialVersionUID = 5511403858142574493L; public Box3DimensionalFunction(int m, double[] startParams, double theoreticalStartCost) { @@ -1132,7 +1120,6 @@ public class MinpackTest { } private static class JennrichSampsonFunction extends MinpackFunction { - private static final long serialVersionUID = -2489165190443352947L; public JennrichSampsonFunction(int m, double[] startParams, double theoreticalStartCost, @@ -1168,7 +1155,6 @@ public class MinpackTest { } private static class BrownDennisFunction extends MinpackFunction { - private static final long serialVersionUID = 8340018645694243910L; public BrownDennisFunction(int m, double[] startParams, double theoreticalStartCost, @@ -1216,7 +1202,6 @@ public class MinpackTest { } private static class ChebyquadFunction extends MinpackFunction { - private static final long serialVersionUID = -2394877275028008594L; private static double[] buildChebyquadArray(int n, double factor) { double[] array = new double[n]; @@ -1294,7 +1279,6 @@ public class MinpackTest { } private static class BrownAlmostLinearFunction extends MinpackFunction { - private static final long serialVersionUID = 8239594490466964725L; public BrownAlmostLinearFunction(int m, double factor, double theoreticalStartCost, @@ -1355,7 +1339,6 @@ public class MinpackTest { } private static class Osborne1Function extends MinpackFunction { - private static final long serialVersionUID = 4006743521149849494L; public Osborne1Function(double[] startParams, double theoreticalStartCost, @@ -1408,7 +1391,6 @@ public class MinpackTest { } private static class Osborne2Function extends MinpackFunction { - private static final long serialVersionUID = -8418268780389858746L; public Osborne2Function(double[] startParams, double theoreticalStartCost, diff --git a/src/test/java/org/apache/commons/math3/linear/BlockFieldMatrixTest.java b/src/test/java/org/apache/commons/math3/linear/BlockFieldMatrixTest.java index 8f4854b51..193b8738b 100644 --- a/src/test/java/org/apache/commons/math3/linear/BlockFieldMatrixTest.java +++ b/src/test/java/org/apache/commons/math3/linear/BlockFieldMatrixTest.java @@ -376,7 +376,7 @@ public final class BlockFieldMatrixTest { public void testOperate() { FieldMatrix m = new BlockFieldMatrix(id); TestUtils.assertEquals(testVector, m.operate(testVector)); - TestUtils.assertEquals(testVector, m.operate(new ArrayFieldVector(testVector)).getData()); + TestUtils.assertEquals(testVector, m.operate(new ArrayFieldVector(testVector)).toArray()); m = new BlockFieldMatrix(bigSingular); try { m.operate(testVector); diff --git a/src/test/java/org/apache/commons/math3/linear/FieldMatrixImplTest.java b/src/test/java/org/apache/commons/math3/linear/FieldMatrixImplTest.java index 0dd77f74f..11e4beea9 100644 --- a/src/test/java/org/apache/commons/math3/linear/FieldMatrixImplTest.java +++ b/src/test/java/org/apache/commons/math3/linear/FieldMatrixImplTest.java @@ -269,7 +269,7 @@ public final class FieldMatrixImplTest { public void testOperate() { FieldMatrix m = new Array2DRowFieldMatrix(id); TestUtils.assertEquals(testVector, m.operate(testVector)); - TestUtils.assertEquals(testVector, m.operate(new ArrayFieldVector(testVector)).getData()); + TestUtils.assertEquals(testVector, m.operate(new ArrayFieldVector(testVector)).toArray()); m = new Array2DRowFieldMatrix(bigSingular); try { m.operate(testVector); diff --git a/src/test/java/org/apache/commons/math3/ml/neuralnet/OffsetFeatureInitializer.java b/src/test/java/org/apache/commons/math3/ml/neuralnet/OffsetFeatureInitializer.java index 15ee1ad51..9c800cc84 100644 --- a/src/test/java/org/apache/commons/math3/ml/neuralnet/OffsetFeatureInitializer.java +++ b/src/test/java/org/apache/commons/math3/ml/neuralnet/OffsetFeatureInitializer.java @@ -17,10 +17,6 @@ package org.apache.commons.math3.ml.neuralnet; -import org.junit.Test; -import org.junit.Assert; -import org.apache.commons.math3.random.RandomGenerator; -import org.apache.commons.math3.random.Well44497b; /** * Wraps a given initializer. diff --git a/src/test/java/org/apache/commons/math3/ml/neuralnet/oned/NeuronStringTest.java b/src/test/java/org/apache/commons/math3/ml/neuralnet/oned/NeuronStringTest.java index 7f67130aa..782cbdaa4 100644 --- a/src/test/java/org/apache/commons/math3/ml/neuralnet/oned/NeuronStringTest.java +++ b/src/test/java/org/apache/commons/math3/ml/neuralnet/oned/NeuronStringTest.java @@ -17,23 +17,20 @@ package org.apache.commons.math3.ml.neuralnet.oned; -import java.io.ByteArrayOutputStream; import java.io.ByteArrayInputStream; -import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; +import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.util.ArrayList; -import java.util.HashSet; import java.util.Collection; -import org.junit.Test; -import org.junit.Assert; -import org.junit.Ignore; -import org.apache.commons.math3.exception.NumberIsTooSmallException; + import org.apache.commons.math3.ml.neuralnet.FeatureInitializer; import org.apache.commons.math3.ml.neuralnet.FeatureInitializerFactory; import org.apache.commons.math3.ml.neuralnet.Network; import org.apache.commons.math3.ml.neuralnet.Neuron; -import org.apache.commons.math3.random.Well44497b; +import org.junit.Assert; +import org.junit.Test; /** * Tests for {@link NeuronString} and {@link Network} functionality for diff --git a/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenTrainingTaskTest.java b/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenTrainingTaskTest.java index cd1d60f9d..6d5177b41 100644 --- a/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenTrainingTaskTest.java +++ b/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenTrainingTaskTest.java @@ -17,26 +17,22 @@ package org.apache.commons.math3.ml.neuralnet.sofm; -import java.util.Set; -import java.util.HashSet; -import java.util.Collection; -import java.util.List; import java.util.ArrayList; -import java.util.concurrent.Executors; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Future; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import java.util.concurrent.ExecutionException; -import java.io.PrintWriter; -import java.io.FileNotFoundException; -import java.io.IOException; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.Assert; -import org.junit.runner.RunWith; -import org.apache.commons.math3.RetryRunner; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + import org.apache.commons.math3.Retry; +import org.apache.commons.math3.RetryRunner; import org.apache.commons.math3.util.FastMath; -import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; /** * Tests for {@link KohonenTrainingTask} @@ -127,24 +123,6 @@ public class KohonenTrainingTaskTest { Assert.assertEquals(1, ratio, 1e-1); // We do not require the optimal travel. } - /** - * Creates a map of the travel suggested by the solver. - * - * @param solver Solver. - * @return a 4-columns table: {@code }. - */ - private String travelCoordinatesTable(TravellingSalesmanSolver solver) { - final StringBuilder s = new StringBuilder(); - for (double[] c : solver.getCoordinatesList()) { - s.append(c[0]).append(" ").append(c[1]).append(" "); - final City city = solver.getClosestCity(c[0], c[1]); - final double[] cityCoord = city.getCoordinates(); - s.append(cityCoord[0]).append(" ").append(cityCoord[1]).append(" "); - s.append(" # ").append(city.getName()).append("\n"); - } - return s.toString(); - } - /** * Compute the distance covered by the salesman, including * the trip back (from the last to first city). @@ -182,29 +160,4 @@ public class KohonenTrainingTaskTest { return dist; } - /** - * Prints a summary of the current state of the solver to the - * given filename. - * - * @param filename File. - * @param solver Solver. - */ - private void printSummary(String filename, - TravellingSalesmanSolver solver) { - PrintWriter out = null; - try { - out = new PrintWriter(filename); - out.println(travelCoordinatesTable(solver)); - - final City[] result = solver.getCityList(); - out.println("# Number of unique cities: " + uniqueCities(result).size()); - out.println("# Travel distance: " + computeTravelDistance(result)); - } catch (Exception e) { - // Do nothing. - } finally { - if (out != null) { - out.close(); - } - } - } } diff --git a/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/TravellingSalesmanSolver.java b/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/TravellingSalesmanSolver.java index f64f2ebce..369ea33d2 100644 --- a/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/TravellingSalesmanSolver.java +++ b/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/TravellingSalesmanSolver.java @@ -79,9 +79,6 @@ public class TravellingSalesmanSolver { long seed) { random = new Well44497b(seed); - final double[] xRange = {Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY}; - final double[] yRange = {Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY}; - // Make sure that each city will appear only once in the list. for (City city : cityList) { cities.add(city); diff --git a/src/test/java/org/apache/commons/math3/ml/neuralnet/twod/NeuronSquareMesh2DTest.java b/src/test/java/org/apache/commons/math3/ml/neuralnet/twod/NeuronSquareMesh2DTest.java index 1067dcd7c..9d5f21c35 100644 --- a/src/test/java/org/apache/commons/math3/ml/neuralnet/twod/NeuronSquareMesh2DTest.java +++ b/src/test/java/org/apache/commons/math3/ml/neuralnet/twod/NeuronSquareMesh2DTest.java @@ -17,23 +17,22 @@ package org.apache.commons.math3.ml.neuralnet.twod; -import java.io.ByteArrayOutputStream; import java.io.ByteArrayInputStream; -import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; +import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.util.Collection; -import org.junit.Test; -import org.junit.Assert; -import org.junit.Ignore; +import java.util.HashSet; + +import org.apache.commons.math3.exception.NumberIsTooSmallException; import org.apache.commons.math3.ml.neuralnet.FeatureInitializer; import org.apache.commons.math3.ml.neuralnet.FeatureInitializerFactory; import org.apache.commons.math3.ml.neuralnet.Network; import org.apache.commons.math3.ml.neuralnet.Neuron; import org.apache.commons.math3.ml.neuralnet.SquareNeighbourhood; -import org.apache.commons.math3.exception.NumberIsTooSmallException; +import org.junit.Assert; +import org.junit.Test; /** * Tests for {@link NeuronSquareMesh2D} and {@link Network} functionality for diff --git a/src/test/java/org/apache/commons/math3/ode/sampling/DummyStepInterpolatorTest.java b/src/test/java/org/apache/commons/math3/ode/sampling/DummyStepInterpolatorTest.java index 380412574..3f4ad374f 100644 --- a/src/test/java/org/apache/commons/math3/ode/sampling/DummyStepInterpolatorTest.java +++ b/src/test/java/org/apache/commons/math3/ode/sampling/DummyStepInterpolatorTest.java @@ -120,9 +120,6 @@ public class DummyStepInterpolatorTest { } private static class BadStepInterpolator extends DummyStepInterpolator { - @SuppressWarnings("unused") - public BadStepInterpolator() { - } public BadStepInterpolator(double[] y, boolean forward) { super(y, new double[y.length], forward); } diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizerTest.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizerTest.java index 66733683d..bf22542a3 100644 --- a/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizerTest.java +++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizerTest.java @@ -19,7 +19,6 @@ package org.apache.commons.math3.optim.nonlinear.scalar.gradient; import org.apache.commons.math3.analysis.MultivariateFunction; import org.apache.commons.math3.analysis.MultivariateVectorFunction; -import org.apache.commons.math3.analysis.solvers.BrentSolver; import org.apache.commons.math3.exception.MathUnsupportedOperationException; import org.apache.commons.math3.geometry.euclidean.twod.Vector2D; import org.apache.commons.math3.linear.BlockRealMatrix; diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizerTest.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizerTest.java index 0a75c5eec..af565e5f0 100644 --- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizerTest.java +++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizerTest.java @@ -96,6 +96,7 @@ import org.junit.Test; * @author Jorge J. More (original fortran minpack tests) * @author Luc Maisonobe (non-minpack tests and minpack tests Java translation) */ +@Deprecated public class MultiStartMultivariateVectorOptimizerTest { @Test(expected=NullPointerException.class) diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java index 2dc8efe01..7a9c9eb97 100644 --- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java +++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java @@ -18,6 +18,7 @@ package org.apache.commons.math3.optim.nonlinear.vector.jacobian; import java.io.IOException; import java.util.Arrays; + import org.apache.commons.math3.analysis.MultivariateVectorFunction; import org.apache.commons.math3.analysis.MultivariateMatrixFunction; import org.apache.commons.math3.exception.ConvergenceException; @@ -98,6 +99,7 @@ import org.junit.Test; * @author Jorge J. More (original fortran minpack tests) * @author Luc Maisonobe (non-minpack tests and minpack tests Java translation) */ +@Deprecated public abstract class AbstractLeastSquaresOptimizerAbstractTest { public abstract AbstractLeastSquaresOptimizer createOptimizer(); diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTest.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTest.java index 719761631..92ad195f7 100644 --- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTest.java +++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTest.java @@ -15,6 +15,7 @@ package org.apache.commons.math3.optim.nonlinear.vector.jacobian; import java.io.IOException; import java.util.Arrays; + import org.apache.commons.math3.optim.PointVectorValuePair; import org.apache.commons.math3.optim.InitialGuess; import org.apache.commons.math3.optim.MaxEval; @@ -24,6 +25,7 @@ import org.apache.commons.math3.util.FastMath; import org.junit.Test; import org.junit.Assert; +@Deprecated public class AbstractLeastSquaresOptimizerTest { public static AbstractLeastSquaresOptimizer createOptimizer() { diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTestValidation.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTestValidation.java index d9aa76141..575b95c44 100644 --- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTestValidation.java +++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTestValidation.java @@ -17,6 +17,7 @@ import java.util.Arrays; import java.util.List; import java.util.ArrayList; import java.awt.geom.Point2D; + import org.apache.commons.math3.optim.PointVectorValuePair; import org.apache.commons.math3.optim.InitialGuess; import org.apache.commons.math3.optim.MaxEval; @@ -45,6 +46,7 @@ import org.junit.Assert; * mvn test -Dtest=AbstractLeastSquaresOptimizerTestValidation -DargLine="-DmcRuns=1234 -server" * */ +@Deprecated public class AbstractLeastSquaresOptimizerTestValidation { private static final int MONTE_CARLO_RUNS = Integer.parseInt(System.getProperty("mcRuns", "100")); @@ -208,8 +210,6 @@ public class AbstractLeastSquaresOptimizerTestValidation { // Number of observations. final int numObs = 10; - // number of parameters. - final int numParams = 2; // Create a single set of observations. final Point2D.Double[] obs = lineGenerator.generate(numObs); @@ -225,7 +225,6 @@ public class AbstractLeastSquaresOptimizerTestValidation { // Dummy optimizer (to compute the chi-square). final AbstractLeastSquaresOptimizer optim = new DummyOptimizer(); - final double[] init = { slope, offset }; // Get chi-square of the best parameters set for the given set of // observations. final double bestChi2N = getChi2N(optim, problem, regress); @@ -316,6 +315,7 @@ public class AbstractLeastSquaresOptimizerTestValidation { * A dummy optimizer. * Used for computing the covariance matrix. */ +@Deprecated class DummyOptimizer extends AbstractLeastSquaresOptimizer { public DummyOptimizer() { super(null); diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleProblem.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleProblem.java index 41414fbda..fe2c3bc74 100644 --- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleProblem.java +++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleProblem.java @@ -17,6 +17,7 @@ package org.apache.commons.math3.optim.nonlinear.vector.jacobian; import java.util.ArrayList; + import org.apache.commons.math3.analysis.MultivariateVectorFunction; import org.apache.commons.math3.analysis.MultivariateMatrixFunction; import org.apache.commons.math3.util.MathUtils; @@ -38,6 +39,7 @@ import org.apache.commons.math3.optim.nonlinear.vector.ModelFunctionJacobian; * corresponding circle. * */ +@Deprecated class CircleProblem { /** Cloud of points assumed to be fitted by a circle. */ private final ArrayList points; diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleVectorial.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleVectorial.java index 0248f9e06..2f6354768 100644 --- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleVectorial.java +++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/CircleVectorial.java @@ -18,6 +18,7 @@ package org.apache.commons.math3.optim.nonlinear.vector.jacobian; import java.util.ArrayList; + import org.apache.commons.math3.analysis.MultivariateVectorFunction; import org.apache.commons.math3.analysis.MultivariateMatrixFunction; import org.apache.commons.math3.geometry.euclidean.twod.Vector2D; @@ -27,6 +28,7 @@ import org.apache.commons.math3.optim.nonlinear.vector.ModelFunctionJacobian; /** * Class used in the tests. */ +@Deprecated class CircleVectorial { private ArrayList points; diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/GaussNewtonOptimizerTest.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/GaussNewtonOptimizerTest.java index 900f834b5..ee3d00fa8 100644 --- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/GaussNewtonOptimizerTest.java +++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/GaussNewtonOptimizerTest.java @@ -18,6 +18,7 @@ package org.apache.commons.math3.optim.nonlinear.vector.jacobian; import java.io.IOException; + import org.apache.commons.math3.exception.ConvergenceException; import org.apache.commons.math3.exception.TooManyEvaluationsException; import org.apache.commons.math3.exception.MathUnsupportedOperationException; @@ -91,6 +92,7 @@ import org.junit.Test; * @author Jorge J. More (original fortran minpack tests) * @author Luc Maisonobe (non-minpack tests and minpack tests Java translation) */ +@Deprecated public class GaussNewtonOptimizerTest extends AbstractLeastSquaresOptimizerAbstractTest { diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizerTest.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizerTest.java index 9d5de801b..9a2708923 100644 --- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizerTest.java +++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizerTest.java @@ -19,6 +19,7 @@ package org.apache.commons.math3.optim.nonlinear.vector.jacobian; import java.util.ArrayList; import java.util.List; + import org.apache.commons.math3.optim.PointVectorValuePair; import org.apache.commons.math3.optim.InitialGuess; import org.apache.commons.math3.optim.MaxEval; @@ -101,6 +102,7 @@ import org.junit.Test; * @author Jorge J. More (original fortran minpack tests) * @author Luc Maisonobe (non-minpack tests and minpack tests Java translation) */ +@Deprecated public class LevenbergMarquardtOptimizerTest extends AbstractLeastSquaresOptimizerAbstractTest { @Override @@ -316,47 +318,6 @@ public class LevenbergMarquardtOptimizerTest Assert.assertEquals(radius, paramFound[2], asymptoticStandardErrorFound[2]); } - private static class QuadraticProblem { - private List x; - private List y; - - public QuadraticProblem() { - x = new ArrayList(); - y = new ArrayList(); - } - - public void addPoint(double x, double y) { - this.x.add(x); - this.y.add(y); - } - - public ModelFunction getModelFunction() { - return new ModelFunction(new MultivariateVectorFunction() { - public double[] value(double[] variables) { - double[] values = new double[x.size()]; - for (int i = 0; i < values.length; ++i) { - values[i] = (variables[0] * x.get(i) + variables[1]) * x.get(i) + variables[2]; - } - return values; - } - }); - } - - public ModelFunctionJacobian getModelFunctionJacobian() { - return new ModelFunctionJacobian(new MultivariateMatrixFunction() { - public double[][] value(double[] params) { - double[][] jacobian = new double[x.size()][3]; - for (int i = 0; i < jacobian.length; ++i) { - jacobian[i][0] = x.get(i) * x.get(i); - jacobian[i][1] = x.get(i); - jacobian[i][2] = 1.0; - } - return jacobian; - } - }); - } - } - private static class BevingtonProblem { private List time; private List count; diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/MinpackTest.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/MinpackTest.java index a48cb5501..898dbddc1 100644 --- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/MinpackTest.java +++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/MinpackTest.java @@ -18,6 +18,7 @@ package org.apache.commons.math3.optim.nonlinear.vector.jacobian; import java.util.Arrays; + import org.apache.commons.math3.exception.TooManyEvaluationsException; import org.apache.commons.math3.analysis.MultivariateVectorFunction; import org.apache.commons.math3.analysis.MultivariateMatrixFunction; @@ -94,6 +95,7 @@ import org.junit.Test; * @author Jorge J. More (original fortran minpack tests) * @author Luc Maisonobe (non-minpack tests and minpack tests Java translation) */ +@Deprecated public class MinpackTest { @Test diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/RandomCirclePointGenerator.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/RandomCirclePointGenerator.java index 2c747157b..fdbe23664 100644 --- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/RandomCirclePointGenerator.java +++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/RandomCirclePointGenerator.java @@ -28,6 +28,7 @@ import org.apache.commons.math3.geometry.euclidean.twod.Vector2D; /** * Factory for generating a cloud of points that approximate a circle. */ +@Deprecated public class RandomCirclePointGenerator { /** RNG for the x-coordinate of the center. */ private final RealDistribution cX; diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/RandomStraightLinePointGenerator.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/RandomStraightLinePointGenerator.java index 91e4baecb..2da67c6aa 100644 --- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/RandomStraightLinePointGenerator.java +++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/RandomStraightLinePointGenerator.java @@ -18,6 +18,7 @@ package org.apache.commons.math3.optim.nonlinear.vector.jacobian; import java.awt.geom.Point2D; + import org.apache.commons.math3.random.RandomGenerator; import org.apache.commons.math3.random.Well44497b; import org.apache.commons.math3.distribution.RealDistribution; @@ -27,6 +28,7 @@ import org.apache.commons.math3.distribution.NormalDistribution; /** * Factory for generating a cloud of points that approximate a straight line. */ +@Deprecated public class RandomStraightLinePointGenerator { /** Slope. */ private final double slope; diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/StatisticalReferenceDataset.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/StatisticalReferenceDataset.java index 93dcbbf88..6fca15427 100644 --- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/StatisticalReferenceDataset.java +++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/StatisticalReferenceDataset.java @@ -19,6 +19,7 @@ package org.apache.commons.math3.optim.nonlinear.vector.jacobian; import java.io.BufferedReader; import java.io.IOException; import java.util.ArrayList; + import org.apache.commons.math3.analysis.MultivariateVectorFunction; import org.apache.commons.math3.analysis.MultivariateMatrixFunction; import org.apache.commons.math3.optim.nonlinear.vector.ModelFunction; @@ -32,6 +33,7 @@ import org.apache.commons.math3.util.MathArrays; * Instances of this class can be created by invocation of the * {@link StatisticalReferenceDatasetFactory}. */ +@Deprecated public abstract class StatisticalReferenceDataset { /** The name of this dataset. */ diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/StatisticalReferenceDatasetFactory.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/StatisticalReferenceDatasetFactory.java index a9cac8ae7..2c491658e 100644 --- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/StatisticalReferenceDatasetFactory.java +++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/StatisticalReferenceDatasetFactory.java @@ -20,12 +20,14 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; + import org.apache.commons.math3.util.FastMath; /** * A factory to create instances of {@link StatisticalReferenceDataset} from * available resources. */ +@Deprecated public class StatisticalReferenceDatasetFactory { private StatisticalReferenceDatasetFactory() { diff --git a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/StraightLineProblem.java b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/StraightLineProblem.java index 09c16df97..092e37fbe 100644 --- a/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/StraightLineProblem.java +++ b/src/test/java/org/apache/commons/math3/optim/nonlinear/vector/jacobian/StraightLineProblem.java @@ -18,6 +18,7 @@ package org.apache.commons.math3.optim.nonlinear.vector.jacobian; import java.util.ArrayList; + import org.apache.commons.math3.analysis.MultivariateVectorFunction; import org.apache.commons.math3.analysis.MultivariateMatrixFunction; import org.apache.commons.math3.analysis.UnivariateFunction; @@ -37,6 +38,7 @@ import org.apache.commons.math3.optim.nonlinear.vector.ModelFunctionJacobian; *
  • for each pair (a, b), the y-coordinate of the line.
  • * */ +@Deprecated class StraightLineProblem { /** Cloud of points assumed to be fitted by a straight line. */ private final ArrayList points; diff --git a/src/test/java/org/apache/commons/math3/optim/univariate/BrentOptimizerTest.java b/src/test/java/org/apache/commons/math3/optim/univariate/BrentOptimizerTest.java index a3cc73e3d..575eb5c05 100644 --- a/src/test/java/org/apache/commons/math3/optim/univariate/BrentOptimizerTest.java +++ b/src/test/java/org/apache/commons/math3/optim/univariate/BrentOptimizerTest.java @@ -255,7 +255,6 @@ public final class BrentOptimizerTest { new SearchInterval(minSin - 6.789 * delta, minSin + 9.876 * delta, init)); - final int numEval = optimizer.getEvaluations(); final double sol = result.getPoint(); final double expected = init; @@ -289,7 +288,6 @@ public final class BrentOptimizerTest { GoalType.MINIMIZE, new SearchInterval(minSin - 6.789 * delta, minSin + 9.876 * delta)); - final int numEval = optimizer.getEvaluations(); final double sol = result.getPoint(); final double expected = 4.712389027602411; diff --git a/src/test/java/org/apache/commons/math3/optimization/MultivariateDifferentiableMultiStartOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/MultivariateDifferentiableMultiStartOptimizerTest.java index 7e0aa53d0..9eabe99d1 100644 --- a/src/test/java/org/apache/commons/math3/optimization/MultivariateDifferentiableMultiStartOptimizerTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/MultivariateDifferentiableMultiStartOptimizerTest.java @@ -30,6 +30,7 @@ import org.apache.commons.math3.random.UncorrelatedRandomVectorGenerator; import org.junit.Assert; import org.junit.Test; +@Deprecated public class MultivariateDifferentiableMultiStartOptimizerTest { @Test diff --git a/src/test/java/org/apache/commons/math3/optimization/MultivariateDifferentiableVectorMultiStartOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/MultivariateDifferentiableVectorMultiStartOptimizerTest.java index 9e53ae6aa..bdc1c132f 100644 --- a/src/test/java/org/apache/commons/math3/optimization/MultivariateDifferentiableVectorMultiStartOptimizerTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/MultivariateDifferentiableVectorMultiStartOptimizerTest.java @@ -93,6 +93,7 @@ import org.junit.Test; * @author Jorge J. More (original fortran minpack tests) * @author Luc Maisonobe (non-minpack tests and minpack tests Java translation) */ +@Deprecated public class MultivariateDifferentiableVectorMultiStartOptimizerTest { @Test diff --git a/src/test/java/org/apache/commons/math3/optimization/MultivariateMultiStartOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/MultivariateMultiStartOptimizerTest.java index f9444fd32..dc52366c0 100644 --- a/src/test/java/org/apache/commons/math3/optimization/MultivariateMultiStartOptimizerTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/MultivariateMultiStartOptimizerTest.java @@ -28,6 +28,7 @@ import org.apache.commons.math3.random.UncorrelatedRandomVectorGenerator; import org.junit.Assert; import org.junit.Test; +@Deprecated public class MultivariateMultiStartOptimizerTest { @Test public void testRosenbrock() { diff --git a/src/test/java/org/apache/commons/math3/optimization/PointValuePairTest.java b/src/test/java/org/apache/commons/math3/optimization/PointValuePairTest.java index fb6601490..e683ee604 100644 --- a/src/test/java/org/apache/commons/math3/optimization/PointValuePairTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/PointValuePairTest.java @@ -22,6 +22,7 @@ import org.apache.commons.math3.TestUtils; import org.junit.Assert; import org.junit.Test; +@Deprecated public class PointValuePairTest { @Test diff --git a/src/test/java/org/apache/commons/math3/optimization/PointVectorValuePairTest.java b/src/test/java/org/apache/commons/math3/optimization/PointVectorValuePairTest.java index 0233fb7ac..153de5220 100644 --- a/src/test/java/org/apache/commons/math3/optimization/PointVectorValuePairTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/PointVectorValuePairTest.java @@ -22,6 +22,7 @@ import org.apache.commons.math3.TestUtils; import org.junit.Assert; import org.junit.Test; +@Deprecated public class PointVectorValuePairTest { @Test diff --git a/src/test/java/org/apache/commons/math3/optimization/SimplePointCheckerTest.java b/src/test/java/org/apache/commons/math3/optimization/SimplePointCheckerTest.java index 03e5f6379..5595b118a 100644 --- a/src/test/java/org/apache/commons/math3/optimization/SimplePointCheckerTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/SimplePointCheckerTest.java @@ -20,6 +20,7 @@ import org.apache.commons.math3.exception.NotStrictlyPositiveException; import org.junit.Test; import org.junit.Assert; +@Deprecated public class SimplePointCheckerTest { @Test(expected=NotStrictlyPositiveException.class) public void testIterationCheckPrecondition() { diff --git a/src/test/java/org/apache/commons/math3/optimization/SimpleValueCheckerTest.java b/src/test/java/org/apache/commons/math3/optimization/SimpleValueCheckerTest.java index 668ffbd16..baf865fe5 100644 --- a/src/test/java/org/apache/commons/math3/optimization/SimpleValueCheckerTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/SimpleValueCheckerTest.java @@ -20,6 +20,7 @@ import org.apache.commons.math3.exception.NotStrictlyPositiveException; import org.junit.Test; import org.junit.Assert; +@Deprecated public class SimpleValueCheckerTest { @Test(expected=NotStrictlyPositiveException.class) public void testIterationCheckPrecondition() { diff --git a/src/test/java/org/apache/commons/math3/optimization/SimpleVectorValueCheckerTest.java b/src/test/java/org/apache/commons/math3/optimization/SimpleVectorValueCheckerTest.java index 3730b443a..54ade9f08 100644 --- a/src/test/java/org/apache/commons/math3/optimization/SimpleVectorValueCheckerTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/SimpleVectorValueCheckerTest.java @@ -20,6 +20,7 @@ import org.apache.commons.math3.exception.NotStrictlyPositiveException; import org.junit.Test; import org.junit.Assert; +@Deprecated public class SimpleVectorValueCheckerTest { @Test(expected=NotStrictlyPositiveException.class) public void testIterationCheckPrecondition() { diff --git a/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java index 8ed6cb703..a95763702 100644 --- a/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java @@ -36,6 +36,7 @@ import org.junit.Test; /** * Test for {@link BOBYQAOptimizer}. */ +@Deprecated public class BOBYQAOptimizerTest { static final int DIM = 13; diff --git a/src/test/java/org/apache/commons/math3/optimization/direct/CMAESOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/direct/CMAESOptimizerTest.java index e0ac1505d..29c3eec97 100644 --- a/src/test/java/org/apache/commons/math3/optimization/direct/CMAESOptimizerTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/direct/CMAESOptimizerTest.java @@ -40,6 +40,7 @@ import org.junit.runner.RunWith; /** * Test for {@link CMAESOptimizer}. */ +@Deprecated @RunWith(RetryRunner.class) public class CMAESOptimizerTest { diff --git a/src/test/java/org/apache/commons/math3/optimization/direct/MultivariateFunctionMappingAdapterTest.java b/src/test/java/org/apache/commons/math3/optimization/direct/MultivariateFunctionMappingAdapterTest.java index 62f638c62..138584a41 100644 --- a/src/test/java/org/apache/commons/math3/optimization/direct/MultivariateFunctionMappingAdapterTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/direct/MultivariateFunctionMappingAdapterTest.java @@ -24,6 +24,7 @@ import org.apache.commons.math3.optimization.PointValuePair; import org.junit.Assert; import org.junit.Test; +@Deprecated public class MultivariateFunctionMappingAdapterTest { @Test diff --git a/src/test/java/org/apache/commons/math3/optimization/direct/MultivariateFunctionPenaltyAdapterTest.java b/src/test/java/org/apache/commons/math3/optimization/direct/MultivariateFunctionPenaltyAdapterTest.java index 67962699d..0ad840bc3 100644 --- a/src/test/java/org/apache/commons/math3/optimization/direct/MultivariateFunctionPenaltyAdapterTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/direct/MultivariateFunctionPenaltyAdapterTest.java @@ -25,6 +25,7 @@ import org.apache.commons.math3.optimization.SimplePointChecker; import org.junit.Assert; import org.junit.Test; +@Deprecated public class MultivariateFunctionPenaltyAdapterTest { @Test diff --git a/src/test/java/org/apache/commons/math3/optimization/direct/PowellOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/direct/PowellOptimizerTest.java index f21ebf259..fcb31fb7f 100644 --- a/src/test/java/org/apache/commons/math3/optimization/direct/PowellOptimizerTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/direct/PowellOptimizerTest.java @@ -28,6 +28,7 @@ import org.junit.Test; /** * Test for {@link PowellOptimizer}. */ +@Deprecated public class PowellOptimizerTest { @Test diff --git a/src/test/java/org/apache/commons/math3/optimization/direct/SimplexOptimizerMultiDirectionalTest.java b/src/test/java/org/apache/commons/math3/optimization/direct/SimplexOptimizerMultiDirectionalTest.java index d130f93ed..9dfa46cdd 100644 --- a/src/test/java/org/apache/commons/math3/optimization/direct/SimplexOptimizerMultiDirectionalTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/direct/SimplexOptimizerMultiDirectionalTest.java @@ -25,6 +25,7 @@ import org.apache.commons.math3.util.FastMath; import org.junit.Assert; import org.junit.Test; +@Deprecated public class SimplexOptimizerMultiDirectionalTest { @Test public void testMinimize1() { diff --git a/src/test/java/org/apache/commons/math3/optimization/direct/SimplexOptimizerNelderMeadTest.java b/src/test/java/org/apache/commons/math3/optimization/direct/SimplexOptimizerNelderMeadTest.java index b47ff6eb4..83ba20a9d 100644 --- a/src/test/java/org/apache/commons/math3/optimization/direct/SimplexOptimizerNelderMeadTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/direct/SimplexOptimizerNelderMeadTest.java @@ -30,6 +30,7 @@ import org.apache.commons.math3.util.FastMath; import org.junit.Assert; import org.junit.Test; +@Deprecated public class SimplexOptimizerNelderMeadTest { @Test public void testMinimize1() { diff --git a/src/test/java/org/apache/commons/math3/optimization/fitting/CurveFitterTest.java b/src/test/java/org/apache/commons/math3/optimization/fitting/CurveFitterTest.java index 4d3804bce..eb1bdb704 100644 --- a/src/test/java/org/apache/commons/math3/optimization/fitting/CurveFitterTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/fitting/CurveFitterTest.java @@ -23,6 +23,7 @@ import org.apache.commons.math3.util.FastMath; import org.junit.Assert; import org.junit.Test; +@Deprecated public class CurveFitterTest { @Test diff --git a/src/test/java/org/apache/commons/math3/optimization/fitting/GaussianFitterTest.java b/src/test/java/org/apache/commons/math3/optimization/fitting/GaussianFitterTest.java index cc83a2705..ddccdb253 100644 --- a/src/test/java/org/apache/commons/math3/optimization/fitting/GaussianFitterTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/fitting/GaussianFitterTest.java @@ -19,7 +19,6 @@ package org.apache.commons.math3.optimization.fitting; import org.apache.commons.math3.exception.MathIllegalArgumentException; import org.apache.commons.math3.optimization.general.LevenbergMarquardtOptimizer; - import org.junit.Assert; import org.junit.Test; @@ -28,6 +27,7 @@ import org.junit.Test; * * @since 2.2 */ +@Deprecated public class GaussianFitterTest { /** Good data. */ protected static final double[][] DATASET1 = new double[][] { diff --git a/src/test/java/org/apache/commons/math3/optimization/fitting/HarmonicFitterTest.java b/src/test/java/org/apache/commons/math3/optimization/fitting/HarmonicFitterTest.java index 698faaa67..f2c11081b 100644 --- a/src/test/java/org/apache/commons/math3/optimization/fitting/HarmonicFitterTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/fitting/HarmonicFitterTest.java @@ -25,10 +25,10 @@ import org.apache.commons.math3.exception.NumberIsTooSmallException; import org.apache.commons.math3.exception.MathIllegalStateException; import org.apache.commons.math3.util.FastMath; import org.apache.commons.math3.util.MathUtils; - import org.junit.Test; import org.junit.Assert; +@Deprecated public class HarmonicFitterTest { @Test(expected=NumberIsTooSmallException.class) public void testPreconditions1() { diff --git a/src/test/java/org/apache/commons/math3/optimization/fitting/PolynomialFitterTest.java b/src/test/java/org/apache/commons/math3/optimization/fitting/PolynomialFitterTest.java index 74bd8eee2..ad58b80b9 100644 --- a/src/test/java/org/apache/commons/math3/optimization/fitting/PolynomialFitterTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/fitting/PolynomialFitterTest.java @@ -31,7 +31,6 @@ import org.apache.commons.math3.util.FastMath; import org.apache.commons.math3.distribution.RealDistribution; import org.apache.commons.math3.distribution.UniformRealDistribution; import org.apache.commons.math3.TestUtils; - import org.junit.Test; import org.junit.Assert; @@ -39,6 +38,7 @@ import org.junit.Assert; * Test for class {@link CurveFitter} where the function to fit is a * polynomial. */ +@Deprecated public class PolynomialFitterTest { @Test public void testFit() { @@ -138,7 +138,7 @@ public class PolynomialFitterTest { final double[] init = new double[] { 0, 0 }; final int maxEval = 10000; // Trying hard to fit. - final double[] gn = doMath798(new GaussNewtonOptimizer(checker), maxEval, init); + doMath798(new GaussNewtonOptimizer(checker), maxEval, init); } /** diff --git a/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java b/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java index fbb6bb37b..4dbe17d0e 100644 --- a/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java @@ -95,6 +95,7 @@ import org.junit.Test; * @author Jorge J. More (original fortran minpack tests) * @author Luc Maisonobe (non-minpack tests and minpack tests Java translation) */ +@Deprecated public abstract class AbstractLeastSquaresOptimizerAbstractTest { public abstract AbstractLeastSquaresOptimizer createOptimizer(); diff --git a/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerTest.java index 6b6ad1261..67a2385e7 100644 --- a/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerTest.java @@ -17,11 +17,11 @@ import java.io.IOException; import java.util.Arrays; import org.junit.Assert; - import org.apache.commons.math3.optimization.PointVectorValuePair; import org.apache.commons.math3.util.FastMath; import org.junit.Test; +@Deprecated public class AbstractLeastSquaresOptimizerTest { public static AbstractLeastSquaresOptimizer createOptimizer() { diff --git a/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerTestValidation.java b/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerTestValidation.java index 34dc3ddd8..71898fc2c 100644 --- a/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerTestValidation.java +++ b/src/test/java/org/apache/commons/math3/optimization/general/AbstractLeastSquaresOptimizerTestValidation.java @@ -17,6 +17,7 @@ import java.util.Arrays; import java.util.List; import java.util.ArrayList; import java.awt.geom.Point2D; + import org.apache.commons.math3.optimization.PointVectorValuePair; import org.apache.commons.math3.stat.descriptive.SummaryStatistics; import org.apache.commons.math3.stat.descriptive.StatisticalSummary; @@ -41,6 +42,7 @@ import org.junit.Assert; * mvn test -Dtest=AbstractLeastSquaresOptimizerTestValidation -DargLine="-DmcRuns=1234 -server" * */ +@Deprecated public class AbstractLeastSquaresOptimizerTestValidation { private static final int MONTE_CARLO_RUNS = Integer.parseInt(System.getProperty("mcRuns", "100")); @@ -200,7 +202,6 @@ public class AbstractLeastSquaresOptimizerTestValidation { // Number of observations. final int numObs = 10; // number of parameters. - final int numParams = 2; // Create a single set of observations. final Point2D.Double[] obs = lineGenerator.generate(numObs); @@ -216,7 +217,6 @@ public class AbstractLeastSquaresOptimizerTestValidation { // Dummy optimizer (to compute the chi-square). final AbstractLeastSquaresOptimizer optim = new DummyOptimizer(); - final double[] init = { slope, offset }; // Get chi-square of the best parameters set for the given set of // observations. final double bestChi2N = getChi2N(optim, problem, regress); @@ -302,6 +302,7 @@ public class AbstractLeastSquaresOptimizerTestValidation { * A dummy optimizer. * Used for computing the covariance matrix. */ +@Deprecated class DummyOptimizer extends AbstractLeastSquaresOptimizer { public DummyOptimizer() { super(null); diff --git a/src/test/java/org/apache/commons/math3/optimization/general/CircleProblem.java b/src/test/java/org/apache/commons/math3/optimization/general/CircleProblem.java index 5e2bb76aa..feca13e58 100644 --- a/src/test/java/org/apache/commons/math3/optimization/general/CircleProblem.java +++ b/src/test/java/org/apache/commons/math3/optimization/general/CircleProblem.java @@ -38,6 +38,7 @@ import org.apache.commons.math3.util.FastMath; * corresponding circle. * */ +@Deprecated class CircleProblem implements MultivariateDifferentiableVectorFunction { /** Cloud of points assumed to be fitted by a circle. */ private final ArrayList points; diff --git a/src/test/java/org/apache/commons/math3/optimization/general/CircleScalar.java b/src/test/java/org/apache/commons/math3/optimization/general/CircleScalar.java index c33965f0e..6b39b419f 100644 --- a/src/test/java/org/apache/commons/math3/optimization/general/CircleScalar.java +++ b/src/test/java/org/apache/commons/math3/optimization/general/CircleScalar.java @@ -26,6 +26,7 @@ import org.apache.commons.math3.geometry.euclidean.twod.Vector2D; /** * Class used in the tests. */ +@Deprecated public class CircleScalar implements MultivariateDifferentiableFunction { private ArrayList points; diff --git a/src/test/java/org/apache/commons/math3/optimization/general/CircleVectorial.java b/src/test/java/org/apache/commons/math3/optimization/general/CircleVectorial.java index 88de7fbd4..7d79e5692 100644 --- a/src/test/java/org/apache/commons/math3/optimization/general/CircleVectorial.java +++ b/src/test/java/org/apache/commons/math3/optimization/general/CircleVectorial.java @@ -26,6 +26,7 @@ import org.apache.commons.math3.geometry.euclidean.twod.Vector2D; /** * Class used in the tests. */ +@Deprecated class CircleVectorial implements MultivariateDifferentiableVectorFunction { private ArrayList points; diff --git a/src/test/java/org/apache/commons/math3/optimization/general/GaussNewtonOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/general/GaussNewtonOptimizerTest.java index ba8117930..c987e1435 100644 --- a/src/test/java/org/apache/commons/math3/optimization/general/GaussNewtonOptimizerTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/general/GaussNewtonOptimizerTest.java @@ -86,6 +86,7 @@ import org.junit.Test; * @author Jorge J. More (original fortran minpack tests) * @author Luc Maisonobe (non-minpack tests and minpack tests Java translation) */ +@Deprecated public class GaussNewtonOptimizerTest extends AbstractLeastSquaresOptimizerAbstractTest { diff --git a/src/test/java/org/apache/commons/math3/optimization/general/LevenbergMarquardtOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/general/LevenbergMarquardtOptimizerTest.java index e949a4bac..81c2c5292 100644 --- a/src/test/java/org/apache/commons/math3/optimization/general/LevenbergMarquardtOptimizerTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/general/LevenbergMarquardtOptimizerTest.java @@ -97,6 +97,7 @@ import org.junit.Ignore; * @author Jorge J. More (original fortran minpack tests) * @author Luc Maisonobe (non-minpack tests and minpack tests Java translation) */ +@Deprecated public class LevenbergMarquardtOptimizerTest extends AbstractLeastSquaresOptimizerAbstractTest { @Override diff --git a/src/test/java/org/apache/commons/math3/optimization/general/MinpackTest.java b/src/test/java/org/apache/commons/math3/optimization/general/MinpackTest.java index e39b32ddf..63432f72a 100644 --- a/src/test/java/org/apache/commons/math3/optimization/general/MinpackTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/general/MinpackTest.java @@ -20,7 +20,6 @@ package org.apache.commons.math3.optimization.general; import java.io.Serializable; import java.util.Arrays; - import org.apache.commons.math3.exception.TooManyEvaluationsException; import org.apache.commons.math3.analysis.differentiation.DerivativeStructure; import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableVectorFunction; @@ -91,6 +90,7 @@ import org.junit.Test; * @author Jorge J. More (original fortran minpack tests) * @author Luc Maisonobe (non-minpack tests and minpack tests Java translation) */ +@Deprecated public class MinpackTest { @Test diff --git a/src/test/java/org/apache/commons/math3/optimization/general/NonLinearConjugateGradientOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/general/NonLinearConjugateGradientOptimizerTest.java index 4665c7905..26091a4cd 100644 --- a/src/test/java/org/apache/commons/math3/optimization/general/NonLinearConjugateGradientOptimizerTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/general/NonLinearConjugateGradientOptimizerTest.java @@ -93,6 +93,7 @@ import org.junit.Test; * @author Jorge J. More (original fortran minpack tests) * @author Luc Maisonobe (non-minpack tests and minpack tests Java translation) */ +@Deprecated public class NonLinearConjugateGradientOptimizerTest { @Test public void testTrivial() { diff --git a/src/test/java/org/apache/commons/math3/optimization/general/RandomCirclePointGenerator.java b/src/test/java/org/apache/commons/math3/optimization/general/RandomCirclePointGenerator.java index 155f49232..86f82726b 100644 --- a/src/test/java/org/apache/commons/math3/optimization/general/RandomCirclePointGenerator.java +++ b/src/test/java/org/apache/commons/math3/optimization/general/RandomCirclePointGenerator.java @@ -29,6 +29,7 @@ import org.apache.commons.math3.geometry.euclidean.twod.Vector2D; /** * Factory for generating a cloud of points that approximate a circle. */ +@Deprecated public class RandomCirclePointGenerator { /** RNG for the x-coordinate of the center. */ private final RealDistribution cX; diff --git a/src/test/java/org/apache/commons/math3/optimization/general/RandomStraightLinePointGenerator.java b/src/test/java/org/apache/commons/math3/optimization/general/RandomStraightLinePointGenerator.java index a7f6eb68f..db626e823 100644 --- a/src/test/java/org/apache/commons/math3/optimization/general/RandomStraightLinePointGenerator.java +++ b/src/test/java/org/apache/commons/math3/optimization/general/RandomStraightLinePointGenerator.java @@ -18,6 +18,7 @@ package org.apache.commons.math3.optimization.general; import java.awt.geom.Point2D; + import org.apache.commons.math3.random.RandomGenerator; import org.apache.commons.math3.random.Well44497b; import org.apache.commons.math3.distribution.RealDistribution; @@ -27,6 +28,7 @@ import org.apache.commons.math3.distribution.NormalDistribution; /** * Factory for generating a cloud of points that approximate a straight line. */ +@Deprecated public class RandomStraightLinePointGenerator { /** Slope. */ private final double slope; diff --git a/src/test/java/org/apache/commons/math3/optimization/general/StatisticalReferenceDataset.java b/src/test/java/org/apache/commons/math3/optimization/general/StatisticalReferenceDataset.java index 739acfdbc..1b6c4405c 100644 --- a/src/test/java/org/apache/commons/math3/optimization/general/StatisticalReferenceDataset.java +++ b/src/test/java/org/apache/commons/math3/optimization/general/StatisticalReferenceDataset.java @@ -31,6 +31,7 @@ import org.apache.commons.math3.util.MathArrays; * Instances of this class can be created by invocation of the * {@link StatisticalReferenceDatasetFactory}. */ +@Deprecated public abstract class StatisticalReferenceDataset { /** The name of this dataset. */ diff --git a/src/test/java/org/apache/commons/math3/optimization/general/StatisticalReferenceDatasetFactory.java b/src/test/java/org/apache/commons/math3/optimization/general/StatisticalReferenceDatasetFactory.java index 0103b4bf5..167c85620 100644 --- a/src/test/java/org/apache/commons/math3/optimization/general/StatisticalReferenceDatasetFactory.java +++ b/src/test/java/org/apache/commons/math3/optimization/general/StatisticalReferenceDatasetFactory.java @@ -27,6 +27,7 @@ import org.apache.commons.math3.analysis.differentiation.DerivativeStructure; * A factory to create instances of {@link StatisticalReferenceDataset} from * available resources. */ +@Deprecated public class StatisticalReferenceDatasetFactory { private StatisticalReferenceDatasetFactory() { diff --git a/src/test/java/org/apache/commons/math3/optimization/general/StraightLineProblem.java b/src/test/java/org/apache/commons/math3/optimization/general/StraightLineProblem.java index bfc703d6b..1b7d933e7 100644 --- a/src/test/java/org/apache/commons/math3/optimization/general/StraightLineProblem.java +++ b/src/test/java/org/apache/commons/math3/optimization/general/StraightLineProblem.java @@ -36,6 +36,7 @@ import org.apache.commons.math3.stat.regression.SimpleRegression; *
  • for each pair (a, b), the y-coordinate of the line.
  • * */ +@Deprecated class StraightLineProblem implements MultivariateDifferentiableVectorFunction { /** Cloud of points assumed to be fitted by a straight line. */ private final ArrayList points; diff --git a/src/test/java/org/apache/commons/math3/optimization/linear/SimplexSolverTest.java b/src/test/java/org/apache/commons/math3/optimization/linear/SimplexSolverTest.java index ad4f2fe51..110992a7c 100644 --- a/src/test/java/org/apache/commons/math3/optimization/linear/SimplexSolverTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/linear/SimplexSolverTest.java @@ -28,6 +28,7 @@ import org.apache.commons.math3.optimization.PointValuePair; import org.apache.commons.math3.util.Precision; import org.junit.Test; +@Deprecated public class SimplexSolverTest { @Test diff --git a/src/test/java/org/apache/commons/math3/optimization/linear/SimplexTableauTest.java b/src/test/java/org/apache/commons/math3/optimization/linear/SimplexTableauTest.java index efbef43b9..7fad94381 100644 --- a/src/test/java/org/apache/commons/math3/optimization/linear/SimplexTableauTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/linear/SimplexTableauTest.java @@ -25,6 +25,7 @@ import org.apache.commons.math3.optimization.GoalType; import org.junit.Assert; import org.junit.Test; +@Deprecated public class SimplexTableauTest { @Test diff --git a/src/test/java/org/apache/commons/math3/optimization/univariate/BracketFinderTest.java b/src/test/java/org/apache/commons/math3/optimization/univariate/BracketFinderTest.java index 465efbbe3..b5783c258 100644 --- a/src/test/java/org/apache/commons/math3/optimization/univariate/BracketFinderTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/univariate/BracketFinderTest.java @@ -18,13 +18,13 @@ package org.apache.commons.math3.optimization.univariate; import org.apache.commons.math3.analysis.UnivariateFunction; import org.apache.commons.math3.optimization.GoalType; - import org.junit.Assert; import org.junit.Test; /** * Test for {@link BracketFinder}. */ +@Deprecated public class BracketFinderTest { @Test diff --git a/src/test/java/org/apache/commons/math3/optimization/univariate/BrentOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/univariate/BrentOptimizerTest.java index ed3724ef5..34ee8c704 100644 --- a/src/test/java/org/apache/commons/math3/optimization/univariate/BrentOptimizerTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/univariate/BrentOptimizerTest.java @@ -34,6 +34,7 @@ import org.junit.Test; /** */ +@Deprecated public final class BrentOptimizerTest { @Test @@ -207,7 +208,6 @@ public final class BrentOptimizerTest { minSin - 6.789 * delta, minSin + 9.876 * delta, init); - final int numEval = optimizer.getEvaluations(); final double sol = result.getPoint(); final double expected = init; @@ -239,7 +239,6 @@ public final class BrentOptimizerTest { = optimizer.optimize(200, f, GoalType.MINIMIZE, minSin - 6.789 * delta, minSin + 9.876 * delta); - final int numEval = optimizer.getEvaluations(); final double sol = result.getPoint(); final double expected = 4.712389027602411; diff --git a/src/test/java/org/apache/commons/math3/optimization/univariate/SimpleUnivariateValueCheckerTest.java b/src/test/java/org/apache/commons/math3/optimization/univariate/SimpleUnivariateValueCheckerTest.java index c10a26f7b..8ad9f66cd 100644 --- a/src/test/java/org/apache/commons/math3/optimization/univariate/SimpleUnivariateValueCheckerTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/univariate/SimpleUnivariateValueCheckerTest.java @@ -20,6 +20,7 @@ import org.apache.commons.math3.exception.NotStrictlyPositiveException; import org.junit.Test; import org.junit.Assert; +@Deprecated public class SimpleUnivariateValueCheckerTest { @Test(expected=NotStrictlyPositiveException.class) public void testIterationCheckPrecondition() { diff --git a/src/test/java/org/apache/commons/math3/optimization/univariate/UnivariateMultiStartOptimizerTest.java b/src/test/java/org/apache/commons/math3/optimization/univariate/UnivariateMultiStartOptimizerTest.java index b8e1d2235..18fbdab27 100644 --- a/src/test/java/org/apache/commons/math3/optimization/univariate/UnivariateMultiStartOptimizerTest.java +++ b/src/test/java/org/apache/commons/math3/optimization/univariate/UnivariateMultiStartOptimizerTest.java @@ -26,6 +26,7 @@ import org.apache.commons.math3.util.FastMath; import org.junit.Assert; import org.junit.Test; +@Deprecated public class UnivariateMultiStartOptimizerTest { @Test diff --git a/src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java b/src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java index 98ee7ddb0..42e9a7f9c 100644 --- a/src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java +++ b/src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java @@ -28,14 +28,12 @@ import org.apache.commons.math3.TestUtils; import org.apache.commons.math3.analysis.UnivariateFunction; import org.apache.commons.math3.analysis.integration.BaseAbstractUnivariateIntegrator; import org.apache.commons.math3.analysis.integration.IterativeLegendreGaussIntegrator; -import org.apache.commons.math3.distribution.AbstractRealDistribution; import org.apache.commons.math3.distribution.ConstantRealDistribution; import org.apache.commons.math3.distribution.NormalDistribution; import org.apache.commons.math3.distribution.RealDistribution; import org.apache.commons.math3.distribution.RealDistributionAbstractTest; import org.apache.commons.math3.distribution.UniformRealDistribution; import org.apache.commons.math3.exception.NullArgumentException; -import org.apache.commons.math3.exception.OutOfRangeException; import org.apache.commons.math3.stat.descriptive.SummaryStatistics; import org.apache.commons.math3.util.FastMath; import org.junit.Assert; diff --git a/src/test/java/org/apache/commons/math3/special/BetaTest.java b/src/test/java/org/apache/commons/math3/special/BetaTest.java index 5c5b3ca7e..d313639aa 100644 --- a/src/test/java/org/apache/commons/math3/special/BetaTest.java +++ b/src/test/java/org/apache/commons/math3/special/BetaTest.java @@ -147,7 +147,7 @@ public class BetaTest { final double b = 223; try { - final double r = Beta.regularizedBeta(x, a, b, 1e-14, 10000); + Beta.regularizedBeta(x, a, b, 1e-14, 10000); } catch (StackOverflowError error) { Assert.fail("Infinite recursion"); } diff --git a/src/test/java/org/apache/commons/math3/stat/clustering/DBSCANClustererTest.java b/src/test/java/org/apache/commons/math3/stat/clustering/DBSCANClustererTest.java index 91f881e92..657e2de5a 100644 --- a/src/test/java/org/apache/commons/math3/stat/clustering/DBSCANClustererTest.java +++ b/src/test/java/org/apache/commons/math3/stat/clustering/DBSCANClustererTest.java @@ -24,6 +24,7 @@ import org.apache.commons.math3.exception.NullArgumentException; import org.junit.Assert; import org.junit.Test; +@Deprecated public class DBSCANClustererTest { @Test diff --git a/src/test/java/org/apache/commons/math3/stat/clustering/EuclideanDoublePointTest.java b/src/test/java/org/apache/commons/math3/stat/clustering/EuclideanDoublePointTest.java index bd9fb11b2..8c37594a5 100644 --- a/src/test/java/org/apache/commons/math3/stat/clustering/EuclideanDoublePointTest.java +++ b/src/test/java/org/apache/commons/math3/stat/clustering/EuclideanDoublePointTest.java @@ -24,6 +24,7 @@ import org.apache.commons.math3.util.FastMath; import org.junit.Assert; import org.junit.Test; +@Deprecated public class EuclideanDoublePointTest { @Test diff --git a/src/test/java/org/apache/commons/math3/stat/clustering/EuclideanIntegerPointTest.java b/src/test/java/org/apache/commons/math3/stat/clustering/EuclideanIntegerPointTest.java index 15d3ab663..038f8a8cb 100644 --- a/src/test/java/org/apache/commons/math3/stat/clustering/EuclideanIntegerPointTest.java +++ b/src/test/java/org/apache/commons/math3/stat/clustering/EuclideanIntegerPointTest.java @@ -26,6 +26,7 @@ import org.apache.commons.math3.util.FastMath; import org.junit.Assert; import org.junit.Test; +@Deprecated public class EuclideanIntegerPointTest { @Test diff --git a/src/test/java/org/apache/commons/math3/stat/clustering/KMeansPlusPlusClustererTest.java b/src/test/java/org/apache/commons/math3/stat/clustering/KMeansPlusPlusClustererTest.java index 5c7f61735..d14f77bc4 100644 --- a/src/test/java/org/apache/commons/math3/stat/clustering/KMeansPlusPlusClustererTest.java +++ b/src/test/java/org/apache/commons/math3/stat/clustering/KMeansPlusPlusClustererTest.java @@ -28,6 +28,7 @@ import org.apache.commons.math3.exception.NumberIsTooSmallException; import org.junit.Assert; import org.junit.Test; +@Deprecated public class KMeansPlusPlusClustererTest { @Test diff --git a/src/test/java/org/apache/commons/math3/util/MathUtilsTest.java b/src/test/java/org/apache/commons/math3/util/MathUtilsTest.java index 6c95f2fba..2089bf5ce 100644 --- a/src/test/java/org/apache/commons/math3/util/MathUtilsTest.java +++ b/src/test/java/org/apache/commons/math3/util/MathUtilsTest.java @@ -19,7 +19,7 @@ import org.apache.commons.math3.exception.MathArithmeticException; import org.apache.commons.math3.exception.NotFiniteNumberException; import org.apache.commons.math3.exception.NullArgumentException; import org.apache.commons.math3.exception.util.LocalizedFormats; -import org.apache.commons.math3.random.RandomDataImpl; +import org.apache.commons.math3.random.RandomDataGenerator; import org.junit.Assert; import org.junit.Test; @@ -94,7 +94,7 @@ public final class MathUtilsTest { public void testPermutedArrayHash() { double[] original = new double[10]; double[] permuted = new double[10]; - RandomDataImpl random = new RandomDataImpl(); + RandomDataGenerator random = new RandomDataGenerator(); // Generate 10 distinct random values for (int i = 0; i < 10; i++) { diff --git a/src/test/java/org/apache/commons/math3/util/ResizableDoubleArrayTest.java b/src/test/java/org/apache/commons/math3/util/ResizableDoubleArrayTest.java index f00c3de61..6d9d2444c 100644 --- a/src/test/java/org/apache/commons/math3/util/ResizableDoubleArrayTest.java +++ b/src/test/java/org/apache/commons/math3/util/ResizableDoubleArrayTest.java @@ -46,14 +46,14 @@ public class ResizableDoubleArrayTest extends DoubleArrayAbstractTest { @Test public void testConstructors() { float defaultExpansionFactor = 2.0f; - float defaultContractionCriteria = 2.5f; + double defaultContractionCriteria = 2.5; int defaultMode = ResizableDoubleArray.MULTIPLICATIVE_MODE; ResizableDoubleArray testDa = new ResizableDoubleArray(2); Assert.assertEquals(0, testDa.getNumElements()); Assert.assertEquals(2, testDa.getCapacity()); Assert.assertEquals(defaultExpansionFactor, testDa.getExpansionFactor(), 0); - Assert.assertEquals(defaultContractionCriteria, testDa.getContractionCriteria(), 0); + Assert.assertEquals(defaultContractionCriteria, testDa.getContractionCriterion(), 0); Assert.assertEquals(defaultMode, testDa.getExpansionMode()); try { da = new ResizableDoubleArray(-1); @@ -69,44 +69,44 @@ public class ResizableDoubleArrayTest extends DoubleArrayAbstractTest { testDa = new ResizableDoubleArray(initialArray); Assert.assertEquals(3, testDa.getNumElements()); - testDa = new ResizableDoubleArray(2, 2.0f); + testDa = new ResizableDoubleArray(2, 2.0); Assert.assertEquals(0, testDa.getNumElements()); Assert.assertEquals(2, testDa.getCapacity()); Assert.assertEquals(defaultExpansionFactor, testDa.getExpansionFactor(), 0); - Assert.assertEquals(defaultContractionCriteria, testDa.getContractionCriteria(), 0); + Assert.assertEquals(defaultContractionCriteria, testDa.getContractionCriterion(), 0); Assert.assertEquals(defaultMode, testDa.getExpansionMode()); try { - da = new ResizableDoubleArray(2, 0.5f); + da = new ResizableDoubleArray(2, 0.5); Assert.fail("Expecting IllegalArgumentException"); } catch (IllegalArgumentException ex) { // expected } - testDa = new ResizableDoubleArray(2, 3.0f); + testDa = new ResizableDoubleArray(2, 3.0); Assert.assertEquals(3.0f, testDa.getExpansionFactor(), 0); - Assert.assertEquals(3.5f, testDa.getContractionCriteria(), 0); + Assert.assertEquals(3.5f, testDa.getContractionCriterion(), 0); - testDa = new ResizableDoubleArray(2, 2.0f, 3.0f); + testDa = new ResizableDoubleArray(2, 2.0, 3.0); Assert.assertEquals(0, testDa.getNumElements()); Assert.assertEquals(2, testDa.getCapacity()); Assert.assertEquals(defaultExpansionFactor, testDa.getExpansionFactor(), 0); - Assert.assertEquals(3.0f, testDa.getContractionCriteria(), 0); + Assert.assertEquals(3.0f, testDa.getContractionCriterion(), 0); Assert.assertEquals(defaultMode, testDa.getExpansionMode()); try { - da = new ResizableDoubleArray(2, 2.0f, 1.5f); + da = new ResizableDoubleArray(2, 2.0, 1.5); Assert.fail("Expecting IllegalArgumentException"); } catch (IllegalArgumentException ex) { // expected } - testDa = new ResizableDoubleArray(2, 2.0f, 3.0f, - ResizableDoubleArray.ADDITIVE_MODE); + testDa = new ResizableDoubleArray(2, 2.0, 3.0, + ResizableDoubleArray.ExpansionMode.ADDITIVE); Assert.assertEquals(0, testDa.getNumElements()); Assert.assertEquals(2, testDa.getCapacity()); Assert.assertEquals(defaultExpansionFactor, testDa.getExpansionFactor(), 0); - Assert.assertEquals(3.0f, testDa.getContractionCriteria(), 0); + Assert.assertEquals(3.0f, testDa.getContractionCriterion(), 0); Assert.assertEquals(ResizableDoubleArray.ADDITIVE_MODE, testDa.getExpansionMode()); @@ -118,8 +118,8 @@ public class ResizableDoubleArrayTest extends DoubleArrayAbstractTest { } // Copy constructor - testDa = new ResizableDoubleArray(2, 2.0f, 3.0f, - ResizableDoubleArray.ADDITIVE_MODE); + testDa = new ResizableDoubleArray(2, 2.0, 3.0, + ResizableDoubleArray.ExpansionMode.ADDITIVE); testDa.addElement(2.0); testDa.addElement(3.2); ResizableDoubleArray copyDa = new ResizableDoubleArray(testDa); @@ -179,8 +179,8 @@ public class ResizableDoubleArrayTest extends DoubleArrayAbstractTest { // ADDITIVE_MODE - ResizableDoubleArray testDa = new ResizableDoubleArray(2, 2.0f, 3.0f, - ResizableDoubleArray.ADDITIVE_MODE); + ResizableDoubleArray testDa = new ResizableDoubleArray(2, 2.0, 3.0, + ResizableDoubleArray.ExpansionMode.ADDITIVE); Assert.assertEquals(2, testDa.getCapacity()); testDa.addElement(1d); testDa.addElement(1d); @@ -213,8 +213,8 @@ public class ResizableDoubleArrayTest extends DoubleArrayAbstractTest { Assert.assertEquals(6, testDa.getNumElements()); // ADDITIVE_MODE (x's are occupied storage locations, 0's are open) - testDa = new ResizableDoubleArray(2, 2.0f, 2.5f, - ResizableDoubleArray.ADDITIVE_MODE); + testDa = new ResizableDoubleArray(2, 2.0, 2.5, + ResizableDoubleArray.ExpansionMode.ADDITIVE); Assert.assertEquals(2, testDa.getCapacity()); testDa.addElements(new double[] { 1d }); // x,0 testDa.addElements(new double[] { 2d }); // x,x @@ -248,8 +248,8 @@ public class ResizableDoubleArrayTest extends DoubleArrayAbstractTest { Assert.assertEquals(6, da.getElement(2), 0); // ADDITIVE_MODE (x's are occupied storage locations, 0's are open) - ResizableDoubleArray testDa = new ResizableDoubleArray(2, 2.0f, 2.5f, - ResizableDoubleArray.ADDITIVE_MODE); + ResizableDoubleArray testDa = new ResizableDoubleArray(2, 2.0, 2.5, + ResizableDoubleArray.ExpansionMode.ADDITIVE); Assert.assertEquals(2, testDa.getCapacity()); testDa.addElement(1d); // x,0 testDa.addElement(2d); // x,x @@ -334,7 +334,7 @@ public class ResizableDoubleArrayTest extends DoubleArrayAbstractTest { @Test public void testWithInitialCapacityAndExpansionFactor() { - ResizableDoubleArray eDA3 = new ResizableDoubleArray(3, 3.0f, 3.5f); + ResizableDoubleArray eDA3 = new ResizableDoubleArray(3, 3.0, 3.5); Assert.assertEquals("Initial number of elements should be 0", 0, eDA3.getNumElements() ); final IntegerDistribution randomData = new UniformIntegerDistribution(100, 3000); @@ -442,7 +442,7 @@ public class ResizableDoubleArrayTest extends DoubleArrayAbstractTest { @Test public void testMutators() { ((ResizableDoubleArray)da).setContractionCriteria(10f); - Assert.assertEquals(10f, ((ResizableDoubleArray)da).getContractionCriteria(), 0); + Assert.assertEquals(10f, ((ResizableDoubleArray)da).getContractionCriterion(), 0); ((ResizableDoubleArray)da).setExpansionFactor(8f); Assert.assertEquals(8f, ((ResizableDoubleArray)da).getExpansionFactor(), 0); try { @@ -483,10 +483,10 @@ public class ResizableDoubleArrayTest extends DoubleArrayAbstractTest { verifyEquality(first, second); // Equals iff same data, same properties - ResizableDoubleArray third = new ResizableDoubleArray(3, 2.0f, 2.0f); + ResizableDoubleArray third = new ResizableDoubleArray(3, 2.0, 2.0); verifyInequality(third, first); - ResizableDoubleArray fourth = new ResizableDoubleArray(3, 2.0f, 2.0f); - ResizableDoubleArray fifth = new ResizableDoubleArray(2, 2.0f, 2.0f); + ResizableDoubleArray fourth = new ResizableDoubleArray(3, 2.0, 2.0); + ResizableDoubleArray fifth = new ResizableDoubleArray(2, 2.0, 2.0); verifyEquality(third, fourth); verifyInequality(third, fifth); third.addElement(4.1);