gaussLaguerreQuadrature

Gauss-Laguerre Quadrature

@safe pure nothrow @nogc
size_t
gaussLaguerreQuadrature
(
T
)
(
scope T[] x
,
scope T[] w
,
scope T[] work
,
T alpha = 0
)

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

(optional) 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];

gaussLaguerreQuadrature(x, w, work);

static immutable xc =
   [ 0.26356032,
     1.41340306,
     3.59642577,
     7.08581001,
    12.64080084];

static immutable wc =
   [5.21755611e-01,
    3.98666811e-01,
    7.59424497e-02,
    3.61175868e-03,
    2.33699724e-05];

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

Meta