Fixed lots of warnings due to missing @Deprecated annotations.
This commit is contained in:
parent
abffaf334c
commit
e875e6d598
|
@ -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;
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.apache.commons.math3.optim.PointVectorValuePair;
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
@Deprecated
|
||||
public class MultiStartMultivariateVectorOptimizer
|
||||
extends BaseMultiStartMultivariateOptimizer<PointVectorValuePair> {
|
||||
/** Underlying optimizer. */
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.apache.commons.math3.linear.RealMatrix;
|
|||
*
|
||||
* @since 3.1
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class MultivariateVectorOptimizer
|
||||
extends BaseMultivariateOptimizer<PointVectorValuePair> {
|
||||
/** Target values for the model function at optimum. */
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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++) {
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.junit.Test;
|
|||
* Test cases for {@link KolmogorovSmirnovDistribution}.
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public class KolmogorovSmirnovDistributionTest {
|
||||
|
||||
private static final double TOLERANCE = 10e-10;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.junit.Test;
|
|||
*
|
||||
* @since 2.2
|
||||
*/
|
||||
@Deprecated
|
||||
public class GaussianFitterTest {
|
||||
/** Good data. */
|
||||
protected static final double[][] DATASET1 = new double[][] {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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}.
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -288,48 +288,6 @@ public class LevenbergMarquardtOptimizerTest
|
|||
Assert.assertThat(optimum.getEvaluations(), is(2));
|
||||
}
|
||||
|
||||
//TODO delete or use
|
||||
private static class QuadraticProblem {
|
||||
private List<Double> x;
|
||||
private List<Double> y;
|
||||
|
||||
public QuadraticProblem() {
|
||||
x = new ArrayList<Double>();
|
||||
y = new ArrayList<Double>();
|
||||
}
|
||||
|
||||
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<Double> time;
|
||||
private List<Double> count;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -376,7 +376,7 @@ public final class BlockFieldMatrixTest {
|
|||
public void testOperate() {
|
||||
FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(id);
|
||||
TestUtils.assertEquals(testVector, m.operate(testVector));
|
||||
TestUtils.assertEquals(testVector, m.operate(new ArrayFieldVector<Fraction>(testVector)).getData());
|
||||
TestUtils.assertEquals(testVector, m.operate(new ArrayFieldVector<Fraction>(testVector)).toArray());
|
||||
m = new BlockFieldMatrix<Fraction>(bigSingular);
|
||||
try {
|
||||
m.operate(testVector);
|
||||
|
|
|
@ -269,7 +269,7 @@ public final class FieldMatrixImplTest {
|
|||
public void testOperate() {
|
||||
FieldMatrix<Fraction> m = new Array2DRowFieldMatrix<Fraction>(id);
|
||||
TestUtils.assertEquals(testVector, m.operate(testVector));
|
||||
TestUtils.assertEquals(testVector, m.operate(new ArrayFieldVector<Fraction>(testVector)).getData());
|
||||
TestUtils.assertEquals(testVector, m.operate(new ArrayFieldVector<Fraction>(testVector)).toArray());
|
||||
m = new Array2DRowFieldMatrix<Fraction>(bigSingular);
|
||||
try {
|
||||
m.operate(testVector);
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <x (neuron)> <y (neuron)> <x (city)> <y (city)>}.
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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"
|
||||
* </code></pre>
|
||||
*/
|
||||
@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);
|
||||
|
|
|
@ -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.</li>
|
||||
* </ul>
|
||||
*/
|
||||
@Deprecated
|
||||
class CircleProblem {
|
||||
/** Cloud of points assumed to be fitted by a circle. */
|
||||
private final ArrayList<double[]> points;
|
||||
|
|
|
@ -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<Vector2D> points;
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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<Double> x;
|
||||
private List<Double> y;
|
||||
|
||||
public QuadraticProblem() {
|
||||
x = new ArrayList<Double>();
|
||||
y = new ArrayList<Double>();
|
||||
}
|
||||
|
||||
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<Double> time;
|
||||
private List<Double> count;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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;
|
|||
* <li>for each pair (a, b), the y-coordinate of the line.</li>
|
||||
* </ul>
|
||||
*/
|
||||
@Deprecated
|
||||
class StraightLineProblem {
|
||||
/** Cloud of points assumed to be fitted by a straight line. */
|
||||
private final ArrayList<double[]> points;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.apache.commons.math3.random.UncorrelatedRandomVectorGenerator;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@Deprecated
|
||||
public class MultivariateDifferentiableMultiStartOptimizerTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.apache.commons.math3.TestUtils;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@Deprecated
|
||||
public class PointValuePairTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.apache.commons.math3.TestUtils;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@Deprecated
|
||||
public class PointVectorValuePairTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.junit.Test;
|
|||
/**
|
||||
* Test for {@link BOBYQAOptimizer}.
|
||||
*/
|
||||
@Deprecated
|
||||
public class BOBYQAOptimizerTest {
|
||||
|
||||
static final int DIM = 13;
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.junit.runner.RunWith;
|
|||
/**
|
||||
* Test for {@link CMAESOptimizer}.
|
||||
*/
|
||||
@Deprecated
|
||||
@RunWith(RetryRunner.class)
|
||||
public class CMAESOptimizerTest {
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.commons.math3.optimization.PointValuePair;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@Deprecated
|
||||
public class MultivariateFunctionMappingAdapterTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.apache.commons.math3.optimization.SimplePointChecker;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@Deprecated
|
||||
public class MultivariateFunctionPenaltyAdapterTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.junit.Test;
|
|||
/**
|
||||
* Test for {@link PowellOptimizer}.
|
||||
*/
|
||||
@Deprecated
|
||||
public class PowellOptimizerTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.apache.commons.math3.util.FastMath;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@Deprecated
|
||||
public class CurveFitterTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -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[][] {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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"
|
||||
* </code></pre>
|
||||
*/
|
||||
@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);
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.apache.commons.math3.util.FastMath;
|
|||
* corresponding circle.</li>
|
||||
* </ul>
|
||||
*/
|
||||
@Deprecated
|
||||
class CircleProblem implements MultivariateDifferentiableVectorFunction {
|
||||
/** Cloud of points assumed to be fitted by a circle. */
|
||||
private final ArrayList<Vector2D> points;
|
||||
|
|
|
@ -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<Vector2D> points;
|
||||
|
||||
|
|
|
@ -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<Vector2D> points;
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.apache.commons.math3.stat.regression.SimpleRegression;
|
|||
* <li>for each pair (a, b), the y-coordinate of the line.</li>
|
||||
* </ul>
|
||||
*/
|
||||
@Deprecated
|
||||
class StraightLineProblem implements MultivariateDifferentiableVectorFunction {
|
||||
/** Cloud of points assumed to be fitted by a straight line. */
|
||||
private final ArrayList<double[]> points;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.apache.commons.math3.optimization.GoalType;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@Deprecated
|
||||
public class SimplexTableauTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.apache.commons.math3.util.FastMath;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@Deprecated
|
||||
public class UnivariateMultiStartOptimizerTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.commons.math3.exception.NullArgumentException;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@Deprecated
|
||||
public class DBSCANClustererTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.commons.math3.util.FastMath;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@Deprecated
|
||||
public class EuclideanDoublePointTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.apache.commons.math3.util.FastMath;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@Deprecated
|
||||
public class EuclideanIntegerPointTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.apache.commons.math3.exception.NumberIsTooSmallException;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@Deprecated
|
||||
public class KMeansPlusPlusClustererTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -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++) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue