Class GaussianQuadrature
A Gaussian quadrature: the nodes and weights of an orthogonal polynomial's rule of a given order, from the eigen-decomposition of its recurrence's Jacobi matrix (G.H. Golub and J.H. Welsch, "Calculation of Gauss quadrature rules", Math. Comput. 23 (1969), 221-230), and the weighted sum of a function at the nodes.
public class GaussianQuadrature
- Inheritance
-
GaussianQuadrature
- Derived
- Inherited Members
Remarks
A weight whose quotient overflows or underflows is formed in logarithms; one that can't be recovered, its
eigenvector component zero, is dropped as QuantLib drops it. Order zero is refused: QuantLib allocates an array of
n − 1 elements, which wraps (gaussianquadratures.cpp:41), and throws C++'s std::bad_array_new_length.
Constructors
GaussianQuadrature(int, GaussianOrthogonalPolynomial)
Initializes a new instance of the GaussianQuadrature class.
public GaussianQuadrature(int n, GaussianOrthogonalPolynomial orthPoly)
Parameters
nintThe order, positive.
orthPolyGaussianOrthogonalPolynomialThe orthogonal polynomial.
Exceptions
- ArgumentNullException
orthPolyis null.- ArgumentOutOfRangeException
nis negative.- ArgumentException
nis zero.
Properties
Order
Gets the order, the number of nodes.
public int Order { get; }
Property Value
Methods
Evaluate(Func<double, double>)
The weighted sum of f at the nodes, from the last node to the first.
public double Evaluate(Func<double, double> f)
Parameters
Returns
- double
Σ wᵢ·f(xᵢ).
Exceptions
- ArgumentNullException
fis null.
Weights()
The weights.
public Vector Weights()
Returns
- Vector
A copy of the weights.
X()
The nodes.
public Vector X()
Returns
- Vector
A copy of the nodes.