Class GaussKronrodNonAdaptive
The non-adaptive Gauss-Kronrod integration: QuantLib's 10-, 21-, 43- and 87-point rules in succession, each reusing its predecessors' points, until an estimate is within the absolute or the relative accuracy; for fast integration of smooth functions.
public sealed class GaussKronrodNonAdaptive : Integrator
- Inheritance
-
GaussKronrodNonAdaptive
- Inherited Members
Remarks
The rules sample the integrand at 87 points at most, on QUADPACK's qng abscissae and weights (L. W.
Fullerton, Bell Labs, 1981). Each integration's result carries its error estimate,
AbsoluteError, and its number of evaluations, 21, 43 or 87, which QuantLib keeps
in the integrator's mutable members (kronrodintegral.cpp:299-350);
IntegrationSuccess(IntegrationResult) reads them.
The maximum number of evaluations isn't a bound here: the last rule's result is returned whatever its error, and IntegrationSuccess(IntegrationResult) compares its count with the maximum, as QuantLib's does.
Constructors
GaussKronrodNonAdaptive(double, int, double)
Initializes a new instance of the GaussKronrodNonAdaptive class.
public GaussKronrodNonAdaptive(double absoluteAccuracy, int maxEvaluations, double relativeAccuracy)
Parameters
absoluteAccuracydoubleThe absolute accuracy, above machine epsilon.
maxEvaluationsintThe maximum number of evaluations, which IntegrationSuccess(IntegrationResult) compares with a result's count.
relativeAccuracydoubleThe relative accuracy.
Exceptions
- ArgumentException
absoluteAccuracyisn't above machine epsilon.- ArgumentOutOfRangeException
maxEvaluationsis negative.
Properties
RelativeAccuracy
Gets the relative accuracy.
public double RelativeAccuracy { get; }
Property Value
Methods
IntegrateCore(Func<double, double>, double, double)
The rule's integral over [a, b], a below b, with the number of evaluations it made and its error estimate, if it computes one.
protected override IntegrationResult IntegrateCore(Func<double, double> f, double a, double b)
Parameters
Returns
- IntegrationResult
The integral, the number of evaluations and the error estimate, or null for none.
Exceptions
- ArgumentException
The limits aren't ordered (a NaN limit).
SetRelativeAccuracy(double)
A copy of the integrator with the relative accuracy set; QuantLib's setter checks nothing.
public GaussKronrodNonAdaptive SetRelativeAccuracy(double relativeAccuracy)
Parameters
relativeAccuracydoubleThe relative accuracy.
Returns
- GaussKronrodNonAdaptive
The modified copy.