diff --git a/src/main/java/org/apache/commons/math4/analysis/DifferentiableMultivariateFunction.java b/src/main/java/org/apache/commons/math4/analysis/DifferentiableMultivariateFunction.java
deleted file mode 100644
index 8ca1ab954..000000000
--- a/src/main/java/org/apache/commons/math4/analysis/DifferentiableMultivariateFunction.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.math4.analysis;
-
-/**
- * Extension of {@link MultivariateFunction} representing a differentiable
- * multivariate real function.
- * @since 2.0
- * @deprecated as of 3.1 replaced by {@link org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableFunction}
- */
-@Deprecated
-public interface DifferentiableMultivariateFunction extends MultivariateFunction {
-
- /**
- * Returns the partial derivative of the function with respect to a point coordinate.
- *
- * The partial derivative is defined with respect to point coordinate
- * xk. If the partial derivatives with respect to all coordinates are
- * needed, it may be more efficient to use the {@link #gradient()} method which will
- * compute them all at once.
- *
- * @param k index of the coordinate with respect to which the partial
- * derivative is computed
- * @return the partial derivative function with respect to kth point coordinate
- */
- MultivariateFunction partialDerivative(int k);
-
- /**
- * Returns the gradient function.
- * If only one partial derivative with respect to a specific coordinate is
- * needed, it may be more efficient to use the {@link #partialDerivative(int)} method
- * which will compute only the specified component.
- * @return the gradient function
- */
- MultivariateVectorFunction gradient();
-
-}
diff --git a/src/main/java/org/apache/commons/math4/analysis/DifferentiableMultivariateVectorFunction.java b/src/main/java/org/apache/commons/math4/analysis/DifferentiableMultivariateVectorFunction.java
deleted file mode 100644
index 7cc768823..000000000
--- a/src/main/java/org/apache/commons/math4/analysis/DifferentiableMultivariateVectorFunction.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.math4.analysis;
-
-/**
- * Extension of {@link MultivariateVectorFunction} representing a differentiable
- * multivariate vectorial function.
- * @since 2.0
- * @deprecated as of 3.1 replaced by {@link org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction}
- */
-@Deprecated
-public interface DifferentiableMultivariateVectorFunction
- extends MultivariateVectorFunction {
-
- /**
- * Returns the jacobian function.
- * @return the jacobian function
- */
- MultivariateMatrixFunction jacobian();
-
-}
diff --git a/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateFunction.java b/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateFunction.java
deleted file mode 100644
index a59f23f83..000000000
--- a/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateFunction.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.analysis;
-
-/**
- * Extension of {@link UnivariateFunction} representing a differentiable univariate real function.
- *
- * @deprecated as of 3.1 replaced by {@link org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction}
- */
-@Deprecated
-public interface DifferentiableUnivariateFunction
- extends UnivariateFunction {
-
- /**
- * Returns the derivative of the function
- *
- * @return the derivative function
- */
- UnivariateFunction derivative();
-
-}
diff --git a/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateMatrixFunction.java b/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateMatrixFunction.java
deleted file mode 100644
index 7a6c6883b..000000000
--- a/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateMatrixFunction.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.analysis;
-
-/**
- * Extension of {@link UnivariateMatrixFunction} representing a differentiable univariate matrix function.
- *
- * @since 2.0
- * @deprecated as of 3.1 replaced by {@link org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableMatrixFunction}
- */
-@Deprecated
-public interface DifferentiableUnivariateMatrixFunction
- extends UnivariateMatrixFunction {
-
- /**
- * Returns the derivative of the function
- *
- * @return the derivative function
- */
- UnivariateMatrixFunction derivative();
-
-}
diff --git a/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateVectorFunction.java b/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateVectorFunction.java
deleted file mode 100644
index 9b9a371dd..000000000
--- a/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateVectorFunction.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.analysis;
-
-/**
- * Extension of {@link UnivariateVectorFunction} representing a differentiable univariate vectorial function.
- *
- * @since 2.0
- * @deprecated as of 3.1 replaced by {@link org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableVectorFunction}
- */
-@Deprecated
-public interface DifferentiableUnivariateVectorFunction
- extends UnivariateVectorFunction {
-
- /**
- * Returns the derivative of the function
- *
- * @return the derivative function
- */
- UnivariateVectorFunction derivative();
-
-}
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 77555d3ea..dca2e8a8b 100644
--- a/src/main/java/org/apache/commons/math4/analysis/FunctionUtils.java
+++ b/src/main/java/org/apache/commons/math4/analysis/FunctionUtils.java
@@ -18,8 +18,6 @@
package org.apache.commons.math4.analysis;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableFunction;
-import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.analysis.function.Identity;
import org.apache.commons.math4.exception.DimensionMismatchException;
@@ -97,49 +95,6 @@ public class FunctionUtils {
};
}
- /**
- * Composes functions.
- *
- * The functions in the argument list are composed sequentially, in the
- * given order. For example, compose(f1,f2,f3) acts like f1(f2(f3(x))).
- *
- * @param f List of functions.
- * @return the composite function.
- * @deprecated as of 3.1 replaced by {@link #compose(UnivariateDifferentiableFunction...)}
- */
- @Deprecated
- 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--) {
- r = f[i].value(r);
- }
- return r;
- }
-
- /** {@inheritDoc} */
- @Override
- public UnivariateFunction derivative() {
- return new UnivariateFunction() {
- /** {@inheritDoc} */
- @Override
- public double value(double x) {
- double p = 1;
- double r = x;
- for (int i = f.length - 1; i >= 0; i--) {
- p *= f[i].derivative().value(r);
- r = f[i].value(r);
- }
- return p;
- }
- };
- }
- };
- }
-
/**
* Adds functions.
*
@@ -196,44 +151,6 @@ public class FunctionUtils {
};
}
- /**
- * Adds functions.
- *
- * @param f List of functions.
- * @return a function that computes the sum of the functions.
- * @deprecated as of 3.1 replaced by {@link #add(UnivariateDifferentiableFunction...)}
- */
- @Deprecated
- 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++) {
- r += f[i].value(x);
- }
- return r;
- }
-
- /** {@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++) {
- r += f[i].derivative().value(x);
- }
- return r;
- }
- };
- }
- };
- }
-
/**
* Multiplies functions.
*
@@ -287,50 +204,6 @@ public class FunctionUtils {
};
}
- /**
- * Multiplies functions.
- *
- * @param f List of functions.
- * @return a function that computes the product of the functions.
- * @deprecated as of 3.1 replaced by {@link #multiply(UnivariateDifferentiableFunction...)}
- */
- @Deprecated
- 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++) {
- r *= f[i].value(x);
- }
- return r;
- }
-
- /** {@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++) {
- double prod = f[i].derivative().value(x);
- for (int j = 0; j < f.length; j++) {
- if (i != j) {
- prod *= f[j].value(x);
- }
- }
- sum += prod;
- }
- return sum;
- }
- };
- }
- };
- }
-
/**
* Returns the univariate function
* {@code h(x) = combiner(f(x), g(x))}.
@@ -464,369 +337,4 @@ public class FunctionUtils {
return s;
}
- /** Convert a {@link UnivariateDifferentiableFunction} into a {@link DifferentiableUnivariateFunction}.
- * @param f function to convert
- * @return converted function
- * @deprecated this conversion method is temporary in version 3.1, as the {@link
- * DifferentiableUnivariateFunction} interface itself is deprecated
- */
- @Deprecated
- public static DifferentiableUnivariateFunction toDifferentiableUnivariateFunction(final UnivariateDifferentiableFunction f) {
- 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);
- }
- };
- }
-
- };
- }
-
- /** Convert a {@link DifferentiableUnivariateFunction} into a {@link UnivariateDifferentiableFunction}.
- *
- * Note that the converted function is able to handle {@link DerivativeStructure} up to order one.
- * If the function is called with higher order, a {@link NumberIsTooLargeException} will be thrown.
- *
- * @param f function to convert
- * @return converted function
- * @deprecated this conversion method is temporary in version 3.1, as the {@link
- * DifferentiableUnivariateFunction} interface itself is deprecated
- */
- @Deprecated
- public static UnivariateDifferentiableFunction toUnivariateDifferential(final DifferentiableUnivariateFunction f) {
- return new UnivariateDifferentiableFunction() {
-
- /** {@inheritDoc} */
- @Override
- public double value(final double x) {
- return f.value(x);
- }
-
- /** {@inheritDoc}
- * @exception NumberIsTooLargeException if derivation order is greater than 1
- */
- @Override
- public DerivativeStructure value(final DerivativeStructure t)
- throws NumberIsTooLargeException {
- switch (t.getOrder()) {
- case 0 :
- return new DerivativeStructure(t.getFreeParameters(), 0, f.value(t.getValue()));
- case 1 : {
- final int parameters = t.getFreeParameters();
- final double[] derivatives = new double[parameters + 1];
- derivatives[0] = f.value(t.getValue());
- final double fPrime = f.derivative().value(t.getValue());
- int[] orders = new int[parameters];
- for (int i = 0; i < parameters; ++i) {
- orders[i] = 1;
- derivatives[i + 1] = fPrime * t.getPartialDerivative(orders);
- orders[i] = 0;
- }
- return new DerivativeStructure(parameters, 1, derivatives);
- }
- default :
- throw new NumberIsTooLargeException(t.getOrder(), 1, true);
- }
- }
-
- };
- }
-
- /** Convert a {@link MultivariateDifferentiableFunction} into a {@link DifferentiableMultivariateFunction}.
- * @param f function to convert
- * @return converted function
- * @deprecated this conversion method is temporary in version 3.1, as the {@link
- * DifferentiableMultivariateFunction} interface itself is deprecated
- */
- @Deprecated
- public static DifferentiableMultivariateFunction toDifferentiableMultivariateFunction(final MultivariateDifferentiableFunction f) {
- 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;
-
- // delegate computation to underlying function
- final DerivativeStructure[] dsX = new DerivativeStructure[n];
- for (int i = 0; i < n; ++i) {
- if (i == k) {
- dsX[i] = new DerivativeStructure(1, 1, 0, x[i]);
- } else {
- dsX[i] = new DerivativeStructure(1, 1, x[i]);
- }
- }
- final DerivativeStructure y = f.value(dsX);
-
- // extract partial derivative
- return y.getPartialDerivative(1);
-
- }
- };
- }
-
- public MultivariateVectorFunction gradient() {
- return new MultivariateVectorFunction() {
- /** {@inheritDoc} */
- @Override
- public double[] value(final double[] x) {
-
- final int n = x.length;
-
- // delegate computation to underlying function
- final DerivativeStructure[] dsX = new DerivativeStructure[n];
- for (int i = 0; i < n; ++i) {
- dsX[i] = new DerivativeStructure(n, 1, i, x[i]);
- }
- final DerivativeStructure y = f.value(dsX);
-
- // extract gradient
- final double[] gradient = new double[n];
- final int[] orders = new int[n];
- for (int i = 0; i < n; ++i) {
- orders[i] = 1;
- gradient[i] = y.getPartialDerivative(orders);
- orders[i] = 0;
- }
-
- return gradient;
-
- }
- };
- }
-
- };
- }
-
- /** Convert a {@link DifferentiableMultivariateFunction} into a {@link MultivariateDifferentiableFunction}.
- *
- * Note that the converted function is able to handle {@link DerivativeStructure} elements
- * that all have the same number of free parameters and order, and with order at most 1.
- * If the function is called with inconsistent numbers of free parameters or higher order, a
- * {@link DimensionMismatchException} or a {@link NumberIsTooLargeException} will be thrown.
- *
- * @param f function to convert
- * @return converted function
- * @deprecated this conversion method is temporary in version 3.1, as the {@link
- * DifferentiableMultivariateFunction} interface itself is deprecated
- */
- @Deprecated
- public static MultivariateDifferentiableFunction toMultivariateDifferentiableFunction(final DifferentiableMultivariateFunction f) {
- return new MultivariateDifferentiableFunction() {
-
- /** {@inheritDoc} */
- @Override
- public double value(final double[] x) {
- return f.value(x);
- }
-
- /** {@inheritDoc}
- * @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 {
-
- // check parameters and orders limits
- final int parameters = t[0].getFreeParameters();
- final int order = t[0].getOrder();
- final int n = t.length;
- if (order > 1) {
- throw new NumberIsTooLargeException(order, 1, true);
- }
-
- // check all elements in the array are consistent
- for (int i = 0; i < n; ++i) {
- if (t[i].getFreeParameters() != parameters) {
- throw new DimensionMismatchException(t[i].getFreeParameters(), parameters);
- }
-
- if (t[i].getOrder() != order) {
- throw new DimensionMismatchException(t[i].getOrder(), order);
- }
- }
-
- // delegate computation to underlying function
- final double[] point = new double[n];
- for (int i = 0; i < n; ++i) {
- point[i] = t[i].getValue();
- }
- final double value = f.value(point);
- final double[] gradient = f.gradient().value(point);
-
- // merge value and gradient into one DerivativeStructure
- final double[] derivatives = new double[parameters + 1];
- derivatives[0] = value;
- final int[] orders = new int[parameters];
- for (int i = 0; i < parameters; ++i) {
- orders[i] = 1;
- for (int j = 0; j < n; ++j) {
- derivatives[i + 1] += gradient[j] * t[j].getPartialDerivative(orders);
- }
- orders[i] = 0;
- }
-
- return new DerivativeStructure(parameters, order, derivatives);
-
- }
-
- };
- }
-
- /** Convert a {@link MultivariateDifferentiableVectorFunction} into a {@link DifferentiableMultivariateVectorFunction}.
- * @param f function to convert
- * @return converted function
- * @deprecated this conversion method is temporary in version 3.1, as the {@link
- * DifferentiableMultivariateVectorFunction} interface itself is deprecated
- */
- @Deprecated
- public static DifferentiableMultivariateVectorFunction toDifferentiableMultivariateVectorFunction(final MultivariateDifferentiableVectorFunction f) {
- return new DifferentiableMultivariateVectorFunction() {
-
- /** {@inheritDoc} */
- @Override
- public double[] value(final double[] x) {
- return f.value(x);
- }
-
- public MultivariateMatrixFunction jacobian() {
- return new MultivariateMatrixFunction() {
- /** {@inheritDoc} */
- @Override
- public double[][] value(final double[] x) {
-
- final int n = x.length;
-
- // delegate computation to underlying function
- final DerivativeStructure[] dsX = new DerivativeStructure[n];
- for (int i = 0; i < n; ++i) {
- dsX[i] = new DerivativeStructure(n, 1, i, x[i]);
- }
- final DerivativeStructure[] y = f.value(dsX);
-
- // extract Jacobian
- final double[][] jacobian = new double[y.length][n];
- final int[] orders = new int[n];
- for (int i = 0; i < y.length; ++i) {
- for (int j = 0; j < n; ++j) {
- orders[j] = 1;
- jacobian[i][j] = y[i].getPartialDerivative(orders);
- orders[j] = 0;
- }
- }
-
- return jacobian;
-
- }
- };
- }
-
- };
- }
-
- /** Convert a {@link DifferentiableMultivariateVectorFunction} into a {@link MultivariateDifferentiableVectorFunction}.
- *
- * Note that the converted function is able to handle {@link DerivativeStructure} elements
- * that all have the same number of free parameters and order, and with order at most 1.
- * If the function is called with inconsistent numbers of free parameters or higher order, a
- * {@link DimensionMismatchException} or a {@link NumberIsTooLargeException} will be thrown.
- *
- * @param f function to convert
- * @return converted function
- * @deprecated this conversion method is temporary in version 3.1, as the {@link
- * DifferentiableMultivariateFunction} interface itself is deprecated
- */
- @Deprecated
- public static MultivariateDifferentiableVectorFunction toMultivariateDifferentiableVectorFunction(final DifferentiableMultivariateVectorFunction f) {
- return new MultivariateDifferentiableVectorFunction() {
-
- /** {@inheritDoc} */
- @Override
- public double[] value(final double[] x) {
- return f.value(x);
- }
-
- /** {@inheritDoc}
- * @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 {
-
- // check parameters and orders limits
- final int parameters = t[0].getFreeParameters();
- final int order = t[0].getOrder();
- final int n = t.length;
- if (order > 1) {
- throw new NumberIsTooLargeException(order, 1, true);
- }
-
- // check all elements in the array are consistent
- for (int i = 0; i < n; ++i) {
- if (t[i].getFreeParameters() != parameters) {
- throw new DimensionMismatchException(t[i].getFreeParameters(), parameters);
- }
-
- if (t[i].getOrder() != order) {
- throw new DimensionMismatchException(t[i].getOrder(), order);
- }
- }
-
- // delegate computation to underlying function
- final double[] point = new double[n];
- for (int i = 0; i < n; ++i) {
- point[i] = t[i].getValue();
- }
- final double[] value = f.value(point);
- final double[][] jacobian = f.jacobian().value(point);
-
- // merge value and Jacobian into a DerivativeStructure array
- final DerivativeStructure[] merged = new DerivativeStructure[value.length];
- for (int k = 0; k < merged.length; ++k) {
- final double[] derivatives = new double[parameters + 1];
- derivatives[0] = value[k];
- final int[] orders = new int[parameters];
- for (int i = 0; i < parameters; ++i) {
- orders[i] = 1;
- for (int j = 0; j < n; ++j) {
- derivatives[i + 1] += jacobian[k][j] * t[j].getPartialDerivative(orders);
- }
- orders[i] = 0;
- }
- merged[k] = new DerivativeStructure(parameters, order, derivatives);
- }
-
- return merged;
-
- }
-
- };
- }
-
}
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 3c9a48c42..b4f1457af 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
@@ -764,6 +764,7 @@ public class DerivativeStructure implements RealFieldElement, Seriali
/** Base 10 logarithm.
* @return base 10 logarithm of the instance
*/
+ @Override
public SparseGradient log10() {
return new SparseGradient(FastMath.log10(value), 1.0 / (FastMath.log(10.0) * value), derivatives);
}
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 6733822e9..2d9a3dd12 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
@@ -17,9 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.util.FastMath;
@@ -29,22 +26,13 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Acos implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Acos implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return FastMath.acos(x);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Deprecated
- @Override
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 fb78cd528..29c325da8 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
@@ -17,9 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.util.FastMath;
@@ -29,22 +26,13 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Acosh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Acosh implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return FastMath.acosh(x);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Deprecated
- @Override
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 ee6a66cba..56c1b93f0 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
@@ -17,9 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.util.FastMath;
@@ -29,22 +26,13 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Asin implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Asin implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return FastMath.asin(x);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Deprecated
- @Override
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 21184cd14..a4e5d3fab 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
@@ -17,9 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.util.FastMath;
@@ -29,22 +26,13 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Asinh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Asinh implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return FastMath.asinh(x);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Deprecated
- @Override
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 122790597..25f8208e0 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
@@ -17,9 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.util.FastMath;
@@ -29,22 +26,13 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Atan implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Atan implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return FastMath.atan(x);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Deprecated
- @Override
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 1f573bf07..ea284bda7 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
@@ -17,9 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.util.FastMath;
@@ -29,22 +26,13 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Atanh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Atanh implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return FastMath.atanh(x);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Deprecated
- @Override
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 dc7cdcc35..6d08743d0 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
@@ -17,9 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.util.FastMath;
@@ -29,22 +26,13 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Cbrt implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Cbrt implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return FastMath.cbrt(x);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Deprecated
- @Override
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 acd9681cb..5b612f5e8 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
@@ -17,7 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
@@ -26,7 +25,7 @@ import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiabl
*
* @since 3.0
*/
-public class Constant implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Constant implements UnivariateDifferentiableFunction {
/** Constant. */
private final double c;
@@ -43,15 +42,6 @@ public class Constant implements UnivariateDifferentiableFunction, Differentiabl
return c;
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Deprecated
- @Override
- public DifferentiableUnivariateFunction derivative() {
- return new Constant(0);
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 8f3807009..3f992c24d 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
@@ -17,9 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.util.FastMath;
@@ -29,22 +26,13 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Cos implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Cos implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return FastMath.cos(x);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Deprecated
- @Override
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 4bdcad584..5678612c8 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
@@ -17,7 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.util.FastMath;
@@ -27,22 +26,13 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Cosh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Cosh implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return FastMath.cosh(x);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Deprecated
- @Override
- public DifferentiableUnivariateFunction derivative() {
- return new Sinh();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 7baf5354d..abee43e57 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
@@ -17,9 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.util.FastMath;
@@ -29,22 +26,13 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Exp implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Exp implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return FastMath.exp(x);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Override
- @Deprecated
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 1b0c61dd6..aba08f11d 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
@@ -17,9 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.util.FastMath;
@@ -29,22 +26,13 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Expm1 implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Expm1 implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return FastMath.expm1(x);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Override
- @Deprecated
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 1b04a34fb..e703ed3e1 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
@@ -19,10 +19,7 @@ package org.apache.commons.math4.analysis.function;
import java.util.Arrays;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.exception.DimensionMismatchException;
@@ -37,7 +34,7 @@ import org.apache.commons.math4.util.Precision;
*
* @since 3.0
*/
-public class Gaussian implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Gaussian implements UnivariateDifferentiableFunction {
/** Mean. */
private final double mean;
/** Inverse of the standard deviation. */
@@ -95,15 +92,6 @@ public class Gaussian implements UnivariateDifferentiableFunction, Differentiabl
return value(x - mean, norm, i2s2);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Override
- @Deprecated
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/**
* Parametric function where the input array contains the parameters of
* the Gaussian, ordered as follows:
@@ -125,6 +113,7 @@ public class Gaussian implements UnivariateDifferentiableFunction, Differentiabl
* not 3.
* @throws NotStrictlyPositiveException if {@code param[2]} is negative.
*/
+ @Override
public double value(double x, double ... param)
throws NullArgumentException,
DimensionMismatchException,
@@ -150,6 +139,7 @@ public class Gaussian implements UnivariateDifferentiableFunction, Differentiabl
* not 3.
* @throws NotStrictlyPositiveException if {@code param[2]} is negative.
*/
+ @Override
public double[] gradient(double x, double ... param)
throws NullArgumentException,
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 b07ac6636..6207d007a 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
@@ -17,10 +17,7 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.exception.DimensionMismatchException;
@@ -33,7 +30,7 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class HarmonicOscillator implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class HarmonicOscillator implements UnivariateDifferentiableFunction {
/** Amplitude. */
private final double amplitude;
/** Angular frequency. */
@@ -62,15 +59,6 @@ public class HarmonicOscillator implements UnivariateDifferentiableFunction, Dif
return value(omega * x + phase, amplitude);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Override
- @Deprecated
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/**
* Parametric function where the input array contains the parameters of
* the harmonic oscillator function, ordered as follows:
@@ -91,6 +79,7 @@ public class HarmonicOscillator implements UnivariateDifferentiableFunction, Dif
* @throws DimensionMismatchException if the size of {@code param} is
* not 3.
*/
+ @Override
public double value(double x, double ... param)
throws NullArgumentException,
DimensionMismatchException {
@@ -111,6 +100,7 @@ public class HarmonicOscillator implements UnivariateDifferentiableFunction, Dif
* @throws DimensionMismatchException if the size of {@code param} is
* not 3.
*/
+ @Override
public double[] gradient(double x, double ... param)
throws NullArgumentException,
DimensionMismatchException {
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 dd0c84bb9..56567d464 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
@@ -17,7 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
@@ -26,22 +25,13 @@ import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiabl
*
* @since 3.0
*/
-public class Identity implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Identity implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return x;
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Override
- @Deprecated
- public DifferentiableUnivariateFunction derivative() {
- return new Constant(1);
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 77df37bb7..500496265 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
@@ -17,9 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
@@ -28,22 +25,13 @@ import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiabl
*
* @since 3.0
*/
-public class Inverse implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Inverse implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return 1 / x;
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Override
- @Deprecated
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 028890ce6..5f114669a 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
@@ -17,9 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.util.FastMath;
@@ -29,22 +26,13 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Log implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Log implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return FastMath.log(x);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Override
- @Deprecated
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 cb8184c2d..e0ad0b421 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
@@ -17,9 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.util.FastMath;
@@ -29,7 +26,7 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Log10 implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Log10 implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
@@ -37,15 +34,6 @@ public class Log10 implements UnivariateDifferentiableFunction, DifferentiableUn
return FastMath.log10(x);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Override
- @Deprecated
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 5f223fa4b..f95c97058 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
@@ -17,9 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.util.FastMath;
@@ -29,22 +26,13 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Log1p implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Log1p implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return FastMath.log1p(x);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Override
- @Deprecated
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 701b3cf38..c5ff5e0ec 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
@@ -17,10 +17,7 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.exception.DimensionMismatchException;
@@ -34,7 +31,7 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Logistic implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Logistic implements UnivariateDifferentiableFunction {
/** Lower asymptote. */
private final double a;
/** Upper asymptote. */
@@ -86,15 +83,6 @@ public class Logistic implements UnivariateDifferentiableFunction, Differentiabl
return value(m - x, k, b, q, a, oneOverN);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Override
- @Deprecated
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/**
* Parametric function where the input array contains the parameters of
* the {@link Logistic#Logistic(double,double,double,double,double,double)
@@ -121,6 +109,7 @@ public class Logistic implements UnivariateDifferentiableFunction, Differentiabl
* not 6.
* @throws NotStrictlyPositiveException if {@code param[5] <= 0}.
*/
+ @Override
public double value(double x, double ... param)
throws NullArgumentException,
DimensionMismatchException,
@@ -146,6 +135,7 @@ public class Logistic implements UnivariateDifferentiableFunction, Differentiabl
* not 6.
* @throws NotStrictlyPositiveException if {@code param[5] <= 0}.
*/
+ @Override
public double[] gradient(double x, double ... param)
throws NullArgumentException,
DimensionMismatchException,
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 24ad0d1b3..55b1fd9a8 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
@@ -17,10 +17,7 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.exception.DimensionMismatchException;
@@ -35,7 +32,7 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Logit implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Logit implements UnivariateDifferentiableFunction {
/** Lower bound. */
private final double lo;
/** Higher bound. */
@@ -68,15 +65,6 @@ public class Logit implements UnivariateDifferentiableFunction, DifferentiableUn
return value(x, lo, hi);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Override
- @Deprecated
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/**
* Parametric function where the input array contains the parameters of
* the logit function, ordered as follows:
@@ -96,6 +84,7 @@ public class Logit implements UnivariateDifferentiableFunction, DifferentiableUn
* @throws DimensionMismatchException if the size of {@code param} is
* not 2.
*/
+ @Override
public double value(double x, double ... param)
throws NullArgumentException,
DimensionMismatchException {
@@ -116,6 +105,7 @@ public class Logit implements UnivariateDifferentiableFunction, DifferentiableUn
* @throws DimensionMismatchException if the size of {@code param} is
* not 2.
*/
+ @Override
public double[] gradient(double x, double ... param)
throws NullArgumentException,
DimensionMismatchException {
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 61f847a53..714de04b2 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
@@ -17,7 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
@@ -26,22 +25,13 @@ import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiabl
*
* @since 3.0
*/
-public class Minus implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Minus implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return -x;
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Override
- @Deprecated
- public DifferentiableUnivariateFunction derivative() {
- return new Constant(-1);
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 4ded52a34..f605c9351 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
@@ -17,9 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.util.FastMath;
@@ -29,7 +26,7 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Power implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Power implements UnivariateDifferentiableFunction {
/** Power. */
private final double p;
@@ -46,15 +43,6 @@ public class Power implements UnivariateDifferentiableFunction, DifferentiableUn
return FastMath.pow(x, p);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Override
- @Deprecated
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 577728ee0..52d582523 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
@@ -19,10 +19,7 @@ package org.apache.commons.math4.analysis.function;
import java.util.Arrays;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.exception.DimensionMismatchException;
@@ -38,7 +35,7 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Sigmoid implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Sigmoid implements UnivariateDifferentiableFunction {
/** Lower asymptote. */
private final double lo;
/** Higher asymptote. */
@@ -64,15 +61,6 @@ public class Sigmoid implements UnivariateDifferentiableFunction, Differentiable
this.hi = hi;
}
- /** {@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) {
@@ -99,6 +87,7 @@ public class Sigmoid implements UnivariateDifferentiableFunction, Differentiable
* @throws DimensionMismatchException if the size of {@code param} is
* not 2.
*/
+ @Override
public double value(double x, double ... param)
throws NullArgumentException,
DimensionMismatchException {
@@ -119,6 +108,7 @@ public class Sigmoid implements UnivariateDifferentiableFunction, Differentiable
* @throws DimensionMismatchException if the size of {@code param} is
* not 2.
*/
+ @Override
public double[] gradient(double x, double ... param)
throws NullArgumentException,
DimensionMismatchException {
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 4d57d9ae5..08e958112 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
@@ -17,7 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.util.FastMath;
@@ -27,22 +26,13 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Sin implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Sin implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return FastMath.sin(x);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Override
- @Deprecated
- public DifferentiableUnivariateFunction derivative() {
- return new Cos();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 72bf6114b..b6207fcac 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
@@ -17,9 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.exception.DimensionMismatchException;
@@ -35,7 +32,7 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Sinc implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Sinc implements UnivariateDifferentiableFunction {
/**
* Value below which the computations are done using Taylor series.
*
@@ -95,15 +92,6 @@ 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();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 2274fb170..617f9a46d 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
@@ -17,7 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.util.FastMath;
@@ -27,22 +26,13 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Sinh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Sinh implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return FastMath.sinh(x);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Override
- @Deprecated
- public DifferentiableUnivariateFunction derivative() {
- return new Cosh();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 381d8ccb7..979e67d7c 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
@@ -17,9 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.util.FastMath;
@@ -29,22 +26,13 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Sqrt implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Sqrt implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return FastMath.sqrt(x);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Override
- @Deprecated
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 cef9146d8..dc205892e 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
@@ -17,9 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.util.FastMath;
@@ -29,22 +26,13 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Tan implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Tan implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return FastMath.tan(x);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Override
- @Deprecated
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
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 afe70f9cf..2769ca537 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
@@ -17,9 +17,6 @@
package org.apache.commons.math4.analysis.function;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.util.FastMath;
@@ -29,22 +26,13 @@ import org.apache.commons.math4.util.FastMath;
*
* @since 3.0
*/
-public class Tanh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class Tanh implements UnivariateDifferentiableFunction {
/** {@inheritDoc} */
@Override
public double value(double x) {
return FastMath.tanh(x);
}
- /** {@inheritDoc}
- * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
- */
- @Override
- @Deprecated
- public UnivariateFunction derivative() {
- return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
- }
-
/** {@inheritDoc}
* @since 3.1
*/
diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegrator.java
index 826aabc5f..eedc41e5a 100644
--- a/src/main/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegrator.java
@@ -158,6 +158,7 @@ public class IterativeLegendreGaussIntegrator
throws TooManyEvaluationsException {
// Function to be integrated is stored in the base class.
final UnivariateFunction f = new UnivariateFunction() {
+ @Override
public double value(double x)
throws MathIllegalArgumentException, TooManyEvaluationsException {
return computeObjectiveValue(x);
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolator.java
index ac54924c0..100b92793 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolator.java
@@ -63,6 +63,7 @@ public class AkimaSplineInterpolator
* @throws NumberIsTooSmallException if the size of {@code xvals} is smaller
* than 5.
*/
+ @Override
public PolynomialSplineFunction interpolate(double[] xvals,
double[] yvals)
throws DimensionMismatchException,
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/DividedDifferenceInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/DividedDifferenceInterpolator.java
index 762429811..936ddc51e 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/DividedDifferenceInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/DividedDifferenceInterpolator.java
@@ -52,6 +52,7 @@ public class DividedDifferenceInterpolator
* @throws NonMonotonicSequenceException if {@code x} is not sorted in
* strictly increasing order.
*/
+ @Override
public PolynomialFunctionNewtonForm interpolate(double x[], double y[])
throws DimensionMismatchException,
NumberIsTooSmallException,
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/HermiteInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/HermiteInterpolator.java
index 19035794e..3aeb13503 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/HermiteInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/HermiteInterpolator.java
@@ -164,8 +164,8 @@ public class HermiteInterpolator implements UnivariateDifferentiableVectorFuncti
* @return interpolated value
* @exception NoDataException if sample is empty
*/
- public double[] value(double x)
- throws NoDataException {
+ @Override
+ public double[] value(double x) throws NoDataException {
// safety check
checkInterpolation();
@@ -196,6 +196,7 @@ public class HermiteInterpolator implements UnivariateDifferentiableVectorFuncti
* @return interpolated value
* @exception NoDataException if sample is empty
*/
+ @Override
public DerivativeStructure[] value(final DerivativeStructure x)
throws NoDataException {
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/LinearInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/LinearInterpolator.java
index 2eb19f042..eb9d07872 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/LinearInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/LinearInterpolator.java
@@ -42,6 +42,7 @@ public class LinearInterpolator implements UnivariateInterpolator {
* @throws NumberIsTooSmallException if the size of {@code x} is smaller
* than 2.
*/
+ @Override
public PolynomialSplineFunction interpolate(double x[], double y[])
throws DimensionMismatchException,
NumberIsTooSmallException,
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/LoessInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/LoessInterpolator.java
index a362511a7..f256c1711 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/LoessInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/LoessInterpolator.java
@@ -180,6 +180,7 @@ public class LoessInterpolator
* accomodate the size of the input data (i.e. the bandwidth must be
* larger than 2/n).
*/
+ @Override
public final PolynomialSplineFunction interpolate(final double[] xval,
final double[] yval)
throws NonMonotonicSequenceException,
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolatingFunction.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolatingFunction.java
index a18cbc045..9e754a906 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolatingFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolatingFunction.java
@@ -194,6 +194,7 @@ public class MicrosphereInterpolatingFunction
* @return the interpolated value.
* @throws DimensionMismatchException if point dimension does not math sample
*/
+ @Override
public double value(double[] point) throws DimensionMismatchException {
final RealVector p = new ArrayRealVector(point);
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/NevilleInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/NevilleInterpolator.java
index ee39b7f73..d214cc87c 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/NevilleInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/NevilleInterpolator.java
@@ -51,6 +51,7 @@ public class NevilleInterpolator implements UnivariateInterpolator,
* @throws NonMonotonicSequenceException if two abscissae have the same
* value.
*/
+ @Override
public PolynomialFunctionLagrangeForm interpolate(double x[], double y[])
throws DimensionMismatchException,
NumberIsTooSmallException,
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolator.java
index 393281e35..99d725c77 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolator.java
@@ -62,6 +62,7 @@ public class SplineInterpolator implements UnivariateInterpolator {
* @throws NumberIsTooSmallException if the size of {@code x} is smaller
* than 3.
*/
+ @Override
public PolynomialSplineFunction interpolate(double x[], double y[])
throws DimensionMismatchException,
NumberIsTooSmallException,
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 f4f13aa85..a9f7c0d7e 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
@@ -471,8 +471,8 @@ class TricubicFunction
* @throws OutOfRangeException if {@code x}, {@code y} or
* {@code z} are not in the interval {@code [0, 1]}.
*/
- public double value(double x, double y, double z)
- throws OutOfRangeException {
+ @Override
+ public double value(double x, double y, double z) throws OutOfRangeException {
if (x < 0 || x > 1) {
throw new OutOfRangeException(x, 0, 1);
}
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 2ba29bbf9..013739713 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
@@ -116,6 +116,7 @@ public class UnivariatePeriodicInterpolator
final UnivariateFunction f = interpolator.interpolate(x, y);
return new UnivariateFunction() {
+ @Override
public double value(final double x) throws MathIllegalArgumentException {
return f.value(MathUtils.reduce(x, period, offset));
}
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 0260f5819..5c8c09784 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
@@ -19,9 +19,7 @@ package org.apache.commons.math4.analysis.polynomials;
import java.io.Serializable;
import java.util.Arrays;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.exception.NoDataException;
@@ -37,7 +35,7 @@ import org.apache.commons.math4.util.MathUtils;
* is used to evaluate the function.
*
*/
-public class PolynomialFunction implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction, Serializable {
+public class PolynomialFunction implements UnivariateDifferentiableFunction, Serializable {
/**
* Serialization identifier
*/
@@ -87,8 +85,10 @@ public class PolynomialFunction implements UnivariateDifferentiableFunction, Dif
*
* @param x Argument for which the function value should be computed.
* @return the value of the polynomial at the given point.
- * @see UnivariateFunction#value(double)
+ * @see {@link org.apache.commons.math4.analysis.UnivariateFunction#value(double)
+ * UnivariateFunction#value(double)}
*/
+ @Override
public double value(double x) {
return evaluate(coefficients, x);
}
@@ -281,15 +281,6 @@ public class PolynomialFunction implements UnivariateDifferentiableFunction, Dif
return new PolynomialFunction(differentiate(coefficients));
}
- /**
- * Returns the derivative as a {@link UnivariateFunction}.
- *
- * @return the derivative function.
- */
- public UnivariateFunction derivative() {
- return polynomialDerivative();
- }
-
/**
* Returns a string representation of the polynomial.
*
diff --git a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionLagrangeForm.java b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionLagrangeForm.java
index b499d44a0..226cd25cd 100644
--- a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionLagrangeForm.java
+++ b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionLagrangeForm.java
@@ -95,6 +95,7 @@ public class PolynomialFunctionLagrangeForm implements UnivariateFunction {
* @throws NumberIsTooSmallException if the size of {@code x} is less
* than 2.
*/
+ @Override
public double value(double z) {
return evaluateInternal(x, y, z);
}
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 f63359fee..09fa2b009 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
@@ -92,6 +92,7 @@ public class PolynomialFunctionNewtonForm implements UnivariateDifferentiableFun
* @param z Point at which the function value is to be computed.
* @return the function value.
*/
+ @Override
public double value(double z) {
return evaluate(a, c, z);
}
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 7e501c2ce..afa7eef5e 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
@@ -18,8 +18,6 @@ package org.apache.commons.math4.analysis.polynomials;
import java.util.Arrays;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.exception.DimensionMismatchException;
@@ -63,7 +61,7 @@ import org.apache.commons.math4.util.MathArrays;
* polynomials[j](x - knot[j])
*
*/
-public class PolynomialSplineFunction implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
+public class PolynomialSplineFunction implements UnivariateDifferentiableFunction {
/**
* Spline segment interval delimiters (knots).
* Size is n + 1 for n segments.
@@ -132,6 +130,7 @@ public class PolynomialSplineFunction implements UnivariateDifferentiableFunctio
* spline function (smaller than the smallest knot point or larger than the
* largest knot point).
*/
+ @Override
public double value(double v) {
if (v < knots[0] || v > knots[n]) {
throw new OutOfRangeException(v, knots[0], knots[n]);
@@ -149,15 +148,6 @@ public class PolynomialSplineFunction implements UnivariateDifferentiableFunctio
return polynomials[i].value(v - knots[i]);
}
- /**
- * Get the derivative of the polynomial spline function.
- *
- * @return the derivative function.
- */
- public UnivariateFunction derivative() {
- return polynomialSplineDerivative();
- }
-
/**
* Get the derivative of the polynomial spline function.
*
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractDifferentiableUnivariateSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractDifferentiableUnivariateSolver.java
deleted file mode 100644
index 1fba11913..000000000
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractDifferentiableUnivariateSolver.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.math4.analysis.solvers;
-
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.UnivariateFunction;
-import org.apache.commons.math4.exception.TooManyEvaluationsException;
-
-/**
- * Provide a default implementation for several functions useful to generic
- * solvers.
- *
- * @since 3.0
- * @deprecated as of 3.1, replaced by {@link AbstractUnivariateDifferentiableSolver}
- */
-@Deprecated
-public abstract class AbstractDifferentiableUnivariateSolver
- extends BaseAbstractUnivariateSolver
- implements DifferentiableUnivariateSolver {
- /** Derivative of the function to solve. */
- private UnivariateFunction functionDerivative;
-
- /**
- * Construct a solver with given absolute accuracy.
- *
- * @param absoluteAccuracy Maximum absolute error.
- */
- protected AbstractDifferentiableUnivariateSolver(final double absoluteAccuracy) {
- super(absoluteAccuracy);
- }
-
- /**
- * Construct a solver with given accuracies.
- *
- * @param relativeAccuracy Maximum relative error.
- * @param absoluteAccuracy Maximum absolute error.
- * @param functionValueAccuracy Maximum function value error.
- */
- protected AbstractDifferentiableUnivariateSolver(final double relativeAccuracy,
- final double absoluteAccuracy,
- final double functionValueAccuracy) {
- super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy);
- }
-
- /**
- * Compute the objective function value.
- *
- * @param point Point at which the objective function must be evaluated.
- * @return the objective function value at specified point.
- * @throws TooManyEvaluationsException if the maximal number of evaluations is exceeded.
- */
- protected double computeDerivativeObjectiveValue(double point)
- throws TooManyEvaluationsException {
- incrementEvaluationCount();
- return functionDerivative.value(point);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void setup(int maxEval, DifferentiableUnivariateFunction f,
- double min, double max, double startValue) {
- super.setup(maxEval, f, min, max, startValue);
- functionDerivative = f.derivative();
- }
-}
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/DifferentiableUnivariateSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/DifferentiableUnivariateSolver.java
deleted file mode 100644
index 09a1d2036..000000000
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/DifferentiableUnivariateSolver.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.analysis.solvers;
-
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-
-
-/**
- * Interface for (univariate real) rootfinding algorithms.
- * Implementations will search for only one zero in the given interval.
- *
- * @deprecated as of 3.1, replaced by {@link UnivariateDifferentiableSolver}
- */
-@Deprecated
-public interface DifferentiableUnivariateSolver
- extends BaseUnivariateSolver {}
diff --git a/src/test/java/org/apache/commons/math4/analysis/FunctionUtilsTest.java b/src/test/java/org/apache/commons/math4/analysis/FunctionUtilsTest.java
index f1c649a3c..bfa4340a9 100644
--- a/src/test/java/org/apache/commons/math4/analysis/FunctionUtilsTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/FunctionUtilsTest.java
@@ -17,15 +17,7 @@
package org.apache.commons.math4.analysis;
-import org.apache.commons.math4.analysis.BivariateFunction;
-import org.apache.commons.math4.analysis.DifferentiableMultivariateFunction;
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.FunctionUtils;
-import org.apache.commons.math4.analysis.MultivariateFunction;
-import org.apache.commons.math4.analysis.MultivariateVectorFunction;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableFunction;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
import org.apache.commons.math4.analysis.function.Add;
import org.apache.commons.math4.analysis.function.Constant;
@@ -241,116 +233,4 @@ public class FunctionUtilsTest {
}
}
- @Test
- @Deprecated
- public void testToDifferentiableUnivariateFunction() {
-
- // Sin implements both UnivariateDifferentiableFunction and DifferentiableUnivariateFunction
- Sin sin = new Sin();
- DifferentiableUnivariateFunction converted = FunctionUtils.toDifferentiableUnivariateFunction(sin);
- for (double x = 0.1; x < 0.5; x += 0.01) {
- Assert.assertEquals(sin.value(x), converted.value(x), 1.0e-10);
- Assert.assertEquals(sin.derivative().value(x), converted.derivative().value(x), 1.0e-10);
- }
-
- }
-
- @Test
- @Deprecated
- public void testToUnivariateDifferential() {
-
- // Sin implements both UnivariateDifferentiableFunction and DifferentiableUnivariateFunction
- Sin sin = new Sin();
- UnivariateDifferentiableFunction converted = FunctionUtils.toUnivariateDifferential(sin);
- for (double x = 0.1; x < 0.5; x += 0.01) {
- DerivativeStructure t = new DerivativeStructure(2, 1, x, 1.0, 2.0);
- Assert.assertEquals(sin.value(t).getValue(), converted.value(t).getValue(), 1.0e-10);
- Assert.assertEquals(sin.value(t).getPartialDerivative(1, 0),
- converted.value(t).getPartialDerivative(1, 0),
- 1.0e-10);
- Assert.assertEquals(sin.value(t).getPartialDerivative(0, 1),
- converted.value(t).getPartialDerivative(0, 1),
- 1.0e-10);
- }
-
- }
-
- @Test
- @Deprecated
- public void testToDifferentiableMultivariateFunction() {
-
- MultivariateDifferentiableFunction hypot = new MultivariateDifferentiableFunction() {
-
- public double value(double[] point) {
- return FastMath.hypot(point[0], point[1]);
- }
-
- public DerivativeStructure value(DerivativeStructure[] point) {
- return DerivativeStructure.hypot(point[0], point[1]);
- }
- };
-
- DifferentiableMultivariateFunction converted = FunctionUtils.toDifferentiableMultivariateFunction(hypot);
- for (double x = 0.1; x < 0.5; x += 0.01) {
- for (double y = 0.1; y < 0.5; y += 0.01) {
- double[] point = new double[] { x, y };
- Assert.assertEquals(hypot.value(point), converted.value(point), 1.0e-10);
- Assert.assertEquals(x / hypot.value(point), converted.gradient().value(point)[0], 1.0e-10);
- Assert.assertEquals(y / hypot.value(point), converted.gradient().value(point)[1], 1.0e-10);
- }
- }
-
- }
-
- @Test
- @Deprecated
- public void testToMultivariateDifferentiableFunction() {
-
- DifferentiableMultivariateFunction hypot = new DifferentiableMultivariateFunction() {
-
- public double value(double[] point) {
- return FastMath.hypot(point[0], point[1]);
- }
-
- public MultivariateFunction partialDerivative(final int k) {
- return new MultivariateFunction() {
- public double value(double[] point) {
- return point[k] / FastMath.hypot(point[0], point[1]);
- }
- };
- }
-
- public MultivariateVectorFunction gradient() {
- return new MultivariateVectorFunction() {
- public double[] value(double[] point) {
- final double h = FastMath.hypot(point[0], point[1]);
- return new double[] { point[0] / h, point[1] / h };
- }
- };
- }
-
- };
-
- MultivariateDifferentiableFunction converted = FunctionUtils.toMultivariateDifferentiableFunction(hypot);
- for (double x = 0.1; x < 0.5; x += 0.01) {
- for (double y = 0.1; y < 0.5; y += 0.01) {
- DerivativeStructure[] t = new DerivativeStructure[] {
- new DerivativeStructure(3, 1, x, 1.0, 2.0, 3.0 ),
- new DerivativeStructure(3, 1, y, 4.0, 5.0, 6.0 )
- };
- DerivativeStructure h = DerivativeStructure.hypot(t[0], t[1]);
- Assert.assertEquals(h.getValue(), converted.value(t).getValue(), 1.0e-10);
- Assert.assertEquals(h.getPartialDerivative(1, 0, 0),
- converted.value(t).getPartialDerivative(1, 0, 0),
- 1.0e-10);
- Assert.assertEquals(h.getPartialDerivative(0, 1, 0),
- converted.value(t).getPartialDerivative(0, 1, 0),
- 1.0e-10);
- Assert.assertEquals(h.getPartialDerivative(0, 0, 1),
- converted.value(t).getPartialDerivative(0, 0, 1),
- 1.0e-10);
- }
- }
- }
-
}
diff --git a/src/test/java/org/apache/commons/math4/analysis/MonitoredFunction.java b/src/test/java/org/apache/commons/math4/analysis/MonitoredFunction.java
index b2a9e9d68..db4b17bb4 100644
--- a/src/test/java/org/apache/commons/math4/analysis/MonitoredFunction.java
+++ b/src/test/java/org/apache/commons/math4/analysis/MonitoredFunction.java
@@ -16,7 +16,6 @@
*/
package org.apache.commons.math4.analysis;
-import org.apache.commons.math4.analysis.UnivariateFunction;
/**
* Wrapper class for counting functions calls.
@@ -37,12 +36,13 @@ public class MonitoredFunction implements UnivariateFunction {
return callsCount;
}
+ @Override
public double value(double x) {
++callsCount;
return f.value(x);
}
private int callsCount;
- private UnivariateFunction f;
+ private final UnivariateFunction f;
}
diff --git a/src/test/java/org/apache/commons/math4/analysis/QuinticFunction.java b/src/test/java/org/apache/commons/math4/analysis/QuinticFunction.java
index 533943601..e4d0c552a 100644
--- a/src/test/java/org/apache/commons/math4/analysis/QuinticFunction.java
+++ b/src/test/java/org/apache/commons/math4/analysis/QuinticFunction.java
@@ -28,10 +28,12 @@ public class QuinticFunction implements UnivariateDifferentiableFunction {
/* Evaluate quintic.
* @see org.apache.commons.math4.UnivariateFunction#value(double)
*/
+ @Override
public double value(double x) {
return (x-1)*(x-0.5)*x*(x+0.5)*(x+1);
}
+ @Override
public DerivativeStructure value(DerivativeStructure t) {
return t.subtract(1).multiply(t.subtract(0.5)).multiply(t).multiply(t.add(0.5)).multiply(t.add(1));
}
diff --git a/src/test/java/org/apache/commons/math4/analysis/SumSincFunction.java b/src/test/java/org/apache/commons/math4/analysis/SumSincFunction.java
index cb44ab2a6..5fdd86677 100644
--- a/src/test/java/org/apache/commons/math4/analysis/SumSincFunction.java
+++ b/src/test/java/org/apache/commons/math4/analysis/SumSincFunction.java
@@ -16,8 +16,6 @@
*/
package org.apache.commons.math4.analysis;
-import org.apache.commons.math4.analysis.MultivariateFunction;
-import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.function.Sinc;
/**
@@ -43,6 +41,7 @@ public class SumSincFunction implements MultivariateFunction {
* @param point Argument.
* @return the value of this function at point {@code x}.
*/
+ @Override
public double value(double[] point) {
double sum = 0;
for (int i = 0, max = point.length; i < max; i++) {
diff --git a/src/test/java/org/apache/commons/math4/analysis/XMinus5Function.java b/src/test/java/org/apache/commons/math4/analysis/XMinus5Function.java
index 61fdc4894..7bbc94ffe 100644
--- a/src/test/java/org/apache/commons/math4/analysis/XMinus5Function.java
+++ b/src/test/java/org/apache/commons/math4/analysis/XMinus5Function.java
@@ -25,13 +25,15 @@ import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiabl
*/
public class XMinus5Function implements UnivariateDifferentiableFunction {
- /* Evaluate x - 5 fuction.
+ /* Evaluate x - 5 function.
* @see org.apache.commons.math4.UnivariateFunction#value(double)
*/
+ @Override
public double value(double x) {
return x - 5;
}
+ @Override
public DerivativeStructure value(DerivativeStructure t) {
return t.subtract(5);
}
diff --git a/src/test/java/org/apache/commons/math4/analysis/differentiation/FiniteDifferencesDifferentiatorTest.java b/src/test/java/org/apache/commons/math4/analysis/differentiation/FiniteDifferencesDifferentiatorTest.java
index acea0d769..b949b2408 100644
--- a/src/test/java/org/apache/commons/math4/analysis/differentiation/FiniteDifferencesDifferentiatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/differentiation/FiniteDifferencesDifferentiatorTest.java
@@ -22,12 +22,6 @@ import org.apache.commons.math4.analysis.QuinticFunction;
import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.UnivariateMatrixFunction;
import org.apache.commons.math4.analysis.UnivariateVectorFunction;
-import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math4.analysis.differentiation.FiniteDifferencesDifferentiator;
-import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableMatrixFunction;
-import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableVectorFunction;
-import org.apache.commons.math4.analysis.differentiation.UnivariateFunctionDifferentiator;
import org.apache.commons.math4.analysis.function.Gaussian;
import org.apache.commons.math4.analysis.function.Sin;
import org.apache.commons.math4.exception.MathInternalError;
@@ -69,6 +63,7 @@ public class FiniteDifferencesDifferentiatorTest {
new FiniteDifferencesDifferentiator(5, 0.01);
UnivariateDifferentiableFunction f =
differentiator.differentiate(new UnivariateFunction() {
+ @Override
public double value(double x) {
return 42.0;
}
@@ -87,6 +82,7 @@ public class FiniteDifferencesDifferentiatorTest {
new FiniteDifferencesDifferentiator(5, 0.01);
UnivariateDifferentiableFunction f =
differentiator.differentiate(new UnivariateFunction() {
+ @Override
public double value(double x) {
return 2 - 3 * x;
}
@@ -159,7 +155,7 @@ public class FiniteDifferencesDifferentiatorTest {
// the 1.0e-6 step size is far too small for finite differences in the quintic on this abscissa range for 7 points
// the errors are huge!
final double[] expectedBad = new double[] {
- 2.910e-11, 2.087e-5, 147.7, 3.820e7, 6.354e14, 6.548e19, 1.543e27
+ 2.910e-11, 2.087e-5, 147.7, 3.820e7, 6.354e14, 6.548e19, 1.543e27
};
for (int i = 0; i < maxErrorGood.length; ++i) {
@@ -173,6 +169,7 @@ public class FiniteDifferencesDifferentiatorTest {
public void testWrongOrder() {
UnivariateDifferentiableFunction f =
new FiniteDifferencesDifferentiator(3, 0.01).differentiate(new UnivariateFunction() {
+ @Override
public double value(double x) {
// this exception should not be thrown because wrong order
// should be detected before function call
@@ -186,6 +183,7 @@ public class FiniteDifferencesDifferentiatorTest {
public void testWrongOrderVector() {
UnivariateDifferentiableVectorFunction f =
new FiniteDifferencesDifferentiator(3, 0.01).differentiate(new UnivariateVectorFunction() {
+ @Override
public double[] value(double x) {
// this exception should not be thrown because wrong order
// should be detected before function call
@@ -199,6 +197,7 @@ public class FiniteDifferencesDifferentiatorTest {
public void testWrongOrderMatrix() {
UnivariateDifferentiableMatrixFunction f =
new FiniteDifferencesDifferentiator(3, 0.01).differentiate(new UnivariateMatrixFunction() {
+ @Override
public double[][] value(double x) {
// this exception should not be thrown because wrong order
// should be detected before function call
@@ -218,6 +217,7 @@ public class FiniteDifferencesDifferentiatorTest {
final double slope = 2.5;
UnivariateFunction f = new UnivariateFunction() {
+ @Override
public double value(double x) {
if (x < 0) {
throw new NumberIsTooSmallException(x, 0, true);
@@ -261,11 +261,11 @@ public class FiniteDifferencesDifferentiatorTest {
// here, we did set the bounds, so evaluations are done within domain
// using f(0.0), f(0.1), f(0.2)
Assert.assertEquals(slope, properlyBounded.value(tLow).getPartialDerivative(1), 1.0e-10);
-
+
// here, we did set the bounds, so evaluations are done within domain
// using f(0.8), f(0.9), f(1.0)
Assert.assertEquals(slope, properlyBounded.value(tHigh).getPartialDerivative(1), 1.0e-10);
-
+
}
@Test
@@ -274,6 +274,7 @@ public class FiniteDifferencesDifferentiatorTest {
UnivariateFunctionDifferentiator differentiator =
new FiniteDifferencesDifferentiator(9, 1.0 / 32, 0.0, Double.POSITIVE_INFINITY);
UnivariateDifferentiableFunction sqrt = differentiator.differentiate(new UnivariateFunction() {
+ @Override
public double value(double x) {
return FastMath.sqrt(x);
}
@@ -296,11 +297,12 @@ public class FiniteDifferencesDifferentiatorTest {
new FiniteDifferencesDifferentiator(7, 0.01);
UnivariateDifferentiableVectorFunction f =
differentiator.differentiate(new UnivariateVectorFunction() {
-
+
+ @Override
public double[] value(double x) {
return new double[] { FastMath.cos(x), FastMath.sin(x) };
}
-
+
});
for (double x = -10; x < 10; x += 0.1) {
@@ -331,14 +333,15 @@ public class FiniteDifferencesDifferentiatorTest {
new FiniteDifferencesDifferentiator(7, 0.01);
UnivariateDifferentiableMatrixFunction f =
differentiator.differentiate(new UnivariateMatrixFunction() {
-
+
+ @Override
public double[][] value(double x) {
return new double[][] {
{ FastMath.cos(x), FastMath.sin(x) },
{ FastMath.cosh(x), FastMath.sinh(x) }
};
}
-
+
});
for (double x = -1; x < 1; x += 0.02) {
diff --git a/src/test/java/org/apache/commons/math4/analysis/differentiation/GradientFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/differentiation/GradientFunctionTest.java
index 69372e47b..3d7b60782 100644
--- a/src/test/java/org/apache/commons/math4/analysis/differentiation/GradientFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/differentiation/GradientFunctionTest.java
@@ -18,9 +18,6 @@
package org.apache.commons.math4.analysis.differentiation;
import org.apache.commons.math4.TestUtils;
-import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math4.analysis.differentiation.GradientFunction;
-import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableFunction;
import org.apache.commons.math4.exception.DimensionMismatchException;
import org.apache.commons.math4.exception.MathIllegalArgumentException;
import org.apache.commons.math4.util.FastMath;
@@ -59,7 +56,8 @@ public class GradientFunctionTest {
}
private static class EuclideanDistance implements MultivariateDifferentiableFunction {
-
+
+ @Override
public double value(double[] point) {
double d2 = 0;
for (double x : point) {
@@ -67,7 +65,8 @@ public class GradientFunctionTest {
}
return FastMath.sqrt(d2);
}
-
+
+ @Override
public DerivativeStructure value(DerivativeStructure[] point)
throws DimensionMismatchException, MathIllegalArgumentException {
DerivativeStructure d2 = point[0].getField().getZero();
diff --git a/src/test/java/org/apache/commons/math4/analysis/differentiation/JacobianFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/differentiation/JacobianFunctionTest.java
index d3359c5f8..73957673d 100644
--- a/src/test/java/org/apache/commons/math4/analysis/differentiation/JacobianFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/differentiation/JacobianFunctionTest.java
@@ -17,12 +17,9 @@
package org.apache.commons.math4.analysis.differentiation;
-import org.junit.Assert;
import org.apache.commons.math4.TestUtils;
-import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math4.analysis.differentiation.JacobianFunction;
-import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction;
import org.apache.commons.math4.util.FastMath;
+import org.junit.Assert;
import org.junit.Test;
@@ -56,7 +53,8 @@ public class JacobianFunctionTest {
public SphereMapping(final double radius) {
this.radius = radius;
}
-
+
+ @Override
public double[] value(double[] point) {
final double cLat = FastMath.cos(point[0]);
final double sLat = FastMath.sin(point[0]);
@@ -68,7 +66,8 @@ public class JacobianFunctionTest {
radius * sLat
};
}
-
+
+ @Override
public DerivativeStructure[] value(DerivativeStructure[] point) {
final DerivativeStructure cLat = point[0].cos();
final DerivativeStructure sLat = point[0].sin();
diff --git a/src/test/java/org/apache/commons/math4/analysis/differentiation/SparseGradientTest.java b/src/test/java/org/apache/commons/math4/analysis/differentiation/SparseGradientTest.java
index a82a163d6..fdfe87b9c 100644
--- a/src/test/java/org/apache/commons/math4/analysis/differentiation/SparseGradientTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/differentiation/SparseGradientTest.java
@@ -21,7 +21,6 @@ import java.util.List;
import org.apache.commons.math4.ExtendedFieldElementAbstractTest;
import org.apache.commons.math4.TestUtils;
-import org.apache.commons.math4.analysis.differentiation.SparseGradient;
import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
import org.apache.commons.math4.random.Well1024a;
import org.apache.commons.math4.util.FastMath;
@@ -309,7 +308,7 @@ public class SparseGradientTest extends ExtendedFieldElementAbstractTest= 0; --i) {
sgY1 = sgY1.multiply(sgX).add(poly.getCoefficients()[i]);
}
- SparseGradient sgY2 = sgX.compose(poly.value(x), poly.derivative().value(x));
+ SparseGradient sgY2 = sgX.compose(poly.value(x), poly.polynomialDerivative().value(x));
SparseGradient zero = sgY1.subtract(sgY2);
checkF0F1(zero, 0.0, 0.0);
}
diff --git a/src/test/java/org/apache/commons/math4/analysis/function/SincTest.java b/src/test/java/org/apache/commons/math4/analysis/function/SincTest.java
index 864f76e92..08b49c5e4 100644
--- a/src/test/java/org/apache/commons/math4/analysis/function/SincTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/function/SincTest.java
@@ -18,7 +18,6 @@ package org.apache.commons.math4.analysis.function;
import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math4.analysis.function.Sinc;
import org.apache.commons.math4.dfp.Dfp;
import org.apache.commons.math4.dfp.DfpField;
import org.apache.commons.math4.dfp.DfpMath;
@@ -32,6 +31,7 @@ public class SincTest {
public void testShortcut() {
final Sinc s = new Sinc();
final UnivariateFunction f = new UnivariateFunction() {
+ @Override
public double value(double x) {
Dfp dfpX = new DfpField(25).newDfp(x);
return DfpMath.sin(dfpX).divide(dfpX).toDouble();
@@ -106,7 +106,8 @@ public class SincTest {
public void testDerivativeShortcut() {
final Sinc sinc = new Sinc();
final UnivariateFunction f = new UnivariateFunction() {
- public double value(double x) {
+ @Override
+ public double value(double x) {
Dfp dfpX = new DfpField(25).newDfp(x);
return DfpMath.cos(dfpX).subtract(DfpMath.sin(dfpX).divide(dfpX)).divide(dfpX).toDouble();
}
diff --git a/src/test/java/org/apache/commons/math4/analysis/function/SqrtTest.java b/src/test/java/org/apache/commons/math4/analysis/function/SqrtTest.java
index 04d0769f8..825f8c7ec 100644
--- a/src/test/java/org/apache/commons/math4/analysis/function/SqrtTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/function/SqrtTest.java
@@ -19,20 +19,20 @@ package org.apache.commons.math4.analysis.function;
import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math4.analysis.function.Sqrt;
import org.apache.commons.math4.util.FastMath;
-import org.junit.Test;
import org.junit.Assert;
+import org.junit.Test;
public class SqrtTest {
@Test
public void testComparison() {
final Sqrt s = new Sqrt();
final UnivariateFunction f = new UnivariateFunction() {
- public double value(double x) {
- return FastMath.sqrt(x);
- }
- };
+ @Override
+ public double value(double x) {
+ return FastMath.sqrt(x);
+ }
+ };
for (double x = 1e-30; x < 1e10; x *= 2) {
final double fX = f.value(x);
@@ -45,7 +45,8 @@ public class SqrtTest {
public void testDerivativeComparison() {
final UnivariateDifferentiableFunction sPrime = new Sqrt();
final UnivariateFunction f = new UnivariateFunction() {
- public double value(double x) {
+ @Override
+ public double value(double x) {
return 1 / (2 * FastMath.sqrt(x));
}
};
diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegratorTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegratorTest.java
index e59eb94f5..2f2b467e3 100644
--- a/src/test/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegratorTest.java
@@ -22,9 +22,6 @@ import org.apache.commons.math4.analysis.QuinticFunction;
import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.function.Gaussian;
import org.apache.commons.math4.analysis.function.Sin;
-import org.apache.commons.math4.analysis.integration.BaseAbstractUnivariateIntegrator;
-import org.apache.commons.math4.analysis.integration.IterativeLegendreGaussIntegrator;
-import org.apache.commons.math4.analysis.integration.UnivariateIntegrator;
import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
import org.apache.commons.math4.exception.TooManyEvaluationsException;
import org.apache.commons.math4.util.FastMath;
@@ -128,6 +125,7 @@ public class IterativeLegendreGaussIntegratorTest {
public void testIssue464() {
final double value = 0.2;
UnivariateFunction f = new UnivariateFunction() {
+ @Override
public double value(double x) {
return (x >= 0 && x <= 5) ? value : 0.0;
}
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolatorTest.java
index 87fd5b99b..15e4281fb 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolatorTest.java
@@ -16,9 +16,10 @@
*/
package org.apache.commons.math4.analysis.interpolation;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import org.apache.commons.math4.analysis.UnivariateFunction;
-import org.apache.commons.math4.analysis.interpolation.AkimaSplineInterpolator;
-import org.apache.commons.math4.analysis.interpolation.UnivariateInterpolator;
import org.apache.commons.math4.distribution.UniformRealDistribution;
import org.apache.commons.math4.exception.DimensionMismatchException;
import org.apache.commons.math4.exception.NonMonotonicSequenceException;
@@ -31,8 +32,6 @@ import org.apache.commons.math4.util.Precision;
import org.junit.Assert;
import org.junit.Test;
-import static org.junit.Assert.*;
-
public class AkimaSplineInterpolatorTest
{
@@ -119,6 +118,7 @@ public class AkimaSplineInterpolatorTest
UnivariateFunction f = new UnivariateFunction()
{
+ @Override
public double value( double x )
{
return 2 * x - 5;
@@ -147,6 +147,7 @@ public class AkimaSplineInterpolatorTest
UnivariateFunction f = new UnivariateFunction()
{
+ @Override
public double value( double x )
{
return ( 3 * x * x ) - ( 5 * x ) + 7;
@@ -174,6 +175,7 @@ public class AkimaSplineInterpolatorTest
UnivariateFunction f = new UnivariateFunction()
{
+ @Override
public double value( double x )
{
return ( 3 * x * x * x ) - ( 0.5 * x * x ) + ( 1 * x ) - 1;
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunctionTest.java
index dd63a6cd0..0ec77aa42 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunctionTest.java
@@ -17,7 +17,6 @@
package org.apache.commons.math4.analysis.interpolation;
import org.apache.commons.math4.analysis.BivariateFunction;
-import org.apache.commons.math4.analysis.interpolation.BicubicInterpolatingFunction;
import org.apache.commons.math4.distribution.UniformRealDistribution;
import org.apache.commons.math4.exception.DimensionMismatchException;
import org.apache.commons.math4.exception.MathIllegalArgumentException;
@@ -28,7 +27,6 @@ import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.Precision;
import org.junit.Assert;
import org.junit.Test;
-import org.junit.Ignore;
/**
* Test case for the bicubic function.
@@ -193,21 +191,25 @@ public final class BicubicInterpolatingFunctionTest {
// Function values
BivariateFunction f = new BivariateFunction() {
+ @Override
public double value(double x, double y) {
return 2 * x - 3 * y + 5;
}
};
BivariateFunction dfdx = new BivariateFunction() {
+ @Override
public double value(double x, double y) {
return 2;
}
};
BivariateFunction dfdy = new BivariateFunction() {
+ @Override
public double value(double x, double y) {
return -3;
}
};
BivariateFunction d2fdxdy = new BivariateFunction() {
+ @Override
public double value(double x, double y) {
return 0;
}
@@ -247,21 +249,25 @@ public final class BicubicInterpolatingFunctionTest {
// Function values
BivariateFunction f = new BivariateFunction() {
+ @Override
public double value(double x, double y) {
return 2 * x * x - 3 * y * y + 4 * x * y - 5;
}
};
BivariateFunction dfdx = new BivariateFunction() {
+ @Override
public double value(double x, double y) {
return 4 * (x + y);
}
};
BivariateFunction dfdy = new BivariateFunction() {
+ @Override
public double value(double x, double y) {
return 4 * x - 6 * y;
}
};
BivariateFunction d2fdxdy = new BivariateFunction() {
+ @Override
public double value(double x, double y) {
return 4;
}
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatorTest.java
index 9d94b036f..6a2a9d760 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatorTest.java
@@ -17,9 +17,6 @@
package org.apache.commons.math4.analysis.interpolation;
import org.apache.commons.math4.analysis.BivariateFunction;
-import org.apache.commons.math4.analysis.interpolation.BicubicInterpolatingFunction;
-import org.apache.commons.math4.analysis.interpolation.BicubicInterpolator;
-import org.apache.commons.math4.analysis.interpolation.BivariateGridInterpolator;
import org.apache.commons.math4.distribution.UniformRealDistribution;
import org.apache.commons.math4.exception.DimensionMismatchException;
import org.apache.commons.math4.exception.MathIllegalArgumentException;
@@ -86,6 +83,7 @@ public final class BicubicInterpolatorTest {
@Test
public void testPlane() {
BivariateFunction f = new BivariateFunction() {
+ @Override
public double value(double x, double y) {
return 2 * x - 3 * y + 5;
}
@@ -105,6 +103,7 @@ public final class BicubicInterpolatorTest {
@Test
public void testParaboloid() {
BivariateFunction f = new BivariateFunction() {
+ @Override
public double value(double x, double y) {
return 2 * x * x - 3 * y * y + 4 * x * y - 5;
}
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolatorTest.java
index 26268691e..eab4faa28 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolatorTest.java
@@ -17,8 +17,6 @@
package org.apache.commons.math4.analysis.interpolation;
import org.apache.commons.math4.analysis.MultivariateFunction;
-import org.apache.commons.math4.analysis.interpolation.MicrosphereInterpolator;
-import org.apache.commons.math4.analysis.interpolation.MultivariateInterpolator;
import org.apache.commons.math4.util.FastMath;
import org.junit.Assert;
import org.junit.Test;
@@ -36,13 +34,14 @@ public final class MicrosphereInterpolatorTest {
@Test
public void testLinearFunction2D() {
MultivariateFunction f = new MultivariateFunction() {
- public double value(double[] x) {
- if (x.length != 2) {
- throw new IllegalArgumentException();
- }
- return 2 * x[0] - 3 * x[1] + 5;
+ @Override
+ public double value(double[] x) {
+ if (x.length != 2) {
+ throw new IllegalArgumentException();
}
- };
+ return 2 * x[0] - 3 * x[1] + 5;
+ }
+ };
MultivariateInterpolator interpolator = new MicrosphereInterpolator();
@@ -88,6 +87,7 @@ public final class MicrosphereInterpolatorTest {
@Test
public void testParaboloid2D() {
MultivariateFunction f = new MultivariateFunction() {
+ @Override
public double value(double[] x) {
if (x.length != 2) {
throw new IllegalArgumentException();
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunctionTest.java
index c39e644d9..c6701b302 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunctionTest.java
@@ -17,7 +17,6 @@
package org.apache.commons.math4.analysis.interpolation;
import org.apache.commons.math4.analysis.BivariateFunction;
-import org.apache.commons.math4.analysis.interpolation.PiecewiseBicubicSplineInterpolatingFunction;
import org.apache.commons.math4.distribution.UniformRealDistribution;
import org.apache.commons.math4.exception.DimensionMismatchException;
import org.apache.commons.math4.exception.InsufficientDataException;
@@ -145,6 +144,7 @@ public final class PiecewiseBicubicSplineInterpolatingFunctionTest {
// Function values
BivariateFunction f = new BivariateFunction() {
+ @Override
public double value(double x, double y) {
return 2 * x - 3 * y + 5;
}
@@ -180,6 +180,7 @@ public final class PiecewiseBicubicSplineInterpolatingFunctionTest {
// Function values
BivariateFunction f = new BivariateFunction() {
+ @Override
public double value(double x, double y) {
return 2 * x * x - 3 * y * y + 4 * x * y - 5;
}
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatorTest.java
index eee82f9e2..1645294d4 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatorTest.java
@@ -17,12 +17,9 @@
package org.apache.commons.math4.analysis.interpolation;
import org.apache.commons.math4.analysis.BivariateFunction;
-import org.apache.commons.math4.analysis.interpolation.BivariateGridInterpolator;
-import org.apache.commons.math4.analysis.interpolation.PiecewiseBicubicSplineInterpolator;
import org.apache.commons.math4.distribution.UniformRealDistribution;
import org.apache.commons.math4.exception.DimensionMismatchException;
import org.apache.commons.math4.exception.InsufficientDataException;
-import org.apache.commons.math4.exception.MathIllegalArgumentException;
import org.apache.commons.math4.exception.NonMonotonicSequenceException;
import org.apache.commons.math4.exception.NullArgumentException;
import org.apache.commons.math4.random.RandomGenerator;
@@ -43,7 +40,6 @@ public final class PiecewiseBicubicSplineInterpolatorTest {
double[] yval = new double[] { -4, -3, -1, 2.5, 3.5 };
double[][] zval = new double[xval.length][yval.length];
- @SuppressWarnings( "unused" )
BivariateGridInterpolator interpolator = new PiecewiseBicubicSplineInterpolator();
try {
@@ -145,6 +141,7 @@ public final class PiecewiseBicubicSplineInterpolatorTest {
// Function values
BivariateFunction f = new BivariateFunction() {
+ @Override
public double value( double x, double y ) {
return 2 * x - 3 * y + 5;
}
@@ -196,6 +193,7 @@ public final class PiecewiseBicubicSplineInterpolatorTest {
// Function values
BivariateFunction f = new BivariateFunction() {
+ @Override
public double value( double x, double y ) {
return 2 * x * x - 3 * y * y + 4 * x * y - 5;
}
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolatorTest.java
index 46d345543..02c7815a0 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolatorTest.java
@@ -18,8 +18,6 @@ package org.apache.commons.math4.analysis.interpolation;
import org.apache.commons.math4.TestUtils;
import org.apache.commons.math4.analysis.UnivariateFunction;
-import org.apache.commons.math4.analysis.interpolation.SplineInterpolator;
-import org.apache.commons.math4.analysis.interpolation.UnivariateInterpolator;
import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
import org.apache.commons.math4.analysis.polynomials.PolynomialSplineFunction;
import org.apache.commons.math4.exception.DimensionMismatchException;
@@ -215,10 +213,10 @@ public class SplineInterpolatorTest {
for (int i = 1; i < x.length - 2; i++) {
// evaluate polynomials and derivatives at x[i + 1]
Assert.assertEquals(polynomials[i].value(x[i +1] - x[i]), polynomials[i + 1].value(0), 0.1);
- Assert.assertEquals(polynomials[i].derivative().value(x[i +1] - x[i]),
- polynomials[i + 1].derivative().value(0), 0.5);
- Assert.assertEquals(polynomials[i].polynomialDerivative().derivative().value(x[i +1] - x[i]),
- polynomials[i + 1].polynomialDerivative().derivative().value(0), 0.5);
+ Assert.assertEquals(polynomials[i].polynomialDerivative().value(x[i +1] - x[i]),
+ polynomials[i + 1].polynomialDerivative().value(0), 0.5);
+ Assert.assertEquals(polynomials[i].polynomialDerivative().polynomialDerivative().value(x[i +1] - x[i]),
+ polynomials[i + 1].polynomialDerivative().polynomialDerivative().value(0), 0.5);
}
}
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunctionTest.java
index bf3da2a29..44f06a051 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunctionTest.java
@@ -17,7 +17,6 @@
package org.apache.commons.math4.analysis.interpolation;
import org.apache.commons.math4.analysis.TrivariateFunction;
-import org.apache.commons.math4.analysis.interpolation.TricubicInterpolatingFunction;
import org.apache.commons.math4.distribution.UniformRealDistribution;
import org.apache.commons.math4.exception.DimensionMismatchException;
import org.apache.commons.math4.exception.MathIllegalArgumentException;
@@ -30,7 +29,6 @@ import org.junit.Test;
/**
* Test case for the bicubic function.
- *
*/
public final class TricubicInterpolatingFunctionTest {
/**
@@ -47,7 +45,7 @@ public final class TricubicInterpolatingFunctionTest {
TrivariateFunction tcf = new TricubicInterpolatingFunction(xval, yval, zval,
fval, fval, fval, fval,
fval, fval, fval, fval);
-
+
double[] wxval = new double[] {3, 2, 5, 6.5};
try {
tcf = new TricubicInterpolatingFunction(wxval, yval, zval,
@@ -420,30 +418,35 @@ public final class TricubicInterpolatingFunctionTest {
@Test
public void testPlane() {
final TrivariateFunction f = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return 2 * x - 3 * y - 4 * z + 5;
}
};
final TrivariateFunction dfdx = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return 2;
}
};
final TrivariateFunction dfdy = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return -3;
}
};
final TrivariateFunction dfdz = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return -4;
}
};
final TrivariateFunction zero = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return 0;
}
@@ -477,48 +480,56 @@ public final class TricubicInterpolatingFunctionTest {
@Test
public void testQuadric() {
final TrivariateFunction f = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return 2 * x * x - 3 * y * y - 4 * z * z + 5 * x * y + 6 * x * z - 2 * y * z + 3;
}
};
final TrivariateFunction dfdx = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return 4 * x + 5 * y + 6 * z;
}
};
final TrivariateFunction dfdy = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return -6 * y + 5 * x - 2 * z;
}
};
final TrivariateFunction dfdz = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return -8 * z + 6 * x - 2 * y;
}
};
final TrivariateFunction d2fdxdy = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return 5;
}
};
final TrivariateFunction d2fdxdz = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return 6;
}
};
final TrivariateFunction d2fdydz = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return -2;
}
};
final TrivariateFunction d3fdxdydz = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return 0;
}
@@ -558,54 +569,63 @@ public final class TricubicInterpolatingFunctionTest {
final double ky = 1;
final TrivariateFunction arg = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return omega * z - kx * x - ky * y;
}
};
final TrivariateFunction f = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return a * FastMath.cos(arg.value(x, y, z));
}
};
final TrivariateFunction dfdx = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return kx * a * FastMath.sin(arg.value(x, y, z));
}
};
final TrivariateFunction dfdy = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return ky * a * FastMath.sin(arg.value(x, y, z));
}
};
final TrivariateFunction dfdz = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return -omega * a * FastMath.sin(arg.value(x, y, z));
}
};
final TrivariateFunction d2fdxdy = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return -ky * kx * a * FastMath.cos(arg.value(x, y, z));
}
};
final TrivariateFunction d2fdxdz = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return omega * kx * a * FastMath.cos(arg.value(x, y, z));
}
};
final TrivariateFunction d2fdydz = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return omega * ky * a * FastMath.cos(arg.value(x, y, z));
}
};
final TrivariateFunction d3fdxdydz = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return omega * ky * kx * a * FastMath.sin(arg.value(x, y, z));
}
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatorTest.java
index d975c18fb..a02e7d530 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatorTest.java
@@ -17,8 +17,6 @@
package org.apache.commons.math4.analysis.interpolation;
import org.apache.commons.math4.analysis.TrivariateFunction;
-import org.apache.commons.math4.analysis.interpolation.TricubicInterpolatingFunction;
-import org.apache.commons.math4.analysis.interpolation.TricubicInterpolator;
import org.apache.commons.math4.exception.DimensionMismatchException;
import org.apache.commons.math4.exception.MathIllegalArgumentException;
import org.apache.commons.math4.util.FastMath;
@@ -127,6 +125,7 @@ public final class TricubicInterpolatorTest {
// Function values
TrivariateFunction f = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return 2 * x - 3 * y - 4 * z + 5;
}
@@ -186,6 +185,7 @@ public final class TricubicInterpolatorTest {
// Function values
TrivariateFunction f = new TrivariateFunction() {
+ @Override
public double value(double x, double y, double z) {
return a * FastMath.cos(omega * z - kx * x - ky * y);
}
diff --git a/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionTest.java
index 52be305ac..375f4df07 100644
--- a/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionTest.java
@@ -17,10 +17,9 @@
package org.apache.commons.math4.analysis.polynomials;
import org.apache.commons.math4.TestUtils;
-import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
import org.apache.commons.math4.util.FastMath;
-import org.junit.Test;
import org.junit.Assert;
+import org.junit.Test;
/**
* Tests the PolynomialFunction implementation of a UnivariateFunction.
@@ -48,9 +47,9 @@ public final class PolynomialFunctionTest {
Assert.assertEquals(f.value(456.89), c[0], tolerance);
Assert.assertEquals(f.degree(), 0);
- Assert.assertEquals(f.derivative().value(0), 0, tolerance);
+ Assert.assertEquals(f.polynomialDerivative().value(0), 0, tolerance);
- Assert.assertEquals(f.polynomialDerivative().derivative().value(0), 0, tolerance);
+ Assert.assertEquals(f.polynomialDerivative().polynomialDerivative().value(0), 0, tolerance);
}
/**
@@ -79,7 +78,7 @@ public final class PolynomialFunctionTest {
Assert.assertEquals(f.degree(), 1);
- Assert.assertEquals(f.polynomialDerivative().derivative().value(0), 0, tolerance);
+ Assert.assertEquals(f.polynomialDerivative().polynomialDerivative().value(0), 0, tolerance);
}
/**
@@ -142,15 +141,15 @@ public final class PolynomialFunctionTest {
PolynomialFunction h = new PolynomialFunction(h_coeff);
// compare f' = g
- Assert.assertEquals(f.derivative().value(0), g.value(0), tolerance);
- Assert.assertEquals(f.derivative().value(1), g.value(1), tolerance);
- Assert.assertEquals(f.derivative().value(100), g.value(100), tolerance);
- Assert.assertEquals(f.derivative().value(4.1), g.value(4.1), tolerance);
- Assert.assertEquals(f.derivative().value(-3.25), g.value(-3.25), tolerance);
+ Assert.assertEquals(f.polynomialDerivative().value(0), g.value(0), tolerance);
+ Assert.assertEquals(f.polynomialDerivative().value(1), g.value(1), tolerance);
+ Assert.assertEquals(f.polynomialDerivative().value(100), g.value(100), tolerance);
+ Assert.assertEquals(f.polynomialDerivative().value(4.1), g.value(4.1), tolerance);
+ Assert.assertEquals(f.polynomialDerivative().value(-3.25), g.value(-3.25), tolerance);
// compare g' = h
- Assert.assertEquals(g.derivative().value(FastMath.PI), h.value(FastMath.PI), tolerance);
- Assert.assertEquals(g.derivative().value(FastMath.E), h.value(FastMath.E), tolerance);
+ Assert.assertEquals(g.polynomialDerivative().value(FastMath.PI), h.value(FastMath.PI), tolerance);
+ Assert.assertEquals(g.polynomialDerivative().value(FastMath.E), h.value(FastMath.E), tolerance);
}
@Test
@@ -241,15 +240,15 @@ public final class PolynomialFunctionTest {
PolynomialFunction h = new PolynomialFunction(h_coeff);
// compare f' = g
- Assert.assertEquals(f.derivative().value(0), g.value(0), tolerance);
- Assert.assertEquals(f.derivative().value(1), g.value(1), tolerance);
- Assert.assertEquals(f.derivative().value(100), g.value(100), tolerance);
- Assert.assertEquals(f.derivative().value(4.1), g.value(4.1), tolerance);
- Assert.assertEquals(f.derivative().value(-3.25), g.value(-3.25), tolerance);
+ Assert.assertEquals(f.polynomialDerivative().value(0), g.value(0), tolerance);
+ Assert.assertEquals(f.polynomialDerivative().value(1), g.value(1), tolerance);
+ Assert.assertEquals(f.polynomialDerivative().value(100), g.value(100), tolerance);
+ Assert.assertEquals(f.polynomialDerivative().value(4.1), g.value(4.1), tolerance);
+ Assert.assertEquals(f.polynomialDerivative().value(-3.25), g.value(-3.25), tolerance);
// compare g' = h
- Assert.assertEquals(g.derivative().value(FastMath.PI), h.value(FastMath.PI), tolerance);
- Assert.assertEquals(g.derivative().value(FastMath.E), h.value(FastMath.E), tolerance);
+ Assert.assertEquals(g.polynomialDerivative().value(FastMath.PI), h.value(FastMath.PI), tolerance);
+ Assert.assertEquals(g.polynomialDerivative().value(FastMath.E), h.value(FastMath.E), tolerance);
}
public void checkPolynomial(PolynomialFunction p, String reference) {
diff --git a/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunctionTest.java
index 255203a05..37f6212cb 100644
--- a/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunctionTest.java
@@ -19,8 +19,6 @@ package org.apache.commons.math4.analysis.polynomials;
import java.util.Arrays;
import org.apache.commons.math4.analysis.UnivariateFunction;
-import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math4.analysis.polynomials.PolynomialSplineFunction;
import org.apache.commons.math4.exception.MathIllegalArgumentException;
import org.apache.commons.math4.exception.MathIllegalStateException;
import org.apache.commons.math4.exception.OutOfRangeException;
@@ -94,7 +92,7 @@ public class PolynomialSplineFunctionTest {
public void testValues() {
PolynomialSplineFunction spline =
new PolynomialSplineFunction(knots, polynomials);
- UnivariateFunction dSpline = spline.derivative();
+ UnivariateFunction dSpline = spline.polynomialSplineDerivative();
/**
* interior points -- spline value at x should equal p(x - knot)
@@ -153,7 +151,7 @@ public class PolynomialSplineFunctionTest {
Assert.assertTrue(spline.isValidPoint(x));
// Ensure that no exception is thrown.
spline.value(x);
-
+
final double xRange = xMax - xMin;
x = xMin + xRange / 3.4;
Assert.assertTrue(spline.isValidPoint(x));
diff --git a/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtilsTest.java b/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtilsTest.java
index ad1346199..45eba7859 100644
--- a/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtilsTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtilsTest.java
@@ -18,8 +18,6 @@ package org.apache.commons.math4.analysis.polynomials;
import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.analysis.integration.IterativeLegendreGaussIntegrator;
-import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math4.analysis.polynomials.PolynomialsUtils;
import org.apache.commons.math4.util.CombinatoricsUtils;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.Precision;
@@ -80,6 +78,7 @@ public class PolynomialsUtilsTest {
@Test
public void testChebyshevOrthogonality() {
UnivariateFunction weight = new UnivariateFunction() {
+ @Override
public double value(double x) {
return 1 / FastMath.sqrt(1 - x * x);
}
@@ -131,6 +130,7 @@ public class PolynomialsUtilsTest {
@Test
public void testHermiteOrthogonality() {
UnivariateFunction weight = new UnivariateFunction() {
+ @Override
public double value(double x) {
return FastMath.exp(-x * x);
}
@@ -188,6 +188,7 @@ public class PolynomialsUtilsTest {
@Test
public void testLaguerreOrthogonality() {
UnivariateFunction weight = new UnivariateFunction() {
+ @Override
public double value(double x) {
return FastMath.exp(-x);
}
@@ -239,6 +240,7 @@ public class PolynomialsUtilsTest {
@Test
public void testLegendreOrthogonality() {
UnivariateFunction weight = new UnivariateFunction() {
+ @Override
public double value(double x) {
return 1;
}
@@ -304,6 +306,7 @@ public class PolynomialsUtilsTest {
final int vv = v;
final int ww = w;
UnivariateFunction weight = new UnivariateFunction() {
+ @Override
public double value(double x) {
return FastMath.pow(1 - x, vv) * FastMath.pow(1 + x, ww);
}
@@ -331,7 +334,7 @@ public class PolynomialsUtilsTest {
PolynomialFunction f1xM1
= new PolynomialFunction(PolynomialsUtils.shift(f1x.getCoefficients(), -1));
checkPolynomial(f1xM1, "2 - 3 x + 2 x^2");
-
+
PolynomialFunction f1x3
= new PolynomialFunction(PolynomialsUtils.shift(f1x.getCoefficients(), 3));
checkPolynomial(f1x3, "22 + 13 x + 2 x^2");
@@ -371,6 +374,7 @@ public class PolynomialsUtilsTest {
final double nonZeroThreshold,
final double zeroThreshold) {
UnivariateFunction f = new UnivariateFunction() {
+ @Override
public double value(double x) {
return weight.value(x) * p1.value(x) * p2.value(x);
}