Class
NumCosmoMathSpectral
Description [src]
final class NumCosmoMath.Spectral : GObject.Object
{
/* No available fields */
}
Spectral methods for function approximation.
Represents a function on an interval by its Chebyshev series, computed adaptively on nested Chebyshev–Lobatto grids via FFTW. Provides Clenshaw–Curtis integration, Clenshaw evaluation and differentiation, and the banded ultraspherical (Gegenbauer) operators of the well-conditioned spectral method.
For the node placement, coefficient normalization, integration and operator formulas, see the theoretical background page: Spectral Methods.
Functions
ncm_spectral_chebT_to_gegenbauer_alpha1
Converts Chebyshev $T_n$ coefficients to Gegenbauer $C^{(1)}_n$ coefficients ($\alpha=1$), where $C^{(1)}_n = U_n$. See the Spectral Methods page for the conversion relation.
ncm_spectral_chebT_to_gegenbauer_alpha2
Converts Chebyshev $T_n$ coefficients to Gegenbauer $C^{(2)}_k$ coefficients ($\alpha=2$) via the basis-projection formula. See the Spectral Methods page for the formula.
ncm_spectral_chebyshev_deriv
Evaluates the first derivative of a Chebyshev expansion at $t$ using a fused backward recurrence and Clenshaw algorithm, without explicitly forming the derivative series. See the Spectral Methods page for the derivative-coefficient relations.
ncm_spectral_chebyshev_deriv_x
Evaluates the first derivative of a Chebyshev expansion at a point x in [a_v, b]. This function converts x to t using $t = (2x - (a_v+b))/(b-a_v)$, evaluates the derivative with respect to t using ncm_spectral_chebyshev_deriv(), and then applies the chain rule: $df/dx = (df/dt) \cdot (dt/dx) = (df/dt) \cdot 2/(b-a_v)$.
ncm_spectral_chebyshev_eval
Evaluates a Chebyshev expansion $f(t) = \sum_{k=0}^{N-1} a_k T_k(t)$ at t
using the Clenshaw recurrence, switching to the Reinsch modification near the
endpoints to avoid cancellation. The variable t should be in the interval
[-1, 1]. To evaluate at a point x in [a, b], use ncm_spectral_chebyshev_eval_x()
or first convert x to t using ncm_spectral_x_to_t(). See the
Spectral Methods page for details.
ncm_spectral_chebyshev_eval_x
Evaluates a Chebyshev expansion at a point x in [a_v, b]. This function converts x to t using $t = (2x - (a_v+b))/(b-a_v)$ and then calls ncm_spectral_chebyshev_eval().
ncm_spectral_clear
If spectral is not NULL, decreases the reference count of spectral by one
and sets the pointer to NULL.
ncm_spectral_compute_d2_row
Computes row k of the second derivative operator $\frac{d^2}{dx^2}$ that maps Chebyshev coefficients to Gegenbauer $C^{(2)}_k$ coefficients.
ncm_spectral_compute_d_row
Computes row k of the first derivative operator $\frac{d}{dx}$ that maps Chebyshev coefficients to Gegenbauer $C^{(2)}_k$ coefficients.
ncm_spectral_compute_proj_row
Computes row k of the projection operator that maps Chebyshev coefficients to Gegenbauer $C^{(2)}_k$ coefficients (ultraspherical basis with $\lambda=2$). This is the identity operator expressed in different bases.
ncm_spectral_compute_x2_d2_row
Computes row k of the $x^2 \cdot \frac{d^2}{dx^2}$ operator that maps Chebyshev coefficients to Gegenbauer $C^{(2)}_k$ coefficients.
ncm_spectral_compute_x2_row
Computes row k of the multiplication by $x^2$ operator that maps Chebyshev coefficients to Gegenbauer $C^{(2)}_k$ coefficients.
ncm_spectral_compute_x_d2_row
Computes row k of the $x \cdot \frac{d^2}{dx^2}$ operator that maps Chebyshev coefficients to Gegenbauer $C^{(2)}_k$ coefficients.
ncm_spectral_compute_x_d_row
Computes row k of the $x \cdot \frac{d}{dx}$ operator that maps Chebyshev coefficients to Gegenbauer $C^{(2)}_k$ coefficients.
ncm_spectral_compute_x_row
Computes row k of the multiplication by x operator that maps Chebyshev coefficients to Gegenbauer $C^{(2)}_k$ coefficients.
ncm_spectral_gegenbauer_alpha1_eval
Evaluates a Gegenbauer $C^{(1)}_n$ expansion at t using a stable recurrence
(with $C^{(1)}_n = U_n$). The variable t should be in the interval [-1, 1]. To
evaluate at a point x in [a, b], use ncm_spectral_gegenbauer_alpha1_eval_x() or
first convert x to t using ncm_spectral_x_to_t().
ncm_spectral_gegenbauer_alpha1_eval_x
Evaluates a Gegenbauer $C^{(1)}_n$ expansion at a point x in [a, b]. This function converts x to t using $t = (2x - (a+b))/(b-a)$ and then calls ncm_spectral_gegenbauer_alpha1_eval().
ncm_spectral_gegenbauer_alpha2_eval
Evaluates a Gegenbauer $C^{(2)}_n$ expansion at t using a stable recurrence.
The variable t should be in the interval [-1, 1]. To evaluate at a point x in
[a, b], use ncm_spectral_gegenbauer_alpha2_eval_x() or first convert x to t
using ncm_spectral_x_to_t(). See the
Spectral Methods page for the
$C^{(2)}_n$ recurrence.
ncm_spectral_gegenbauer_alpha2_eval_x
Evaluates a Gegenbauer $C^{(2)}_n$ expansion at a point x in [a, b]. This function converts x to t using $t = (2x - (a+b))/(b-a)$ and then calls ncm_spectral_gegenbauer_alpha2_eval().
ncm_spectral_get_d2_matrix
Returns the second derivative operator matrix that transforms Chebyshev $T_n$ coefficients of $f(x)$ to Gegenbauer $C^{(2)}_k$ coefficients of $\frac{d^2f}{dx^2}$.
ncm_spectral_get_d_matrix
Returns the derivative operator matrix that transforms Chebyshev $T_n$ coefficients of $f(x)$ to Gegenbauer $C^{(2)}_k$ coefficients of $\frac{df}{dx}$.
ncm_spectral_get_proj_matrix
Returns the projection (identity) operator matrix that transforms Chebyshev $T_n$ coefficients to Gegenbauer $C^{(2)}_k$ coefficients.
ncm_spectral_get_x2_d2_matrix
Returns the $x^2 \cdot \frac{d^2}{dx^2}$ operator matrix that transforms Chebyshev $T_n$ coefficients of $f(x)$ to Gegenbauer $C^{(2)}_k$ coefficients of $x^2 \cdot \frac{d^2f}{dx^2}$.
ncm_spectral_get_x2_matrix
Returns the multiplication by $x^2$ operator matrix that transforms Chebyshev $T_n$ coefficients of $f(x)$ to Gegenbauer $C^{(2)}_k$ coefficients of $x^2 \cdot f(x)$.
ncm_spectral_get_x_d2_matrix
Returns the $x \cdot \frac{d^2}{dx^2}$ operator matrix that transforms Chebyshev $T_n$ coefficients of $f(x)$ to Gegenbauer $C^{(2)}_k$ coefficients of $x \cdot \frac{d^2f}{dx^2}$.
ncm_spectral_get_x_d_matrix
Returns the $x \cdot \frac{d}{dx}$ operator matrix that transforms Chebyshev $T_n$ coefficients of $f(x)$ to Gegenbauer $C^{(2)}_k$ coefficients of $x \cdot \frac{df}{dx}$.
ncm_spectral_get_x_matrix
Returns the multiplication by $x$ operator matrix that transforms Chebyshev $T_n$ coefficients of $f(x)$ to Gegenbauer $C^{(2)}_k$ coefficients of $x \cdot f(x)$.
Instance methods
ncm_spectral_compute_chebyshev_coeffs
Computes order Chebyshev coefficients of $f(x)$ on $[a,b]$ at fixed resolution,
sampling F at the Chebyshev–Lobatto nodes and applying FFTW DCT-I. See the
Spectral Methods page for the node
placement and coefficient normalization.
ncm_spectral_compute_chebyshev_coeffs_adaptive
Computes Chebyshev coefficients of $f(x)$ on $[a,b]$ adaptively, starting at
level k_min and doubling the nested Chebyshev–Lobatto grid until the
coefficients converge to tol or max-order is reached. Only the new odd
nodes are evaluated at each refinement. See the
Spectral Methods page for the nested
grids and convergence criterion.
ncm_spectral_compute_chebyshev_coeffs_adaptive_weighted
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.
ncm_spectral_free
Decreases the reference count of spectral by one. If the reference count
reaches zero, the object is freed.
Properties
NumCosmoMath.Spectral:max-order
Maximum refinement level k for adaptive computations. The maximum number of nodes is N_max = 2^max_order + 1.
Signals
Signals inherited from GObject (1)
GObject::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.