org.apache.commons.math3.analysis.integration.gauss
Class GaussIntegratorFactory

java.lang.Object
  extended by org.apache.commons.math3.analysis.integration.gauss.GaussIntegratorFactory

public class GaussIntegratorFactory
extends Object

Class that provides different ways to compute the nodes and weights to be used by the Gaussian integration rule.

Since:
3.1
Version:
$Id: GaussIntegratorFactory.java 1364420 2012-07-22 20:01:12Z tn $

Field Summary
private  BaseRuleFactory<Double> legendre
          Generator of Gauss-Legendre integrators.
private  BaseRuleFactory<BigDecimal> legendreHighPrecision
          Generator of Gauss-Legendre integrators.
 
Constructor Summary
GaussIntegratorFactory()
           
 
Method Summary
private static Pair<double[],double[]> getRule(BaseRuleFactory<? extends Number> factory, int numberOfPoints)
           
 GaussIntegrator legendre(int numberOfPoints)
          Creates an integrator of the given order, and whose call to the integrate method will perform an integration on the natural interval [-1 , 1].
 GaussIntegrator legendre(int numberOfPoints, double lowerBound, double upperBound)
          Creates an integrator of the given order, and whose call to the integrate method will perform an integration on the given interval.
 GaussIntegrator legendreHighPrecision(int numberOfPoints)
          Creates an integrator of the given order, and whose call to the integrate method will perform an integration on the natural interval [-1 , 1].
 GaussIntegrator legendreHighPrecision(int numberOfPoints, double lowerBound, double upperBound)
          Creates an integrator of the given order, and whose call to the integrate method will perform an integration on the given interval.
private static Pair<double[],double[]> transform(Pair<double[],double[]> rule, double a, double b)
          Performs a change of variable so that the integration can be performed on an arbitrary interval [a, b].
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

legendre

private final BaseRuleFactory<Double> legendre
Generator of Gauss-Legendre integrators.


legendreHighPrecision

private final BaseRuleFactory<BigDecimal> legendreHighPrecision
Generator of Gauss-Legendre integrators.

Constructor Detail

GaussIntegratorFactory

public GaussIntegratorFactory()
Method Detail

legendre

public GaussIntegrator legendre(int numberOfPoints)
Creates an integrator of the given order, and whose call to the integrate method will perform an integration on the natural interval [-1 , 1].

Parameters:
numberOfPoints - Order of the integration rule.
Returns:
a Gauss-Legendre integrator.

legendre

public GaussIntegrator legendre(int numberOfPoints,
                                double lowerBound,
                                double upperBound)
Creates an integrator of the given order, and whose call to the integrate method will perform an integration on the given interval.

Parameters:
numberOfPoints - Order of the integration rule.
lowerBound - Lower bound of the integration interval.
upperBound - Upper bound of the integration interval.
Returns:
a Gauss-Legendre integrator.

legendreHighPrecision

public GaussIntegrator legendreHighPrecision(int numberOfPoints)
Creates an integrator of the given order, and whose call to the integrate method will perform an integration on the natural interval [-1 , 1].

Parameters:
numberOfPoints - Order of the integration rule.
Returns:
a Gauss-Legendre integrator.

legendreHighPrecision

public GaussIntegrator legendreHighPrecision(int numberOfPoints,
                                             double lowerBound,
                                             double upperBound)
Creates an integrator of the given order, and whose call to the integrate method will perform an integration on the given interval.

Parameters:
numberOfPoints - Order of the integration rule.
lowerBound - Lower bound of the integration interval.
upperBound - Upper bound of the integration interval.
Returns:
a Gauss-Legendre integrator.

getRule

private static Pair<double[],double[]> getRule(BaseRuleFactory<? extends Number> factory,
                                               int numberOfPoints)
Parameters:
factory - Integration rule factory.
numberOfPoints - Order of the integration rule.
Returns:
the integration nodes and weights.

transform

private static Pair<double[],double[]> transform(Pair<double[],double[]> rule,
                                                 double a,
                                                 double b)
Performs a change of variable so that the integration can be performed on an arbitrary interval [a, b]. It is assumed that the natural interval is [-1, 1].

Parameters:
rule - Original points and weights.
a - Lower bound of the integration interval.
b - Lower bound of the integration interval.
Returns:
the points and weights adapted to the new interval.


Copyright (c) 2003-2013 Apache Software Foundation