commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject [45/82] [partial] [math] Update for next development iteration: commons-math4
Date Mon, 16 Feb 2015 22:40:15 GMT
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/StepFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/StepFunction.java b/src/main/java/org/apache/commons/math3/analysis/function/StepFunction.java
deleted file mode 100644
index 51e3678..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/StepFunction.java
+++ /dev/null
@@ -1,100 +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.math3.analysis.function;
-
-import java.util.Arrays;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * <a href="http://en.wikipedia.org/wiki/Step_function">
- *  Step function</a>.
- *
- * @since 3.0
- */
-public class StepFunction implements UnivariateFunction {
-    /** Abscissae. */
-    private final double[] abscissa;
-    /** Ordinates. */
-    private final double[] ordinate;
-
-    /**
-     * Builds a step function from a list of arguments and the corresponding
-     * values. Specifically, returns the function h(x) defined by <pre><code>
-     * h(x) = y[0] for all x < x[1]
-     *        y[1] for x[1] <= x < x[2]
-     *        ...
-     *        y[y.length - 1] for x >= x[x.length - 1]
-     * </code></pre>
-     * The value of {@code x[0]} is ignored, but it must be strictly less than
-     * {@code x[1]}.
-     *
-     * @param x Domain values where the function changes value.
-     * @param y Values of the function.
-     * @throws NonMonotonicSequenceException
-     * if the {@code x} array is not sorted in strictly increasing order.
-     * @throws NullArgumentException if {@code x} or {@code y} are {@code null}.
-     * @throws NoDataException if {@code x} or {@code y} are zero-length.
-     * @throws DimensionMismatchException if {@code x} and {@code y} do not
-     * have the same length.
-     */
-    public StepFunction(double[] x,
-                        double[] y)
-        throws NullArgumentException, NoDataException,
-               DimensionMismatchException, NonMonotonicSequenceException {
-        if (x == null ||
-            y == null) {
-            throw new NullArgumentException();
-        }
-        if (x.length == 0 ||
-            y.length == 0) {
-            throw new NoDataException();
-        }
-        if (y.length != x.length) {
-            throw new DimensionMismatchException(y.length, x.length);
-        }
-        MathArrays.checkOrder(x);
-
-        abscissa = MathArrays.copyOf(x);
-        ordinate = MathArrays.copyOf(y);
-    }
-
-    /** {@inheritDoc} */
-    public double value(double x) {
-        int index = Arrays.binarySearch(abscissa, x);
-        double fx = 0;
-
-        if (index < -1) {
-            // "x" is between "abscissa[-index-2]" and "abscissa[-index-1]".
-            fx = ordinate[-index-2];
-        } else if (index >= 0) {
-            // "x" is exactly "abscissa[index]".
-            fx = ordinate[index];
-        } else {
-            // Otherwise, "x" is smaller than the first value in "abscissa"
-            // (hence the returned value should be "ordinate[0]").
-            fx = ordinate[0];
-        }
-
-        return fx;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Subtract.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Subtract.java b/src/main/java/org/apache/commons/math3/analysis/function/Subtract.java
deleted file mode 100644
index 7b87dd6..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Subtract.java
+++ /dev/null
@@ -1,32 +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.math3.analysis.function;
-
-import org.apache.commons.math3.analysis.BivariateFunction;
-
-/**
- * Subtract the second operand from the first.
- *
- * @since 3.0
- */
-public class Subtract implements BivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x, double y) {
-        return x - y;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Tan.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Tan.java b/src/main/java/org/apache/commons/math3/analysis/function/Tan.java
deleted file mode 100644
index 03304b4..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Tan.java
+++ /dev/null
@@ -1,53 +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.math3.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Tangent function.
- *
- * @since 3.0
- */
-public class Tan implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.tan(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.tan();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Tanh.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Tanh.java b/src/main/java/org/apache/commons/math3/analysis/function/Tanh.java
deleted file mode 100644
index 6c7ef0d..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Tanh.java
+++ /dev/null
@@ -1,53 +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.math3.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Hyperbolic tangent function.
- *
- * @since 3.0
- */
-public class Tanh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.tanh(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.tanh();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Ulp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Ulp.java b/src/main/java/org/apache/commons/math3/analysis/function/Ulp.java
deleted file mode 100644
index d075a73..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Ulp.java
+++ /dev/null
@@ -1,33 +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.math3.analysis.function;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * {@code ulp} function.
- *
- * @since 3.0
- */
-public class Ulp implements UnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.ulp(x);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/package-info.java b/src/main/java/org/apache/commons/math3/analysis/function/package-info.java
deleted file mode 100644
index cb24544..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/package-info.java
+++ /dev/null
@@ -1,26 +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.
- */
-/**
- *
- *    <p>
- *      The {@code function} package contains function objects that wrap the
- *      methods contained in {@link java.lang.Math}, as well as common
- *      mathematical functions such as the gaussian and sinc functions.
- *    </p>
- *
- */
-package org.apache.commons.math3.analysis.function;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/BaseAbstractUnivariateIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/BaseAbstractUnivariateIntegrator.java b/src/main/java/org/apache/commons/math3/analysis/integration/BaseAbstractUnivariateIntegrator.java
deleted file mode 100644
index 23c25b0..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/BaseAbstractUnivariateIntegrator.java
+++ /dev/null
@@ -1,280 +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.math3.analysis.integration;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.solvers.UnivariateSolverUtils;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.Incrementor;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * Provide a default implementation for several generic functions.
- *
- * @since 1.2
- */
-public abstract class BaseAbstractUnivariateIntegrator implements UnivariateIntegrator {
-
-    /** Default absolute accuracy. */
-    public static final double DEFAULT_ABSOLUTE_ACCURACY = 1.0e-15;
-
-    /** Default relative accuracy. */
-    public static final double DEFAULT_RELATIVE_ACCURACY = 1.0e-6;
-
-    /** Default minimal iteration count. */
-    public static final int DEFAULT_MIN_ITERATIONS_COUNT = 3;
-
-    /** Default maximal iteration count. */
-    public static final int DEFAULT_MAX_ITERATIONS_COUNT = Integer.MAX_VALUE;
-
-    /** The iteration count. */
-    protected final Incrementor iterations;
-
-    /** Maximum absolute error. */
-    private final double absoluteAccuracy;
-
-    /** Maximum relative error. */
-    private final double relativeAccuracy;
-
-    /** minimum number of iterations */
-    private final int minimalIterationCount;
-
-    /** The functions evaluation count. */
-    private final Incrementor evaluations;
-
-    /** Function to integrate. */
-    private UnivariateFunction function;
-
-    /** Lower bound for the interval. */
-    private double min;
-
-    /** Upper bound for the interval. */
-    private double max;
-
-    /**
-     * Construct an integrator with given accuracies and iteration counts.
-     * <p>
-     * The meanings of the various parameters are:
-     * <ul>
-     *   <li>relative accuracy:
-     *       this is used to stop iterations if the absolute accuracy can't be
-     *       achieved due to large values or short mantissa length. If this
-     *       should be the primary criterion for convergence rather then a
-     *       safety measure, set the absolute accuracy to a ridiculously small value,
-     *       like {@link org.apache.commons.math3.util.Precision#SAFE_MIN Precision.SAFE_MIN}.</li>
-     *   <li>absolute accuracy:
-     *       The default is usually chosen so that results in the interval
-     *       -10..-0.1 and +0.1..+10 can be found with a reasonable accuracy. If the
-     *       expected absolute value of your results is of much smaller magnitude, set
-     *       this to a smaller value.</li>
-     *   <li>minimum number of iterations:
-     *       minimal iteration is needed to avoid false early convergence, e.g.
-     *       the sample points happen to be zeroes of the function. Users can
-     *       use the default value or choose one that they see as appropriate.</li>
-     *   <li>maximum number of iterations:
-     *       usually a high iteration count indicates convergence problems. However,
-     *       the "reasonable value" varies widely for different algorithms. Users are
-     *       advised to use the default value supplied by the algorithm.</li>
-     * </ul>
-     * </p>
-     * @param relativeAccuracy relative accuracy of the result
-     * @param absoluteAccuracy absolute accuracy of the result
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     */
-    protected BaseAbstractUnivariateIntegrator(final double relativeAccuracy,
-                                               final double absoluteAccuracy,
-                                               final int minimalIterationCount,
-                                               final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException {
-
-        // accuracy settings
-        this.relativeAccuracy      = relativeAccuracy;
-        this.absoluteAccuracy      = absoluteAccuracy;
-
-        // iterations count settings
-        if (minimalIterationCount <= 0) {
-            throw new NotStrictlyPositiveException(minimalIterationCount);
-        }
-        if (maximalIterationCount <= minimalIterationCount) {
-            throw new NumberIsTooSmallException(maximalIterationCount, minimalIterationCount, false);
-        }
-        this.minimalIterationCount = minimalIterationCount;
-        this.iterations            = new Incrementor();
-        iterations.setMaximalCount(maximalIterationCount);
-
-        // prepare evaluations counter, but do not set it yet
-        evaluations = new Incrementor();
-
-    }
-
-    /**
-     * Construct an integrator with given accuracies.
-     * @param relativeAccuracy relative accuracy of the result
-     * @param absoluteAccuracy absolute accuracy of the result
-     */
-    protected BaseAbstractUnivariateIntegrator(final double relativeAccuracy,
-                                           final double absoluteAccuracy) {
-        this(relativeAccuracy, absoluteAccuracy,
-             DEFAULT_MIN_ITERATIONS_COUNT, DEFAULT_MAX_ITERATIONS_COUNT);
-    }
-
-    /**
-     * Construct an integrator with given iteration counts.
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     */
-    protected BaseAbstractUnivariateIntegrator(final int minimalIterationCount,
-                                           final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException {
-        this(DEFAULT_RELATIVE_ACCURACY, DEFAULT_ABSOLUTE_ACCURACY,
-             minimalIterationCount, maximalIterationCount);
-    }
-
-    /** {@inheritDoc} */
-    public double getRelativeAccuracy() {
-        return relativeAccuracy;
-    }
-
-    /** {@inheritDoc} */
-    public double getAbsoluteAccuracy() {
-        return absoluteAccuracy;
-    }
-
-    /** {@inheritDoc} */
-    public int getMinimalIterationCount() {
-        return minimalIterationCount;
-    }
-
-    /** {@inheritDoc} */
-    public int getMaximalIterationCount() {
-        return iterations.getMaximalCount();
-    }
-
-    /** {@inheritDoc} */
-    public int getEvaluations() {
-        return evaluations.getCount();
-    }
-
-    /** {@inheritDoc} */
-    public int getIterations() {
-        return iterations.getCount();
-    }
-
-    /**
-     * @return the lower bound.
-     */
-    protected double getMin() {
-        return min;
-    }
-    /**
-     * @return the upper bound.
-     */
-    protected double getMax() {
-        return max;
-    }
-
-    /**
-     * 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 function
-     * evaluations is exceeded.
-     */
-    protected double computeObjectiveValue(final double point)
-        throws TooManyEvaluationsException {
-        try {
-            evaluations.incrementCount();
-        } catch (MaxCountExceededException e) {
-            throw new TooManyEvaluationsException(e.getMax());
-        }
-        return function.value(point);
-    }
-
-    /**
-     * Prepare for computation.
-     * Subclasses must call this method if they override any of the
-     * {@code solve} methods.
-     *
-     * @param maxEval Maximum number of evaluations.
-     * @param f the integrand function
-     * @param lower the min bound for the interval
-     * @param upper the upper bound for the interval
-     * @throws NullArgumentException if {@code f} is {@code null}.
-     * @throws MathIllegalArgumentException if {@code min >= max}.
-     */
-    protected void setup(final int maxEval,
-                         final UnivariateFunction f,
-                         final double lower, final double upper)
-        throws NullArgumentException, MathIllegalArgumentException {
-
-        // Checks.
-        MathUtils.checkNotNull(f);
-        UnivariateSolverUtils.verifyInterval(lower, upper);
-
-        // Reset.
-        min = lower;
-        max = upper;
-        function = f;
-        evaluations.setMaximalCount(maxEval);
-        evaluations.resetCount();
-        iterations.resetCount();
-
-    }
-
-    /** {@inheritDoc} */
-    public double integrate(final int maxEval, final UnivariateFunction f,
-                            final double lower, final double upper)
-        throws TooManyEvaluationsException, MaxCountExceededException,
-               MathIllegalArgumentException, NullArgumentException {
-
-        // Initialization.
-        setup(maxEval, f, lower, upper);
-
-        // Perform computation.
-        return doIntegrate();
-
-    }
-
-    /**
-     * Method for implementing actual integration algorithms in derived
-     * classes.
-     *
-     * @return the root.
-     * @throws TooManyEvaluationsException if the maximal number of evaluations
-     * is exceeded.
-     * @throws MaxCountExceededException if the maximum iteration count is exceeded
-     * or the integrator detects convergence problems otherwise
-     */
-    protected abstract double doIntegrate()
-        throws TooManyEvaluationsException, MaxCountExceededException;
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/IterativeLegendreGaussIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/IterativeLegendreGaussIntegrator.java b/src/main/java/org/apache/commons/math3/analysis/integration/IterativeLegendreGaussIntegrator.java
deleted file mode 100644
index b7c6b81..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/IterativeLegendreGaussIntegrator.java
+++ /dev/null
@@ -1,182 +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.math3.analysis.integration;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.integration.gauss.GaussIntegratorFactory;
-import org.apache.commons.math3.analysis.integration.gauss.GaussIntegrator;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * This algorithm divides the integration interval into equally-sized
- * sub-interval and on each of them performs a
- * <a href="http://mathworld.wolfram.com/Legendre-GaussQuadrature.html">
- * Legendre-Gauss</a> quadrature.
- * Because of its <em>non-adaptive</em> nature, this algorithm can
- * converge to a wrong value for the integral (for example, if the
- * function is significantly different from zero toward the ends of the
- * integration interval).
- * In particular, a change of variables aimed at estimating integrals
- * over infinite intervals as proposed
- * <a href="http://en.wikipedia.org/w/index.php?title=Numerical_integration#Integrals_over_infinite_intervals">
- *  here</a> should be avoided when using this class.
- *
- * @since 3.1
- */
-
-public class IterativeLegendreGaussIntegrator
-    extends BaseAbstractUnivariateIntegrator {
-    /** Factory that computes the points and weights. */
-    private static final GaussIntegratorFactory FACTORY
-        = new GaussIntegratorFactory();
-    /** Number of integration points (per interval). */
-    private final int numberOfPoints;
-
-    /**
-     * Builds an integrator with given accuracies and iterations counts.
-     *
-     * @param n Number of integration points.
-     * @param relativeAccuracy Relative accuracy of the result.
-     * @param absoluteAccuracy Absolute accuracy of the result.
-     * @param minimalIterationCount Minimum number of iterations.
-     * @param maximalIterationCount Maximum number of iterations.
-     * @throws NotStrictlyPositiveException if minimal number of iterations
-     * or number of points are not strictly positive.
-     * @throws NumberIsTooSmallException if maximal number of iterations
-     * is smaller than or equal to the minimal number of iterations.
-     */
-    public IterativeLegendreGaussIntegrator(final int n,
-                                            final double relativeAccuracy,
-                                            final double absoluteAccuracy,
-                                            final int minimalIterationCount,
-                                            final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException {
-        super(relativeAccuracy, absoluteAccuracy, minimalIterationCount, maximalIterationCount);
-        if (n <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_POINTS, n);
-        }
-       numberOfPoints = n;
-    }
-
-    /**
-     * Builds an integrator with given accuracies.
-     *
-     * @param n Number of integration points.
-     * @param relativeAccuracy Relative accuracy of the result.
-     * @param absoluteAccuracy Absolute accuracy of the result.
-     * @throws NotStrictlyPositiveException if {@code n < 1}.
-     */
-    public IterativeLegendreGaussIntegrator(final int n,
-                                            final double relativeAccuracy,
-                                            final double absoluteAccuracy)
-        throws NotStrictlyPositiveException {
-        this(n, relativeAccuracy, absoluteAccuracy,
-             DEFAULT_MIN_ITERATIONS_COUNT, DEFAULT_MAX_ITERATIONS_COUNT);
-    }
-
-    /**
-     * Builds an integrator with given iteration counts.
-     *
-     * @param n Number of integration points.
-     * @param minimalIterationCount Minimum number of iterations.
-     * @param maximalIterationCount Maximum number of iterations.
-     * @throws NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive.
-     * @throws NumberIsTooSmallException if maximal number of iterations
-     * is smaller than or equal to the minimal number of iterations.
-     * @throws NotStrictlyPositiveException if {@code n < 1}.
-     */
-    public IterativeLegendreGaussIntegrator(final int n,
-                                            final int minimalIterationCount,
-                                            final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException {
-        this(n, DEFAULT_RELATIVE_ACCURACY, DEFAULT_ABSOLUTE_ACCURACY,
-             minimalIterationCount, maximalIterationCount);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected double doIntegrate()
-        throws MathIllegalArgumentException, TooManyEvaluationsException, MaxCountExceededException {
-        // Compute first estimate with a single step.
-        double oldt = stage(1);
-
-        int n = 2;
-        while (true) {
-            // Improve integral with a larger number of steps.
-            final double t = stage(n);
-
-            // Estimate the error.
-            final double delta = FastMath.abs(t - oldt);
-            final double limit =
-                FastMath.max(getAbsoluteAccuracy(),
-                             getRelativeAccuracy() * (FastMath.abs(oldt) + FastMath.abs(t)) * 0.5);
-
-            // check convergence
-            if (iterations.getCount() + 1 >= getMinimalIterationCount() &&
-                delta <= limit) {
-                return t;
-            }
-
-            // Prepare next iteration.
-            final double ratio = FastMath.min(4, FastMath.pow(delta / limit, 0.5 / numberOfPoints));
-            n = FastMath.max((int) (ratio * n), n + 1);
-            oldt = t;
-            iterations.incrementCount();
-        }
-    }
-
-    /**
-     * Compute the n-th stage integral.
-     *
-     * @param n Number of steps.
-     * @return the value of n-th stage integral.
-     * @throws TooManyEvaluationsException if the maximum number of evaluations
-     * is exceeded.
-     */
-    private double stage(final int n)
-        throws TooManyEvaluationsException {
-        // Function to be integrated is stored in the base class.
-        final UnivariateFunction f = new UnivariateFunction() {
-                public double value(double x)
-                    throws MathIllegalArgumentException, TooManyEvaluationsException {
-                    return computeObjectiveValue(x);
-                }
-            };
-
-        final double min = getMin();
-        final double max = getMax();
-        final double step = (max - min) / n;
-
-        double sum = 0;
-        for (int i = 0; i < n; i++) {
-            // Integrate over each sub-interval [a, b].
-            final double a = min + i * step;
-            final double b = a + step;
-            final GaussIntegrator g = FACTORY.legendreHighPrecision(numberOfPoints, a, b);
-            sum += g.integrate(f);
-        }
-
-        return sum;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/LegendreGaussIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/LegendreGaussIntegrator.java b/src/main/java/org/apache/commons/math3/analysis/integration/LegendreGaussIntegrator.java
deleted file mode 100644
index 08f4794..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/LegendreGaussIntegrator.java
+++ /dev/null
@@ -1,265 +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.math3.analysis.integration;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implements the <a href="http://mathworld.wolfram.com/Legendre-GaussQuadrature.html">
- * Legendre-Gauss</a> quadrature formula.
- * <p>
- * Legendre-Gauss integrators are efficient integrators that can
- * accurately integrate functions with few function evaluations. A
- * Legendre-Gauss integrator using an n-points quadrature formula can
- * integrate 2n-1 degree polynomials exactly.
- * </p>
- * <p>
- * These integrators evaluate the function on n carefully chosen
- * abscissas in each step interval (mapped to the canonical [-1,1] interval).
- * The evaluation abscissas are not evenly spaced and none of them are
- * at the interval endpoints. This implies the function integrated can be
- * undefined at integration interval endpoints.
- * </p>
- * <p>
- * The evaluation abscissas x<sub>i</sub> are the roots of the degree n
- * Legendre polynomial. The weights a<sub>i</sub> of the quadrature formula
- * integrals from -1 to +1 &int; Li<sup>2</sup> where Li (x) =
- * &prod; (x-x<sub>k</sub>)/(x<sub>i</sub>-x<sub>k</sub>) for k != i.
- * </p>
- * <p>
- * @since 1.2
- * @deprecated As of 3.1 (to be removed in 4.0). Please use
- * {@link IterativeLegendreGaussIntegrator} instead.
- */
-@Deprecated
-public class LegendreGaussIntegrator extends BaseAbstractUnivariateIntegrator {
-
-    /** Abscissas for the 2 points method. */
-    private static final double[] ABSCISSAS_2 = {
-        -1.0 / FastMath.sqrt(3.0),
-         1.0 / FastMath.sqrt(3.0)
-    };
-
-    /** Weights for the 2 points method. */
-    private static final double[] WEIGHTS_2 = {
-        1.0,
-        1.0
-    };
-
-    /** Abscissas for the 3 points method. */
-    private static final double[] ABSCISSAS_3 = {
-        -FastMath.sqrt(0.6),
-         0.0,
-         FastMath.sqrt(0.6)
-    };
-
-    /** Weights for the 3 points method. */
-    private static final double[] WEIGHTS_3 = {
-        5.0 / 9.0,
-        8.0 / 9.0,
-        5.0 / 9.0
-    };
-
-    /** Abscissas for the 4 points method. */
-    private static final double[] ABSCISSAS_4 = {
-        -FastMath.sqrt((15.0 + 2.0 * FastMath.sqrt(30.0)) / 35.0),
-        -FastMath.sqrt((15.0 - 2.0 * FastMath.sqrt(30.0)) / 35.0),
-         FastMath.sqrt((15.0 - 2.0 * FastMath.sqrt(30.0)) / 35.0),
-         FastMath.sqrt((15.0 + 2.0 * FastMath.sqrt(30.0)) / 35.0)
-    };
-
-    /** Weights for the 4 points method. */
-    private static final double[] WEIGHTS_4 = {
-        (90.0 - 5.0 * FastMath.sqrt(30.0)) / 180.0,
-        (90.0 + 5.0 * FastMath.sqrt(30.0)) / 180.0,
-        (90.0 + 5.0 * FastMath.sqrt(30.0)) / 180.0,
-        (90.0 - 5.0 * FastMath.sqrt(30.0)) / 180.0
-    };
-
-    /** Abscissas for the 5 points method. */
-    private static final double[] ABSCISSAS_5 = {
-        -FastMath.sqrt((35.0 + 2.0 * FastMath.sqrt(70.0)) / 63.0),
-        -FastMath.sqrt((35.0 - 2.0 * FastMath.sqrt(70.0)) / 63.0),
-         0.0,
-         FastMath.sqrt((35.0 - 2.0 * FastMath.sqrt(70.0)) / 63.0),
-         FastMath.sqrt((35.0 + 2.0 * FastMath.sqrt(70.0)) / 63.0)
-    };
-
-    /** Weights for the 5 points method. */
-    private static final double[] WEIGHTS_5 = {
-        (322.0 - 13.0 * FastMath.sqrt(70.0)) / 900.0,
-        (322.0 + 13.0 * FastMath.sqrt(70.0)) / 900.0,
-        128.0 / 225.0,
-        (322.0 + 13.0 * FastMath.sqrt(70.0)) / 900.0,
-        (322.0 - 13.0 * FastMath.sqrt(70.0)) / 900.0
-    };
-
-    /** Abscissas for the current method. */
-    private final double[] abscissas;
-
-    /** Weights for the current method. */
-    private final double[] weights;
-
-    /**
-     * Build a Legendre-Gauss integrator with given accuracies and iterations counts.
-     * @param n number of points desired (must be between 2 and 5 inclusive)
-     * @param relativeAccuracy relative accuracy of the result
-     * @param absoluteAccuracy absolute accuracy of the result
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * @exception MathIllegalArgumentException if number of points is out of [2; 5]
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     */
-    public LegendreGaussIntegrator(final int n,
-                                   final double relativeAccuracy,
-                                   final double absoluteAccuracy,
-                                   final int minimalIterationCount,
-                                   final int maximalIterationCount)
-        throws MathIllegalArgumentException, NotStrictlyPositiveException, NumberIsTooSmallException {
-        super(relativeAccuracy, absoluteAccuracy, minimalIterationCount, maximalIterationCount);
-        switch(n) {
-        case 2 :
-            abscissas = ABSCISSAS_2;
-            weights   = WEIGHTS_2;
-            break;
-        case 3 :
-            abscissas = ABSCISSAS_3;
-            weights   = WEIGHTS_3;
-            break;
-        case 4 :
-            abscissas = ABSCISSAS_4;
-            weights   = WEIGHTS_4;
-            break;
-        case 5 :
-            abscissas = ABSCISSAS_5;
-            weights   = WEIGHTS_5;
-            break;
-        default :
-            throw new MathIllegalArgumentException(
-                    LocalizedFormats.N_POINTS_GAUSS_LEGENDRE_INTEGRATOR_NOT_SUPPORTED,
-                    n, 2, 5);
-        }
-
-    }
-
-    /**
-     * Build a Legendre-Gauss integrator with given accuracies.
-     * @param n number of points desired (must be between 2 and 5 inclusive)
-     * @param relativeAccuracy relative accuracy of the result
-     * @param absoluteAccuracy absolute accuracy of the result
-     * @exception MathIllegalArgumentException if number of points is out of [2; 5]
-     */
-    public LegendreGaussIntegrator(final int n,
-                                   final double relativeAccuracy,
-                                   final double absoluteAccuracy)
-        throws MathIllegalArgumentException {
-        this(n, relativeAccuracy, absoluteAccuracy,
-             DEFAULT_MIN_ITERATIONS_COUNT, DEFAULT_MAX_ITERATIONS_COUNT);
-    }
-
-    /**
-     * Build a Legendre-Gauss integrator with given iteration counts.
-     * @param n number of points desired (must be between 2 and 5 inclusive)
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * @exception MathIllegalArgumentException if number of points is out of [2; 5]
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     */
-    public LegendreGaussIntegrator(final int n,
-                                   final int minimalIterationCount,
-                                   final int maximalIterationCount)
-        throws MathIllegalArgumentException {
-        this(n, DEFAULT_RELATIVE_ACCURACY, DEFAULT_ABSOLUTE_ACCURACY,
-             minimalIterationCount, maximalIterationCount);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected double doIntegrate()
-        throws MathIllegalArgumentException, TooManyEvaluationsException, MaxCountExceededException {
-
-        // compute first estimate with a single step
-        double oldt = stage(1);
-
-        int n = 2;
-        while (true) {
-
-            // improve integral with a larger number of steps
-            final double t = stage(n);
-
-            // estimate error
-            final double delta = FastMath.abs(t - oldt);
-            final double limit =
-                FastMath.max(getAbsoluteAccuracy(),
-                             getRelativeAccuracy() * (FastMath.abs(oldt) + FastMath.abs(t)) * 0.5);
-
-            // check convergence
-            if ((iterations.getCount() + 1 >= getMinimalIterationCount()) && (delta <= limit)) {
-                return t;
-            }
-
-            // prepare next iteration
-            double ratio = FastMath.min(4, FastMath.pow(delta / limit, 0.5 / abscissas.length));
-            n = FastMath.max((int) (ratio * n), n + 1);
-            oldt = t;
-            iterations.incrementCount();
-
-        }
-
-    }
-
-    /**
-     * Compute the n-th stage integral.
-     * @param n number of steps
-     * @return the value of n-th stage integral
-     * @throws TooManyEvaluationsException if the maximum number of evaluations
-     * is exceeded.
-     */
-    private double stage(final int n)
-        throws TooManyEvaluationsException {
-
-        // set up the step for the current stage
-        final double step     = (getMax() - getMin()) / n;
-        final double halfStep = step / 2.0;
-
-        // integrate over all elementary steps
-        double midPoint = getMin() + halfStep;
-        double sum = 0.0;
-        for (int i = 0; i < n; ++i) {
-            for (int j = 0; j < abscissas.length; ++j) {
-                sum += weights[j] * computeObjectiveValue(midPoint + halfStep * abscissas[j]);
-            }
-            midPoint += step;
-        }
-
-        return halfStep * sum;
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java b/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java
deleted file mode 100644
index aaea286..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java
+++ /dev/null
@@ -1,169 +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.math3.analysis.integration;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implements the <a href="http://en.wikipedia.org/wiki/Midpoint_method">
- * Midpoint Rule</a> for integration of real univariate functions. For
- * reference, see <b>Numerical Mathematics</b>, ISBN 0387989595,
- * chapter 9.2.
- * <p>
- * The function should be integrable.</p>
- *
- * @since 3.3
- */
-public class MidPointIntegrator extends BaseAbstractUnivariateIntegrator {
-
-    /** Maximum number of iterations for midpoint. */
-    public static final int MIDPOINT_MAX_ITERATIONS_COUNT = 64;
-
-    /**
-     * Build a midpoint integrator with given accuracies and iterations counts.
-     * @param relativeAccuracy relative accuracy of the result
-     * @param absoluteAccuracy absolute accuracy of the result
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * (must be less than or equal to {@link #MIDPOINT_MAX_ITERATIONS_COUNT}
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     * @exception NumberIsTooLargeException if maximal number of iterations
-     * is greater than {@link #MIDPOINT_MAX_ITERATIONS_COUNT}
-     */
-    public MidPointIntegrator(final double relativeAccuracy,
-                              final double absoluteAccuracy,
-                              final int minimalIterationCount,
-                              final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException {
-        super(relativeAccuracy, absoluteAccuracy, minimalIterationCount, maximalIterationCount);
-        if (maximalIterationCount > MIDPOINT_MAX_ITERATIONS_COUNT) {
-            throw new NumberIsTooLargeException(maximalIterationCount,
-                                                MIDPOINT_MAX_ITERATIONS_COUNT, false);
-        }
-    }
-
-    /**
-     * Build a midpoint integrator with given iteration counts.
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * (must be less than or equal to {@link #MIDPOINT_MAX_ITERATIONS_COUNT}
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     * @exception NumberIsTooLargeException if maximal number of iterations
-     * is greater than {@link #MIDPOINT_MAX_ITERATIONS_COUNT}
-     */
-    public MidPointIntegrator(final int minimalIterationCount,
-                              final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException {
-        super(minimalIterationCount, maximalIterationCount);
-        if (maximalIterationCount > MIDPOINT_MAX_ITERATIONS_COUNT) {
-            throw new NumberIsTooLargeException(maximalIterationCount,
-                                                MIDPOINT_MAX_ITERATIONS_COUNT, false);
-        }
-    }
-
-    /**
-     * Construct a midpoint integrator with default settings.
-     * (max iteration count set to {@link #MIDPOINT_MAX_ITERATIONS_COUNT})
-     */
-    public MidPointIntegrator() {
-        super(DEFAULT_MIN_ITERATIONS_COUNT, MIDPOINT_MAX_ITERATIONS_COUNT);
-    }
-
-    /**
-     * Compute the n-th stage integral of midpoint rule.
-     * This function should only be called by API <code>integrate()</code> in the package.
-     * To save time it does not verify arguments - caller does.
-     * <p>
-     * The interval is divided equally into 2^n sections rather than an
-     * arbitrary m sections because this configuration can best utilize the
-     * already computed values.</p>
-     *
-     * @param n the stage of 1/2 refinement. Must be larger than 0.
-     * @param previousStageResult Result from the previous call to the
-     * {@code stage} method.
-     * @param min Lower bound of the integration interval.
-     * @param diffMaxMin Difference between the lower bound and upper bound
-     * of the integration interval.
-     * @return the value of n-th stage integral
-     * @throws TooManyEvaluationsException if the maximal number of evaluations
-     * is exceeded.
-     */
-    private double stage(final int n,
-                         double previousStageResult,
-                         double min,
-                         double diffMaxMin)
-        throws TooManyEvaluationsException {
-
-        // number of new points in this stage
-        final long np = 1L << (n - 1);
-        double sum = 0;
-
-        // spacing between adjacent new points
-        final double spacing = diffMaxMin / np;
-
-        // the first new point
-        double x = min + 0.5 * spacing;
-        for (long i = 0; i < np; i++) {
-            sum += computeObjectiveValue(x);
-            x += spacing;
-        }
-        // add the new sum to previously calculated result
-        return 0.5 * (previousStageResult + sum * spacing);
-    }
-
-
-    /** {@inheritDoc} */
-    @Override
-    protected double doIntegrate()
-        throws MathIllegalArgumentException, TooManyEvaluationsException, MaxCountExceededException {
-
-        final double min = getMin();
-        final double diff = getMax() - min;
-        final double midPoint = min + 0.5 * diff;
-
-        double oldt = diff * computeObjectiveValue(midPoint);
-
-        while (true) {
-            iterations.incrementCount();
-            final int i = iterations.getCount();
-            final double t = stage(i, oldt, min, diff);
-            if (i >= getMinimalIterationCount()) {
-                final double delta = FastMath.abs(t - oldt);
-                final double rLimit =
-                        getRelativeAccuracy() * (FastMath.abs(oldt) + FastMath.abs(t)) * 0.5;
-                if ((delta <= rLimit) || (delta <= getAbsoluteAccuracy())) {
-                    return t;
-                }
-            }
-            oldt = t;
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/RombergIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/RombergIntegrator.java b/src/main/java/org/apache/commons/math3/analysis/integration/RombergIntegrator.java
deleted file mode 100644
index 430cd6e..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/RombergIntegrator.java
+++ /dev/null
@@ -1,142 +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.math3.analysis.integration;
-
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implements the <a href="http://mathworld.wolfram.com/RombergIntegration.html">
- * Romberg Algorithm</a> for integration of real univariate functions. For
- * reference, see <b>Introduction to Numerical Analysis</b>, ISBN 038795452X,
- * chapter 3.
- * <p>
- * Romberg integration employs k successive refinements of the trapezoid
- * rule to remove error terms less than order O(N^(-2k)). Simpson's rule
- * is a special case of k = 2.</p>
- *
- * @since 1.2
- */
-public class RombergIntegrator extends BaseAbstractUnivariateIntegrator {
-
-    /** Maximal number of iterations for Romberg. */
-    public static final int ROMBERG_MAX_ITERATIONS_COUNT = 32;
-
-    /**
-     * Build a Romberg integrator with given accuracies and iterations counts.
-     * @param relativeAccuracy relative accuracy of the result
-     * @param absoluteAccuracy absolute accuracy of the result
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * (must be less than or equal to {@link #ROMBERG_MAX_ITERATIONS_COUNT})
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     * @exception NumberIsTooLargeException if maximal number of iterations
-     * is greater than {@link #ROMBERG_MAX_ITERATIONS_COUNT}
-     */
-    public RombergIntegrator(final double relativeAccuracy,
-                             final double absoluteAccuracy,
-                             final int minimalIterationCount,
-                             final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException {
-        super(relativeAccuracy, absoluteAccuracy, minimalIterationCount, maximalIterationCount);
-        if (maximalIterationCount > ROMBERG_MAX_ITERATIONS_COUNT) {
-            throw new NumberIsTooLargeException(maximalIterationCount,
-                                                ROMBERG_MAX_ITERATIONS_COUNT, false);
-        }
-    }
-
-    /**
-     * Build a Romberg integrator with given iteration counts.
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * (must be less than or equal to {@link #ROMBERG_MAX_ITERATIONS_COUNT})
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     * @exception NumberIsTooLargeException if maximal number of iterations
-     * is greater than {@link #ROMBERG_MAX_ITERATIONS_COUNT}
-     */
-    public RombergIntegrator(final int minimalIterationCount,
-                             final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException {
-        super(minimalIterationCount, maximalIterationCount);
-        if (maximalIterationCount > ROMBERG_MAX_ITERATIONS_COUNT) {
-            throw new NumberIsTooLargeException(maximalIterationCount,
-                                                ROMBERG_MAX_ITERATIONS_COUNT, false);
-        }
-    }
-
-    /**
-     * Construct a Romberg integrator with default settings
-     * (max iteration count set to {@link #ROMBERG_MAX_ITERATIONS_COUNT})
-     */
-    public RombergIntegrator() {
-        super(DEFAULT_MIN_ITERATIONS_COUNT, ROMBERG_MAX_ITERATIONS_COUNT);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected double doIntegrate()
-        throws TooManyEvaluationsException, MaxCountExceededException {
-
-        final int m = iterations.getMaximalCount() + 1;
-        double previousRow[] = new double[m];
-        double currentRow[]  = new double[m];
-
-        TrapezoidIntegrator qtrap = new TrapezoidIntegrator();
-        currentRow[0] = qtrap.stage(this, 0);
-        iterations.incrementCount();
-        double olds = currentRow[0];
-        while (true) {
-
-            final int i = iterations.getCount();
-
-            // switch rows
-            final double[] tmpRow = previousRow;
-            previousRow = currentRow;
-            currentRow = tmpRow;
-
-            currentRow[0] = qtrap.stage(this, i);
-            iterations.incrementCount();
-            for (int j = 1; j <= i; j++) {
-                // Richardson extrapolation coefficient
-                final double r = (1L << (2 * j)) - 1;
-                final double tIJm1 = currentRow[j - 1];
-                currentRow[j] = tIJm1 + (tIJm1 - previousRow[j - 1]) / r;
-            }
-            final double s = currentRow[i];
-            if (i >= getMinimalIterationCount()) {
-                final double delta  = FastMath.abs(s - olds);
-                final double rLimit = getRelativeAccuracy() * (FastMath.abs(olds) + FastMath.abs(s)) * 0.5;
-                if ((delta <= rLimit) || (delta <= getAbsoluteAccuracy())) {
-                    return s;
-                }
-            }
-            olds = s;
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/SimpsonIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/SimpsonIntegrator.java b/src/main/java/org/apache/commons/math3/analysis/integration/SimpsonIntegrator.java
deleted file mode 100644
index b13ff5f..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/SimpsonIntegrator.java
+++ /dev/null
@@ -1,129 +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.math3.analysis.integration;
-
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implements <a href="http://mathworld.wolfram.com/SimpsonsRule.html">
- * Simpson's Rule</a> for integration of real univariate functions. For
- * reference, see <b>Introduction to Numerical Analysis</b>, ISBN 038795452X,
- * chapter 3.
- * <p>
- * This implementation employs the basic trapezoid rule to calculate Simpson's
- * rule.</p>
- *
- * @since 1.2
- */
-public class SimpsonIntegrator extends BaseAbstractUnivariateIntegrator {
-
-    /** Maximal number of iterations for Simpson. */
-    public static final int SIMPSON_MAX_ITERATIONS_COUNT = 64;
-
-    /**
-     * Build a Simpson integrator with given accuracies and iterations counts.
-     * @param relativeAccuracy relative accuracy of the result
-     * @param absoluteAccuracy absolute accuracy of the result
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * (must be less than or equal to {@link #SIMPSON_MAX_ITERATIONS_COUNT})
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     * @exception NumberIsTooLargeException if maximal number of iterations
-     * is greater than {@link #SIMPSON_MAX_ITERATIONS_COUNT}
-     */
-    public SimpsonIntegrator(final double relativeAccuracy,
-                             final double absoluteAccuracy,
-                             final int minimalIterationCount,
-                             final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException {
-        super(relativeAccuracy, absoluteAccuracy, minimalIterationCount, maximalIterationCount);
-        if (maximalIterationCount > SIMPSON_MAX_ITERATIONS_COUNT) {
-            throw new NumberIsTooLargeException(maximalIterationCount,
-                                                SIMPSON_MAX_ITERATIONS_COUNT, false);
-        }
-    }
-
-    /**
-     * Build a Simpson integrator with given iteration counts.
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * (must be less than or equal to {@link #SIMPSON_MAX_ITERATIONS_COUNT})
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     * @exception NumberIsTooLargeException if maximal number of iterations
-     * is greater than {@link #SIMPSON_MAX_ITERATIONS_COUNT}
-     */
-    public SimpsonIntegrator(final int minimalIterationCount,
-                             final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException {
-        super(minimalIterationCount, maximalIterationCount);
-        if (maximalIterationCount > SIMPSON_MAX_ITERATIONS_COUNT) {
-            throw new NumberIsTooLargeException(maximalIterationCount,
-                                                SIMPSON_MAX_ITERATIONS_COUNT, false);
-        }
-    }
-
-    /**
-     * Construct an integrator with default settings.
-     * (max iteration count set to {@link #SIMPSON_MAX_ITERATIONS_COUNT})
-     */
-    public SimpsonIntegrator() {
-        super(DEFAULT_MIN_ITERATIONS_COUNT, SIMPSON_MAX_ITERATIONS_COUNT);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected double doIntegrate()
-        throws TooManyEvaluationsException, MaxCountExceededException {
-
-        TrapezoidIntegrator qtrap = new TrapezoidIntegrator();
-        if (getMinimalIterationCount() == 1) {
-            return (4 * qtrap.stage(this, 1) - qtrap.stage(this, 0)) / 3.0;
-        }
-
-        // Simpson's rule requires at least two trapezoid stages.
-        double olds = 0;
-        double oldt = qtrap.stage(this, 0);
-        while (true) {
-            final double t = qtrap.stage(this, iterations.getCount());
-            iterations.incrementCount();
-            final double s = (4 * t - oldt) / 3.0;
-            if (iterations.getCount() >= getMinimalIterationCount()) {
-                final double delta = FastMath.abs(s - olds);
-                final double rLimit =
-                    getRelativeAccuracy() * (FastMath.abs(olds) + FastMath.abs(s)) * 0.5;
-                if ((delta <= rLimit) || (delta <= getAbsoluteAccuracy())) {
-                    return s;
-                }
-            }
-            olds = s;
-            oldt = t;
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/TrapezoidIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/TrapezoidIntegrator.java b/src/main/java/org/apache/commons/math3/analysis/integration/TrapezoidIntegrator.java
deleted file mode 100644
index d22d12d..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/TrapezoidIntegrator.java
+++ /dev/null
@@ -1,168 +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.math3.analysis.integration;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implements the <a href="http://mathworld.wolfram.com/TrapezoidalRule.html">
- * Trapezoid Rule</a> for integration of real univariate functions. For
- * reference, see <b>Introduction to Numerical Analysis</b>, ISBN 038795452X,
- * chapter 3.
- * <p>
- * The function should be integrable.</p>
- *
- * @since 1.2
- */
-public class TrapezoidIntegrator extends BaseAbstractUnivariateIntegrator {
-
-    /** Maximum number of iterations for trapezoid. */
-    public static final int TRAPEZOID_MAX_ITERATIONS_COUNT = 64;
-
-    /** Intermediate result. */
-    private double s;
-
-    /**
-     * Build a trapezoid integrator with given accuracies and iterations counts.
-     * @param relativeAccuracy relative accuracy of the result
-     * @param absoluteAccuracy absolute accuracy of the result
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * (must be less than or equal to {@link #TRAPEZOID_MAX_ITERATIONS_COUNT}
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     * @exception NumberIsTooLargeException if maximal number of iterations
-     * is greater than {@link #TRAPEZOID_MAX_ITERATIONS_COUNT}
-     */
-    public TrapezoidIntegrator(final double relativeAccuracy,
-                               final double absoluteAccuracy,
-                               final int minimalIterationCount,
-                               final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException {
-        super(relativeAccuracy, absoluteAccuracy, minimalIterationCount, maximalIterationCount);
-        if (maximalIterationCount > TRAPEZOID_MAX_ITERATIONS_COUNT) {
-            throw new NumberIsTooLargeException(maximalIterationCount,
-                                                TRAPEZOID_MAX_ITERATIONS_COUNT, false);
-        }
-    }
-
-    /**
-     * Build a trapezoid integrator with given iteration counts.
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * (must be less than or equal to {@link #TRAPEZOID_MAX_ITERATIONS_COUNT}
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     * @exception NumberIsTooLargeException if maximal number of iterations
-     * is greater than {@link #TRAPEZOID_MAX_ITERATIONS_COUNT}
-     */
-    public TrapezoidIntegrator(final int minimalIterationCount,
-                               final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException {
-        super(minimalIterationCount, maximalIterationCount);
-        if (maximalIterationCount > TRAPEZOID_MAX_ITERATIONS_COUNT) {
-            throw new NumberIsTooLargeException(maximalIterationCount,
-                                                TRAPEZOID_MAX_ITERATIONS_COUNT, false);
-        }
-    }
-
-    /**
-     * Construct a trapezoid integrator with default settings.
-     * (max iteration count set to {@link #TRAPEZOID_MAX_ITERATIONS_COUNT})
-     */
-    public TrapezoidIntegrator() {
-        super(DEFAULT_MIN_ITERATIONS_COUNT, TRAPEZOID_MAX_ITERATIONS_COUNT);
-    }
-
-    /**
-     * Compute the n-th stage integral of trapezoid rule. This function
-     * should only be called by API <code>integrate()</code> in the package.
-     * To save time it does not verify arguments - caller does.
-     * <p>
-     * The interval is divided equally into 2^n sections rather than an
-     * arbitrary m sections because this configuration can best utilize the
-     * already computed values.</p>
-     *
-     * @param baseIntegrator integrator holding integration parameters
-     * @param n the stage of 1/2 refinement, n = 0 is no refinement
-     * @return the value of n-th stage integral
-     * @throws TooManyEvaluationsException if the maximal number of evaluations
-     * is exceeded.
-     */
-    double stage(final BaseAbstractUnivariateIntegrator baseIntegrator, final int n)
-        throws TooManyEvaluationsException {
-
-        if (n == 0) {
-            final double max = baseIntegrator.getMax();
-            final double min = baseIntegrator.getMin();
-            s = 0.5 * (max - min) *
-                      (baseIntegrator.computeObjectiveValue(min) +
-                       baseIntegrator.computeObjectiveValue(max));
-            return s;
-        } else {
-            final long np = 1L << (n-1);           // number of new points in this stage
-            double sum = 0;
-            final double max = baseIntegrator.getMax();
-            final double min = baseIntegrator.getMin();
-            // spacing between adjacent new points
-            final double spacing = (max - min) / np;
-            double x = min + 0.5 * spacing;    // the first new point
-            for (long i = 0; i < np; i++) {
-                sum += baseIntegrator.computeObjectiveValue(x);
-                x += spacing;
-            }
-            // add the new sum to previously calculated result
-            s = 0.5 * (s + sum * spacing);
-            return s;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected double doIntegrate()
-        throws MathIllegalArgumentException, TooManyEvaluationsException, MaxCountExceededException {
-
-        double oldt = stage(this, 0);
-        iterations.incrementCount();
-        while (true) {
-            final int i = iterations.getCount();
-            final double t = stage(this, i);
-            if (i >= getMinimalIterationCount()) {
-                final double delta = FastMath.abs(t - oldt);
-                final double rLimit =
-                    getRelativeAccuracy() * (FastMath.abs(oldt) + FastMath.abs(t)) * 0.5;
-                if ((delta <= rLimit) || (delta <= getAbsoluteAccuracy())) {
-                    return t;
-                }
-            }
-            oldt = t;
-            iterations.incrementCount();
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/UnivariateIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/UnivariateIntegrator.java b/src/main/java/org/apache/commons/math3/analysis/integration/UnivariateIntegrator.java
deleted file mode 100644
index f5673fb..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/UnivariateIntegrator.java
+++ /dev/null
@@ -1,92 +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.math3.analysis.integration;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-
-/**
- * Interface for univariate real integration algorithms.
- *
- * @since 1.2
- */
-public interface UnivariateIntegrator {
-
-    /**
-     * Get the actual relative accuracy.
-     * @return the accuracy
-     */
-    double getRelativeAccuracy();
-
-    /**
-     * Get the actual absolute accuracy.
-     *
-     * @return the accuracy
-     */
-    double getAbsoluteAccuracy();
-
-    /**
-     * Get the min limit for the number of iterations.
-     *
-     * @return the actual min limit
-     */
-    int getMinimalIterationCount();
-
-    /**
-     * Get the upper limit for the number of iterations.
-     *
-     * @return the actual upper limit
-     */
-    int getMaximalIterationCount();
-
-    /**
-     * Integrate the function in the given interval.
-     *
-     * @param maxEval Maximum number of evaluations.
-     * @param f the integrand function
-     * @param min the min bound for the interval
-     * @param max the upper bound for the interval
-     * @return the value of integral
-     * @throws TooManyEvaluationsException if the maximum number of function
-     * evaluations is exceeded.
-     * @throws MaxCountExceededException if the maximum iteration count is exceeded
-     * or the integrator detects convergence problems otherwise
-     * @throws MathIllegalArgumentException if min > max or the endpoints do not
-     * satisfy the requirements specified by the integrator
-     * @throws NullArgumentException if {@code f} is {@code null}.
-     */
-    double integrate(int maxEval, UnivariateFunction f, double min,
-                     double max)
-        throws TooManyEvaluationsException, MaxCountExceededException,
-               MathIllegalArgumentException, NullArgumentException;
-
-    /**
-     * Get the number of function evaluations of the last run of the integrator.
-     * @return number of function evaluations
-     */
-    int getEvaluations();
-
-    /**
-     * Get the number of iterations of the last run of the integrator.
-     * @return number of iterations
-     */
-    int getIterations();
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/gauss/BaseRuleFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/gauss/BaseRuleFactory.java b/src/main/java/org/apache/commons/math3/analysis/integration/gauss/BaseRuleFactory.java
deleted file mode 100644
index 556fa0c..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/gauss/BaseRuleFactory.java
+++ /dev/null
@@ -1,153 +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.math3.analysis.integration.gauss;
-
-import java.util.Map;
-import java.util.TreeMap;
-import org.apache.commons.math3.util.Pair;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Base class for rules that determines the integration nodes and their
- * weights.
- * Subclasses must implement the {@link #computeRule(int) computeRule} method.
- *
- * @param <T> Type of the number used to represent the points and weights of
- * the quadrature rules.
- *
- * @since 3.1
- */
-public abstract class BaseRuleFactory<T extends Number> {
-    /** List of points and weights, indexed by the order of the rule. */
-    private final Map<Integer, Pair<T[], T[]>> pointsAndWeights
-        = new TreeMap<Integer, Pair<T[], T[]>>();
-    /** Cache for double-precision rules. */
-    private final Map<Integer, Pair<double[], double[]>> pointsAndWeightsDouble
-        = new TreeMap<Integer, Pair<double[], double[]>>();
-
-    /**
-     * Gets a copy of the quadrature rule with the given number of integration
-     * points.
-     *
-     * @param numberOfPoints Number of integration points.
-     * @return a copy of the integration rule.
-     * @throws NotStrictlyPositiveException if {@code numberOfPoints < 1}.
-     * @throws DimensionMismatchException if the elements of the rule pair do not
-     * have the same length.
-     */
-    public Pair<double[], double[]> getRule(int numberOfPoints)
-        throws NotStrictlyPositiveException, DimensionMismatchException {
-
-        if (numberOfPoints <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_POINTS,
-                                                   numberOfPoints);
-        }
-
-        // Try to obtain the rule from the cache.
-        Pair<double[], double[]> cached = pointsAndWeightsDouble.get(numberOfPoints);
-
-        if (cached == null) {
-            // Rule not computed yet.
-
-            // Compute the rule.
-            final Pair<T[], T[]> rule = getRuleInternal(numberOfPoints);
-            cached = convertToDouble(rule);
-
-            // Cache it.
-            pointsAndWeightsDouble.put(numberOfPoints, cached);
-        }
-
-        // Return a copy.
-        return new Pair<double[], double[]>(cached.getFirst().clone(),
-                                            cached.getSecond().clone());
-    }
-
-    /**
-     * Gets a rule.
-     * Synchronization ensures that rules will be computed and added to the
-     * cache at most once.
-     * The returned rule is a reference into the cache.
-     *
-     * @param numberOfPoints Order of the rule to be retrieved.
-     * @return the points and weights corresponding to the given order.
-     * @throws DimensionMismatchException if the elements of the rule pair do not
-     * have the same length.
-     */
-    protected synchronized Pair<T[], T[]> getRuleInternal(int numberOfPoints)
-        throws DimensionMismatchException {
-        final Pair<T[], T[]> rule = pointsAndWeights.get(numberOfPoints);
-        if (rule == null) {
-            addRule(computeRule(numberOfPoints));
-            // The rule should be available now.
-            return getRuleInternal(numberOfPoints);
-        }
-        return rule;
-    }
-
-    /**
-     * Stores a rule.
-     *
-     * @param rule Rule to be stored.
-     * @throws DimensionMismatchException if the elements of the pair do not
-     * have the same length.
-     */
-    protected void addRule(Pair<T[], T[]> rule) throws DimensionMismatchException {
-        if (rule.getFirst().length != rule.getSecond().length) {
-            throw new DimensionMismatchException(rule.getFirst().length,
-                                                 rule.getSecond().length);
-        }
-
-        pointsAndWeights.put(rule.getFirst().length, rule);
-    }
-
-    /**
-     * Computes the rule for the given order.
-     *
-     * @param numberOfPoints Order of the rule to be computed.
-     * @return the computed rule.
-     * @throws DimensionMismatchException if the elements of the pair do not
-     * have the same length.
-     */
-    protected abstract Pair<T[], T[]> computeRule(int numberOfPoints)
-        throws DimensionMismatchException;
-
-    /**
-     * Converts the from the actual {@code Number} type to {@code double}
-     *
-     * @param <T> Type of the number used to represent the points and
-     * weights of the quadrature rules.
-     * @param rule Points and weights.
-     * @return points and weights as {@code double}s.
-     */
-    private static <T extends Number> Pair<double[], double[]> convertToDouble(Pair<T[], T[]> rule) {
-        final T[] pT = rule.getFirst();
-        final T[] wT = rule.getSecond();
-
-        final int len = pT.length;
-        final double[] pD = new double[len];
-        final double[] wD = new double[len];
-
-        for (int i = 0; i < len; i++) {
-            pD[i] = pT[i].doubleValue();
-            wD[i] = wT[i].doubleValue();
-        }
-
-        return new Pair<double[], double[]>(pD, wD);
-    }
-}


Mime
View raw message