gaussJacobiQuadrature

Gauss-Jacobi Quadrature

@safe pure nothrow @nogc
size_t
gaussJacobiQuadrature
(
T
)
(
scope T[] x
,
scope T[] w
,
scope T[] work
,,)

Parameters

x T[]

(out) user-allocated quadrature nodes in ascending order length of N

w T[]

(out) user-allocated corresponding quadrature weights length of N

work T[]

(temp) user-allocated workspace length of greate or equal to (N + 1) ^^ 2

alpha T

parameter '> -1'

beta T

parameter '> -1'

Return Value

Type: size_t

0 on success, xSTEQR LAPACK code on numerical error.

Examples

import mir.math.common;
import mir.ndslice.allocation;

auto n = 5;
auto x = new double[n];
auto w = new double[n];
auto work = new double[(n + 1) ^^ 2];

gaussJacobiQuadrature(x, w, work, 2.3, 3.6);

static immutable xc =
   [-0.6553677 ,
    -0.29480426,
     0.09956621,
     0.47584565,
     0.78356514];

static immutable wc =
   [0.02262392,
    0.19871672,
    0.43585107,
    0.32146619,
    0.0615342 ];

foreach (i; 0 .. n)
{
    assert(x[i].approxEqual(xc[i]));
    assert(w[i].approxEqual(wc[i]));
}

Meta