From 946995ac1621c46f7a2c647003d49222e2f91f02 Mon Sep 17 00:00:00 2001 From: Gilles Sadowski Date: Mon, 24 Jan 2011 09:48:39 +0000 Subject: [PATCH] MATH-500 Temporarily moved "ConvergingAlgorithm" and "ConvergingAlgorithmImpl" to package "analysis.integration". See MATH-501. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1062707 13f79535-47bb-0310-9956-ffa450edef68 --- .../integration}/ConvergingAlgorithm.java | 2 +- .../integration}/ConvergingAlgorithmImpl.java | 41 +------------------ .../integration/UnivariateRealIntegrator.java | 21 ---------- .../UnivariateRealIntegratorImpl.java | 35 ++++++++-------- 4 files changed, 18 insertions(+), 81 deletions(-) rename src/main/java/org/apache/commons/math/{ => analysis/integration}/ConvergingAlgorithm.java (98%) rename src/main/java/org/apache/commons/math/{ => analysis/integration}/ConvergingAlgorithmImpl.java (72%) diff --git a/src/main/java/org/apache/commons/math/ConvergingAlgorithm.java b/src/main/java/org/apache/commons/math/analysis/integration/ConvergingAlgorithm.java similarity index 98% rename from src/main/java/org/apache/commons/math/ConvergingAlgorithm.java rename to src/main/java/org/apache/commons/math/analysis/integration/ConvergingAlgorithm.java index 5ea0a23fe..7f19160a1 100644 --- a/src/main/java/org/apache/commons/math/ConvergingAlgorithm.java +++ b/src/main/java/org/apache/commons/math/analysis/integration/ConvergingAlgorithm.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.commons.math; +package org.apache.commons.math.analysis.integration; /** diff --git a/src/main/java/org/apache/commons/math/ConvergingAlgorithmImpl.java b/src/main/java/org/apache/commons/math/analysis/integration/ConvergingAlgorithmImpl.java similarity index 72% rename from src/main/java/org/apache/commons/math/ConvergingAlgorithmImpl.java rename to src/main/java/org/apache/commons/math/analysis/integration/ConvergingAlgorithmImpl.java index 7fecc045f..ee13ea26d 100644 --- a/src/main/java/org/apache/commons/math/ConvergingAlgorithmImpl.java +++ b/src/main/java/org/apache/commons/math/analysis/integration/ConvergingAlgorithmImpl.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.commons.math; +package org.apache.commons.math.analysis.integration; import org.apache.commons.math.exception.MaxCountExceededException; @@ -29,60 +29,21 @@ import org.apache.commons.math.exception.MaxCountExceededException; */ @Deprecated public abstract class ConvergingAlgorithmImpl implements ConvergingAlgorithm { - /** Maximum absolute error. */ protected double absoluteAccuracy; - /** Maximum relative error. */ protected double relativeAccuracy; - /** Maximum number of iterations. */ protected int maximalIterationCount; - /** Default maximum absolute error. */ protected double defaultAbsoluteAccuracy; - /** Default maximum relative error. */ protected double defaultRelativeAccuracy; - /** Default maximum number of iterations. */ protected int defaultMaximalIterationCount; - /** The last iteration count. */ protected int iterationCount; - /** - * Construct an algorithm with given iteration count and accuracy. - * - * @param defaultAbsoluteAccuracy maximum absolute error - * @param defaultMaximalIterationCount maximum number of iterations - * @throws IllegalArgumentException if f is null or the - * defaultAbsoluteAccuracy is not valid - * @deprecated in 2.2. Derived classes should use the "setter" methods - * in order to assign meaningful values to all the instances variables. - */ - @Deprecated - protected ConvergingAlgorithmImpl(final int defaultMaximalIterationCount, - final double defaultAbsoluteAccuracy) { - this.defaultAbsoluteAccuracy = defaultAbsoluteAccuracy; - this.defaultRelativeAccuracy = 1.0e-14; - this.absoluteAccuracy = defaultAbsoluteAccuracy; - this.relativeAccuracy = defaultRelativeAccuracy; - this.defaultMaximalIterationCount = defaultMaximalIterationCount; - this.maximalIterationCount = defaultMaximalIterationCount; - this.iterationCount = 0; - } - - /** - * Default constructor. - * - * @since 2.2 - * @deprecated in 2.2 (to be removed as soon as the single non-default one - * has been removed). - */ - @Deprecated - protected ConvergingAlgorithmImpl() {} - /** {@inheritDoc} */ public int getIterationCount() { return iterationCount; diff --git a/src/main/java/org/apache/commons/math/analysis/integration/UnivariateRealIntegrator.java b/src/main/java/org/apache/commons/math/analysis/integration/UnivariateRealIntegrator.java index 6de384fc5..1fa2f5863 100644 --- a/src/main/java/org/apache/commons/math/analysis/integration/UnivariateRealIntegrator.java +++ b/src/main/java/org/apache/commons/math/analysis/integration/UnivariateRealIntegrator.java @@ -17,7 +17,6 @@ package org.apache.commons.math.analysis.integration; import org.apache.commons.math.ConvergenceException; -import org.apache.commons.math.ConvergingAlgorithm; import org.apache.commons.math.exception.MathUserException; import org.apache.commons.math.analysis.UnivariateRealFunction; @@ -59,25 +58,6 @@ public interface UnivariateRealIntegrator extends ConvergingAlgorithm { */ void resetMinimalIterationCount(); - /** - * Integrate the function in the given interval. - * - * @param min the lower bound for the interval - * @param max the upper bound for the interval - * @return the value of integral - * @throws ConvergenceException if the maximum iteration count is exceeded - * or the integrator detects convergence problems otherwise - * @throws MathUserException if an error occurs evaluating the - * function - * @throws IllegalArgumentException if min > max or the endpoints do not - * satisfy the requirements specified by the integrator - * @deprecated replaced by {@link #integrate(UnivariateRealFunction, double, double)} - * since 2.0 - */ - @Deprecated - double integrate(double min, double max) - throws ConvergenceException, MathUserException, IllegalArgumentException; - /** * Integrate the function in the given interval. * @@ -102,5 +82,4 @@ public interface UnivariateRealIntegrator extends ConvergingAlgorithm { * because no result was yet computed or the last attempt failed */ double getResult() throws IllegalStateException; - } diff --git a/src/main/java/org/apache/commons/math/analysis/integration/UnivariateRealIntegratorImpl.java b/src/main/java/org/apache/commons/math/analysis/integration/UnivariateRealIntegratorImpl.java index a089595c8..c43046a75 100644 --- a/src/main/java/org/apache/commons/math/analysis/integration/UnivariateRealIntegratorImpl.java +++ b/src/main/java/org/apache/commons/math/analysis/integration/UnivariateRealIntegratorImpl.java @@ -16,7 +16,6 @@ */ package org.apache.commons.math.analysis.integration; -import org.apache.commons.math.ConvergingAlgorithmImpl; import org.apache.commons.math.MathRuntimeException; import org.apache.commons.math.analysis.UnivariateRealFunction; import org.apache.commons.math.exception.util.LocalizedFormats; @@ -30,43 +29,40 @@ import org.apache.commons.math.exception.NullArgumentException; */ public abstract class UnivariateRealIntegratorImpl extends ConvergingAlgorithmImpl implements UnivariateRealIntegrator { - /** Serializable version identifier. */ private static final long serialVersionUID = 6248808456637441533L; - /** minimum number of iterations */ protected int minimalIterationCount; - /** default minimum number of iterations */ protected int defaultMinimalIterationCount; - /** indicates whether an integral has been computed */ protected boolean resultComputed = false; - /** the last computed integral */ protected double result; - /** The integrand functione. * @deprecated as of 2.0 the integrand function is passed as an argument * to the {@link #integrate(UnivariateRealFunction, double, double)}method. */ @Deprecated protected UnivariateRealFunction f; - /** - * Construct an integrator with given iteration count and accuracy. - * - * @param f the integrand function - * @param defaultMaximalIterationCount maximum number of iterations - * @throws IllegalArgumentException if f is null or the iteration - * limits are not valid - * @deprecated as of 2.0 the integrand function is passed as an argument - * to the {@link #integrate(UnivariateRealFunction, double, double)}method. - */ + /** + * Construct an integrator with given iteration count and accuracy. + * + * @param f the integrand function + * @param defaultMaximalIterationCount maximum number of iterations + * @throws IllegalArgumentException if f is null or the iteration + * limits are not valid + * @deprecated as of 2.0 the integrand function is passed as an argument + * to the {@link #integrate(UnivariateRealFunction, double, double)}method. + */ @Deprecated protected UnivariateRealIntegratorImpl(final UnivariateRealFunction f, final int defaultMaximalIterationCount) throws IllegalArgumentException { - super(defaultMaximalIterationCount, 1.0e-15); + + setMaximalIterationCount(defaultMaximalIterationCount); + setAbsoluteAccuracy(1.0e-15); + if (f == null) { throw new NullArgumentException(LocalizedFormats.FUNCTION); } @@ -90,8 +86,9 @@ public abstract class UnivariateRealIntegratorImpl */ protected UnivariateRealIntegratorImpl(final int defaultMaximalIterationCount) throws IllegalArgumentException { - super(defaultMaximalIterationCount, 1.0e-15); + setMaximalIterationCount(defaultMaximalIterationCount); + setAbsoluteAccuracy(1.0e-15); // parameters that are problem specific setRelativeAccuracy(1.0e-6); this.defaultMinimalIterationCount = 3;