Class FieldAbstractRuleFactory<T extends CalculusFieldElement<T>>
java.lang.Object
org.hipparchus.analysis.integration.gauss.FieldAbstractRuleFactory<T>
- Type Parameters:
T
- Type of the number used to represent the points and weights of the quadrature rules.
- All Implemented Interfaces:
FieldRuleFactory<T>
- Direct Known Subclasses:
FieldHermiteRuleFactory
,FieldLaguerreRuleFactory
,FieldLegendreRuleFactory
public abstract class FieldAbstractRuleFactory<T extends CalculusFieldElement<T>>
extends Object
implements FieldRuleFactory<T>
Base class for rules that determines the integration nodes and their
weights.
Subclasses must implement the
computeRule
method.- Since:
- 2.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncomputeRule
(int numberOfPoints) Computes the rule for the given order.protected void
enforceSymmetry
(T[] roots) Enforce symmetry of roots.protected T[]
findRoots
(int n, CalculusFieldUnivariateFunction<T> ratioEvaluator) Computes roots of the associated orthogonal polynomials.getField()
Get the field to which rule coefficients belong.getRule
(int numberOfPoints) Gets a copy of the quadrature rule with the given number of integration points.
-
Constructor Details
-
FieldAbstractRuleFactory
Simple constructor- Parameters:
field
- field to which rule coefficients belong
-
-
Method Details
-
getField
Get the field to which rule coefficients belong.- Returns:
- field to which rule coefficients belong
-
getRule
Gets a copy of the quadrature rule with the given number of integration points. The number of points is arbitrarily limited to 1000. It prevents resources exhaustion. In practice the number of points is often much lower.- Specified by:
getRule
in interfaceFieldRuleFactory<T extends CalculusFieldElement<T>>
- Parameters:
numberOfPoints
- Number of integration points.- Returns:
- a copy of the integration rule.
- Throws:
MathIllegalArgumentException
- ifnumberOfPoints < 1
.
-
computeRule
protected abstract Pair<T[],T[]> computeRule(int numberOfPoints) throws MathIllegalArgumentException Computes the rule for the given order.- Parameters:
numberOfPoints
- Order of the rule to be computed.- Returns:
- the computed rule.
- Throws:
MathIllegalArgumentException
- if the elements of the pair do not have the same length.
-
findRoots
Computes roots of the associated orthogonal polynomials.The roots are found using the Aberth method. The guess points for initializing search for degree n are fixed for degrees 1 and 2 and are selected from n-1 roots of rule n-1 (the two extreme roots are used, plus the n-1 intermediate points between all roots).
- Parameters:
n
- number of roots to search forratioEvaluator
- function evaluating the ratio Pₙ(x)/Pₙ'(x)- Returns:
- sorted array of roots
-
enforceSymmetry
Enforce symmetry of roots.- Parameters:
roots
- roots to process in place
-