Method

NumCosmoMathSpectralcompute_chebyshev_coeffs_adaptive_weighted

Declaration [src]

guint
ncm_spectral_compute_chebyshev_coeffs_adaptive_weighted (
  NcmSpectral* spectral,
  NcmSpectralF F,
  gdouble a,
  gdouble b,
  guint k_min,
  gdouble tol,
  GArray** coeffs,
  gpointer user_data
)

Description [src]

Computes the Chebyshev coefficients of the weighted function $F(x(t))\sqrt{1-t^2}\,h$, with $h = (b-a)/2$, using the same adaptive nested grids as ncm_spectral_compute_chebyshev_coeffs_adaptive(). The weight turns the expansion into a Clenshaw–Curtis quadrature: $\int_a^b F(x)\,dx = \pi\,$ coeffs[0], and weighted inner products $\int_a^b F(x)G(x)\,dx$ follow from these coefficients and the standard coefficients of $G$. See the Spectral Methods page for the derivation.

If coeffs points to NULL, allocates a new GArray. If coeffs points to an existing GArray, resizes it as needed. Through bindings, coeffs always receives NULL.

Parameters

F

Type: NcmSpectralF

Function to evaluate, receives x in [a,b].

a

Type: gdouble

Left endpoint of the interval.

b

Type: gdouble

Right endpoint of the interval.

k_min

Type: guint

Minimum refinement level (N_min = 2^k_min + 1).

tol

Type: gdouble

Spectral convergence tolerance.

coeffs

Type: An array of double

Output 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: gpointer

User data for F.

The argument can be NULL.
The data is owned by the caller of the method.

Return value

Type: guint

The final refinement level k used (N = 2^k + 1).