Class MultidimIntegral
- Namespace
- NanoQL.Experimental
- Assembly
- NanoQL.dll
Integrates a scalar function of a vector over a box, one one-dimensional integrator per dimension, the last dimension outermost: it generalizes TwoDimensionalIntegral to any number of dimensions up to 15.
[Experimental("NQL0001")]
public sealed class MultidimIntegral
- Inheritance
-
MultidimIntegral
- Inherited Members
Remarks
Immutable; QuantLib's integration-variable buffer is a per-call buffer. An integration of no dimension is
refused: QuantLib's entry point reads integrationLevelEntries_[size - 1] of an empty set
(multidimintegrator.hpp:55), as one of more than 15 is, QuantLib's own check.
Constructors
MultidimIntegral(IEnumerable<Integrator>)
Initializes a new instance of the MultidimIntegral class.
public MultidimIntegral(IEnumerable<Integrator> integrators)
Parameters
integratorsIEnumerable<Integrator>One integrator per dimension, the first dimension's first.
Exceptions
- ArgumentNullException
integratorsor an element is null.- ArgumentException
There's no integrator, or more than 15 ("Too many dimensions in integration.").
Methods
Integrate(MultidimIntegrand, ReadOnlySpan<double>, ReadOnlySpan<double>)
The integral of a function over the box [a, b].
public double Integrate(MultidimIntegrand f, ReadOnlySpan<double> a, ReadOnlySpan<double> b)
Parameters
fMultidimIntegrandThe integrand.
aReadOnlySpan<double>The lower limit of each dimension.
bReadOnlySpan<double>The upper limit of each dimension.
Returns
- double
The integral.
Exceptions
- ArgumentNullException
fis null.- ArgumentException
The limits' sizes aren't the dimension ("Incompatible integration problem dimensions").