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
This commit is contained in:
parent
d86b785b6d
commit
946995ac16
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.commons.math;
|
package org.apache.commons.math.analysis.integration;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.apache.commons.math;
|
package org.apache.commons.math.analysis.integration;
|
||||||
|
|
||||||
import org.apache.commons.math.exception.MaxCountExceededException;
|
import org.apache.commons.math.exception.MaxCountExceededException;
|
||||||
|
|
||||||
|
@ -29,60 +29,21 @@ import org.apache.commons.math.exception.MaxCountExceededException;
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public abstract class ConvergingAlgorithmImpl implements ConvergingAlgorithm {
|
public abstract class ConvergingAlgorithmImpl implements ConvergingAlgorithm {
|
||||||
|
|
||||||
/** Maximum absolute error. */
|
/** Maximum absolute error. */
|
||||||
protected double absoluteAccuracy;
|
protected double absoluteAccuracy;
|
||||||
|
|
||||||
/** Maximum relative error. */
|
/** Maximum relative error. */
|
||||||
protected double relativeAccuracy;
|
protected double relativeAccuracy;
|
||||||
|
|
||||||
/** Maximum number of iterations. */
|
/** Maximum number of iterations. */
|
||||||
protected int maximalIterationCount;
|
protected int maximalIterationCount;
|
||||||
|
|
||||||
/** Default maximum absolute error. */
|
/** Default maximum absolute error. */
|
||||||
protected double defaultAbsoluteAccuracy;
|
protected double defaultAbsoluteAccuracy;
|
||||||
|
|
||||||
/** Default maximum relative error. */
|
/** Default maximum relative error. */
|
||||||
protected double defaultRelativeAccuracy;
|
protected double defaultRelativeAccuracy;
|
||||||
|
|
||||||
/** Default maximum number of iterations. */
|
/** Default maximum number of iterations. */
|
||||||
protected int defaultMaximalIterationCount;
|
protected int defaultMaximalIterationCount;
|
||||||
|
|
||||||
/** The last iteration count. */
|
/** The last iteration count. */
|
||||||
protected int iterationCount;
|
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} */
|
/** {@inheritDoc} */
|
||||||
public int getIterationCount() {
|
public int getIterationCount() {
|
||||||
return iterationCount;
|
return iterationCount;
|
|
@ -17,7 +17,6 @@
|
||||||
package org.apache.commons.math.analysis.integration;
|
package org.apache.commons.math.analysis.integration;
|
||||||
|
|
||||||
import org.apache.commons.math.ConvergenceException;
|
import org.apache.commons.math.ConvergenceException;
|
||||||
import org.apache.commons.math.ConvergingAlgorithm;
|
|
||||||
import org.apache.commons.math.exception.MathUserException;
|
import org.apache.commons.math.exception.MathUserException;
|
||||||
import org.apache.commons.math.analysis.UnivariateRealFunction;
|
import org.apache.commons.math.analysis.UnivariateRealFunction;
|
||||||
|
|
||||||
|
@ -59,25 +58,6 @@ public interface UnivariateRealIntegrator extends ConvergingAlgorithm {
|
||||||
*/
|
*/
|
||||||
void resetMinimalIterationCount();
|
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.
|
* 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
|
* because no result was yet computed or the last attempt failed
|
||||||
*/
|
*/
|
||||||
double getResult() throws IllegalStateException;
|
double getResult() throws IllegalStateException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.commons.math.analysis.integration;
|
package org.apache.commons.math.analysis.integration;
|
||||||
|
|
||||||
import org.apache.commons.math.ConvergingAlgorithmImpl;
|
|
||||||
import org.apache.commons.math.MathRuntimeException;
|
import org.apache.commons.math.MathRuntimeException;
|
||||||
import org.apache.commons.math.analysis.UnivariateRealFunction;
|
import org.apache.commons.math.analysis.UnivariateRealFunction;
|
||||||
import org.apache.commons.math.exception.util.LocalizedFormats;
|
import org.apache.commons.math.exception.util.LocalizedFormats;
|
||||||
|
@ -30,22 +29,16 @@ import org.apache.commons.math.exception.NullArgumentException;
|
||||||
*/
|
*/
|
||||||
public abstract class UnivariateRealIntegratorImpl
|
public abstract class UnivariateRealIntegratorImpl
|
||||||
extends ConvergingAlgorithmImpl implements UnivariateRealIntegrator {
|
extends ConvergingAlgorithmImpl implements UnivariateRealIntegrator {
|
||||||
|
|
||||||
/** Serializable version identifier. */
|
/** Serializable version identifier. */
|
||||||
private static final long serialVersionUID = 6248808456637441533L;
|
private static final long serialVersionUID = 6248808456637441533L;
|
||||||
|
|
||||||
/** minimum number of iterations */
|
/** minimum number of iterations */
|
||||||
protected int minimalIterationCount;
|
protected int minimalIterationCount;
|
||||||
|
|
||||||
/** default minimum number of iterations */
|
/** default minimum number of iterations */
|
||||||
protected int defaultMinimalIterationCount;
|
protected int defaultMinimalIterationCount;
|
||||||
|
|
||||||
/** indicates whether an integral has been computed */
|
/** indicates whether an integral has been computed */
|
||||||
protected boolean resultComputed = false;
|
protected boolean resultComputed = false;
|
||||||
|
|
||||||
/** the last computed integral */
|
/** the last computed integral */
|
||||||
protected double result;
|
protected double result;
|
||||||
|
|
||||||
/** The integrand functione.
|
/** The integrand functione.
|
||||||
* @deprecated as of 2.0 the integrand function is passed as an argument
|
* @deprecated as of 2.0 the integrand function is passed as an argument
|
||||||
* to the {@link #integrate(UnivariateRealFunction, double, double)}method. */
|
* to the {@link #integrate(UnivariateRealFunction, double, double)}method. */
|
||||||
|
@ -66,7 +59,10 @@ public abstract class UnivariateRealIntegratorImpl
|
||||||
protected UnivariateRealIntegratorImpl(final UnivariateRealFunction f,
|
protected UnivariateRealIntegratorImpl(final UnivariateRealFunction f,
|
||||||
final int defaultMaximalIterationCount)
|
final int defaultMaximalIterationCount)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
super(defaultMaximalIterationCount, 1.0e-15);
|
|
||||||
|
setMaximalIterationCount(defaultMaximalIterationCount);
|
||||||
|
setAbsoluteAccuracy(1.0e-15);
|
||||||
|
|
||||||
if (f == null) {
|
if (f == null) {
|
||||||
throw new NullArgumentException(LocalizedFormats.FUNCTION);
|
throw new NullArgumentException(LocalizedFormats.FUNCTION);
|
||||||
}
|
}
|
||||||
|
@ -90,8 +86,9 @@ public abstract class UnivariateRealIntegratorImpl
|
||||||
*/
|
*/
|
||||||
protected UnivariateRealIntegratorImpl(final int defaultMaximalIterationCount)
|
protected UnivariateRealIntegratorImpl(final int defaultMaximalIterationCount)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
super(defaultMaximalIterationCount, 1.0e-15);
|
|
||||||
|
|
||||||
|
setMaximalIterationCount(defaultMaximalIterationCount);
|
||||||
|
setAbsoluteAccuracy(1.0e-15);
|
||||||
// parameters that are problem specific
|
// parameters that are problem specific
|
||||||
setRelativeAccuracy(1.0e-6);
|
setRelativeAccuracy(1.0e-6);
|
||||||
this.defaultMinimalIterationCount = 3;
|
this.defaultMinimalIterationCount = 3;
|
||||||
|
|
Loading…
Reference in New Issue