Class BaseRuleFactory<T extends Number>
java.lang.Object
org.apache.commons.math3.analysis.integration.gauss.BaseRuleFactory<T>
- Type Parameters:
T- Type of the number used to represent the points and weights of the quadrature rules.
- Direct Known Subclasses:
HermiteRuleFactory,LegendreHighPrecisionRuleFactory,LegendreRuleFactory
Base class for rules that determines the integration nodes and their
weights.
Subclasses must implement the
computeRule method.- Since:
- 3.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidStores a rule.computeRule(int numberOfPoints) Computes the rule for the given order.Pair<double[], double[]> getRule(int numberOfPoints) Gets a copy of the quadrature rule with the given number of integration points.getRuleInternal(int numberOfPoints) Gets a rule.
-
Constructor Details
-
BaseRuleFactory
public BaseRuleFactory()
-
-
Method Details
-
getRule
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- Number of integration points.- Returns:
- a copy of the integration rule.
- Throws:
NotStrictlyPositiveException- ifnumberOfPoints < 1.DimensionMismatchException- if the elements of the rule pair do not have the same length.
-
getRuleInternal
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- Order of the rule to be retrieved.- Returns:
- the points and weights corresponding to the given order.
- Throws:
DimensionMismatchException- if the elements of the rule pair do not have the same length.
-
addRule
Stores a rule.- Parameters:
rule- Rule to be stored.- Throws:
DimensionMismatchException- if the elements of the pair do not have the same length.
-
computeRule
Computes the rule for the given order.- Parameters:
numberOfPoints- Order of the rule to be computed.- Returns:
- the computed rule.
- Throws:
DimensionMismatchException- if the elements of the pair do not have the same length.
-