Top Description Fields Constructors Methods
org.apache.commons.math3.analysis.integration.gauss

public abstract Class BaseRuleFactory<T extends Number>

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.commons.math3.analysis.integration.gauss.HermiteRuleFactory, org.apache.commons.math3.analysis.integration.gauss.LegendreHighPrecisionRuleFactory, org.apache.commons.math3.analysis.integration.gauss.LegendreRuleFactory
Type Parameters
<T>
Type of the number used to represent the points and weights of the quadrature rules.
Imports
java.util.Map, .TreeMap, org.apache.commons.math3.util.Pair, org.apache.commons.math3.exception.DimensionMismatchException, .NotStrictlyPositiveException, org.apache.commons.math3.exception.util.LocalizedFormats

Base class for rules that determines the integration nodes and their weights. Subclasses must implement the computeRule method.
Since
3.1

Field Summary

Modifier and TypeField and Description
private final Map<Integer, Pair<T[], T[]>>
pointsAndWeights

List of points and weights, indexed by the order of the rule.

private final Map<Integer, Pair<double[], double[]>>
pointsAndWeightsDouble

Cache for double-precision rules.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
addRule(Pair<T[], T[]>
Rule to be stored.
rule
)

Stores a rule.

protected abstract Pair<T[], T[]>

Returns:

the computed rule.
computeRule
(int
Order of the rule to be computed.
numberOfPoints
)

Computes the rule for the given order.

private static <
Type of the number used to represent the points and weights of the quadrature rules.
T extends Number
>
Pair<double[], double[]>

Returns:

points and weights as doubles.
convertToDouble
(Pair<T[], T[]>
Points and weights.
rule
)

Converts the from the actual Number type to double

public Pair<double[], double[]>

Returns:

a copy of the integration rule.
getRule
(int
Number of integration points.
numberOfPoints
)

Gets a copy of the quadrature rule with the given number of integration points.

protected synchronized Pair<T[], T[]>

Returns:

the points and weights corresponding to the given order.
getRuleInternal
(int
Order of the rule to be retrieved.
numberOfPoints
)

Gets a rule.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

pointsAndWeightsback to summary
private final Map<Integer, Pair<T[], T[]>> pointsAndWeights

List of points and weights, indexed by the order of the rule.

pointsAndWeightsDoubleback to summary
private final Map<Integer, Pair<double[], double[]>> pointsAndWeightsDouble

Cache for double-precision rules.

Constructor Detail

BaseRuleFactoryback to summary
public BaseRuleFactory()

Method Detail

addRuleback to summary
protected void addRule(Pair<T[], T[]> rule) throws DimensionMismatchException

Stores a rule.

Parameters
rule:Pair<T[], T[]>

Rule to be stored.

Exceptions
DimensionMismatchException:
if the elements of the pair do not have the same length.
computeRuleback to summary
protected abstract Pair<T[], T[]> computeRule(int numberOfPoints) throws DimensionMismatchException

Computes the rule for the given order.

Parameters
numberOfPoints:int

Order of the rule to be computed.

Returns:Pair<T[], T[]>

the computed rule.

Exceptions
DimensionMismatchException:
if the elements of the pair do not have the same length.
convertToDoubleback to summary
private static <T extends Number> Pair<double[], double[]> convertToDouble(Pair<T[], T[]> rule)

Converts the from the actual Number type to double

Parameters
<T>
Type of the number used to represent the points and weights of the quadrature rules.
rule:Pair<T[], T[]>

Points and weights.

Returns:Pair<double[], double[]>

points and weights as doubles.

getRuleback to summary
public Pair<double[], double[]> getRule(int numberOfPoints) throws NotStrictlyPositiveException, DimensionMismatchException

Gets a copy of the quadrature rule with the given number of integration points.

Parameters
numberOfPoints:int

Number of integration points.

Returns:Pair<double[], double[]>

a copy of the integration rule.

Exceptions
NotStrictlyPositiveException:
if numberOfPoints < 1.
DimensionMismatchException:
if the elements of the rule pair do not have the same length.
getRuleInternalback to summary
protected synchronized Pair<T[], T[]> getRuleInternal(int numberOfPoints) throws DimensionMismatchException

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.

Parameters
numberOfPoints:int

Order of the rule to be retrieved.

Returns:Pair<T[], T[]>

the points and weights corresponding to the given order.

Exceptions
DimensionMismatchException:
if the elements of the rule pair do not have the same length.