MATH-707
Renamed "UnivariateRealIntegrator" to "UnivariateIntegrator" and "UnivariateRealIntegratorImpl" to "BaseAbstractUnivariateIntegrator". git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1239390 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0043cafb2e
commit
0576e96e73
|
@ -33,7 +33,7 @@ import org.apache.commons.math.util.MathUtils;
|
|||
* @version $Id$
|
||||
* @since 1.2
|
||||
*/
|
||||
public abstract class UnivariateRealIntegratorImpl implements UnivariateRealIntegrator {
|
||||
public abstract class BaseAbstractUnivariateIntegrator implements UnivariateIntegrator {
|
||||
|
||||
/** Default absolute accuracy. */
|
||||
public static final double DEFAULT_ABSOLUTE_ACCURACY = 1.0e-15;
|
||||
|
@ -106,7 +106,7 @@ public abstract class UnivariateRealIntegratorImpl implements UnivariateRealInte
|
|||
* @exception NumberIsTooSmallException if maximal number of iterations
|
||||
* is lesser than or equal to the minimal number of iterations
|
||||
*/
|
||||
protected UnivariateRealIntegratorImpl(final double relativeAccuracy,
|
||||
protected BaseAbstractUnivariateIntegrator(final double relativeAccuracy,
|
||||
final double absoluteAccuracy,
|
||||
final int minimalIterationCount,
|
||||
final int maximalIterationCount)
|
||||
|
@ -137,7 +137,7 @@ public abstract class UnivariateRealIntegratorImpl implements UnivariateRealInte
|
|||
* @param relativeAccuracy relative accuracy of the result
|
||||
* @param absoluteAccuracy absolute accuracy of the result
|
||||
*/
|
||||
protected UnivariateRealIntegratorImpl(final double relativeAccuracy,
|
||||
protected BaseAbstractUnivariateIntegrator(final double relativeAccuracy,
|
||||
final double absoluteAccuracy) {
|
||||
this(relativeAccuracy, absoluteAccuracy,
|
||||
DEFAULT_MIN_ITERATIONS_COUNT, DEFAULT_MAX_ITERATIONS_COUNT);
|
||||
|
@ -152,7 +152,7 @@ public abstract class UnivariateRealIntegratorImpl implements UnivariateRealInte
|
|||
* @exception NumberIsTooSmallException if maximal number of iterations
|
||||
* is lesser than or equal to the minimal number of iterations
|
||||
*/
|
||||
protected UnivariateRealIntegratorImpl(final int minimalIterationCount,
|
||||
protected BaseAbstractUnivariateIntegrator(final int minimalIterationCount,
|
||||
final int maximalIterationCount)
|
||||
throws NotStrictlyPositiveException, NumberIsTooSmallException {
|
||||
this(DEFAULT_RELATIVE_ACCURACY, DEFAULT_ABSOLUTE_ACCURACY,
|
|
@ -51,7 +51,7 @@ import org.apache.commons.math.util.FastMath;
|
|||
* @since 1.2
|
||||
*/
|
||||
|
||||
public class LegendreGaussIntegrator extends UnivariateRealIntegratorImpl {
|
||||
public class LegendreGaussIntegrator extends BaseAbstractUnivariateIntegrator {
|
||||
|
||||
/** Abscissas for the 2 points method. */
|
||||
private static final double[] ABSCISSAS_2 = {
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.commons.math.util.FastMath;
|
|||
* @version $Id$
|
||||
* @since 1.2
|
||||
*/
|
||||
public class RombergIntegrator extends UnivariateRealIntegratorImpl {
|
||||
public class RombergIntegrator extends BaseAbstractUnivariateIntegrator {
|
||||
|
||||
/** Maximal number of iterations for Romberg. */
|
||||
public static final int ROMBERG_MAX_ITERATIONS_COUNT = 32;
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.apache.commons.math.util.FastMath;
|
|||
* @version $Id$
|
||||
* @since 1.2
|
||||
*/
|
||||
public class SimpsonIntegrator extends UnivariateRealIntegratorImpl {
|
||||
public class SimpsonIntegrator extends BaseAbstractUnivariateIntegrator {
|
||||
|
||||
/** Maximal number of iterations for Simpson. */
|
||||
public static final int SIMPSON_MAX_ITERATIONS_COUNT = 64;
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.apache.commons.math.util.FastMath;
|
|||
* @version $Id$
|
||||
* @since 1.2
|
||||
*/
|
||||
public class TrapezoidIntegrator extends UnivariateRealIntegratorImpl {
|
||||
public class TrapezoidIntegrator extends BaseAbstractUnivariateIntegrator {
|
||||
|
||||
/** Maximum number of iterations for trapezoid. */
|
||||
public static final int TRAPEZOID_MAX_ITERATIONS_COUNT = 64;
|
||||
|
@ -113,7 +113,7 @@ public class TrapezoidIntegrator extends UnivariateRealIntegratorImpl {
|
|||
* @throws TooManyEvaluationsException if the maximal number of evaluations
|
||||
* is exceeded.
|
||||
*/
|
||||
double stage(final UnivariateRealIntegratorImpl baseIntegrator, final int n)
|
||||
double stage(final BaseAbstractUnivariateIntegrator baseIntegrator, final int n)
|
||||
throws TooManyEvaluationsException {
|
||||
|
||||
if (n == 0) {
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.apache.commons.math.exception.TooManyEvaluationsException;
|
|||
* @version $Id$
|
||||
* @since 1.2
|
||||
*/
|
||||
public interface UnivariateRealIntegrator {
|
||||
public interface UnivariateIntegrator {
|
||||
|
||||
/**
|
||||
* Get the actual relative accuracy.
|
|
@ -33,7 +33,7 @@ public class LegendreGaussIntegratorTest {
|
|||
@Test
|
||||
public void testSinFunction() {
|
||||
UnivariateFunction f = new SinFunction();
|
||||
UnivariateRealIntegratorImpl integrator = new LegendreGaussIntegrator(5, 1.0e-14, 1.0e-10, 2, 15);
|
||||
BaseAbstractUnivariateIntegrator integrator = new LegendreGaussIntegrator(5, 1.0e-14, 1.0e-10, 2, 15);
|
||||
double min, max, expected, result, tolerance;
|
||||
|
||||
min = 0; max = FastMath.PI; expected = 2;
|
||||
|
@ -52,11 +52,11 @@ public class LegendreGaussIntegratorTest {
|
|||
@Test
|
||||
public void testQuinticFunction() {
|
||||
UnivariateFunction f = new QuinticFunction();
|
||||
UnivariateRealIntegrator integrator =
|
||||
UnivariateIntegrator integrator =
|
||||
new LegendreGaussIntegrator(3,
|
||||
UnivariateRealIntegratorImpl.DEFAULT_RELATIVE_ACCURACY,
|
||||
UnivariateRealIntegratorImpl.DEFAULT_ABSOLUTE_ACCURACY,
|
||||
UnivariateRealIntegratorImpl.DEFAULT_MIN_ITERATIONS_COUNT,
|
||||
BaseAbstractUnivariateIntegrator.DEFAULT_RELATIVE_ACCURACY,
|
||||
BaseAbstractUnivariateIntegrator.DEFAULT_ABSOLUTE_ACCURACY,
|
||||
BaseAbstractUnivariateIntegrator.DEFAULT_MIN_ITERATIONS_COUNT,
|
||||
64);
|
||||
double min, max, expected, result;
|
||||
|
||||
|
@ -79,9 +79,9 @@ public class LegendreGaussIntegratorTest {
|
|||
for (int n = 2; n < 6; ++n) {
|
||||
LegendreGaussIntegrator integrator =
|
||||
new LegendreGaussIntegrator(n,
|
||||
UnivariateRealIntegratorImpl.DEFAULT_RELATIVE_ACCURACY,
|
||||
UnivariateRealIntegratorImpl.DEFAULT_ABSOLUTE_ACCURACY,
|
||||
UnivariateRealIntegratorImpl.DEFAULT_MIN_ITERATIONS_COUNT,
|
||||
BaseAbstractUnivariateIntegrator.DEFAULT_RELATIVE_ACCURACY,
|
||||
BaseAbstractUnivariateIntegrator.DEFAULT_ABSOLUTE_ACCURACY,
|
||||
BaseAbstractUnivariateIntegrator.DEFAULT_MIN_ITERATIONS_COUNT,
|
||||
64);
|
||||
|
||||
// an n points Gauss-Legendre integrator integrates 2n-1 degree polynoms exactly
|
||||
|
|
|
@ -43,7 +43,7 @@ public final class RombergIntegratorTest {
|
|||
@Test
|
||||
public void testSinFunction() {
|
||||
UnivariateFunction f = new SinFunction();
|
||||
UnivariateRealIntegrator integrator = new RombergIntegrator();
|
||||
UnivariateIntegrator integrator = new RombergIntegrator();
|
||||
double min, max, expected, result, tolerance;
|
||||
|
||||
min = 0; max = FastMath.PI; expected = 2;
|
||||
|
@ -67,7 +67,7 @@ public final class RombergIntegratorTest {
|
|||
@Test
|
||||
public void testQuinticFunction() {
|
||||
UnivariateFunction f = new QuinticFunction();
|
||||
UnivariateRealIntegrator integrator = new RombergIntegrator();
|
||||
UnivariateIntegrator integrator = new RombergIntegrator();
|
||||
double min, max, expected, result, tolerance;
|
||||
|
||||
min = 0; max = 1; expected = -1.0/48;
|
||||
|
|
|
@ -42,7 +42,7 @@ public final class SimpsonIntegratorTest {
|
|||
@Test
|
||||
public void testSinFunction() {
|
||||
UnivariateFunction f = new SinFunction();
|
||||
UnivariateRealIntegrator integrator = new SimpsonIntegrator();
|
||||
UnivariateIntegrator integrator = new SimpsonIntegrator();
|
||||
double min, max, expected, result, tolerance;
|
||||
|
||||
min = 0; max = FastMath.PI; expected = 2;
|
||||
|
@ -66,7 +66,7 @@ public final class SimpsonIntegratorTest {
|
|||
@Test
|
||||
public void testQuinticFunction() {
|
||||
UnivariateFunction f = new QuinticFunction();
|
||||
UnivariateRealIntegrator integrator = new SimpsonIntegrator();
|
||||
UnivariateIntegrator integrator = new SimpsonIntegrator();
|
||||
double min, max, expected, result, tolerance;
|
||||
|
||||
min = 0; max = 1; expected = -1.0/48;
|
||||
|
|
|
@ -42,7 +42,7 @@ public final class TrapezoidIntegratorTest {
|
|||
@Test
|
||||
public void testSinFunction() {
|
||||
UnivariateFunction f = new SinFunction();
|
||||
UnivariateRealIntegrator integrator = new TrapezoidIntegrator();
|
||||
UnivariateIntegrator integrator = new TrapezoidIntegrator();
|
||||
double min, max, expected, result, tolerance;
|
||||
|
||||
min = 0; max = FastMath.PI; expected = 2;
|
||||
|
@ -66,7 +66,7 @@ public final class TrapezoidIntegratorTest {
|
|||
@Test
|
||||
public void testQuinticFunction() {
|
||||
UnivariateFunction f = new QuinticFunction();
|
||||
UnivariateRealIntegrator integrator = new TrapezoidIntegrator();
|
||||
UnivariateIntegrator integrator = new TrapezoidIntegrator();
|
||||
double min, max, expected, result, tolerance;
|
||||
|
||||
min = 0; max = 1; expected = -1.0/48;
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.commons.math.distribution;
|
|||
|
||||
import org.apache.commons.math.analysis.UnivariateFunction;
|
||||
import org.apache.commons.math.analysis.integration.RombergIntegrator;
|
||||
import org.apache.commons.math.analysis.integration.UnivariateRealIntegrator;
|
||||
import org.apache.commons.math.analysis.integration.UnivariateIntegrator;
|
||||
import org.apache.commons.math.exception.OutOfRangeException;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
@ -156,7 +156,7 @@ public class AbstractRealDistributionTest {
|
|||
return x * density(x);
|
||||
}
|
||||
};
|
||||
final UnivariateRealIntegrator integrator = new RombergIntegrator();
|
||||
final UnivariateIntegrator integrator = new RombergIntegrator();
|
||||
return integrator.integrate(Integer.MAX_VALUE, f, x0, x4);
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ public class AbstractRealDistributionTest {
|
|||
return x * x * density(x);
|
||||
}
|
||||
};
|
||||
final UnivariateRealIntegrator integrator = new RombergIntegrator();
|
||||
final UnivariateIntegrator integrator = new RombergIntegrator();
|
||||
final double meanX2 = integrator.integrate(Integer.MAX_VALUE,
|
||||
f, x0, x4);
|
||||
return meanX2 - meanX * meanX;
|
||||
|
|
Loading…
Reference in New Issue