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 thecomputeRule
method.- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description FieldAbstractRuleFactory(Field<T> field)
Simple constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Pair<T[],T[]>
computeRule(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.Field<T>
getField()
Get the field to which rule coefficients belong.Pair<T[],T[]>
getRule(int numberOfPoints)
Gets a copy of the quadrature rule with the given number of integration points.
-
-
-
Method Detail
-
getField
public Field<T> getField()
Get the field to which rule coefficients belong.- Returns:
- field to which rule coefficients belong
-
getRule
public Pair<T[],T[]> getRule(int numberOfPoints) throws MathIllegalArgumentException
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
protected T[] findRoots(int n, CalculusFieldUnivariateFunction<T> ratioEvaluator)
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
protected void enforceSymmetry(T[] roots)
Enforce symmetry of roots.- Parameters:
roots
- roots to process in place
-
-