Method
NumCosmoMathSpectralcompute_chebyshev_coeffs
Declaration [src]
void
ncm_spectral_compute_chebyshev_coeffs (
NcmSpectral* spectral,
NcmSpectralF F,
gdouble a,
gdouble b,
guint order,
GArray** coeffs,
gpointer user_data
)
Description [src]
Computes Chebyshev coefficients of f(x) on [a,b] using FFTW DCT-I. The function F
is sampled at Chebyshev nodes $x_k = (a+b)/2 - (b-a)/2\cos(k\pi/(N-1))$ which correspond
to the Chebyshev points $t_k = \cos(k\pi/(N-1))$ in $[-1,1]$ transformed to $[a,b]$.
The Chebyshev expansion is $f(x) = f(t) = \sum_{k=0}^{N-1} a_k T_k(t)$ where
$t = (2x - (a+b))/(b-a)$.
If coeffs points to NULL, allocates a new GArray of size order. If coeffs points
to an existing GArray, resizes it to order. Through bindings, coeffs always receives NULL.
Parameters
F-
Type:
NcmSpectralFFunction to evaluate, receives x in [a,b].
a-
Type:
gdoubleLeft endpoint of the interval.
b-
Type:
gdoubleRight endpoint of the interval.
order-
Type:
guintNumber of Chebyshev coefficients to compute.
coeffs-
Type: An array of
doubleOutput array of coefficients.
The argument will be set by the function. The caller of the method takes ownership of the returned data, and is responsible for freeing it. user_data-
Type:
gpointerUser data for
F.The argument can be NULL.The data is owned by the caller of the method.