From 8d9ddbca5f9aacf8e2aeb7b2ea0f100ac1b058ff Mon Sep 17 00:00:00 2001 From: Luc Maisonobe Date: Fri, 10 Apr 2015 17:45:37 +0200 Subject: [PATCH] Fixed @Override checkstyle warnings. @Override was forbidden at some places in Java 5, but is now mandatory at the same places in Java 7. --- .../commons/math4/analysis/FunctionUtils.java | 37 ++++++++++++ .../differentiation/DerivativeStructure.java | 59 +++++++++++++++++++ .../FiniteDifferencesDifferentiator.java | 9 +++ .../differentiation/GradientFunction.java | 1 + .../differentiation/JacobianFunction.java | 1 + .../differentiation/SparseGradient.java | 59 +++++++++++++++++++ .../commons/math4/analysis/function/Abs.java | 1 + .../commons/math4/analysis/function/Acos.java | 3 + .../math4/analysis/function/Acosh.java | 3 + .../commons/math4/analysis/function/Add.java | 1 + .../commons/math4/analysis/function/Asin.java | 3 + .../math4/analysis/function/Asinh.java | 3 + .../commons/math4/analysis/function/Atan.java | 3 + .../math4/analysis/function/Atan2.java | 1 + .../math4/analysis/function/Atanh.java | 3 + .../commons/math4/analysis/function/Cbrt.java | 3 + .../commons/math4/analysis/function/Ceil.java | 1 + .../math4/analysis/function/Constant.java | 3 + .../commons/math4/analysis/function/Cos.java | 3 + .../commons/math4/analysis/function/Cosh.java | 3 + .../math4/analysis/function/Divide.java | 1 + .../commons/math4/analysis/function/Exp.java | 3 + .../math4/analysis/function/Expm1.java | 3 + .../math4/analysis/function/Floor.java | 1 + .../math4/analysis/function/Gaussian.java | 3 + .../analysis/function/HarmonicOscillator.java | 3 + .../math4/analysis/function/Identity.java | 3 + .../math4/analysis/function/Inverse.java | 3 + .../commons/math4/analysis/function/Log.java | 3 + .../math4/analysis/function/Log10.java | 3 + .../math4/analysis/function/Log1p.java | 3 + .../math4/analysis/function/Logistic.java | 3 + .../math4/analysis/function/Logit.java | 3 + .../commons/math4/analysis/function/Max.java | 1 + .../commons/math4/analysis/function/Min.java | 1 + .../math4/analysis/function/Minus.java | 3 + .../math4/analysis/function/Multiply.java | 1 + .../commons/math4/analysis/function/Pow.java | 1 + .../math4/analysis/function/Power.java | 3 + .../commons/math4/analysis/function/Rint.java | 1 + .../math4/analysis/function/Sigmoid.java | 3 + .../math4/analysis/function/Signum.java | 1 + .../commons/math4/analysis/function/Sin.java | 3 + .../commons/math4/analysis/function/Sinc.java | 3 + .../commons/math4/analysis/function/Sinh.java | 3 + .../commons/math4/analysis/function/Sqrt.java | 3 + .../math4/analysis/function/StepFunction.java | 1 + .../math4/analysis/function/Subtract.java | 1 + .../commons/math4/analysis/function/Tan.java | 3 + .../commons/math4/analysis/function/Tanh.java | 3 + .../commons/math4/analysis/function/Ulp.java | 1 + .../BaseAbstractUnivariateIntegrator.java | 7 +++ .../BicubicInterpolatingFunction.java | 2 + .../interpolation/BicubicInterpolator.java | 1 + .../MicrosphereInterpolator.java | 1 + ...iseBicubicSplineInterpolatingFunction.java | 1 + .../PiecewiseBicubicSplineInterpolator.java | 1 + .../TricubicInterpolatingFunction.java | 1 + .../interpolation/TricubicInterpolator.java | 1 + .../UnivariatePeriodicInterpolator.java | 1 + .../polynomials/PolynomialFunction.java | 3 + .../PolynomialFunctionNewtonForm.java | 1 + .../polynomials/PolynomialSplineFunction.java | 1 + .../polynomials/PolynomialsUtils.java | 5 ++ .../solvers/BaseAbstractUnivariateSolver.java | 8 +++ .../analysis/solvers/BaseSecantSolver.java | 2 + .../BracketingNthOrderBrentSolver.java | 2 + .../math4/fitting/AbstractCurveFitter.java | 1 + .../leastsquares/AbstractEvaluation.java | 6 ++ .../leastsquares/DenseWeightedEvaluation.java | 3 + .../leastsquares/EvaluationRmsChecker.java | 1 + .../leastsquares/GaussNewtonOptimizer.java | 1 + .../leastsquares/LeastSquaresAdapter.java | 7 +++ .../leastsquares/LeastSquaresFactory.java | 13 ++++ .../LevenbergMarquardtOptimizer.java | 1 + .../fitting/leastsquares/OptimumImpl.java | 11 ++++ .../math4/linear/AbstractFieldMatrix.java | 53 +++++++++++++++++ .../math4/linear/AbstractRealMatrix.java | 57 ++++++++++++++++++ .../math4/linear/ArrayFieldVector.java | 28 +++++++++ .../math4/linear/CholeskyDecomposition.java | 3 + .../DefaultFieldMatrixChangingVisitor.java | 3 + .../DefaultFieldMatrixPreservingVisitor.java | 3 + .../DefaultRealMatrixChangingVisitor.java | 3 + .../DefaultRealMatrixPreservingVisitor.java | 3 + .../math4/linear/EigenDecomposition.java | 1 + .../math4/linear/FieldLUDecomposition.java | 4 ++ .../commons/math4/linear/LUDecomposition.java | 3 + .../math4/linear/OpenMapRealVector.java | 3 + .../math4/linear/RRQRDecomposition.java | 4 ++ .../commons/math4/linear/RealVector.java | 12 ++++ .../math4/linear/SparseFieldVector.java | 28 +++++++++ .../neuralnet/FeatureInitializerFactory.java | 2 + .../commons/math4/ml/neuralnet/Network.java | 2 + .../neuralnet/sofm/KohonenTrainingTask.java | 1 + .../neuralnet/sofm/KohonenUpdateAction.java | 1 + .../sofm/LearningFactorFunctionFactory.java | 2 + .../NeighbourhoodSizeFunctionFactory.java | 2 + .../commons/math4/ode/AbstractIntegrator.java | 15 +++++ .../math4/ode/AbstractParameterizable.java | 2 + .../math4/ode/ContinuousOutputModel.java | 1 + .../commons/math4/ode/JacobianMatrices.java | 5 ++ .../math4/ode/MultistepIntegrator.java | 4 ++ .../math4/ode/ParameterJacobianWrapper.java | 3 + .../math4/ode/ParameterizedWrapper.java | 4 ++ .../commons/math4/ode/events/EventFilter.java | 4 ++ .../ode/nonstiff/AdamsMoultonIntegrator.java | 2 + .../sampling/AbstractStepInterpolator.java | 10 ++++ .../math4/ode/sampling/DummyStepHandler.java | 1 + .../math4/ode/sampling/StepNormalizer.java | 1 + .../optim/AbstractConvergenceChecker.java | 1 + .../optim/AbstractOptimizationProblem.java | 5 ++ .../commons/math4/optim/BaseOptimizer.java | 2 + .../scalar/LeastSquaresConverter.java | 1 + .../MultivariateFunctionMappingAdapter.java | 8 +++ .../NonLinearConjugateGradientOptimizer.java | 1 + .../scalar/noderiv/CMAESOptimizer.java | 1 + .../AbstractStorelessUnivariateStatistic.java | 3 + .../AbstractUnivariateStatistic.java | 3 + .../AggregateSummaryStatistics.java | 7 +++ .../stat/descriptive/moment/FirstMoment.java | 1 + .../descriptive/moment/GeometricMean.java | 1 + .../stat/descriptive/moment/Kurtosis.java | 1 + .../math4/stat/descriptive/moment/Mean.java | 1 + .../stat/descriptive/moment/Skewness.java | 1 + .../descriptive/moment/StandardDeviation.java | 1 + .../stat/descriptive/moment/Variance.java | 1 + .../math4/stat/descriptive/rank/Max.java | 1 + .../math4/stat/descriptive/rank/Min.java | 1 + .../descriptive/rank/PSquarePercentile.java | 2 + .../stat/descriptive/summary/Product.java | 1 + .../math4/stat/descriptive/summary/Sum.java | 1 + .../stat/descriptive/summary/SumOfLogs.java | 1 + .../descriptive/summary/SumOfSquares.java | 1 + .../stat/interval/AgrestiCoullInterval.java | 1 + .../stat/interval/ClopperPearsonInterval.java | 1 + .../interval/NormalApproximationInterval.java | 1 + .../stat/interval/WilsonScoreInterval.java | 1 + .../AbstractMultipleLinearRegression.java | 5 ++ 138 files changed, 679 insertions(+) diff --git a/src/main/java/org/apache/commons/math4/analysis/FunctionUtils.java b/src/main/java/org/apache/commons/math4/analysis/FunctionUtils.java index ecb816da0..77555d3ea 100644 --- a/src/main/java/org/apache/commons/math4/analysis/FunctionUtils.java +++ b/src/main/java/org/apache/commons/math4/analysis/FunctionUtils.java @@ -50,6 +50,7 @@ public class FunctionUtils { public static UnivariateFunction compose(final UnivariateFunction ... f) { return new UnivariateFunction() { /** {@inheritDoc} */ + @Override public double value(double x) { double r = x; for (int i = f.length - 1; i >= 0; i--) { @@ -74,6 +75,7 @@ public class FunctionUtils { return new UnivariateDifferentiableFunction() { /** {@inheritDoc} */ + @Override public double value(final double t) { double r = t; for (int i = f.length - 1; i >= 0; i--) { @@ -83,6 +85,7 @@ public class FunctionUtils { } /** {@inheritDoc} */ + @Override public DerivativeStructure value(final DerivativeStructure t) { DerivativeStructure r = t; for (int i = f.length - 1; i >= 0; i--) { @@ -108,6 +111,7 @@ public class FunctionUtils { public static DifferentiableUnivariateFunction compose(final DifferentiableUnivariateFunction ... f) { return new DifferentiableUnivariateFunction() { /** {@inheritDoc} */ + @Override public double value(double x) { double r = x; for (int i = f.length - 1; i >= 0; i--) { @@ -117,9 +121,11 @@ public class FunctionUtils { } /** {@inheritDoc} */ + @Override public UnivariateFunction derivative() { return new UnivariateFunction() { /** {@inheritDoc} */ + @Override public double value(double x) { double p = 1; double r = x; @@ -143,6 +149,7 @@ public class FunctionUtils { public static UnivariateFunction add(final UnivariateFunction ... f) { return new UnivariateFunction() { /** {@inheritDoc} */ + @Override public double value(double x) { double r = f[0].value(x); for (int i = 1; i < f.length; i++) { @@ -164,6 +171,7 @@ public class FunctionUtils { return new UnivariateDifferentiableFunction() { /** {@inheritDoc} */ + @Override public double value(final double t) { double r = f[0].value(t); for (int i = 1; i < f.length; i++) { @@ -175,6 +183,7 @@ public class FunctionUtils { /** {@inheritDoc} * @throws DimensionMismatchException if functions are not consistent with each other */ + @Override public DerivativeStructure value(final DerivativeStructure t) throws DimensionMismatchException { DerivativeStructure r = f[0].value(t); @@ -198,6 +207,7 @@ public class FunctionUtils { public static DifferentiableUnivariateFunction add(final DifferentiableUnivariateFunction ... f) { return new DifferentiableUnivariateFunction() { /** {@inheritDoc} */ + @Override public double value(double x) { double r = f[0].value(x); for (int i = 1; i < f.length; i++) { @@ -207,9 +217,11 @@ public class FunctionUtils { } /** {@inheritDoc} */ + @Override public UnivariateFunction derivative() { return new UnivariateFunction() { /** {@inheritDoc} */ + @Override public double value(double x) { double r = f[0].derivative().value(x); for (int i = 1; i < f.length; i++) { @@ -231,6 +243,7 @@ public class FunctionUtils { public static UnivariateFunction multiply(final UnivariateFunction ... f) { return new UnivariateFunction() { /** {@inheritDoc} */ + @Override public double value(double x) { double r = f[0].value(x); for (int i = 1; i < f.length; i++) { @@ -252,6 +265,7 @@ public class FunctionUtils { return new UnivariateDifferentiableFunction() { /** {@inheritDoc} */ + @Override public double value(final double t) { double r = f[0].value(t); for (int i = 1; i < f.length; i++) { @@ -261,6 +275,7 @@ public class FunctionUtils { } /** {@inheritDoc} */ + @Override public DerivativeStructure value(final DerivativeStructure t) { DerivativeStructure r = f[0].value(t); for (int i = 1; i < f.length; i++) { @@ -283,6 +298,7 @@ public class FunctionUtils { public static DifferentiableUnivariateFunction multiply(final DifferentiableUnivariateFunction ... f) { return new DifferentiableUnivariateFunction() { /** {@inheritDoc} */ + @Override public double value(double x) { double r = f[0].value(x); for (int i = 1; i < f.length; i++) { @@ -292,9 +308,11 @@ public class FunctionUtils { } /** {@inheritDoc} */ + @Override public UnivariateFunction derivative() { return new UnivariateFunction() { /** {@inheritDoc} */ + @Override public double value(double x) { double sum = 0; for (int i = 0; i < f.length; i++) { @@ -327,6 +345,7 @@ public class FunctionUtils { final UnivariateFunction g) { return new UnivariateFunction() { /** {@inheritDoc} */ + @Override public double value(double x) { return combiner.value(f.value(x), g.value(x)); } @@ -348,6 +367,7 @@ public class FunctionUtils { final double initialValue) { return new MultivariateFunction() { /** {@inheritDoc} */ + @Override public double value(double[] point) { double result = combiner.value(initialValue, f.value(point[0])); for (int i = 1; i < point.length; i++) { @@ -383,6 +403,7 @@ public class FunctionUtils { final double fixed) { return new UnivariateFunction() { /** {@inheritDoc} */ + @Override public double value(double x) { return f.value(fixed, x); } @@ -399,6 +420,7 @@ public class FunctionUtils { final double fixed) { return new UnivariateFunction() { /** {@inheritDoc} */ + @Override public double value(double x) { return f.value(x, fixed); } @@ -453,14 +475,17 @@ public class FunctionUtils { return new DifferentiableUnivariateFunction() { /** {@inheritDoc} */ + @Override public double value(final double x) { return f.value(x); } /** {@inheritDoc} */ + @Override public UnivariateFunction derivative() { return new UnivariateFunction() { /** {@inheritDoc} */ + @Override public double value(final double x) { return f.value(new DerivativeStructure(1, 1, 0, x)).getPartialDerivative(1); } @@ -485,6 +510,7 @@ public class FunctionUtils { return new UnivariateDifferentiableFunction() { /** {@inheritDoc} */ + @Override public double value(final double x) { return f.value(x); } @@ -492,6 +518,7 @@ public class FunctionUtils { /** {@inheritDoc} * @exception NumberIsTooLargeException if derivation order is greater than 1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) throws NumberIsTooLargeException { switch (t.getOrder()) { @@ -529,14 +556,17 @@ public class FunctionUtils { return new DifferentiableMultivariateFunction() { /** {@inheritDoc} */ + @Override public double value(final double[] x) { return f.value(x); } /** {@inheritDoc} */ + @Override public MultivariateFunction partialDerivative(final int k) { return new MultivariateFunction() { /** {@inheritDoc} */ + @Override public double value(final double[] x) { final int n = x.length; @@ -562,6 +592,7 @@ public class FunctionUtils { public MultivariateVectorFunction gradient() { return new MultivariateVectorFunction() { /** {@inheritDoc} */ + @Override public double[] value(final double[] x) { final int n = x.length; @@ -608,6 +639,7 @@ public class FunctionUtils { return new MultivariateDifferentiableFunction() { /** {@inheritDoc} */ + @Override public double value(final double[] x) { return f.value(x); } @@ -616,6 +648,7 @@ public class FunctionUtils { * @exception NumberIsTooLargeException if derivation order is higher than 1 * @exception DimensionMismatchException if numbers of free parameters are inconsistent */ + @Override public DerivativeStructure value(final DerivativeStructure[] t) throws DimensionMismatchException, NumberIsTooLargeException { @@ -676,6 +709,7 @@ public class FunctionUtils { return new DifferentiableMultivariateVectorFunction() { /** {@inheritDoc} */ + @Override public double[] value(final double[] x) { return f.value(x); } @@ -683,6 +717,7 @@ public class FunctionUtils { public MultivariateMatrixFunction jacobian() { return new MultivariateMatrixFunction() { /** {@inheritDoc} */ + @Override public double[][] value(final double[] x) { final int n = x.length; @@ -731,6 +766,7 @@ public class FunctionUtils { return new MultivariateDifferentiableVectorFunction() { /** {@inheritDoc} */ + @Override public double[] value(final double[] x) { return f.value(x); } @@ -739,6 +775,7 @@ public class FunctionUtils { * @exception NumberIsTooLargeException if derivation order is higher than 1 * @exception DimensionMismatchException if numbers of free parameters are inconsistent */ + @Override public DerivativeStructure[] value(final DerivativeStructure[] t) throws DimensionMismatchException, NumberIsTooLargeException { diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructure.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructure.java index a179eba2b..3c9a48c42 100644 --- a/src/main/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructure.java +++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructure.java @@ -248,6 +248,7 @@ public class DerivativeStructure implements RealFieldElement getField() { return new Field() { /** {@inheritDoc} */ + @Override public DerivativeStructure getZero() { return new DerivativeStructure(compiler.getFreeParameters(), compiler.getOrder(), 0.0); } /** {@inheritDoc} */ + @Override public DerivativeStructure getOne() { return new DerivativeStructure(compiler.getFreeParameters(), compiler.getOrder(), 1.0); } /** {@inheritDoc} */ + @Override public Class> getRuntimeClass() { return DerivativeStructure.class; } @@ -659,6 +690,7 @@ public class DerivativeStructure implements RealFieldElement */ + @Override public UnivariateDifferentiableFunction differentiate(final UnivariateFunction function) { return new UnivariateDifferentiableFunction() { /** {@inheritDoc} */ + @Override public double value(final double x) throws MathIllegalArgumentException { return function.value(x); } /** {@inheritDoc} */ + @Override public DerivativeStructure value(final DerivativeStructure t) throws MathIllegalArgumentException { @@ -280,15 +283,18 @@ public class FiniteDifferencesDifferentiator * derivation order is larger or equal to the number of points. *

*/ + @Override public UnivariateDifferentiableVectorFunction differentiate(final UnivariateVectorFunction function) { return new UnivariateDifferentiableVectorFunction() { /** {@inheritDoc} */ + @Override public double[]value(final double x) throws MathIllegalArgumentException { return function.value(x); } /** {@inheritDoc} */ + @Override public DerivativeStructure[] value(final DerivativeStructure t) throws MathIllegalArgumentException { @@ -331,15 +337,18 @@ public class FiniteDifferencesDifferentiator * derivation order is larger or equal to the number of points. *

*/ + @Override public UnivariateDifferentiableMatrixFunction differentiate(final UnivariateMatrixFunction function) { return new UnivariateDifferentiableMatrixFunction() { /** {@inheritDoc} */ + @Override public double[][] value(final double x) throws MathIllegalArgumentException { return function.value(x); } /** {@inheritDoc} */ + @Override public DerivativeStructure[][] value(final DerivativeStructure t) throws MathIllegalArgumentException { diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/GradientFunction.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/GradientFunction.java index 0b75ae8f1..665a1f834 100644 --- a/src/main/java/org/apache/commons/math4/analysis/differentiation/GradientFunction.java +++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/GradientFunction.java @@ -38,6 +38,7 @@ public class GradientFunction implements MultivariateVectorFunction { } /** {@inheritDoc} */ + @Override public double[] value(double[] point) { // set up parameters diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/JacobianFunction.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/JacobianFunction.java index f7b80825c..16e338c4b 100644 --- a/src/main/java/org/apache/commons/math4/analysis/differentiation/JacobianFunction.java +++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/JacobianFunction.java @@ -40,6 +40,7 @@ public class JacobianFunction implements MultivariateMatrixFunction { } /** {@inheritDoc} */ + @Override public double[][] value(double[] point) { // set up parameters diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/SparseGradient.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/SparseGradient.java index adff345b7..4e82d08fd 100644 --- a/src/main/java/org/apache/commons/math4/analysis/differentiation/SparseGradient.java +++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/SparseGradient.java @@ -130,11 +130,13 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public double getReal() { return value; } /** {@inheritDoc} */ + @Override public SparseGradient add(final SparseGradient a) { final SparseGradient out = new SparseGradient(value + a.value, derivatives); for (Map.Entry entry : a.derivatives.entrySet()) { @@ -176,12 +178,14 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient add(final double c) { final SparseGradient out = new SparseGradient(value + c, derivatives); return out; } /** {@inheritDoc} */ + @Override public SparseGradient subtract(final SparseGradient a) { final SparseGradient out = new SparseGradient(value - a.value, derivatives); for (Map.Entry entry : a.derivatives.entrySet()) { @@ -197,11 +201,13 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient subtract(double c) { return new SparseGradient(value - c, derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient multiply(final SparseGradient a) { final SparseGradient out = new SparseGradient(value * a.value, Collections. emptyMap()); @@ -252,16 +258,19 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient multiply(final double c) { return new SparseGradient(value * c, c, derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient multiply(final int n) { return new SparseGradient(value * n, n, derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient divide(final SparseGradient a) { final SparseGradient out = new SparseGradient(value / a.value, Collections. emptyMap()); @@ -282,30 +291,36 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient divide(final double c) { return new SparseGradient(value / c, 1.0 / c, derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient negate() { return new SparseGradient(-value, -1.0, derivatives); } /** {@inheritDoc} */ + @Override public Field getField() { return new Field() { /** {@inheritDoc} */ + @Override public SparseGradient getZero() { return createConstant(0); } /** {@inheritDoc} */ + @Override public SparseGradient getOne() { return createConstant(1); } /** {@inheritDoc} */ + @Override public Class> getRuntimeClass() { return SparseGradient.class; } @@ -314,11 +329,13 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient remainder(final double a) { return new SparseGradient(FastMath.IEEEremainder(value, a), derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient remainder(final SparseGradient a) { // compute k such that lhs % rhs = lhs - k rhs @@ -330,6 +347,7 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient abs() { if (Double.doubleToLongBits(value) < 0) { // we use the bits representation to also handle -0.0 @@ -340,31 +358,37 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient ceil() { return createConstant(FastMath.ceil(value)); } /** {@inheritDoc} */ + @Override public SparseGradient floor() { return createConstant(FastMath.floor(value)); } /** {@inheritDoc} */ + @Override public SparseGradient rint() { return createConstant(FastMath.rint(value)); } /** {@inheritDoc} */ + @Override public long round() { return FastMath.round(value); } /** {@inheritDoc} */ + @Override public SparseGradient signum() { return createConstant(FastMath.signum(value)); } /** {@inheritDoc} */ + @Override public SparseGradient copySign(final SparseGradient sign) { final long m = Double.doubleToLongBits(value); final long s = Double.doubleToLongBits(sign.value); @@ -375,6 +399,7 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient copySign(final double sign) { final long m = Double.doubleToLongBits(value); final long s = Double.doubleToLongBits(sign); @@ -385,6 +410,7 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient scalb(final int n) { final SparseGradient out = new SparseGradient(FastMath.scalb(value, n), Collections. emptyMap()); for (Map.Entry entry : derivatives.entrySet()) { @@ -394,6 +420,7 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient hypot(final SparseGradient y) { if (Double.isInfinite(value) || Double.isInfinite(y.value)) { return createConstant(Double.POSITIVE_INFINITY); @@ -449,23 +476,27 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient reciprocal() { return new SparseGradient(1.0 / value, -1.0 / (value * value), derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient sqrt() { final double sqrt = FastMath.sqrt(value); return new SparseGradient(sqrt, 0.5 / sqrt, derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient cbrt() { final double cbrt = FastMath.cbrt(value); return new SparseGradient(cbrt, 1.0 / (3 * cbrt * cbrt), derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient rootN(final int n) { if (n == 2) { return sqrt(); @@ -478,11 +509,13 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient pow(final double p) { return new SparseGradient(FastMath.pow(value, p), p * FastMath.pow(value, p - 1), derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient pow(final int n) { if (n == 0) { return getField().getOne(); @@ -493,6 +526,7 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient pow(final SparseGradient e) { return log().multiply(e).exp(); } @@ -518,17 +552,20 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient exp() { final double e = FastMath.exp(value); return new SparseGradient(e, e, derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient expm1() { return new SparseGradient(FastMath.expm1(value), FastMath.exp(value), derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient log() { return new SparseGradient(FastMath.log(value), 1.0 / value, derivatives); } @@ -541,42 +578,50 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient log1p() { return new SparseGradient(FastMath.log1p(value), 1.0 / (1.0 + value), derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient cos() { return new SparseGradient(FastMath.cos(value), -FastMath.sin(value), derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient sin() { return new SparseGradient(FastMath.sin(value), FastMath.cos(value), derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient tan() { final double t = FastMath.tan(value); return new SparseGradient(t, 1 + t * t, derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient acos() { return new SparseGradient(FastMath.acos(value), -1.0 / FastMath.sqrt(1 - value * value), derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient asin() { return new SparseGradient(FastMath.asin(value), 1.0 / FastMath.sqrt(1 - value * value), derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient atan() { return new SparseGradient(FastMath.atan(value), 1.0 / (1 + value * value), derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient atan2(final SparseGradient x) { // compute r = sqrt(x^2+y^2) @@ -613,32 +658,38 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient cosh() { return new SparseGradient(FastMath.cosh(value), FastMath.sinh(value), derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient sinh() { return new SparseGradient(FastMath.sinh(value), FastMath.cosh(value), derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient tanh() { final double t = FastMath.tanh(value); return new SparseGradient(t, 1 - t * t, derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient acosh() { return new SparseGradient(FastMath.acosh(value), 1.0 / FastMath.sqrt(value * value - 1.0), derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient asinh() { return new SparseGradient(FastMath.asinh(value), 1.0 / FastMath.sqrt(value * value + 1.0), derivatives); } /** {@inheritDoc} */ + @Override public SparseGradient atanh() { return new SparseGradient(FastMath.atanh(value), 1.0 / (1.0 - value * value), derivatives); } @@ -680,6 +731,7 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient linearCombination(final SparseGradient[] a, final SparseGradient[] b) throws DimensionMismatchException { @@ -706,6 +758,7 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient linearCombination(final double[] a, final SparseGradient[] b) { // compute a simple value, with all partial derivatives @@ -726,6 +779,7 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient linearCombination(final SparseGradient a1, final SparseGradient b1, final SparseGradient a2, final SparseGradient b2) { @@ -740,6 +794,7 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient linearCombination(final double a1, final SparseGradient b1, final double a2, final SparseGradient b2) { @@ -754,6 +809,7 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient linearCombination(final SparseGradient a1, final SparseGradient b1, final SparseGradient a2, final SparseGradient b2, final SparseGradient a3, final SparseGradient b3) { @@ -771,6 +827,7 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient linearCombination(final double a1, final SparseGradient b1, final double a2, final SparseGradient b2, final double a3, final SparseGradient b3) { @@ -788,6 +845,7 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient linearCombination(final SparseGradient a1, final SparseGradient b1, final SparseGradient a2, final SparseGradient b2, final SparseGradient a3, final SparseGradient b3, @@ -807,6 +865,7 @@ public class SparseGradient implements RealFieldElement, Seriali } /** {@inheritDoc} */ + @Override public SparseGradient linearCombination(final double a1, final SparseGradient b1, final double a2, final SparseGradient b2, final double a3, final SparseGradient b3, diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Abs.java b/src/main/java/org/apache/commons/math4/analysis/function/Abs.java index 6f19b5490..9f52e5a2a 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Abs.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Abs.java @@ -27,6 +27,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Abs implements UnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.abs(x); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Acos.java b/src/main/java/org/apache/commons/math4/analysis/function/Acos.java index 1b51cde76..6733822e9 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Acos.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Acos.java @@ -31,6 +31,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Acos implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.acos(x); } @@ -39,6 +40,7 @@ public class Acos implements UnivariateDifferentiableFunction, DifferentiableUni * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ @Deprecated + @Override public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); } @@ -46,6 +48,7 @@ public class Acos implements UnivariateDifferentiableFunction, DifferentiableUni /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.acos(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Acosh.java b/src/main/java/org/apache/commons/math4/analysis/function/Acosh.java index 3dfcb5e3c..fb78cd528 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Acosh.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Acosh.java @@ -31,6 +31,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Acosh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.acosh(x); } @@ -39,6 +40,7 @@ public class Acosh implements UnivariateDifferentiableFunction, DifferentiableUn * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ @Deprecated + @Override public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); } @@ -46,6 +48,7 @@ public class Acosh implements UnivariateDifferentiableFunction, DifferentiableUn /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.acosh(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Add.java b/src/main/java/org/apache/commons/math4/analysis/function/Add.java index 68680aa6e..e66804ca2 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Add.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Add.java @@ -26,6 +26,7 @@ import org.apache.commons.math4.analysis.BivariateFunction; */ public class Add implements BivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x, double y) { return x + y; } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Asin.java b/src/main/java/org/apache/commons/math4/analysis/function/Asin.java index f6e439dca..ee6a66cba 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Asin.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Asin.java @@ -31,6 +31,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Asin implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.asin(x); } @@ -39,6 +40,7 @@ public class Asin implements UnivariateDifferentiableFunction, DifferentiableUni * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ @Deprecated + @Override public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); } @@ -46,6 +48,7 @@ public class Asin implements UnivariateDifferentiableFunction, DifferentiableUni /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.asin(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Asinh.java b/src/main/java/org/apache/commons/math4/analysis/function/Asinh.java index a632acb49..21184cd14 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Asinh.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Asinh.java @@ -31,6 +31,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Asinh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.asinh(x); } @@ -39,6 +40,7 @@ public class Asinh implements UnivariateDifferentiableFunction, DifferentiableUn * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ @Deprecated + @Override public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); } @@ -46,6 +48,7 @@ public class Asinh implements UnivariateDifferentiableFunction, DifferentiableUn /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.asinh(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Atan.java b/src/main/java/org/apache/commons/math4/analysis/function/Atan.java index 214428e19..122790597 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Atan.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Atan.java @@ -31,6 +31,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Atan implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.atan(x); } @@ -39,6 +40,7 @@ public class Atan implements UnivariateDifferentiableFunction, DifferentiableUni * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ @Deprecated + @Override public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); } @@ -46,6 +48,7 @@ public class Atan implements UnivariateDifferentiableFunction, DifferentiableUni /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.atan(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Atan2.java b/src/main/java/org/apache/commons/math4/analysis/function/Atan2.java index 6673b4af2..9fef4f193 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Atan2.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Atan2.java @@ -27,6 +27,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Atan2 implements BivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x, double y) { return FastMath.atan2(x, y); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Atanh.java b/src/main/java/org/apache/commons/math4/analysis/function/Atanh.java index c342b671a..1f573bf07 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Atanh.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Atanh.java @@ -31,6 +31,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Atanh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.atanh(x); } @@ -39,6 +40,7 @@ public class Atanh implements UnivariateDifferentiableFunction, DifferentiableUn * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ @Deprecated + @Override public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); } @@ -46,6 +48,7 @@ public class Atanh implements UnivariateDifferentiableFunction, DifferentiableUn /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.atanh(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Cbrt.java b/src/main/java/org/apache/commons/math4/analysis/function/Cbrt.java index 225395187..dc7cdcc35 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Cbrt.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Cbrt.java @@ -31,6 +31,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Cbrt implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.cbrt(x); } @@ -39,6 +40,7 @@ public class Cbrt implements UnivariateDifferentiableFunction, DifferentiableUni * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ @Deprecated + @Override public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); } @@ -46,6 +48,7 @@ public class Cbrt implements UnivariateDifferentiableFunction, DifferentiableUni /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.cbrt(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Ceil.java b/src/main/java/org/apache/commons/math4/analysis/function/Ceil.java index 21d8034b6..161f73d04 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Ceil.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Ceil.java @@ -27,6 +27,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Ceil implements UnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.ceil(x); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Constant.java b/src/main/java/org/apache/commons/math4/analysis/function/Constant.java index e2fac7a4b..acd9681cb 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Constant.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Constant.java @@ -38,6 +38,7 @@ public class Constant implements UnivariateDifferentiableFunction, Differentiabl } /** {@inheritDoc} */ + @Override public double value(double x) { return c; } @@ -46,6 +47,7 @@ public class Constant implements UnivariateDifferentiableFunction, Differentiabl * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ @Deprecated + @Override public DifferentiableUnivariateFunction derivative() { return new Constant(0); } @@ -53,6 +55,7 @@ public class Constant implements UnivariateDifferentiableFunction, Differentiabl /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return new DerivativeStructure(t.getFreeParameters(), t.getOrder(), c); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Cos.java b/src/main/java/org/apache/commons/math4/analysis/function/Cos.java index a6607bfe3..8f3807009 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Cos.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Cos.java @@ -31,6 +31,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Cos implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.cos(x); } @@ -39,6 +40,7 @@ public class Cos implements UnivariateDifferentiableFunction, DifferentiableUniv * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ @Deprecated + @Override public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); } @@ -46,6 +48,7 @@ public class Cos implements UnivariateDifferentiableFunction, DifferentiableUniv /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.cos(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Cosh.java b/src/main/java/org/apache/commons/math4/analysis/function/Cosh.java index 5c9416bcd..4bdcad584 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Cosh.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Cosh.java @@ -29,6 +29,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Cosh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.cosh(x); } @@ -37,6 +38,7 @@ public class Cosh implements UnivariateDifferentiableFunction, DifferentiableUni * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ @Deprecated + @Override public DifferentiableUnivariateFunction derivative() { return new Sinh(); } @@ -44,6 +46,7 @@ public class Cosh implements UnivariateDifferentiableFunction, DifferentiableUni /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.cosh(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Divide.java b/src/main/java/org/apache/commons/math4/analysis/function/Divide.java index 18f8f317b..a49769248 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Divide.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Divide.java @@ -26,6 +26,7 @@ import org.apache.commons.math4.analysis.BivariateFunction; */ public class Divide implements BivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x, double y) { return x / y; } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Exp.java b/src/main/java/org/apache/commons/math4/analysis/function/Exp.java index 6233bbc2e..7baf5354d 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Exp.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Exp.java @@ -31,6 +31,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Exp implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.exp(x); } @@ -38,6 +39,7 @@ public class Exp implements UnivariateDifferentiableFunction, DifferentiableUniv /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ + @Override @Deprecated public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); @@ -46,6 +48,7 @@ public class Exp implements UnivariateDifferentiableFunction, DifferentiableUniv /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.exp(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Expm1.java b/src/main/java/org/apache/commons/math4/analysis/function/Expm1.java index 552411d7c..1b0c61dd6 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Expm1.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Expm1.java @@ -31,6 +31,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Expm1 implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.expm1(x); } @@ -38,6 +39,7 @@ public class Expm1 implements UnivariateDifferentiableFunction, DifferentiableUn /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ + @Override @Deprecated public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); @@ -46,6 +48,7 @@ public class Expm1 implements UnivariateDifferentiableFunction, DifferentiableUn /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.expm1(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Floor.java b/src/main/java/org/apache/commons/math4/analysis/function/Floor.java index d63093536..1ecd5d72a 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Floor.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Floor.java @@ -27,6 +27,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Floor implements UnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.floor(x); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Gaussian.java b/src/main/java/org/apache/commons/math4/analysis/function/Gaussian.java index da3eecb2c..1b04a34fb 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Gaussian.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Gaussian.java @@ -90,6 +90,7 @@ public class Gaussian implements UnivariateDifferentiableFunction, Differentiabl } /** {@inheritDoc} */ + @Override public double value(double x) { return value(x - mean, norm, i2s2); } @@ -97,6 +98,7 @@ public class Gaussian implements UnivariateDifferentiableFunction, Differentiabl /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ + @Override @Deprecated public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); @@ -208,6 +210,7 @@ public class Gaussian implements UnivariateDifferentiableFunction, Differentiabl /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) throws DimensionMismatchException { diff --git a/src/main/java/org/apache/commons/math4/analysis/function/HarmonicOscillator.java b/src/main/java/org/apache/commons/math4/analysis/function/HarmonicOscillator.java index 5e4336733..b07ac6636 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/HarmonicOscillator.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/HarmonicOscillator.java @@ -57,6 +57,7 @@ public class HarmonicOscillator implements UnivariateDifferentiableFunction, Dif } /** {@inheritDoc} */ + @Override public double value(double x) { return value(omega * x + phase, amplitude); } @@ -64,6 +65,7 @@ public class HarmonicOscillator implements UnivariateDifferentiableFunction, Dif /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ + @Override @Deprecated public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); @@ -161,6 +163,7 @@ public class HarmonicOscillator implements UnivariateDifferentiableFunction, Dif /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) throws DimensionMismatchException { final double x = t.getValue(); diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Identity.java b/src/main/java/org/apache/commons/math4/analysis/function/Identity.java index 1309f41e2..dd0c84bb9 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Identity.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Identity.java @@ -28,6 +28,7 @@ import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiabl */ public class Identity implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return x; } @@ -35,6 +36,7 @@ public class Identity implements UnivariateDifferentiableFunction, Differentiabl /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ + @Override @Deprecated public DifferentiableUnivariateFunction derivative() { return new Constant(1); @@ -43,6 +45,7 @@ public class Identity implements UnivariateDifferentiableFunction, Differentiabl /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t; } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Inverse.java b/src/main/java/org/apache/commons/math4/analysis/function/Inverse.java index 459eb222f..77df37bb7 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Inverse.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Inverse.java @@ -30,6 +30,7 @@ import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiabl */ public class Inverse implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return 1 / x; } @@ -37,6 +38,7 @@ public class Inverse implements UnivariateDifferentiableFunction, Differentiable /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ + @Override @Deprecated public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); @@ -45,6 +47,7 @@ public class Inverse implements UnivariateDifferentiableFunction, Differentiable /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.reciprocal(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Log.java b/src/main/java/org/apache/commons/math4/analysis/function/Log.java index dbf332ceb..028890ce6 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Log.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Log.java @@ -31,6 +31,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Log implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.log(x); } @@ -38,6 +39,7 @@ public class Log implements UnivariateDifferentiableFunction, DifferentiableUniv /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ + @Override @Deprecated public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); @@ -46,6 +48,7 @@ public class Log implements UnivariateDifferentiableFunction, DifferentiableUniv /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.log(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Log10.java b/src/main/java/org/apache/commons/math4/analysis/function/Log10.java index 6ccc3cf9f..cb8184c2d 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Log10.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Log10.java @@ -32,6 +32,7 @@ import org.apache.commons.math4.util.FastMath; public class Log10 implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.log10(x); } @@ -39,6 +40,7 @@ public class Log10 implements UnivariateDifferentiableFunction, DifferentiableUn /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ + @Override @Deprecated public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); @@ -47,6 +49,7 @@ public class Log10 implements UnivariateDifferentiableFunction, DifferentiableUn /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.log10(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Log1p.java b/src/main/java/org/apache/commons/math4/analysis/function/Log1p.java index 1974f056f..5f223fa4b 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Log1p.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Log1p.java @@ -31,6 +31,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Log1p implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.log1p(x); } @@ -38,6 +39,7 @@ public class Log1p implements UnivariateDifferentiableFunction, DifferentiableUn /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ + @Override @Deprecated public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); @@ -46,6 +48,7 @@ public class Log1p implements UnivariateDifferentiableFunction, DifferentiableUn /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.log1p(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Logistic.java b/src/main/java/org/apache/commons/math4/analysis/function/Logistic.java index 3ca6b7164..701b3cf38 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Logistic.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Logistic.java @@ -81,6 +81,7 @@ public class Logistic implements UnivariateDifferentiableFunction, Differentiabl } /** {@inheritDoc} */ + @Override public double value(double x) { return value(m - x, k, b, q, a, oneOverN); } @@ -88,6 +89,7 @@ public class Logistic implements UnivariateDifferentiableFunction, Differentiabl /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ + @Override @Deprecated public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); @@ -221,6 +223,7 @@ public class Logistic implements UnivariateDifferentiableFunction, Differentiabl /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.negate().add(m).multiply(b).exp().multiply(q).add(1).pow(oneOverN).reciprocal().multiply(k - a).add(a); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Logit.java b/src/main/java/org/apache/commons/math4/analysis/function/Logit.java index 83e9adae8..24ad0d1b3 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Logit.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Logit.java @@ -62,6 +62,7 @@ public class Logit implements UnivariateDifferentiableFunction, DifferentiableUn } /** {@inheritDoc} */ + @Override public double value(double x) throws OutOfRangeException { return value(x, lo, hi); @@ -70,6 +71,7 @@ public class Logit implements UnivariateDifferentiableFunction, DifferentiableUn /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ + @Override @Deprecated public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); @@ -168,6 +170,7 @@ public class Logit implements UnivariateDifferentiableFunction, DifferentiableUn * @since 3.1 * @exception OutOfRangeException if parameter is outside of function domain */ + @Override public DerivativeStructure value(final DerivativeStructure t) throws OutOfRangeException { final double x = t.getValue(); diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Max.java b/src/main/java/org/apache/commons/math4/analysis/function/Max.java index f8ca201ab..cf6a3e351 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Max.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Max.java @@ -27,6 +27,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Max implements BivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x, double y) { return FastMath.max(x, y); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Min.java b/src/main/java/org/apache/commons/math4/analysis/function/Min.java index ee23e96d6..0866dde53 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Min.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Min.java @@ -27,6 +27,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Min implements BivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x, double y) { return FastMath.min(x, y); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Minus.java b/src/main/java/org/apache/commons/math4/analysis/function/Minus.java index d0546c6c0..61f847a53 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Minus.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Minus.java @@ -28,6 +28,7 @@ import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiabl */ public class Minus implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return -x; } @@ -35,6 +36,7 @@ public class Minus implements UnivariateDifferentiableFunction, DifferentiableUn /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ + @Override @Deprecated public DifferentiableUnivariateFunction derivative() { return new Constant(-1); @@ -43,6 +45,7 @@ public class Minus implements UnivariateDifferentiableFunction, DifferentiableUn /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.negate(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Multiply.java b/src/main/java/org/apache/commons/math4/analysis/function/Multiply.java index a5f6be5bb..df3bb50c9 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Multiply.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Multiply.java @@ -26,6 +26,7 @@ import org.apache.commons.math4.analysis.BivariateFunction; */ public class Multiply implements BivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x, double y) { return x * y; } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Pow.java b/src/main/java/org/apache/commons/math4/analysis/function/Pow.java index 475d6b78b..52df284cc 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Pow.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Pow.java @@ -27,6 +27,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Pow implements BivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x, double y) { return FastMath.pow(x, y); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Power.java b/src/main/java/org/apache/commons/math4/analysis/function/Power.java index 12722ca48..4ded52a34 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Power.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Power.java @@ -41,6 +41,7 @@ public class Power implements UnivariateDifferentiableFunction, DifferentiableUn } /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.pow(x, p); } @@ -48,6 +49,7 @@ public class Power implements UnivariateDifferentiableFunction, DifferentiableUn /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ + @Override @Deprecated public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); @@ -56,6 +58,7 @@ public class Power implements UnivariateDifferentiableFunction, DifferentiableUn /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.pow(p); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Rint.java b/src/main/java/org/apache/commons/math4/analysis/function/Rint.java index 2b662f5cb..31312237e 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Rint.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Rint.java @@ -27,6 +27,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Rint implements UnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.rint(x); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Sigmoid.java b/src/main/java/org/apache/commons/math4/analysis/function/Sigmoid.java index 5a80a0a53..577728ee0 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Sigmoid.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Sigmoid.java @@ -67,12 +67,14 @@ public class Sigmoid implements UnivariateDifferentiableFunction, Differentiable /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ + @Override @Deprecated public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); } /** {@inheritDoc} */ + @Override public double value(double x) { return value(x, lo, hi); } @@ -164,6 +166,7 @@ public class Sigmoid implements UnivariateDifferentiableFunction, Differentiable /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) throws DimensionMismatchException { diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Signum.java b/src/main/java/org/apache/commons/math4/analysis/function/Signum.java index c15512bbd..45fbc47c0 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Signum.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Signum.java @@ -27,6 +27,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Signum implements UnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.signum(x); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Sin.java b/src/main/java/org/apache/commons/math4/analysis/function/Sin.java index f094d0555..4d57d9ae5 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Sin.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Sin.java @@ -29,6 +29,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Sin implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.sin(x); } @@ -36,6 +37,7 @@ public class Sin implements UnivariateDifferentiableFunction, DifferentiableUniv /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ + @Override @Deprecated public DifferentiableUnivariateFunction derivative() { return new Cos(); @@ -44,6 +46,7 @@ public class Sin implements UnivariateDifferentiableFunction, DifferentiableUniv /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.sin(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Sinc.java b/src/main/java/org/apache/commons/math4/analysis/function/Sinc.java index fc0d66e86..72bf6114b 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Sinc.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Sinc.java @@ -82,6 +82,7 @@ public class Sinc implements UnivariateDifferentiableFunction, DifferentiableUni } /** {@inheritDoc} */ + @Override public double value(final double x) { final double scaledX = normalized ? FastMath.PI * x : x; if (FastMath.abs(scaledX) <= SHORTCUT) { @@ -97,6 +98,7 @@ public class Sinc implements UnivariateDifferentiableFunction, DifferentiableUni /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ + @Override @Deprecated public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); @@ -105,6 +107,7 @@ public class Sinc implements UnivariateDifferentiableFunction, DifferentiableUni /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) throws DimensionMismatchException { diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Sinh.java b/src/main/java/org/apache/commons/math4/analysis/function/Sinh.java index db6c3111f..2274fb170 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Sinh.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Sinh.java @@ -29,6 +29,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Sinh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.sinh(x); } @@ -36,6 +37,7 @@ public class Sinh implements UnivariateDifferentiableFunction, DifferentiableUni /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ + @Override @Deprecated public DifferentiableUnivariateFunction derivative() { return new Cosh(); @@ -44,6 +46,7 @@ public class Sinh implements UnivariateDifferentiableFunction, DifferentiableUni /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.sinh(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Sqrt.java b/src/main/java/org/apache/commons/math4/analysis/function/Sqrt.java index 97c798080..381d8ccb7 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Sqrt.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Sqrt.java @@ -31,6 +31,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Sqrt implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.sqrt(x); } @@ -38,6 +39,7 @@ public class Sqrt implements UnivariateDifferentiableFunction, DifferentiableUni /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ + @Override @Deprecated public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); @@ -46,6 +48,7 @@ public class Sqrt implements UnivariateDifferentiableFunction, DifferentiableUni /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.sqrt(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/StepFunction.java b/src/main/java/org/apache/commons/math4/analysis/function/StepFunction.java index 8d4e41935..a8289c2ce 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/StepFunction.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/StepFunction.java @@ -80,6 +80,7 @@ public class StepFunction implements UnivariateFunction { } /** {@inheritDoc} */ + @Override public double value(double x) { int index = Arrays.binarySearch(abscissa, x); double fx = 0; diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Subtract.java b/src/main/java/org/apache/commons/math4/analysis/function/Subtract.java index 71dd8e69d..1ce5e95a4 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Subtract.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Subtract.java @@ -26,6 +26,7 @@ import org.apache.commons.math4.analysis.BivariateFunction; */ public class Subtract implements BivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x, double y) { return x - y; } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Tan.java b/src/main/java/org/apache/commons/math4/analysis/function/Tan.java index f2f1d3c4b..cef9146d8 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Tan.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Tan.java @@ -31,6 +31,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Tan implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.tan(x); } @@ -38,6 +39,7 @@ public class Tan implements UnivariateDifferentiableFunction, DifferentiableUniv /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ + @Override @Deprecated public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); @@ -46,6 +48,7 @@ public class Tan implements UnivariateDifferentiableFunction, DifferentiableUniv /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.tan(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Tanh.java b/src/main/java/org/apache/commons/math4/analysis/function/Tanh.java index 64e9400e1..afe70f9cf 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Tanh.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Tanh.java @@ -31,6 +31,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Tanh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.tanh(x); } @@ -38,6 +39,7 @@ public class Tanh implements UnivariateDifferentiableFunction, DifferentiableUni /** {@inheritDoc} * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)} */ + @Override @Deprecated public UnivariateFunction derivative() { return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative(); @@ -46,6 +48,7 @@ public class Tanh implements UnivariateDifferentiableFunction, DifferentiableUni /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { return t.tanh(); } diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Ulp.java b/src/main/java/org/apache/commons/math4/analysis/function/Ulp.java index a4b94184f..543a7d46a 100644 --- a/src/main/java/org/apache/commons/math4/analysis/function/Ulp.java +++ b/src/main/java/org/apache/commons/math4/analysis/function/Ulp.java @@ -27,6 +27,7 @@ import org.apache.commons.math4.util.FastMath; */ public class Ulp implements UnivariateFunction { /** {@inheritDoc} */ + @Override public double value(double x) { return FastMath.ulp(x); } diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/BaseAbstractUnivariateIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/BaseAbstractUnivariateIntegrator.java index 76fcdeaa8..eb052f649 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/BaseAbstractUnivariateIntegrator.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/BaseAbstractUnivariateIntegrator.java @@ -159,31 +159,37 @@ public abstract class BaseAbstractUnivariateIntegrator implements UnivariateInte } /** {@inheritDoc} */ + @Override public double getRelativeAccuracy() { return relativeAccuracy; } /** {@inheritDoc} */ + @Override public double getAbsoluteAccuracy() { return absoluteAccuracy; } /** {@inheritDoc} */ + @Override public int getMinimalIterationCount() { return minimalIterationCount; } /** {@inheritDoc} */ + @Override public int getMaximalIterationCount() { return iterations.getMaximalCount(); } /** {@inheritDoc} */ + @Override public int getEvaluations() { return evaluations.getCount(); } /** {@inheritDoc} */ + @Override public int getIterations() { return iterations.getCount(); } @@ -251,6 +257,7 @@ public abstract class BaseAbstractUnivariateIntegrator implements UnivariateInte } /** {@inheritDoc} */ + @Override public double integrate(final int maxEval, final UnivariateFunction f, final double lower, final double upper) throws TooManyEvaluationsException, MaxCountExceededException, diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunction.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunction.java index cea976612..b89a51778 100644 --- a/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunction.java +++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunction.java @@ -154,6 +154,7 @@ public class BicubicInterpolatingFunction /** * {@inheritDoc} */ + @Override public double value(double x, double y) throws OutOfRangeException { final int i = searchIndex(x, xval); @@ -287,6 +288,7 @@ class BicubicFunction implements BivariateFunction { /** * {@inheritDoc} */ + @Override public double value(double x, double y) { if (x < 0 || x > 1) { throw new OutOfRangeException(x, 0, 1); diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolator.java index 95617f5cc..4737a9bc2 100644 --- a/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolator.java +++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolator.java @@ -44,6 +44,7 @@ public class BicubicInterpolator /** * {@inheritDoc} */ + @Override public BicubicInterpolatingFunction interpolate(final double[] xval, final double[] yval, final double[][] fval) diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolator.java index b26787455..0cc54f151 100644 --- a/src/main/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolator.java +++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolator.java @@ -87,6 +87,7 @@ public class MicrosphereInterpolator /** * {@inheritDoc} */ + @Override public MultivariateFunction interpolate(final double[][] xval, final double[] yval) throws DimensionMismatchException, diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunction.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunction.java index 8a5345328..f547a1f3b 100644 --- a/src/main/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunction.java +++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunction.java @@ -112,6 +112,7 @@ public class PiecewiseBicubicSplineInterpolatingFunction /** * {@inheritDoc} */ + @Override public double value(double x, double y) throws OutOfRangeException { diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolator.java index bd3f62011..7d16b2c2f 100644 --- a/src/main/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolator.java +++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolator.java @@ -33,6 +33,7 @@ public class PiecewiseBicubicSplineInterpolator /** * {@inheritDoc} */ + @Override public PiecewiseBicubicSplineInterpolatingFunction interpolate( final double[] xval, final double[] yval, final double[][] fval) diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunction.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunction.java index 450a2e303..f4f13aa85 100644 --- a/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunction.java +++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunction.java @@ -309,6 +309,7 @@ public class TricubicInterpolatingFunction * * @throws OutOfRangeException if any of the variables is outside its interpolation range. */ + @Override public double value(double x, double y, double z) throws OutOfRangeException { final int i = searchIndex(x, xval); diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolator.java index 027088271..e8fc3d19a 100644 --- a/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolator.java +++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolator.java @@ -32,6 +32,7 @@ public class TricubicInterpolator /** * {@inheritDoc} */ + @Override public TricubicInterpolatingFunction interpolate(final double[] xval, final double[] yval, final double[] zval, diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/UnivariatePeriodicInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/UnivariatePeriodicInterpolator.java index 88b0f5590..2ba29bbf9 100644 --- a/src/main/java/org/apache/commons/math4/analysis/interpolation/UnivariatePeriodicInterpolator.java +++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/UnivariatePeriodicInterpolator.java @@ -81,6 +81,7 @@ public class UnivariatePeriodicInterpolator * @throws NumberIsTooSmallException if the number of extension points * is larger than the size of {@code xval}. */ + @Override public UnivariateFunction interpolate(double[] xval, double[] yval) throws NumberIsTooSmallException, NonMonotonicSequenceException { diff --git a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunction.java b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunction.java index 886e2d7ad..0260f5819 100644 --- a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunction.java +++ b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunction.java @@ -144,6 +144,7 @@ public class PolynomialFunction implements UnivariateDifferentiableFunction, Dif * @throws NoDataException if {@code coefficients} is empty. * @throws NullArgumentException if {@code coefficients} is {@code null}. */ + @Override public DerivativeStructure value(final DerivativeStructure t) throws NullArgumentException, NoDataException { MathUtils.checkNotNull(coefficients); @@ -393,6 +394,7 @@ public class PolynomialFunction implements UnivariateDifferentiableFunction, Dif */ public static class Parametric implements ParametricUnivariateFunction { /** {@inheritDoc} */ + @Override public double[] gradient(double x, double ... parameters) { final double[] gradient = new double[parameters.length]; double xn = 1.0; @@ -404,6 +406,7 @@ public class PolynomialFunction implements UnivariateDifferentiableFunction, Dif } /** {@inheritDoc} */ + @Override public double value(final double x, final double ... parameters) throws NoDataException { return PolynomialFunction.evaluate(parameters, x); diff --git a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionNewtonForm.java b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionNewtonForm.java index a87eee81a..f63359fee 100644 --- a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionNewtonForm.java +++ b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionNewtonForm.java @@ -100,6 +100,7 @@ public class PolynomialFunctionNewtonForm implements UnivariateDifferentiableFun * {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { verifyInputArray(a, c); diff --git a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunction.java b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunction.java index 8bf1aaacb..7e501c2ce 100644 --- a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunction.java +++ b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunction.java @@ -175,6 +175,7 @@ public class PolynomialSplineFunction implements UnivariateDifferentiableFunctio /** {@inheritDoc} * @since 3.1 */ + @Override public DerivativeStructure value(final DerivativeStructure t) { final double t0 = t.getValue(); if (t0 < knots[0] || t0 > knots[n]) { diff --git a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtils.java b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtils.java index 5416e1914..601692eff 100644 --- a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtils.java +++ b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtils.java @@ -106,6 +106,7 @@ public class PolynomialsUtils { new RecurrenceCoefficientsGenerator() { private final BigFraction[] coeffs = { BigFraction.ZERO, BigFraction.TWO, BigFraction.ONE }; /** {@inheritDoc} */ + @Override public BigFraction[] generate(int k) { return coeffs; } @@ -130,6 +131,7 @@ public class PolynomialsUtils { return buildPolynomial(degree, HERMITE_COEFFICIENTS, new RecurrenceCoefficientsGenerator() { /** {@inheritDoc} */ + @Override public BigFraction[] generate(int k) { return new BigFraction[] { BigFraction.ZERO, @@ -156,6 +158,7 @@ public class PolynomialsUtils { return buildPolynomial(degree, LAGUERRE_COEFFICIENTS, new RecurrenceCoefficientsGenerator() { /** {@inheritDoc} */ + @Override public BigFraction[] generate(int k) { final int kP1 = k + 1; return new BigFraction[] { @@ -183,6 +186,7 @@ public class PolynomialsUtils { return buildPolynomial(degree, LEGENDRE_COEFFICIENTS, new RecurrenceCoefficientsGenerator() { /** {@inheritDoc} */ + @Override public BigFraction[] generate(int k) { final int kP1 = k + 1; return new BigFraction[] { @@ -233,6 +237,7 @@ public class PolynomialsUtils { return buildPolynomial(degree, JACOBI_COEFFICIENTS.get(key), new RecurrenceCoefficientsGenerator() { /** {@inheritDoc} */ + @Override public BigFraction[] generate(int k) { k++; final int kvw = k + v + w; diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/BaseAbstractUnivariateSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/BaseAbstractUnivariateSolver.java index f74e860cd..a65cd418d 100644 --- a/src/main/java/org/apache/commons/math4/analysis/solvers/BaseAbstractUnivariateSolver.java +++ b/src/main/java/org/apache/commons/math4/analysis/solvers/BaseAbstractUnivariateSolver.java @@ -101,10 +101,12 @@ public abstract class BaseAbstractUnivariateSolver { } /** {@inheritDoc} */ + @Override public boolean converged(final int iteration, final Evaluation previous, final Evaluation current) { diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizer.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizer.java index 39c5803b7..92619d651 100644 --- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizer.java +++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizer.java @@ -204,6 +204,7 @@ public class GaussNewtonOptimizer implements LeastSquaresOptimizer { } /** {@inheritDoc} */ + @Override public Optimum optimize(final LeastSquaresProblem lsp) { //create local evaluation and iteration counts final Incrementor evaluationCounter = lsp.getEvaluationCounter(); diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresAdapter.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresAdapter.java index 474430515..1aff77849 100644 --- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresAdapter.java +++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresAdapter.java @@ -40,37 +40,44 @@ public class LeastSquaresAdapter implements LeastSquaresProblem { } /** {@inheritDoc} */ + @Override public RealVector getStart() { return problem.getStart(); } /** {@inheritDoc} */ + @Override public int getObservationSize() { return problem.getObservationSize(); } /** {@inheritDoc} */ + @Override public int getParameterSize() { return problem.getParameterSize(); } /** {@inheritDoc} * @param point*/ + @Override public Evaluation evaluate(final RealVector point) { return problem.evaluate(point); } /** {@inheritDoc} */ + @Override public Incrementor getEvaluationCounter() { return problem.getEvaluationCounter(); } /** {@inheritDoc} */ + @Override public Incrementor getIterationCounter() { return problem.getIterationCounter(); } /** {@inheritDoc} */ + @Override public ConvergenceChecker getConvergenceChecker() { return problem.getConvergenceChecker(); } diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresFactory.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresFactory.java index 8f96d8783..a85473703 100644 --- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresFactory.java +++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresFactory.java @@ -321,6 +321,7 @@ public class LeastSquaresFactory { } /** {@inheritDoc} */ + @Override public Pair value(final RealVector point) { //TODO get array from RealVector without copying? final double[] p = point.toArray(); @@ -331,11 +332,13 @@ public class LeastSquaresFactory { } /** {@inheritDoc} */ + @Override public RealVector computeValue(final double[] params) { return new ArrayRealVector(value.value(params), false); } /** {@inheritDoc} */ + @Override public RealMatrix computeJacobian(final double[] params) { return new Array2DRowRealMatrix(jacobian.value(params), false); } @@ -400,21 +403,25 @@ public class LeastSquaresFactory { } /** {@inheritDoc} */ + @Override public int getObservationSize() { return target.getDimension(); } /** {@inheritDoc} */ + @Override public int getParameterSize() { return start.getDimension(); } /** {@inheritDoc} */ + @Override public RealVector getStart() { return start == null ? null : start.copy(); } /** {@inheritDoc} */ + @Override public Evaluation evaluate(final RealVector point) { // Copy so optimizer can change point without changing our instance. final RealVector p = paramValidator == null ? @@ -465,16 +472,19 @@ public class LeastSquaresFactory { } /** {@inheritDoc} */ + @Override public RealMatrix getJacobian() { return jacobian; } /** {@inheritDoc} */ + @Override public RealVector getPoint() { return point; } /** {@inheritDoc} */ + @Override public RealVector getResiduals() { return residuals; } @@ -509,16 +519,19 @@ public class LeastSquaresFactory { } /** {@inheritDoc} */ + @Override public RealMatrix getJacobian() { return model.computeJacobian(point.toArray()); } /** {@inheritDoc} */ + @Override public RealVector getPoint() { return point; } /** {@inheritDoc} */ + @Override public RealVector getResiduals() { return target.subtract(model.computeValue(point.toArray())); } diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizer.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizer.java index 3e5ea1a51..c7a721a80 100644 --- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizer.java +++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizer.java @@ -293,6 +293,7 @@ public class LevenbergMarquardtOptimizer implements LeastSquaresOptimizer { } /** {@inheritDoc} */ + @Override public Optimum optimize(final LeastSquaresProblem problem) { // Pull in relevant data from the problem as locals. final int nR = problem.getObservationSize(); // Number of observed data. diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/OptimumImpl.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/OptimumImpl.java index ddd478d89..2a5585954 100644 --- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/OptimumImpl.java +++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/OptimumImpl.java @@ -51,56 +51,67 @@ class OptimumImpl implements Optimum { /* auto-generated implementations */ /** {@inheritDoc} */ + @Override public int getEvaluations() { return evaluations; } /** {@inheritDoc} */ + @Override public int getIterations() { return iterations; } /** {@inheritDoc} */ + @Override public RealMatrix getCovariances(double threshold) { return value.getCovariances(threshold); } /** {@inheritDoc} */ + @Override public RealVector getSigma(double covarianceSingularityThreshold) { return value.getSigma(covarianceSingularityThreshold); } /** {@inheritDoc} */ + @Override public double getRMS() { return value.getRMS(); } /** {@inheritDoc} */ + @Override public RealMatrix getJacobian() { return value.getJacobian(); } /** {@inheritDoc} */ + @Override public double getCost() { return value.getCost(); } /** {@inheritDoc} */ + @Override public double getChiSquare() { return value.getChiSquare(); } /** {@inheritDoc} */ + @Override public double getReducedChiSquare(int n) { return value.getReducedChiSquare(n); } /** {@inheritDoc} */ + @Override public RealVector getResiduals() { return value.getResiduals(); } /** {@inheritDoc} */ + @Override public RealVector getPoint() { return value.getPoint(); } diff --git a/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java b/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java index 314456a0a..23c496934 100644 --- a/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java +++ b/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java @@ -124,19 +124,23 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public Field getField() { return field; } /** {@inheritDoc} */ + @Override public abstract FieldMatrix createMatrix(final int rowDimension, final int columnDimension) throws NotStrictlyPositiveException; /** {@inheritDoc} */ + @Override public abstract FieldMatrix copy(); /** {@inheritDoc} */ + @Override public FieldMatrix add(FieldMatrix m) throws MatrixDimensionMismatchException { // safety check @@ -155,6 +159,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public FieldMatrix subtract(final FieldMatrix m) throws MatrixDimensionMismatchException { // safety check @@ -173,6 +178,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public FieldMatrix scalarAdd(final T d) { final int rowCount = getRowDimension(); @@ -188,6 +194,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public FieldMatrix scalarMultiply(final T d) { final int rowCount = getRowDimension(); final int columnCount = getColumnDimension(); @@ -202,6 +209,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public FieldMatrix multiply(final FieldMatrix m) throws DimensionMismatchException { // safety check @@ -225,12 +233,14 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public FieldMatrix preMultiply(final FieldMatrix m) throws DimensionMismatchException { return m.multiply(this); } /** {@inheritDoc} */ + @Override public FieldMatrix power(final int p) throws NonSquareMatrixException, NotPositiveException { if (p < 0) { @@ -290,6 +300,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public T[][] getData() { final T[][] data = MathArrays.buildArray(field, getRowDimension(), getColumnDimension()); @@ -304,6 +315,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public FieldMatrix getSubMatrix(final int startRow, final int endRow, final int startColumn, final int endColumn) throws NumberIsTooSmallException, OutOfRangeException { @@ -322,6 +334,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public FieldMatrix getSubMatrix(final int[] selectedRows, final int[] selectedColumns) throws NoDataException, NullArgumentException, OutOfRangeException { @@ -347,6 +360,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public void copySubMatrix(final int startRow, final int endRow, final int startColumn, final int endColumn, final T[][] destination) @@ -392,6 +406,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public void copySubMatrix(int[] selectedRows, int[] selectedColumns, T[][] destination) throws MatrixDimensionMismatchException, NoDataException, NullArgumentException, OutOfRangeException { @@ -416,6 +431,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public void setSubMatrix(final T[][] subMatrix, final int row, final int column) throws DimensionMismatchException, OutOfRangeException, @@ -452,6 +468,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public FieldMatrix getRowMatrix(final int row) throws OutOfRangeException { checkRowIndex(row); final int nCols = getColumnDimension(); @@ -465,6 +482,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public void setRowMatrix(final int row, final FieldMatrix matrix) throws OutOfRangeException, MatrixDimensionMismatchException { checkRowIndex(row); @@ -482,6 +500,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public FieldMatrix getColumnMatrix(final int column) throws OutOfRangeException { @@ -497,6 +516,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public void setColumnMatrix(final int column, final FieldMatrix matrix) throws OutOfRangeException, MatrixDimensionMismatchException { checkColumnIndex(column); @@ -514,12 +534,14 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public FieldVector getRowVector(final int row) throws OutOfRangeException { return new ArrayFieldVector(field, getRow(row), false); } /** {@inheritDoc} */ + @Override public void setRowVector(final int row, final FieldVector vector) throws OutOfRangeException, MatrixDimensionMismatchException { checkRowIndex(row); @@ -535,12 +557,14 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public FieldVector getColumnVector(final int column) throws OutOfRangeException { return new ArrayFieldVector(field, getColumn(column), false); } /** {@inheritDoc} */ + @Override public void setColumnVector(final int column, final FieldVector vector) throws OutOfRangeException, MatrixDimensionMismatchException { @@ -557,6 +581,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public T[] getRow(final int row) throws OutOfRangeException { checkRowIndex(row); final int nCols = getColumnDimension(); @@ -570,6 +595,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public void setRow(final int row, final T[] array) throws OutOfRangeException, MatrixDimensionMismatchException { checkRowIndex(row); @@ -584,6 +610,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public T[] getColumn(final int column) throws OutOfRangeException { checkColumnIndex(column); final int nRows = getRowDimension(); @@ -597,6 +624,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public void setColumn(final int column, final T[] array) throws OutOfRangeException, MatrixDimensionMismatchException { checkColumnIndex(column); @@ -610,18 +638,23 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public abstract T getEntry(int row, int column) throws OutOfRangeException; /** {@inheritDoc} */ + @Override public abstract void setEntry(int row, int column, T value) throws OutOfRangeException; /** {@inheritDoc} */ + @Override public abstract void addToEntry(int row, int column, T increment) throws OutOfRangeException; /** {@inheritDoc} */ + @Override public abstract void multiplyEntry(int row, int column, T factor) throws OutOfRangeException; /** {@inheritDoc} */ + @Override public FieldMatrix transpose() { final int nRows = getRowDimension(); final int nCols = getColumnDimension(); @@ -638,17 +671,21 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public boolean isSquare() { return getColumnDimension() == getRowDimension(); } /** {@inheritDoc} */ + @Override public abstract int getRowDimension(); /** {@inheritDoc} */ + @Override public abstract int getColumnDimension(); /** {@inheritDoc} */ + @Override public T getTrace() throws NonSquareMatrixException { final int nRows = getRowDimension(); final int nCols = getColumnDimension(); @@ -663,6 +700,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public T[] operate(final T[] v) throws DimensionMismatchException { final int nRows = getRowDimension(); @@ -684,6 +722,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public FieldVector operate(final FieldVector v) throws DimensionMismatchException { try { @@ -709,6 +748,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public T[] preMultiply(final T[] v) throws DimensionMismatchException { final int nRows = getRowDimension(); @@ -730,6 +770,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public FieldVector preMultiply(final FieldVector v) throws DimensionMismatchException { try { @@ -755,6 +796,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public T walkInRowOrder(final FieldMatrixChangingVisitor visitor) { final int rows = getRowDimension(); final int columns = getColumnDimension(); @@ -770,6 +812,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public T walkInRowOrder(final FieldMatrixPreservingVisitor visitor) { final int rows = getRowDimension(); final int columns = getColumnDimension(); @@ -783,6 +826,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public T walkInRowOrder(final FieldMatrixChangingVisitor visitor, final int startRow, final int endRow, final int startColumn, final int endColumn) @@ -801,6 +845,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public T walkInRowOrder(final FieldMatrixPreservingVisitor visitor, final int startRow, final int endRow, final int startColumn, final int endColumn) @@ -817,6 +862,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public T walkInColumnOrder(final FieldMatrixChangingVisitor visitor) { final int rows = getRowDimension(); final int columns = getColumnDimension(); @@ -832,6 +878,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public T walkInColumnOrder(final FieldMatrixPreservingVisitor visitor) { final int rows = getRowDimension(); final int columns = getColumnDimension(); @@ -845,6 +892,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public T walkInColumnOrder(final FieldMatrixChangingVisitor visitor, final int startRow, final int endRow, final int startColumn, final int endColumn) @@ -863,6 +911,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public T walkInColumnOrder(final FieldMatrixPreservingVisitor visitor, final int startRow, final int endRow, final int startColumn, final int endColumn) @@ -879,16 +928,19 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public T walkInOptimizedOrder(final FieldMatrixChangingVisitor visitor) { return walkInRowOrder(visitor); } /** {@inheritDoc} */ + @Override public T walkInOptimizedOrder(final FieldMatrixPreservingVisitor visitor) { return walkInRowOrder(visitor); } /** {@inheritDoc} */ + @Override public T walkInOptimizedOrder(final FieldMatrixChangingVisitor visitor, final int startRow, final int endRow, final int startColumn, final int endColumn) @@ -897,6 +949,7 @@ public abstract class AbstractFieldMatrix> } /** {@inheritDoc} */ + @Override public T walkInOptimizedOrder(final FieldMatrixPreservingVisitor visitor, final int startRow, final int endRow, final int startColumn, final int endColumn) diff --git a/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java b/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java index e72d4c46c..4dcf64070 100644 --- a/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java +++ b/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java @@ -73,6 +73,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public RealMatrix add(RealMatrix m) throws MatrixDimensionMismatchException { MatrixUtils.checkAdditionCompatible(this, m); @@ -90,6 +91,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public RealMatrix subtract(final RealMatrix m) throws MatrixDimensionMismatchException { MatrixUtils.checkSubtractionCompatible(this, m); @@ -107,6 +109,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public RealMatrix scalarAdd(final double d) { final int rowCount = getRowDimension(); final int columnCount = getColumnDimension(); @@ -121,6 +124,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public RealMatrix scalarMultiply(final double d) { final int rowCount = getRowDimension(); final int columnCount = getColumnDimension(); @@ -135,6 +139,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public RealMatrix multiply(final RealMatrix m) throws DimensionMismatchException { MatrixUtils.checkMultiplicationCompatible(this, m); @@ -157,12 +162,14 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public RealMatrix preMultiply(final RealMatrix m) throws DimensionMismatchException { return m.multiply(this); } /** {@inheritDoc} */ + @Override public RealMatrix power(final int p) throws NotPositiveException, NonSquareMatrixException { if (p < 0) { @@ -223,6 +230,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public double[][] getData() { final double[][] data = new double[getRowDimension()][getColumnDimension()]; @@ -237,6 +245,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public double getNorm() { return walkInColumnOrder(new RealMatrixPreservingVisitor() { @@ -250,6 +259,7 @@ public abstract class AbstractRealMatrix private double maxColSum; /** {@inheritDoc} */ + @Override public void start(final int rows, final int columns, final int startRow, final int endRow, final int startColumn, final int endColumn) { @@ -259,6 +269,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public void visit(final int row, final int column, final double value) { columnSum += FastMath.abs(value); if (row == endRow) { @@ -268,6 +279,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public double end() { return maxColSum; } @@ -275,6 +287,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public double getFrobeniusNorm() { return walkInOptimizedOrder(new RealMatrixPreservingVisitor() { @@ -282,6 +295,7 @@ public abstract class AbstractRealMatrix private double sum; /** {@inheritDoc} */ + @Override public void start(final int rows, final int columns, final int startRow, final int endRow, final int startColumn, final int endColumn) { @@ -289,11 +303,13 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public void visit(final int row, final int column, final double value) { sum += value * value; } /** {@inheritDoc} */ + @Override public double end() { return FastMath.sqrt(sum); } @@ -301,6 +317,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public RealMatrix getSubMatrix(final int startRow, final int endRow, final int startColumn, final int endColumn) throws OutOfRangeException, NumberIsTooSmallException { @@ -318,6 +335,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public RealMatrix getSubMatrix(final int[] selectedRows, final int[] selectedColumns) throws NullArgumentException, NoDataException, OutOfRangeException { @@ -339,6 +357,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public void copySubMatrix(final int startRow, final int endRow, final int startColumn, final int endColumn, final double[][] destination) @@ -386,6 +405,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public void copySubMatrix(int[] selectedRows, int[] selectedColumns, double[][] destination) throws OutOfRangeException, NullArgumentException, NoDataException, @@ -411,6 +431,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public void setSubMatrix(final double[][] subMatrix, final int row, final int column) throws NoDataException, OutOfRangeException, DimensionMismatchException, NullArgumentException { @@ -444,6 +465,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public RealMatrix getRowMatrix(final int row) throws OutOfRangeException { MatrixUtils.checkRowIndex(this, row); final int nCols = getColumnDimension(); @@ -456,6 +478,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public void setRowMatrix(final int row, final RealMatrix matrix) throws OutOfRangeException, MatrixDimensionMismatchException { MatrixUtils.checkRowIndex(this, row); @@ -472,6 +495,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public RealMatrix getColumnMatrix(final int column) throws OutOfRangeException { MatrixUtils.checkColumnIndex(this, column); @@ -485,6 +509,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public void setColumnMatrix(final int column, final RealMatrix matrix) throws OutOfRangeException, MatrixDimensionMismatchException { MatrixUtils.checkColumnIndex(this, column); @@ -501,12 +526,14 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public RealVector getRowVector(final int row) throws OutOfRangeException { return new ArrayRealVector(getRow(row), false); } /** {@inheritDoc} */ + @Override public void setRowVector(final int row, final RealVector vector) throws OutOfRangeException, MatrixDimensionMismatchException { MatrixUtils.checkRowIndex(this, row); @@ -521,12 +548,14 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public RealVector getColumnVector(final int column) throws OutOfRangeException { return new ArrayRealVector(getColumn(column), false); } /** {@inheritDoc} */ + @Override public void setColumnVector(final int column, final RealVector vector) throws OutOfRangeException, MatrixDimensionMismatchException { MatrixUtils.checkColumnIndex(this, column); @@ -541,6 +570,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public double[] getRow(final int row) throws OutOfRangeException { MatrixUtils.checkRowIndex(this, row); final int nCols = getColumnDimension(); @@ -553,6 +583,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public void setRow(final int row, final double[] array) throws OutOfRangeException, MatrixDimensionMismatchException { MatrixUtils.checkRowIndex(this, row); @@ -566,6 +597,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public double[] getColumn(final int column) throws OutOfRangeException { MatrixUtils.checkColumnIndex(this, column); final int nRows = getRowDimension(); @@ -578,6 +610,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public void setColumn(final int column, final double[] array) throws OutOfRangeException, MatrixDimensionMismatchException { MatrixUtils.checkColumnIndex(this, column); @@ -591,6 +624,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public void addToEntry(int row, int column, double increment) throws OutOfRangeException { MatrixUtils.checkMatrixIndex(this, row, column); @@ -598,6 +632,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public void multiplyEntry(int row, int column, double factor) throws OutOfRangeException { MatrixUtils.checkMatrixIndex(this, row, column); @@ -605,6 +640,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public RealMatrix transpose() { final int nRows = getRowDimension(); final int nCols = getColumnDimension(); @@ -623,6 +659,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public boolean isSquare() { return getColumnDimension() == getRowDimension(); } @@ -644,6 +681,7 @@ public abstract class AbstractRealMatrix public abstract int getColumnDimension(); /** {@inheritDoc} */ + @Override public double getTrace() throws NonSquareMatrixException { final int nRows = getRowDimension(); final int nCols = getColumnDimension(); @@ -658,6 +696,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public double[] operate(final double[] v) throws DimensionMismatchException { final int nRows = getRowDimension(); @@ -705,6 +744,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public double[] preMultiply(final double[] v) throws DimensionMismatchException { final int nRows = getRowDimension(); @@ -726,6 +766,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public RealVector preMultiply(final RealVector v) throws DimensionMismatchException { try { return new ArrayRealVector(preMultiply(((ArrayRealVector) v).getDataRef()), false); @@ -751,6 +792,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public double walkInRowOrder(final RealMatrixChangingVisitor visitor) { final int rows = getRowDimension(); final int columns = getColumnDimension(); @@ -766,6 +808,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public double walkInRowOrder(final RealMatrixPreservingVisitor visitor) { final int rows = getRowDimension(); final int columns = getColumnDimension(); @@ -779,6 +822,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public double walkInRowOrder(final RealMatrixChangingVisitor visitor, final int startRow, final int endRow, final int startColumn, final int endColumn) @@ -797,6 +841,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public double walkInRowOrder(final RealMatrixPreservingVisitor visitor, final int startRow, final int endRow, final int startColumn, final int endColumn) @@ -813,6 +858,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public double walkInColumnOrder(final RealMatrixChangingVisitor visitor) { final int rows = getRowDimension(); final int columns = getColumnDimension(); @@ -828,6 +874,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public double walkInColumnOrder(final RealMatrixPreservingVisitor visitor) { final int rows = getRowDimension(); final int columns = getColumnDimension(); @@ -841,6 +888,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public double walkInColumnOrder(final RealMatrixChangingVisitor visitor, final int startRow, final int endRow, final int startColumn, final int endColumn) @@ -859,6 +907,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public double walkInColumnOrder(final RealMatrixPreservingVisitor visitor, final int startRow, final int endRow, final int startColumn, final int endColumn) @@ -875,16 +924,19 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public double walkInOptimizedOrder(final RealMatrixChangingVisitor visitor) { return walkInRowOrder(visitor); } /** {@inheritDoc} */ + @Override public double walkInOptimizedOrder(final RealMatrixPreservingVisitor visitor) { return walkInRowOrder(visitor); } /** {@inheritDoc} */ + @Override public double walkInOptimizedOrder(final RealMatrixChangingVisitor visitor, final int startRow, final int endRow, final int startColumn, @@ -894,6 +946,7 @@ public abstract class AbstractRealMatrix } /** {@inheritDoc} */ + @Override public double walkInOptimizedOrder(final RealMatrixPreservingVisitor visitor, final int startRow, final int endRow, final int startColumn, @@ -976,17 +1029,21 @@ public abstract class AbstractRealMatrix */ /** {@inheritDoc} */ + @Override public abstract RealMatrix createMatrix(int rowDimension, int columnDimension) throws NotStrictlyPositiveException; /** {@inheritDoc} */ + @Override public abstract RealMatrix copy(); /** {@inheritDoc} */ + @Override public abstract double getEntry(int row, int column) throws OutOfRangeException; /** {@inheritDoc} */ + @Override public abstract void setEntry(int row, int column, double value) throws OutOfRangeException; } diff --git a/src/main/java/org/apache/commons/math4/linear/ArrayFieldVector.java b/src/main/java/org/apache/commons/math4/linear/ArrayFieldVector.java index 191b6859c..b2240e6c9 100644 --- a/src/main/java/org/apache/commons/math4/linear/ArrayFieldVector.java +++ b/src/main/java/org/apache/commons/math4/linear/ArrayFieldVector.java @@ -380,16 +380,19 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public Field getField() { return field; } /** {@inheritDoc} */ + @Override public FieldVector copy() { return new ArrayFieldVector(this, true); } /** {@inheritDoc} */ + @Override public FieldVector add(FieldVector v) throws DimensionMismatchException { try { @@ -422,6 +425,7 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public FieldVector subtract(FieldVector v) throws DimensionMismatchException { try { @@ -454,6 +458,7 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public FieldVector mapAdd(T d) throws NullArgumentException { T[] out = MathArrays.buildArray(field, data.length); for (int i = 0; i < data.length; i++) { @@ -463,6 +468,7 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public FieldVector mapAddToSelf(T d) throws NullArgumentException { for (int i = 0; i < data.length; i++) { data[i] = data[i].add(d); @@ -471,6 +477,7 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public FieldVector mapSubtract(T d) throws NullArgumentException { T[] out = MathArrays.buildArray(field, data.length); for (int i = 0; i < data.length; i++) { @@ -480,6 +487,7 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public FieldVector mapSubtractToSelf(T d) throws NullArgumentException { for (int i = 0; i < data.length; i++) { data[i] = data[i].subtract(d); @@ -488,6 +496,7 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public FieldVector mapMultiply(T d) throws NullArgumentException { T[] out = MathArrays.buildArray(field, data.length); for (int i = 0; i < data.length; i++) { @@ -497,6 +506,7 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public FieldVector mapMultiplyToSelf(T d) throws NullArgumentException { for (int i = 0; i < data.length; i++) { data[i] = data[i].multiply(d); @@ -505,6 +515,7 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public FieldVector mapDivide(T d) throws NullArgumentException, MathArithmeticException { MathUtils.checkNotNull(d); @@ -516,6 +527,7 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public FieldVector mapDivideToSelf(T d) throws NullArgumentException, MathArithmeticException { MathUtils.checkNotNull(d); @@ -526,6 +538,7 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public FieldVector mapInv() throws MathArithmeticException { T[] out = MathArrays.buildArray(field, data.length); final T one = field.getOne(); @@ -540,6 +553,7 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public FieldVector mapInvToSelf() throws MathArithmeticException { final T one = field.getOne(); for (int i = 0; i < data.length; i++) { @@ -553,6 +567,7 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public FieldVector ebeMultiply(FieldVector v) throws DimensionMismatchException { try { @@ -585,6 +600,7 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public FieldVector ebeDivide(FieldVector v) throws DimensionMismatchException, MathArithmeticException { try { @@ -635,6 +651,7 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public T dotProduct(FieldVector v) throws DimensionMismatchException { try { @@ -667,6 +684,7 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public FieldVector projection(FieldVector v) throws DimensionMismatchException, MathArithmeticException { return v.mapMultiply(dotProduct(v).divide(v.dotProduct(v))); @@ -685,6 +703,7 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public FieldMatrix outerProduct(FieldVector v) { try { return outerProduct((ArrayFieldVector) v); @@ -719,16 +738,19 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public T getEntry(int index) { return data[index]; } /** {@inheritDoc} */ + @Override public int getDimension() { return data.length; } /** {@inheritDoc} */ + @Override public FieldVector append(FieldVector v) { try { return append((ArrayFieldVector) v); @@ -747,6 +769,7 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public FieldVector append(T in) { final T[] out = MathArrays.buildArray(field, data.length + 1); System.arraycopy(data, 0, out, 0, data.length); @@ -755,6 +778,7 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public FieldVector getSubVector(int index, int n) throws OutOfRangeException, NotPositiveException { if (n < 0) { @@ -771,6 +795,7 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public void setEntry(int index, T value) { try { data[index] = value; @@ -780,6 +805,7 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public void setSubVector(int index, FieldVector v) throws OutOfRangeException { try { try { @@ -812,11 +838,13 @@ public class ArrayFieldVector> implements FieldVector< } /** {@inheritDoc} */ + @Override public void set(T value) { Arrays.fill(data, value); } /** {@inheritDoc} */ + @Override public T[] toArray(){ return data.clone(); } diff --git a/src/main/java/org/apache/commons/math4/linear/CholeskyDecomposition.java b/src/main/java/org/apache/commons/math4/linear/CholeskyDecomposition.java index 66d5260ef..520c15e0f 100644 --- a/src/main/java/org/apache/commons/math4/linear/CholeskyDecomposition.java +++ b/src/main/java/org/apache/commons/math4/linear/CholeskyDecomposition.java @@ -216,12 +216,14 @@ public class CholeskyDecomposition { } /** {@inheritDoc} */ + @Override public boolean isNonSingular() { // if we get this far, the matrix was positive definite, hence non-singular return true; } /** {@inheritDoc} */ + @Override public RealVector solve(final RealVector b) { final int m = lTData.length; if (b.getDimension() != m) { @@ -253,6 +255,7 @@ public class CholeskyDecomposition { } /** {@inheritDoc} */ + @Override public RealMatrix solve(RealMatrix b) { final int m = lTData.length; if (b.getRowDimension() != m) { diff --git a/src/main/java/org/apache/commons/math4/linear/DefaultFieldMatrixChangingVisitor.java b/src/main/java/org/apache/commons/math4/linear/DefaultFieldMatrixChangingVisitor.java index 7c93429d7..a9abded51 100644 --- a/src/main/java/org/apache/commons/math4/linear/DefaultFieldMatrixChangingVisitor.java +++ b/src/main/java/org/apache/commons/math4/linear/DefaultFieldMatrixChangingVisitor.java @@ -42,16 +42,19 @@ public class DefaultFieldMatrixChangingVisitor> } /** {@inheritDoc} */ + @Override public void start(int rows, int columns, int startRow, int endRow, int startColumn, int endColumn) { } /** {@inheritDoc} */ + @Override public T visit(int row, int column, T value) { return value; } /** {@inheritDoc} */ + @Override public T end() { return zero; } diff --git a/src/main/java/org/apache/commons/math4/linear/DefaultFieldMatrixPreservingVisitor.java b/src/main/java/org/apache/commons/math4/linear/DefaultFieldMatrixPreservingVisitor.java index 1e8e14f67..ab924b9eb 100644 --- a/src/main/java/org/apache/commons/math4/linear/DefaultFieldMatrixPreservingVisitor.java +++ b/src/main/java/org/apache/commons/math4/linear/DefaultFieldMatrixPreservingVisitor.java @@ -42,14 +42,17 @@ public class DefaultFieldMatrixPreservingVisitor> } /** {@inheritDoc} */ + @Override public void start(int rows, int columns, int startRow, int endRow, int startColumn, int endColumn) { } /** {@inheritDoc} */ + @Override public void visit(int row, int column, T value) {} /** {@inheritDoc} */ + @Override public T end() { return zero; } diff --git a/src/main/java/org/apache/commons/math4/linear/DefaultRealMatrixChangingVisitor.java b/src/main/java/org/apache/commons/math4/linear/DefaultRealMatrixChangingVisitor.java index 04db987b2..0e091bb80 100644 --- a/src/main/java/org/apache/commons/math4/linear/DefaultRealMatrixChangingVisitor.java +++ b/src/main/java/org/apache/commons/math4/linear/DefaultRealMatrixChangingVisitor.java @@ -28,16 +28,19 @@ package org.apache.commons.math4.linear; */ public class DefaultRealMatrixChangingVisitor implements RealMatrixChangingVisitor { /** {@inheritDoc} */ + @Override public void start(int rows, int columns, int startRow, int endRow, int startColumn, int endColumn) { } /** {@inheritDoc} */ + @Override public double visit(int row, int column, double value) { return value; } /** {@inheritDoc} */ + @Override public double end() { return 0; } diff --git a/src/main/java/org/apache/commons/math4/linear/DefaultRealMatrixPreservingVisitor.java b/src/main/java/org/apache/commons/math4/linear/DefaultRealMatrixPreservingVisitor.java index ac6dcfeae..7e5c3acfb 100644 --- a/src/main/java/org/apache/commons/math4/linear/DefaultRealMatrixPreservingVisitor.java +++ b/src/main/java/org/apache/commons/math4/linear/DefaultRealMatrixPreservingVisitor.java @@ -28,14 +28,17 @@ package org.apache.commons.math4.linear; */ public class DefaultRealMatrixPreservingVisitor implements RealMatrixPreservingVisitor { /** {@inheritDoc} */ + @Override public void start(int rows, int columns, int startRow, int endRow, int startColumn, int endColumn) { } /** {@inheritDoc} */ + @Override public void visit(int row, int column, double value) {} /** {@inheritDoc} */ + @Override public double end() { return 0; } diff --git a/src/main/java/org/apache/commons/math4/linear/EigenDecomposition.java b/src/main/java/org/apache/commons/math4/linear/EigenDecomposition.java index 5118a611c..332320c82 100644 --- a/src/main/java/org/apache/commons/math4/linear/EigenDecomposition.java +++ b/src/main/java/org/apache/commons/math4/linear/EigenDecomposition.java @@ -434,6 +434,7 @@ public class EigenDecomposition { } /** {@inheritDoc} */ + @Override public RealMatrix solve(RealMatrix b) { if (!isNonSingular()) { diff --git a/src/main/java/org/apache/commons/math4/linear/FieldLUDecomposition.java b/src/main/java/org/apache/commons/math4/linear/FieldLUDecomposition.java index 8c23ce6ca..101c3154d 100644 --- a/src/main/java/org/apache/commons/math4/linear/FieldLUDecomposition.java +++ b/src/main/java/org/apache/commons/math4/linear/FieldLUDecomposition.java @@ -287,11 +287,13 @@ public class FieldLUDecomposition> { } /** {@inheritDoc} */ + @Override public boolean isNonSingular() { return !singular; } /** {@inheritDoc} */ + @Override public FieldVector solve(FieldVector b) { try { return solve((ArrayFieldVector) b); @@ -377,6 +379,7 @@ public class FieldLUDecomposition> { } /** {@inheritDoc} */ + @Override public FieldMatrix solve(FieldMatrix b) { final int m = pivot.length; if (b.getRowDimension() != m) { @@ -431,6 +434,7 @@ public class FieldLUDecomposition> { } /** {@inheritDoc} */ + @Override public FieldMatrix getInverse() { final int m = pivot.length; final T one = field.getOne(); diff --git a/src/main/java/org/apache/commons/math4/linear/LUDecomposition.java b/src/main/java/org/apache/commons/math4/linear/LUDecomposition.java index 6fbc57a0b..397898e59 100644 --- a/src/main/java/org/apache/commons/math4/linear/LUDecomposition.java +++ b/src/main/java/org/apache/commons/math4/linear/LUDecomposition.java @@ -282,11 +282,13 @@ public class LUDecomposition { } /** {@inheritDoc} */ + @Override public boolean isNonSingular() { return !singular; } /** {@inheritDoc} */ + @Override public RealVector solve(RealVector b) { final int m = pivot.length; if (b.getDimension() != m) { @@ -324,6 +326,7 @@ public class LUDecomposition { } /** {@inheritDoc} */ + @Override public RealMatrix solve(RealMatrix b) { final int m = pivot.length; diff --git a/src/main/java/org/apache/commons/math4/linear/OpenMapRealVector.java b/src/main/java/org/apache/commons/math4/linear/OpenMapRealVector.java index 6928b9398..48136d9c2 100644 --- a/src/main/java/org/apache/commons/math4/linear/OpenMapRealVector.java +++ b/src/main/java/org/apache/commons/math4/linear/OpenMapRealVector.java @@ -791,17 +791,20 @@ public class OpenMapRealVector extends SparseRealVector } /** {@inheritDoc} */ + @Override public boolean hasNext() { return iter.hasNext(); } /** {@inheritDoc} */ + @Override public Entry next() { iter.advance(); return current; } /** {@inheritDoc} */ + @Override public void remove() { throw new UnsupportedOperationException("Not supported"); } diff --git a/src/main/java/org/apache/commons/math4/linear/RRQRDecomposition.java b/src/main/java/org/apache/commons/math4/linear/RRQRDecomposition.java index 857cce0e3..f85b22e8a 100644 --- a/src/main/java/org/apache/commons/math4/linear/RRQRDecomposition.java +++ b/src/main/java/org/apache/commons/math4/linear/RRQRDecomposition.java @@ -219,16 +219,19 @@ public class RRQRDecomposition extends QRDecomposition { } /** {@inheritDoc} */ + @Override public boolean isNonSingular() { return upper.isNonSingular(); } /** {@inheritDoc} */ + @Override public RealVector solve(RealVector b) { return p.operate(upper.solve(b)); } /** {@inheritDoc} */ + @Override public RealMatrix solve(RealMatrix b) { return p.multiply(upper.solve(b)); } @@ -237,6 +240,7 @@ public class RRQRDecomposition extends QRDecomposition { * {@inheritDoc} * @throws SingularMatrixException if the decomposed matrix is singular. */ + @Override public RealMatrix getInverse() { return solve(MatrixUtils.createRealIdentityMatrix(p.getRowDimension())); } diff --git a/src/main/java/org/apache/commons/math4/linear/RealVector.java b/src/main/java/org/apache/commons/math4/linear/RealVector.java index 2d0a1b957..545a521ce 100644 --- a/src/main/java/org/apache/commons/math4/linear/RealVector.java +++ b/src/main/java/org/apache/commons/math4/linear/RealVector.java @@ -759,11 +759,13 @@ public abstract class RealVector { private Entry e = new Entry(); /** {@inheritDoc} */ + @Override public boolean hasNext() { return i < dim; } /** {@inheritDoc} */ + @Override public Entry next() { if (i < dim) { e.setIndex(i++); @@ -778,6 +780,7 @@ public abstract class RealVector { * * @throws MathUnsupportedOperationException in all circumstances. */ + @Override public void remove() throws MathUnsupportedOperationException { throw new MathUnsupportedOperationException(); } @@ -1159,11 +1162,13 @@ public abstract class RealVector { } /** {@inheritDoc} */ + @Override public boolean hasNext() { return next.getIndex() >= 0; } /** {@inheritDoc} */ + @Override public Entry next() { int index = next.getIndex(); if (index < 0) { @@ -1179,6 +1184,7 @@ public abstract class RealVector { * * @throws MathUnsupportedOperationException in all circumstances. */ + @Override public void remove() throws MathUnsupportedOperationException { throw new MathUnsupportedOperationException(); } @@ -1239,11 +1245,13 @@ public abstract class RealVector { private final UnmodifiableEntry e = new UnmodifiableEntry(); /** {@inheritDoc} */ + @Override public boolean hasNext() { return i.hasNext(); } /** {@inheritDoc} */ + @Override public Entry next() { e.setIndex(i.next().getIndex()); return e; @@ -1255,6 +1263,7 @@ public abstract class RealVector { * @throws MathUnsupportedOperationException in all * circumstances. */ + @Override public void remove() throws MathUnsupportedOperationException { throw new MathUnsupportedOperationException(); } @@ -1271,11 +1280,13 @@ public abstract class RealVector { private final UnmodifiableEntry e = new UnmodifiableEntry(); /** {@inheritDoc} */ + @Override public boolean hasNext() { return i.hasNext(); } /** {@inheritDoc} */ + @Override public Entry next() { e.setIndex(i.next().getIndex()); return e; @@ -1287,6 +1298,7 @@ public abstract class RealVector { * @throws MathUnsupportedOperationException in all * circumstances. */ + @Override public void remove() throws MathUnsupportedOperationException { throw new MathUnsupportedOperationException(); diff --git a/src/main/java/org/apache/commons/math4/linear/SparseFieldVector.java b/src/main/java/org/apache/commons/math4/linear/SparseFieldVector.java index f95fdbe4b..7065f1090 100644 --- a/src/main/java/org/apache/commons/math4/linear/SparseFieldVector.java +++ b/src/main/java/org/apache/commons/math4/linear/SparseFieldVector.java @@ -189,6 +189,7 @@ public class SparseFieldVector> implements FieldVector } /** {@inheritDoc} */ + @Override public FieldVector append(FieldVector v) { if (v instanceof SparseFieldVector) { return append((SparseFieldVector) v); @@ -205,6 +206,7 @@ public class SparseFieldVector> implements FieldVector /** {@inheritDoc} * @exception NullArgumentException if d is null */ + @Override public FieldVector append(T d) throws NullArgumentException { MathUtils.checkNotNull(d); FieldVector res = new SparseFieldVector(this, 1); @@ -213,11 +215,13 @@ public class SparseFieldVector> implements FieldVector } /** {@inheritDoc} */ + @Override public FieldVector copy() { return new SparseFieldVector(this); } /** {@inheritDoc} */ + @Override public T dotProduct(FieldVector v) throws DimensionMismatchException { checkVectorDimensions(v.getDimension()); T res = field.getZero(); @@ -230,6 +234,7 @@ public class SparseFieldVector> implements FieldVector } /** {@inheritDoc} */ + @Override public FieldVector ebeDivide(FieldVector v) throws DimensionMismatchException, MathArithmeticException { checkVectorDimensions(v.getDimension()); @@ -243,6 +248,7 @@ public class SparseFieldVector> implements FieldVector } /** {@inheritDoc} */ + @Override public FieldVector ebeMultiply(FieldVector v) throws DimensionMismatchException { checkVectorDimensions(v.getDimension()); @@ -256,22 +262,26 @@ public class SparseFieldVector> implements FieldVector } /** {@inheritDoc} */ + @Override public int getDimension() { return virtualSize; } /** {@inheritDoc} */ + @Override public T getEntry(int index) throws OutOfRangeException { checkIndex(index); return entries.get(index); } /** {@inheritDoc} */ + @Override public Field getField() { return field; } /** {@inheritDoc} */ + @Override public FieldVector getSubVector(int index, int n) throws OutOfRangeException, NotPositiveException { if (n < 0) { @@ -293,11 +303,13 @@ public class SparseFieldVector> implements FieldVector } /** {@inheritDoc} */ + @Override public FieldVector mapAdd(T d) throws NullArgumentException { return copy().mapAddToSelf(d); } /** {@inheritDoc} */ + @Override public FieldVector mapAddToSelf(T d) throws NullArgumentException { for (int i = 0; i < virtualSize; i++) { setEntry(i, getEntry(i).add(d)); @@ -306,12 +318,14 @@ public class SparseFieldVector> implements FieldVector } /** {@inheritDoc} */ + @Override public FieldVector mapDivide(T d) throws NullArgumentException, MathArithmeticException { return copy().mapDivideToSelf(d); } /** {@inheritDoc} */ + @Override public FieldVector mapDivideToSelf(T d) throws NullArgumentException, MathArithmeticException { OpenIntToFieldHashMap.Iterator iter = entries.iterator(); @@ -323,11 +337,13 @@ public class SparseFieldVector> implements FieldVector } /** {@inheritDoc} */ + @Override public FieldVector mapInv() throws MathArithmeticException { return copy().mapInvToSelf(); } /** {@inheritDoc} */ + @Override public FieldVector mapInvToSelf() throws MathArithmeticException { for (int i = 0; i < virtualSize; i++) { setEntry(i, field.getOne().divide(getEntry(i))); @@ -336,11 +352,13 @@ public class SparseFieldVector> implements FieldVector } /** {@inheritDoc} */ + @Override public FieldVector mapMultiply(T d) throws NullArgumentException { return copy().mapMultiplyToSelf(d); } /** {@inheritDoc} */ + @Override public FieldVector mapMultiplyToSelf(T d) throws NullArgumentException { OpenIntToFieldHashMap.Iterator iter = entries.iterator(); while (iter.hasNext()) { @@ -351,11 +369,13 @@ public class SparseFieldVector> implements FieldVector } /** {@inheritDoc} */ + @Override public FieldVector mapSubtract(T d) throws NullArgumentException { return copy().mapSubtractToSelf(d); } /** {@inheritDoc} */ + @Override public FieldVector mapSubtractToSelf(T d) throws NullArgumentException { return mapAddToSelf(field.getZero().subtract(d)); } @@ -381,6 +401,7 @@ public class SparseFieldVector> implements FieldVector } /** {@inheritDoc} */ + @Override public FieldMatrix outerProduct(FieldVector v) { if (v instanceof SparseFieldVector) { return outerProduct((SparseFieldVector)v); @@ -401,6 +422,7 @@ public class SparseFieldVector> implements FieldVector } /** {@inheritDoc} */ + @Override public FieldVector projection(FieldVector v) throws DimensionMismatchException, MathArithmeticException { checkVectorDimensions(v.getDimension()); @@ -410,6 +432,7 @@ public class SparseFieldVector> implements FieldVector /** {@inheritDoc} * @exception NullArgumentException if value is null */ + @Override public void set(T value) { MathUtils.checkNotNull(value); for (int i = 0; i < virtualSize; i++) { @@ -420,6 +443,7 @@ public class SparseFieldVector> implements FieldVector /** {@inheritDoc} * @exception NullArgumentException if value is null */ + @Override public void setEntry(int index, T value) throws NullArgumentException, OutOfRangeException { MathUtils.checkNotNull(value); checkIndex(index); @@ -427,6 +451,7 @@ public class SparseFieldVector> implements FieldVector } /** {@inheritDoc} */ + @Override public void setSubVector(int index, FieldVector v) throws OutOfRangeException { checkIndex(index); @@ -462,6 +487,7 @@ public class SparseFieldVector> implements FieldVector } /** {@inheritDoc} */ + @Override public FieldVector subtract(FieldVector v) throws DimensionMismatchException { if (v instanceof SparseFieldVector) { @@ -482,6 +508,7 @@ public class SparseFieldVector> implements FieldVector } /** {@inheritDoc} */ + @Override public T[] toArray() { T[] res = MathArrays.buildArray(field, virtualSize); OpenIntToFieldHashMap.Iterator iter = entries.iterator(); @@ -544,6 +571,7 @@ public class SparseFieldVector> implements FieldVector } /** {@inheritDoc} */ + @Override public FieldVector add(FieldVector v) throws DimensionMismatchException { if (v instanceof SparseFieldVector) { return add((SparseFieldVector) v); diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/FeatureInitializerFactory.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/FeatureInitializerFactory.java index 1521a6096..1729e4253 100644 --- a/src/main/java/org/apache/commons/math4/ml/neuralnet/FeatureInitializerFactory.java +++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/FeatureInitializerFactory.java @@ -86,6 +86,7 @@ public class FeatureInitializerFactory { private double arg = init; /** {@inheritDoc} */ + @Override public double value() { final double result = f.value(arg); arg += inc; @@ -106,6 +107,7 @@ public class FeatureInitializerFactory { final FeatureInitializer orig) { return new FeatureInitializer() { /** {@inheritDoc} */ + @Override public double value() { return orig.value() + random.sample(); } diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/Network.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/Network.java index 89d335f8f..552006316 100644 --- a/src/main/java/org/apache/commons/math4/ml/neuralnet/Network.java +++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/Network.java @@ -70,6 +70,7 @@ public class Network private static final long serialVersionUID = 20130207L; /** {@inheritDoc} */ + @Override public int compare(Neuron a, Neuron b) { final long aId = a.getIdentifier(); @@ -138,6 +139,7 @@ public class Network /** * {@inheritDoc} */ + @Override public Iterator iterator() { return neuronMap.values().iterator(); } diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTask.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTask.java index 0e0fcabc3..8f173353b 100644 --- a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTask.java +++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTask.java @@ -52,6 +52,7 @@ public class KohonenTrainingTask implements Runnable { /** * {@inheritDoc} */ + @Override public void run() { while (featuresIterator.hasNext()) { updateAction.update(net, featuresIterator.next()); diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java index f09ed24bf..ffe694338 100644 --- a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java +++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java @@ -92,6 +92,7 @@ public class KohonenUpdateAction implements UpdateAction { /** * {@inheritDoc} */ + @Override public void update(Network net, double[] features) { final long numCalls = numberOfCalls.incrementAndGet(); diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/LearningFactorFunctionFactory.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/LearningFactorFunctionFactory.java index 0371475e3..1f3ccd8eb 100644 --- a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/LearningFactorFunctionFactory.java +++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/LearningFactorFunctionFactory.java @@ -68,6 +68,7 @@ public class LearningFactorFunctionFactory { = new ExponentialDecayFunction(initValue, valueAtNumCall, numCall); /** {@inheritDoc} */ + @Override public double value(long n) { return decay.value(n); } @@ -109,6 +110,7 @@ public class LearningFactorFunctionFactory { = new QuasiSigmoidDecayFunction(initValue, slope, numCall); /** {@inheritDoc} */ + @Override public double value(long n) { return decay.value(n); } diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/NeighbourhoodSizeFunctionFactory.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/NeighbourhoodSizeFunctionFactory.java index e87a97372..73f6d6770 100644 --- a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/NeighbourhoodSizeFunctionFactory.java +++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/NeighbourhoodSizeFunctionFactory.java @@ -63,6 +63,7 @@ public class NeighbourhoodSizeFunctionFactory { = new ExponentialDecayFunction(initValue, valueAtNumCall, numCall); /** {@inheritDoc} */ + @Override public int value(long n) { return (int) FastMath.rint(decay.value(n)); } @@ -99,6 +100,7 @@ public class NeighbourhoodSizeFunctionFactory { = new QuasiSigmoidDecayFunction(initValue, slope, numCall); /** {@inheritDoc} */ + @Override public int value(long n) { return (int) FastMath.rint(decay.value(n)); } diff --git a/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java b/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java index 9d23fe21f..b9127ad86 100644 --- a/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java +++ b/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java @@ -99,26 +99,31 @@ public abstract class AbstractIntegrator implements FirstOrderIntegrator { } /** {@inheritDoc} */ + @Override public String getName() { return name; } /** {@inheritDoc} */ + @Override public void addStepHandler(final StepHandler handler) { stepHandlers.add(handler); } /** {@inheritDoc} */ + @Override public Collection getStepHandlers() { return Collections.unmodifiableCollection(stepHandlers); } /** {@inheritDoc} */ + @Override public void clearStepHandlers() { stepHandlers.clear(); } /** {@inheritDoc} */ + @Override public void addEventHandler(final EventHandler handler, final double maxCheckInterval, final double convergence, @@ -129,6 +134,7 @@ public abstract class AbstractIntegrator implements FirstOrderIntegrator { } /** {@inheritDoc} */ + @Override public void addEventHandler(final EventHandler handler, final double maxCheckInterval, final double convergence, @@ -139,6 +145,7 @@ public abstract class AbstractIntegrator implements FirstOrderIntegrator { } /** {@inheritDoc} */ + @Override public Collection getEventHandlers() { final List list = new ArrayList(eventsStates.size()); for (EventState state : eventsStates) { @@ -148,31 +155,37 @@ public abstract class AbstractIntegrator implements FirstOrderIntegrator { } /** {@inheritDoc} */ + @Override public void clearEventHandlers() { eventsStates.clear(); } /** {@inheritDoc} */ + @Override public double getCurrentStepStart() { return stepStart; } /** {@inheritDoc} */ + @Override public double getCurrentSignedStepsize() { return stepSize; } /** {@inheritDoc} */ + @Override public void setMaxEvaluations(int maxEvaluations) { evaluations.setMaximalCount((maxEvaluations < 0) ? Integer.MAX_VALUE : maxEvaluations); } /** {@inheritDoc} */ + @Override public int getMaxEvaluations() { return evaluations.getMaximalCount(); } /** {@inheritDoc} */ + @Override public int getEvaluations() { return evaluations.getCount(); } @@ -223,6 +236,7 @@ public abstract class AbstractIntegrator implements FirstOrderIntegrator { } /** {@inheritDoc} */ + @Override public double integrate(final FirstOrderDifferentialEquations equations, final double t0, final double[] y0, final double t, final double[] y) throws DimensionMismatchException, NumberIsTooSmallException, @@ -329,6 +343,7 @@ public abstract class AbstractIntegrator implements FirstOrderIntegrator { SortedSet occurringEvents = new TreeSet(new Comparator() { /** {@inheritDoc} */ + @Override public int compare(EventState es0, EventState es1) { return orderingSign * Double.compare(es0.getEventTime(), es1.getEventTime()); } diff --git a/src/main/java/org/apache/commons/math4/ode/AbstractParameterizable.java b/src/main/java/org/apache/commons/math4/ode/AbstractParameterizable.java index baa5cbb63..5b4aea718 100644 --- a/src/main/java/org/apache/commons/math4/ode/AbstractParameterizable.java +++ b/src/main/java/org/apache/commons/math4/ode/AbstractParameterizable.java @@ -48,11 +48,13 @@ public abstract class AbstractParameterizable implements Parameterizable { } /** {@inheritDoc} */ + @Override public Collection getParametersNames() { return parametersNames; } /** {@inheritDoc} */ + @Override public boolean isSupported(final String name) { for (final String supportedName : parametersNames) { if (supportedName.equals(name)) { diff --git a/src/main/java/org/apache/commons/math4/ode/ContinuousOutputModel.java b/src/main/java/org/apache/commons/math4/ode/ContinuousOutputModel.java index de3d6c4b7..e48dff934 100644 --- a/src/main/java/org/apache/commons/math4/ode/ContinuousOutputModel.java +++ b/src/main/java/org/apache/commons/math4/ode/ContinuousOutputModel.java @@ -169,6 +169,7 @@ public class ContinuousOutputModel } /** {@inheritDoc} */ + @Override public void init(double t0, double[] y0, double t) { initialTime = Double.NaN; finalTime = Double.NaN; diff --git a/src/main/java/org/apache/commons/math4/ode/JacobianMatrices.java b/src/main/java/org/apache/commons/math4/ode/JacobianMatrices.java index e2f3af9e6..bcbbc6ec7 100644 --- a/src/main/java/org/apache/commons/math4/ode/JacobianMatrices.java +++ b/src/main/java/org/apache/commons/math4/ode/JacobianMatrices.java @@ -343,11 +343,13 @@ public class JacobianMatrices { private class JacobiansSecondaryEquations implements SecondaryEquations { /** {@inheritDoc} */ + @Override public int getDimension() { return stateDim * (stateDim + paramDim); } /** {@inheritDoc} */ + @Override public void computeDerivatives(final double t, final double[] y, final double[] yDot, final double[] z, final double[] zDot) throws MaxCountExceededException, DimensionMismatchException { @@ -442,17 +444,20 @@ public class JacobianMatrices { } /** {@inheritDoc} */ + @Override public int getDimension() { return ode.getDimension(); } /** {@inheritDoc} */ + @Override public void computeDerivatives(double t, double[] y, double[] yDot) throws MaxCountExceededException, DimensionMismatchException { ode.computeDerivatives(t, y, yDot); } /** {@inheritDoc} */ + @Override public void computeMainStateJacobian(double t, double[] y, double[] yDot, double[][] dFdY) throws MaxCountExceededException, DimensionMismatchException { diff --git a/src/main/java/org/apache/commons/math4/ode/MultistepIntegrator.java b/src/main/java/org/apache/commons/math4/ode/MultistepIntegrator.java index df9797dae..b8b6a1dda 100644 --- a/src/main/java/org/apache/commons/math4/ode/MultistepIntegrator.java +++ b/src/main/java/org/apache/commons/math4/ode/MultistepIntegrator.java @@ -234,11 +234,13 @@ public abstract class MultistepIntegrator extends AdaptiveStepsizeIntegrator { starter.integrate(new FirstOrderDifferentialEquations() { /** {@inheritDoc} */ + @Override public int getDimension() { return getExpandable().getTotalDimension(); } /** {@inheritDoc} */ + @Override public void computeDerivatives(double t, double[] y, double[] yDot) { getExpandable().computeDerivatives(t, y, yDot); } @@ -363,6 +365,7 @@ public abstract class MultistepIntegrator extends AdaptiveStepsizeIntegrator { } /** {@inheritDoc} */ + @Override public void handleStep(StepInterpolator interpolator, boolean isLast) throws MaxCountExceededException { @@ -424,6 +427,7 @@ public abstract class MultistepIntegrator extends AdaptiveStepsizeIntegrator { } /** {@inheritDoc} */ + @Override public void init(double t0, double[] y0, double time) { // nothing to do } diff --git a/src/main/java/org/apache/commons/math4/ode/ParameterJacobianWrapper.java b/src/main/java/org/apache/commons/math4/ode/ParameterJacobianWrapper.java index 856eb1503..a01d98f0a 100644 --- a/src/main/java/org/apache/commons/math4/ode/ParameterJacobianWrapper.java +++ b/src/main/java/org/apache/commons/math4/ode/ParameterJacobianWrapper.java @@ -63,16 +63,19 @@ class ParameterJacobianWrapper implements ParameterJacobianProvider { } /** {@inheritDoc} */ + @Override public Collection getParametersNames() { return pode.getParametersNames(); } /** {@inheritDoc} */ + @Override public boolean isSupported(String name) { return pode.isSupported(name); } /** {@inheritDoc} */ + @Override public void computeParameterJacobian(double t, double[] y, double[] yDot, String paramName, double[] dFdP) throws DimensionMismatchException, MaxCountExceededException { diff --git a/src/main/java/org/apache/commons/math4/ode/ParameterizedWrapper.java b/src/main/java/org/apache/commons/math4/ode/ParameterizedWrapper.java index 14594d0ed..e37b849b1 100644 --- a/src/main/java/org/apache/commons/math4/ode/ParameterizedWrapper.java +++ b/src/main/java/org/apache/commons/math4/ode/ParameterizedWrapper.java @@ -59,16 +59,19 @@ class ParameterizedWrapper implements ParameterizedODE { } /** {@inheritDoc} */ + @Override public Collection getParametersNames() { return new ArrayList(); } /** {@inheritDoc} */ + @Override public boolean isSupported(String name) { return false; } /** {@inheritDoc} */ + @Override public double getParameter(String name) throws UnknownParameterException { if (!isSupported(name)) { @@ -78,6 +81,7 @@ class ParameterizedWrapper implements ParameterizedODE { } /** {@inheritDoc} */ + @Override public void setParameter(String name, double value) { } diff --git a/src/main/java/org/apache/commons/math4/ode/events/EventFilter.java b/src/main/java/org/apache/commons/math4/ode/events/EventFilter.java index 27eab1a6d..ccb68656a 100644 --- a/src/main/java/org/apache/commons/math4/ode/events/EventFilter.java +++ b/src/main/java/org/apache/commons/math4/ode/events/EventFilter.java @@ -87,6 +87,7 @@ public class EventFilter implements EventHandler { } /** {@inheritDoc} */ + @Override public void init(double t0, double[] y0, double t) { // delegate to raw handler @@ -101,6 +102,7 @@ public class EventFilter implements EventHandler { } /** {@inheritDoc} */ + @Override public double g(double t, double[] y) { final double rawG = rawHandler.g(t, y); @@ -190,12 +192,14 @@ public class EventFilter implements EventHandler { } /** {@inheritDoc} */ + @Override public Action eventOccurred(double t, double[] y, boolean increasing) { // delegate to raw handler, fixing increasing status on the fly return rawHandler.eventOccurred(t, y, filter.getTriggeredIncreasing()); } /** {@inheritDoc} */ + @Override public void resetState(double t, double[] y) { // delegate to raw handler rawHandler.resetState(t, y); diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonIntegrator.java index dc58b6ce6..37affbee4 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonIntegrator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonIntegrator.java @@ -375,12 +375,14 @@ public class AdamsMoultonIntegrator extends AdamsIntegrator { } /** {@inheritDoc} */ + @Override public void start(int rows, int columns, int startRow, int endRow, int startColumn, int endColumn) { Arrays.fill(after, 0.0); } /** {@inheritDoc} */ + @Override public void visit(int row, int column, double value) { if ((row & 0x1) == 0) { after[column] -= value; diff --git a/src/main/java/org/apache/commons/math4/ode/sampling/AbstractStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/sampling/AbstractStepInterpolator.java index fdd003019..609923154 100644 --- a/src/main/java/org/apache/commons/math4/ode/sampling/AbstractStepInterpolator.java +++ b/src/main/java/org/apache/commons/math4/ode/sampling/AbstractStepInterpolator.java @@ -262,6 +262,7 @@ public abstract class AbstractStepInterpolator } /** {@inheritDoc} */ + @Override public StepInterpolator copy() throws MaxCountExceededException { // finalize the step before performing copy @@ -369,17 +370,20 @@ public abstract class AbstractStepInterpolator } /** {@inheritDoc} */ + @Override public double getInterpolatedTime() { return interpolatedTime; } /** {@inheritDoc} */ + @Override public void setInterpolatedTime(final double time) { interpolatedTime = time; dirtyState = true; } /** {@inheritDoc} */ + @Override public boolean isForward() { return forward; } @@ -412,6 +416,7 @@ public abstract class AbstractStepInterpolator } /** {@inheritDoc} */ + @Override public double[] getInterpolatedState() throws MaxCountExceededException { evaluateCompleteInterpolatedState(); primaryMapper.extractEquationData(interpolatedState, @@ -420,6 +425,7 @@ public abstract class AbstractStepInterpolator } /** {@inheritDoc} */ + @Override public double[] getInterpolatedDerivatives() throws MaxCountExceededException { evaluateCompleteInterpolatedState(); primaryMapper.extractEquationData(interpolatedDerivatives, @@ -428,6 +434,7 @@ public abstract class AbstractStepInterpolator } /** {@inheritDoc} */ + @Override public double[] getInterpolatedSecondaryState(final int index) throws MaxCountExceededException { evaluateCompleteInterpolatedState(); secondaryMappers[index].extractEquationData(interpolatedState, @@ -436,6 +443,7 @@ public abstract class AbstractStepInterpolator } /** {@inheritDoc} */ + @Override public double[] getInterpolatedSecondaryDerivatives(final int index) throws MaxCountExceededException { evaluateCompleteInterpolatedState(); secondaryMappers[index].extractEquationData(interpolatedDerivatives, @@ -500,10 +508,12 @@ public abstract class AbstractStepInterpolator } /** {@inheritDoc} */ + @Override public abstract void writeExternal(ObjectOutput out) throws IOException; /** {@inheritDoc} */ + @Override public abstract void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; diff --git a/src/main/java/org/apache/commons/math4/ode/sampling/DummyStepHandler.java b/src/main/java/org/apache/commons/math4/ode/sampling/DummyStepHandler.java index 7134619ef..4832a9642 100644 --- a/src/main/java/org/apache/commons/math4/ode/sampling/DummyStepHandler.java +++ b/src/main/java/org/apache/commons/math4/ode/sampling/DummyStepHandler.java @@ -50,6 +50,7 @@ public class DummyStepHandler implements StepHandler { } /** {@inheritDoc} */ + @Override public void init(double t0, double[] y0, double t) { } diff --git a/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizer.java b/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizer.java index 176624858..abf95e1b0 100644 --- a/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizer.java +++ b/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizer.java @@ -173,6 +173,7 @@ public class StepNormalizer implements StepHandler { } /** {@inheritDoc} */ + @Override public void init(double t0, double[] y0, double t) { firstTime = Double.NaN; diff --git a/src/main/java/org/apache/commons/math4/optim/AbstractConvergenceChecker.java b/src/main/java/org/apache/commons/math4/optim/AbstractConvergenceChecker.java index 6e0b9ab41..4c8cf2247 100644 --- a/src/main/java/org/apache/commons/math4/optim/AbstractConvergenceChecker.java +++ b/src/main/java/org/apache/commons/math4/optim/AbstractConvergenceChecker.java @@ -63,6 +63,7 @@ public abstract class AbstractConvergenceChecker /** * {@inheritDoc} */ + @Override public abstract boolean converged(int iteration, PAIR previous, PAIR current); diff --git a/src/main/java/org/apache/commons/math4/optim/AbstractOptimizationProblem.java b/src/main/java/org/apache/commons/math4/optim/AbstractOptimizationProblem.java index 343240407..488e4f717 100644 --- a/src/main/java/org/apache/commons/math4/optim/AbstractOptimizationProblem.java +++ b/src/main/java/org/apache/commons/math4/optim/AbstractOptimizationProblem.java @@ -59,16 +59,19 @@ public abstract class AbstractOptimizationProblem } /** {@inheritDoc} */ + @Override public Incrementor getEvaluationCounter() { return new Incrementor(this.maxEvaluations, MAX_EVAL_CALLBACK); } /** {@inheritDoc} */ + @Override public Incrementor getIterationCounter() { return new Incrementor(this.maxIterations, MAX_ITER_CALLBACK); } /** {@inheritDoc} */ + @Override public ConvergenceChecker getConvergenceChecker() { return checker; } @@ -81,6 +84,7 @@ public abstract class AbstractOptimizationProblem * * @throws TooManyEvaluationsException */ + @Override public void trigger(int max) { throw new TooManyEvaluationsException(max); } @@ -94,6 +98,7 @@ public abstract class AbstractOptimizationProblem * * @throws TooManyIterationsException */ + @Override public void trigger(int max) { throw new TooManyIterationsException(max); } diff --git a/src/main/java/org/apache/commons/math4/optim/BaseOptimizer.java b/src/main/java/org/apache/commons/math4/optim/BaseOptimizer.java index 00c0a3c9d..1a3ae4c7a 100644 --- a/src/main/java/org/apache/commons/math4/optim/BaseOptimizer.java +++ b/src/main/java/org/apache/commons/math4/optim/BaseOptimizer.java @@ -238,6 +238,7 @@ public abstract class BaseOptimizer { * {@inheritDoc} * @throws TooManyEvaluationsException */ + @Override public void trigger(int max) { throw new TooManyEvaluationsException(max); } @@ -253,6 +254,7 @@ public abstract class BaseOptimizer { * {@inheritDoc} * @throws TooManyIterationsException */ + @Override public void trigger(int max) { throw new TooManyIterationsException(max); } diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/LeastSquaresConverter.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/LeastSquaresConverter.java index fc59f2cd9..3860cd54b 100644 --- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/LeastSquaresConverter.java +++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/LeastSquaresConverter.java @@ -154,6 +154,7 @@ public class LeastSquaresConverter implements MultivariateFunction { } /** {@inheritDoc} */ + @Override public double value(final double[] point) { // compute residuals final double[] residuals = function.value(point); diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionMappingAdapter.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionMappingAdapter.java index 736382549..a34f02db7 100644 --- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionMappingAdapter.java +++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionMappingAdapter.java @@ -201,11 +201,13 @@ public class MultivariateFunctionMappingAdapter /** Local class for no bounds mapping. */ private static class NoBoundsMapper implements Mapper { /** {@inheritDoc} */ + @Override public double unboundedToBounded(final double y) { return y; } /** {@inheritDoc} */ + @Override public double boundedToUnbounded(final double x) { return x; } @@ -226,11 +228,13 @@ public class MultivariateFunctionMappingAdapter } /** {@inheritDoc} */ + @Override public double unboundedToBounded(final double y) { return lower + FastMath.exp(y); } /** {@inheritDoc} */ + @Override public double boundedToUnbounded(final double x) { return FastMath.log(x - lower); } @@ -251,11 +255,13 @@ public class MultivariateFunctionMappingAdapter } /** {@inheritDoc} */ + @Override public double unboundedToBounded(final double y) { return upper - FastMath.exp(-y); } /** {@inheritDoc} */ + @Override public double boundedToUnbounded(final double x) { return -FastMath.log(upper - x); } @@ -281,11 +287,13 @@ public class MultivariateFunctionMappingAdapter } /** {@inheritDoc} */ + @Override public double unboundedToBounded(final double y) { return boundingFunction.value(y); } /** {@inheritDoc} */ + @Override public double boundedToUnbounded(final double x) { return unboundingFunction.value(x); } diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizer.java index 4d4e2ce4a..078c6ec94 100644 --- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizer.java +++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizer.java @@ -347,6 +347,7 @@ public class NonLinearConjugateGradientOptimizer /** Default identity preconditioner. */ public static class IdentityPreconditioner implements Preconditioner { /** {@inheritDoc} */ + @Override public double[] precondition(double[] variables, double[] r) { return r.clone(); } diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizer.java index bc1e41e3f..121aa2eba 100644 --- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizer.java +++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizer.java @@ -872,6 +872,7 @@ public class CMAESOptimizer } /** {@inheritDoc} */ + @Override public int compareTo(DoubleIndex o) { return Double.compare(value, o.value); } diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractStorelessUnivariateStatistic.java b/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractStorelessUnivariateStatistic.java index fe4603974..9920adfea 100644 --- a/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractStorelessUnivariateStatistic.java +++ b/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractStorelessUnivariateStatistic.java @@ -104,16 +104,19 @@ public abstract class AbstractStorelessUnivariateStatistic /** * {@inheritDoc} */ + @Override public abstract void clear(); /** * {@inheritDoc} */ + @Override public abstract double getResult(); /** * {@inheritDoc} */ + @Override public abstract void increment(final double d); /** diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractUnivariateStatistic.java b/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractUnivariateStatistic.java index c55d3f142..ab8e02d29 100644 --- a/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractUnivariateStatistic.java +++ b/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractUnivariateStatistic.java @@ -116,6 +116,7 @@ public abstract class AbstractUnivariateStatistic /** * {@inheritDoc} */ + @Override public double evaluate(final double[] values) throws MathIllegalArgumentException { test(values, 0, 0); return evaluate(values, 0, values.length); @@ -124,12 +125,14 @@ public abstract class AbstractUnivariateStatistic /** * {@inheritDoc} */ + @Override public abstract double evaluate(final double[] values, final int begin, final int length) throws MathIllegalArgumentException; /** * {@inheritDoc} */ + @Override public abstract UnivariateStatistic copy(); /** diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatistics.java b/src/main/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatistics.java index 3a7c345ee..52fc9cc3a 100644 --- a/src/main/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatistics.java +++ b/src/main/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatistics.java @@ -134,6 +134,7 @@ public class AggregateSummaryStatistics implements StatisticalSummary, * * @see StatisticalSummary#getMax() */ + @Override public double getMax() { synchronized (statistics) { return statistics.getMax(); @@ -145,6 +146,7 @@ public class AggregateSummaryStatistics implements StatisticalSummary, * * @see StatisticalSummary#getMean() */ + @Override public double getMean() { synchronized (statistics) { return statistics.getMean(); @@ -157,6 +159,7 @@ public class AggregateSummaryStatistics implements StatisticalSummary, * * @see StatisticalSummary#getMin() */ + @Override public double getMin() { synchronized (statistics) { return statistics.getMin(); @@ -168,6 +171,7 @@ public class AggregateSummaryStatistics implements StatisticalSummary, * * @see StatisticalSummary#getN() */ + @Override public long getN() { synchronized (statistics) { return statistics.getN(); @@ -180,6 +184,7 @@ public class AggregateSummaryStatistics implements StatisticalSummary, * * @see StatisticalSummary#getStandardDeviation() */ + @Override public double getStandardDeviation() { synchronized (statistics) { return statistics.getStandardDeviation(); @@ -191,6 +196,7 @@ public class AggregateSummaryStatistics implements StatisticalSummary, * * @see StatisticalSummary#getSum() */ + @Override public double getSum() { synchronized (statistics) { return statistics.getSum(); @@ -203,6 +209,7 @@ public class AggregateSummaryStatistics implements StatisticalSummary, * * @see StatisticalSummary#getVariance() */ + @Override public double getVariance() { synchronized (statistics) { return statistics.getVariance(); diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/FirstMoment.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/FirstMoment.java index 8ab7b0f58..00d85132c 100644 --- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/FirstMoment.java +++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/FirstMoment.java @@ -133,6 +133,7 @@ class FirstMoment extends AbstractStorelessUnivariateStatistic /** * {@inheritDoc} */ + @Override public long getN() { return n; } diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/GeometricMean.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/GeometricMean.java index 41c58b945..ab628ded6 100644 --- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/GeometricMean.java +++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/GeometricMean.java @@ -152,6 +152,7 @@ public class GeometricMean extends AbstractStorelessUnivariateStatistic implemen /** * {@inheritDoc} */ + @Override public long getN() { return sumOfLogs.getN(); } diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Kurtosis.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Kurtosis.java index 49700580a..2164ed9f3 100644 --- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Kurtosis.java +++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Kurtosis.java @@ -138,6 +138,7 @@ public class Kurtosis extends AbstractStorelessUnivariateStatistic implements S /** * {@inheritDoc} */ + @Override public long getN() { return moment.getN(); } diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Mean.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Mean.java index 94c58a25f..593eb4228 100644 --- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Mean.java +++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Mean.java @@ -138,6 +138,7 @@ public class Mean extends AbstractStorelessUnivariateStatistic /** * {@inheritDoc} */ + @Override public long getN() { return moment.getN(); } diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Skewness.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Skewness.java index db3d9f4f8..3b488c9b0 100644 --- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Skewness.java +++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Skewness.java @@ -123,6 +123,7 @@ public class Skewness extends AbstractStorelessUnivariateStatistic implements Se /** * {@inheritDoc} */ + @Override public long getN() { return moment.getN(); } diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/StandardDeviation.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/StandardDeviation.java index 5847b13fb..0d86be2cb 100644 --- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/StandardDeviation.java +++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/StandardDeviation.java @@ -117,6 +117,7 @@ public class StandardDeviation extends AbstractStorelessUnivariateStatistic /** * {@inheritDoc} */ + @Override public long getN() { return variance.getN(); } diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Variance.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Variance.java index b1cf852ff..180098295 100644 --- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Variance.java +++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Variance.java @@ -193,6 +193,7 @@ public class Variance extends AbstractStorelessUnivariateStatistic implements Se /** * {@inheritDoc} */ + @Override public long getN() { return moment.getN(); } diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Max.java b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Max.java index e76e68a1d..60efe1b1c 100644 --- a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Max.java +++ b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Max.java @@ -100,6 +100,7 @@ public class Max extends AbstractStorelessUnivariateStatistic implements Seriali /** * {@inheritDoc} */ + @Override public long getN() { return n; } diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Min.java b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Min.java index a0ddf86b6..0152e48de 100644 --- a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Min.java +++ b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Min.java @@ -100,6 +100,7 @@ public class Min extends AbstractStorelessUnivariateStatistic implements Seriali /** * {@inheritDoc} */ + @Override public long getN() { return n; } diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentile.java b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentile.java index 79df28465..418f3c565 100644 --- a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentile.java +++ b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentile.java @@ -227,6 +227,7 @@ public class PSquarePercentile extends AbstractStorelessUnivariateStatistic /** * {@inheritDoc} */ + @Override public long getN() { return countOfObservations; } @@ -491,6 +492,7 @@ public class PSquarePercentile extends AbstractStorelessUnivariateStatistic /** * {@inheritDoc} */ + @Override public double estimate(final int index) { if (index < LOW || index > HIGH) { throw new OutOfRangeException(index, LOW, HIGH); diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/summary/Product.java b/src/main/java/org/apache/commons/math4/stat/descriptive/summary/Product.java index dfbf613be..4336f7f64 100644 --- a/src/main/java/org/apache/commons/math4/stat/descriptive/summary/Product.java +++ b/src/main/java/org/apache/commons/math4/stat/descriptive/summary/Product.java @@ -90,6 +90,7 @@ public class Product extends AbstractStorelessUnivariateStatistic implements Ser /** * {@inheritDoc} */ + @Override public long getN() { return n; } diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/summary/Sum.java b/src/main/java/org/apache/commons/math4/stat/descriptive/summary/Sum.java index 6205d2a81..523de97a9 100644 --- a/src/main/java/org/apache/commons/math4/stat/descriptive/summary/Sum.java +++ b/src/main/java/org/apache/commons/math4/stat/descriptive/summary/Sum.java @@ -89,6 +89,7 @@ public class Sum extends AbstractStorelessUnivariateStatistic implements Seriali /** * {@inheritDoc} */ + @Override public long getN() { return n; } diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/summary/SumOfLogs.java b/src/main/java/org/apache/commons/math4/stat/descriptive/summary/SumOfLogs.java index 57f725cd8..5a95de1e2 100644 --- a/src/main/java/org/apache/commons/math4/stat/descriptive/summary/SumOfLogs.java +++ b/src/main/java/org/apache/commons/math4/stat/descriptive/summary/SumOfLogs.java @@ -97,6 +97,7 @@ public class SumOfLogs extends AbstractStorelessUnivariateStatistic implements S /** * {@inheritDoc} */ + @Override public long getN() { return n; } diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/summary/SumOfSquares.java b/src/main/java/org/apache/commons/math4/stat/descriptive/summary/SumOfSquares.java index 68c589b14..d55c89005 100644 --- a/src/main/java/org/apache/commons/math4/stat/descriptive/summary/SumOfSquares.java +++ b/src/main/java/org/apache/commons/math4/stat/descriptive/summary/SumOfSquares.java @@ -88,6 +88,7 @@ public class SumOfSquares extends AbstractStorelessUnivariateStatistic implement /** * {@inheritDoc} */ + @Override public long getN() { return n; } diff --git a/src/main/java/org/apache/commons/math4/stat/interval/AgrestiCoullInterval.java b/src/main/java/org/apache/commons/math4/stat/interval/AgrestiCoullInterval.java index 6685e647b..ab740fb5e 100644 --- a/src/main/java/org/apache/commons/math4/stat/interval/AgrestiCoullInterval.java +++ b/src/main/java/org/apache/commons/math4/stat/interval/AgrestiCoullInterval.java @@ -30,6 +30,7 @@ import org.apache.commons.math4.util.FastMath; public class AgrestiCoullInterval implements BinomialConfidenceInterval { /** {@inheritDoc} */ + @Override public ConfidenceInterval createInterval(int numberOfTrials, int numberOfSuccesses, double confidenceLevel) { IntervalUtils.checkParameters(numberOfTrials, numberOfSuccesses, confidenceLevel); final double alpha = (1.0 - confidenceLevel) / 2; diff --git a/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java b/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java index ea713d8dc..17dc9f55d 100644 --- a/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java +++ b/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java @@ -29,6 +29,7 @@ import org.apache.commons.math4.distribution.FDistribution; public class ClopperPearsonInterval implements BinomialConfidenceInterval { /** {@inheritDoc} */ + @Override public ConfidenceInterval createInterval(int numberOfTrials, int numberOfSuccesses, double confidenceLevel) { IntervalUtils.checkParameters(numberOfTrials, numberOfSuccesses, confidenceLevel); diff --git a/src/main/java/org/apache/commons/math4/stat/interval/NormalApproximationInterval.java b/src/main/java/org/apache/commons/math4/stat/interval/NormalApproximationInterval.java index a81e58daa..57c394629 100644 --- a/src/main/java/org/apache/commons/math4/stat/interval/NormalApproximationInterval.java +++ b/src/main/java/org/apache/commons/math4/stat/interval/NormalApproximationInterval.java @@ -30,6 +30,7 @@ import org.apache.commons.math4.util.FastMath; public class NormalApproximationInterval implements BinomialConfidenceInterval { /** {@inheritDoc} */ + @Override public ConfidenceInterval createInterval(int numberOfTrials, int numberOfSuccesses, double confidenceLevel) { IntervalUtils.checkParameters(numberOfTrials, numberOfSuccesses, confidenceLevel); diff --git a/src/main/java/org/apache/commons/math4/stat/interval/WilsonScoreInterval.java b/src/main/java/org/apache/commons/math4/stat/interval/WilsonScoreInterval.java index 0c91f62b2..bf683b1c1 100644 --- a/src/main/java/org/apache/commons/math4/stat/interval/WilsonScoreInterval.java +++ b/src/main/java/org/apache/commons/math4/stat/interval/WilsonScoreInterval.java @@ -30,6 +30,7 @@ import org.apache.commons.math4.util.FastMath; public class WilsonScoreInterval implements BinomialConfidenceInterval { /** {@inheritDoc} */ + @Override public ConfidenceInterval createInterval(int numberOfTrials, int numberOfSuccesses, double confidenceLevel) { IntervalUtils.checkParameters(numberOfTrials, numberOfSuccesses, confidenceLevel); final double alpha = (1.0 - confidenceLevel) / 2; diff --git a/src/main/java/org/apache/commons/math4/stat/regression/AbstractMultipleLinearRegression.java b/src/main/java/org/apache/commons/math4/stat/regression/AbstractMultipleLinearRegression.java index 0b9751a40..99775c4b0 100644 --- a/src/main/java/org/apache/commons/math4/stat/regression/AbstractMultipleLinearRegression.java +++ b/src/main/java/org/apache/commons/math4/stat/regression/AbstractMultipleLinearRegression.java @@ -260,6 +260,7 @@ public abstract class AbstractMultipleLinearRegression implements /** * {@inheritDoc} */ + @Override public double[] estimateRegressionParameters() { RealVector b = calculateBeta(); return b.toArray(); @@ -268,6 +269,7 @@ public abstract class AbstractMultipleLinearRegression implements /** * {@inheritDoc} */ + @Override public double[] estimateResiduals() { RealVector b = calculateBeta(); RealVector e = yVector.subtract(xMatrix.operate(b)); @@ -277,6 +279,7 @@ public abstract class AbstractMultipleLinearRegression implements /** * {@inheritDoc} */ + @Override public double[][] estimateRegressionParametersVariance() { return calculateBetaVariance().getData(); } @@ -284,6 +287,7 @@ public abstract class AbstractMultipleLinearRegression implements /** * {@inheritDoc} */ + @Override public double[] estimateRegressionParametersStandardErrors() { double[][] betaVariance = estimateRegressionParametersVariance(); double sigma = calculateErrorVariance(); @@ -298,6 +302,7 @@ public abstract class AbstractMultipleLinearRegression implements /** * {@inheritDoc} */ + @Override public double estimateRegressandVariance() { return calculateYVariance(); }