Skip to content

Commit

Permalink
Merge 94f7208 into a2c3868
Browse files Browse the repository at this point in the history
  • Loading branch information
abchaubey committed Dec 21, 2020
2 parents a2c3868 + 94f7208 commit 8d2cccf
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 65 deletions.
Expand Up @@ -16,12 +16,7 @@
*/
package org.apache.commons.math4.analysis.integration;

import org.apache.commons.math4.exception.MathIllegalArgumentException;
import org.apache.commons.math4.exception.MaxCountExceededException;
import org.apache.commons.math4.exception.NotStrictlyPositiveException;
import org.apache.commons.math4.exception.NumberIsTooLargeException;
import org.apache.commons.math4.exception.NumberIsTooSmallException;
import org.apache.commons.math4.exception.TooManyEvaluationsException;
import org.apache.commons.math4.util.FastMath;

/**
Expand All @@ -47,9 +42,9 @@ public class MidPointIntegrator extends BaseAbstractUnivariateIntegrator {
* @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
* @exception org.apache.commons.math4.exception.NotStrictlyPositiveException if minimal number of iterations
* is not strictly positive
* @exception NumberIsTooSmallException if maximal number of iterations
* @exception org.apache.commons.math4.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 39.
Expand All @@ -69,9 +64,9 @@ public MidPointIntegrator(final double relativeAccuracy,
* Build a midpoint integrator with given iteration counts.
* @param minimalIterationCount minimum number of iterations
* @param maximalIterationCount maximum number of iterations
* @exception NotStrictlyPositiveException if minimal number of iterations
* @exception org.apache.commons.math4.exception.NotStrictlyPositiveException if minimal number of iterations
* is not strictly positive
* @exception NumberIsTooSmallException if maximal number of iterations
* @exception org.apache.commons.math4.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 39.
Expand Down Expand Up @@ -109,7 +104,7 @@ public MidPointIntegrator() {
* @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
* @throws org.apache.commons.math4.exception.TooManyEvaluationsException if the maximal number of evaluations
* is exceeded.
*/
private double stage(final int n,
Expand Down
Expand Up @@ -16,11 +16,7 @@
*/
package org.apache.commons.math4.analysis.integration;

import org.apache.commons.math4.exception.MaxCountExceededException;
import org.apache.commons.math4.exception.NotStrictlyPositiveException;
import org.apache.commons.math4.exception.NumberIsTooLargeException;
import org.apache.commons.math4.exception.NumberIsTooSmallException;
import org.apache.commons.math4.exception.TooManyEvaluationsException;
import org.apache.commons.math4.util.FastMath;

/**
Expand All @@ -47,9 +43,9 @@ public class RombergIntegrator extends BaseAbstractUnivariateIntegrator {
* @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
* @exception org.apache.commons.math4.exception.NotStrictlyPositiveException if minimal number of iterations
* is not strictly positive
* @exception NumberIsTooSmallException if maximal number of iterations
* @exception org.apache.commons.math4.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}
Expand All @@ -70,9 +66,9 @@ public RombergIntegrator(final double relativeAccuracy,
* @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
* @exception org.apache.commons.math4.exception.NotStrictlyPositiveException if minimal number of iterations
* is not strictly positive
* @exception NumberIsTooSmallException if maximal number of iterations
* @exception org.apache.commons.math4.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}
Expand Down
Expand Up @@ -16,9 +16,7 @@
*/
package org.apache.commons.math4.analysis.integration;

import org.apache.commons.math4.exception.NotStrictlyPositiveException;
import org.apache.commons.math4.exception.NumberIsTooLargeException;
import org.apache.commons.math4.exception.NumberIsTooSmallException;
import org.apache.commons.math4.util.FastMath;

/**
Expand All @@ -44,9 +42,9 @@ public class SimpsonIntegrator extends BaseAbstractUnivariateIntegrator {
* @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
* @exception org.apache.commons.math4.exception.NotStrictlyPositiveException if minimal number of iterations
* is not strictly positive
* @exception NumberIsTooSmallException if maximal number of iterations
* @exception org.apache.commons.math4.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}
Expand All @@ -67,9 +65,9 @@ public SimpsonIntegrator(final double relativeAccuracy,
* @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
* @exception org.apache.commons.math4.exception.NotStrictlyPositiveException if minimal number of iterations
* is not strictly positive
* @exception NumberIsTooSmallException if maximal number of iterations
* @exception org.apache.commons.math4.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}
Expand Down
Expand Up @@ -16,12 +16,7 @@
*/
package org.apache.commons.math4.analysis.integration;

import org.apache.commons.math4.exception.MathIllegalArgumentException;
import org.apache.commons.math4.exception.MaxCountExceededException;
import org.apache.commons.math4.exception.NotStrictlyPositiveException;
import org.apache.commons.math4.exception.NumberIsTooLargeException;
import org.apache.commons.math4.exception.NumberIsTooSmallException;
import org.apache.commons.math4.exception.TooManyEvaluationsException;
import org.apache.commons.math4.util.FastMath;

/**
Expand All @@ -48,9 +43,9 @@ public class TrapezoidIntegrator extends BaseAbstractUnivariateIntegrator {
* @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
* @exception org.apache.commons.math4.exception.NotStrictlyPositiveException if minimal number of iterations
* is not strictly positive
* @exception NumberIsTooSmallException if maximal number of iterations
* @exception org.apache.commons.math4.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 63.
Expand All @@ -70,9 +65,9 @@ public TrapezoidIntegrator(final double relativeAccuracy,
* Build a trapezoid integrator with given iteration counts.
* @param minimalIterationCount minimum number of iterations
* @param maximalIterationCount maximum number of iterations
* @exception NotStrictlyPositiveException if minimal number of iterations
* @exception org.apache.commons.math4.exception.NotStrictlyPositiveException if minimal number of iterations
* is not strictly positive
* @exception NumberIsTooSmallException if maximal number of iterations
* @exception org.apache.commons.math4.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 63.
Expand Down Expand Up @@ -106,7 +101,7 @@ public TrapezoidIntegrator() {
* @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
* @throws org.apache.commons.math4.exception.TooManyEvaluationsException if the maximal number of evaluations
* is exceeded.
*/
double stage(final BaseAbstractUnivariateIntegrator baseIntegrator, final int n) {
Expand Down
Expand Up @@ -17,10 +17,6 @@
package org.apache.commons.math4.analysis.integration;

import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.exception.MathIllegalArgumentException;
import org.apache.commons.math4.exception.MaxCountExceededException;
import org.apache.commons.math4.exception.NullArgumentException;
import org.apache.commons.math4.exception.TooManyEvaluationsException;

/**
* Interface for univariate real integration algorithms.
Expand Down Expand Up @@ -65,13 +61,13 @@ public interface UnivariateIntegrator {
* @param min the lower 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
* @throws org.apache.commons.math4.exception.TooManyEvaluationsException if the maximum number of function
* evaluations is exceeded
* @throws MaxCountExceededException if the maximum iteration count is exceeded
* @throws org.apache.commons.math4.exception.MaxCountExceededException if the maximum iteration count is exceeded
* or the integrator detects convergence problems otherwise
* @throws MathIllegalArgumentException if {@code min > max} or the endpoints do not
* @throws org.apache.commons.math4.exception.MathIllegalArgumentException if {@code min > max} or the endpoints do not
* satisfy the requirements specified by the integrator
* @throws NullArgumentException if {@code f} is {@code null}.
* @throws org.apache.commons.math4.exception.NullArgumentException if {@code f} is {@code null}.
*/
double integrate(int maxEval, UnivariateFunction f, double min, double max);

Expand Down
Expand Up @@ -18,7 +18,6 @@

import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.exception.DimensionMismatchException;
import org.apache.commons.math4.exception.NonMonotonicSequenceException;
import org.apache.commons.math4.util.MathArrays;
import org.apache.commons.math4.util.Pair;

Expand All @@ -42,7 +41,7 @@ public class GaussIntegrator {
*
* @param points Integration points.
* @param weights Weights of the corresponding integration nodes.
* @throws NonMonotonicSequenceException if the {@code points} are not
* @throws org.apache.commons.math4.exception.NonMonotonicSequenceException if the {@code points} are not
* sorted in increasing order.
* @throws DimensionMismatchException if points and weights don't have the same length
*/
Expand All @@ -64,7 +63,7 @@ public GaussIntegrator(double[] points,
* the pair) and weights (second element of the pair.
*
* @param pointsAndWeights Integration points and corresponding weights.
* @throws NonMonotonicSequenceException if the {@code points} are not
* @throws org.apache.commons.math4.exception.NonMonotonicSequenceException if the {@code points} are not
* sorted in increasing order.
*
* @see #GaussIntegrator(double[], double[])
Expand Down
Expand Up @@ -16,11 +16,8 @@
*/
package org.apache.commons.math4.analysis.integration.gauss;

import java.math.BigDecimal;

import org.apache.commons.math4.exception.DimensionMismatchException;
import org.apache.commons.math4.exception.NotStrictlyPositiveException;
import org.apache.commons.math4.util.Pair;
import java.math.BigDecimal;

/**
* Class that provides different ways to compute the nodes and weights to be
Expand Down Expand Up @@ -81,7 +78,7 @@ public GaussIntegrator legendre(int numberOfPoints) {
* @param lowerBound Lower bound of the integration interval.
* @param upperBound Upper bound of the integration interval.
* @return a Gauss-Legendre integrator.
* @throws NotStrictlyPositiveException if number of points is not positive
* @throws org.apache.commons.math4.exception.NotStrictlyPositiveException if number of points is not positive
*/
public GaussIntegrator legendre(int numberOfPoints,
double lowerBound,
Expand All @@ -99,7 +96,7 @@ public GaussIntegrator legendre(int numberOfPoints,
*
* @param numberOfPoints Order of the integration rule.
* @return a Gauss-Legendre integrator.
* @throws NotStrictlyPositiveException if number of points is not positive
* @throws org.apache.commons.math4.exception.NotStrictlyPositiveException if number of points is not positive
*/
public GaussIntegrator legendreHighPrecision(int numberOfPoints) {
return new GaussIntegrator(getRule(legendreHighPrecision, numberOfPoints));
Expand All @@ -114,7 +111,7 @@ public GaussIntegrator legendreHighPrecision(int numberOfPoints) {
* @param lowerBound Lower bound of the integration interval.
* @param upperBound Upper bound of the integration interval.
* @return a Gauss-Legendre integrator.
* @throws NotStrictlyPositiveException if number of points is not positive
* @throws org.apache.commons.math4.exception.NotStrictlyPositiveException if number of points is not positive
*/
public GaussIntegrator legendreHighPrecision(int numberOfPoints,
double lowerBound,
Expand Down Expand Up @@ -145,8 +142,8 @@ public SymmetricGaussIntegrator hermite(int numberOfPoints) {
* @param factory Integration rule factory.
* @param numberOfPoints Order of the integration rule.
* @return the integration nodes and weights.
* @throws NotStrictlyPositiveException if number of points is not positive
* @throws DimensionMismatchException if the elements of the rule pair do not
* @throws org.apache.commons.math4.exception.NotStrictlyPositiveException if number of points is not positive
* @throws org.apache.commons.math4.exception.DimensionMismatchException if the elements of the rule pair do not
* have the same length.
*/
private static Pair<double[], double[]> getRule(BaseRuleFactory<? extends Number> factory,
Expand Down
Expand Up @@ -16,7 +16,6 @@
*/
package org.apache.commons.math4.analysis.integration.gauss;

import org.apache.commons.math4.exception.DimensionMismatchException;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.Pair;

Expand Down
Expand Up @@ -20,7 +20,6 @@

import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
import org.apache.commons.math4.analysis.polynomials.PolynomialsUtils;
import org.apache.commons.math4.exception.DimensionMismatchException;
import org.apache.commons.math4.linear.EigenDecomposition;
import org.apache.commons.math4.linear.MatrixUtils;
import org.apache.commons.math4.linear.RealMatrix;
Expand Down
Expand Up @@ -16,12 +16,11 @@
*/
package org.apache.commons.math4.analysis.integration.gauss;

import org.apache.commons.math4.util.Pair;

import java.math.BigDecimal;
import java.math.MathContext;

import org.apache.commons.math4.exception.DimensionMismatchException;
import org.apache.commons.math4.util.Pair;

/**
* Factory that creates Gauss-type quadrature rule using Legendre polynomials.
* In this implementation, the lower and upper bounds of the natural interval
Expand Down
Expand Up @@ -16,7 +16,6 @@
*/
package org.apache.commons.math4.analysis.integration.gauss;

import org.apache.commons.math4.exception.DimensionMismatchException;
import org.apache.commons.math4.util.Pair;

/**
Expand Down
Expand Up @@ -17,8 +17,6 @@
package org.apache.commons.math4.analysis.integration.gauss;

import org.apache.commons.math4.analysis.UnivariateFunction;
import org.apache.commons.math4.exception.DimensionMismatchException;
import org.apache.commons.math4.exception.NonMonotonicSequenceException;
import org.apache.commons.math4.util.Pair;

/**
Expand All @@ -36,9 +34,9 @@ public class SymmetricGaussIntegrator extends GaussIntegrator {
*
* @param points Integration points.
* @param weights Weights of the corresponding integration nodes.
* @throws NonMonotonicSequenceException if the {@code points} are not
* @throws org.apache.commons.math4.exception.NonMonotonicSequenceException if the {@code points} are not
* sorted in increasing order.
* @throws DimensionMismatchException if points and weights don't have the same length
* @throws org.apache.commons.math4.exception.DimensionMismatchException if points and weights don't have the same length
*/
public SymmetricGaussIntegrator(double[] points,
double[] weights) {
Expand All @@ -50,7 +48,7 @@ public SymmetricGaussIntegrator(double[] points,
* the pair) and weights (second element of the pair.
*
* @param pointsAndWeights Integration points and corresponding weights.
* @throws NonMonotonicSequenceException if the {@code points} are not
* @throws org.apache.commons.math4.exception.NonMonotonicSequenceException if the {@code points} are not
* sorted in increasing order.
*
* @see #SymmetricGaussIntegrator(double[], double[])
Expand Down

0 comments on commit 8d2cccf

Please sign in to comment.