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
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.commons.math;
|
||||
package org.apache.commons.math.analysis.integration;
|
||||
|
||||
|
||||
/**
|
|
@ -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;
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue