Class
NumCosmoMathSpectral
Functions
ncm_spectral_chebT_to_gegenbauer_alpha1
Converts Chebyshev $T_n$ coefficients to Gegenbauer $C^{(1)}n$ coefficients ($\alpha=1$). Uses the relationship: $T_n = \frac{1}{2}(C^{(1)}_n + C^{(1)}{n-2})$ for $n \geq 2$.
ncm_spectral_chebT_to_gegenbauer_alpha2
Converts Chebyshev $T_n$ coefficients to Gegenbauer $C^{(2)}_k$ coefficients ($\alpha=2$).
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 Clenshaw recurrence with Reinsch modification near endpoints.
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().
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 Clenshaw recurrence.
For $\alpha=1$, $C^{(1)}_n(t) = U_n(t)$ (Chebyshev polynomials of the second kind).
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 Clenshaw recurrence.
For $\alpha=2$, the recurrence relation is:
$(n+1) C^{(2)}{n+1}(t) = 2(n+2)t C^{(2)}n(t) - (n+3) C^{(2)}{n-1}(t)$
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().
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 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)$.
ncm_spectral_compute_chebyshev_coeffs_adaptive
Computes Chebyshev coefficients adaptively using nested Chebyshev-Lobatto nodes.
The function F is evaluated at points x in [a,b]. Starts at level k_min and refines
by doubling until spectral convergence is achieved or max_order is reached. Uses nested
nodes: only new odd nodes are computed at each refinement level.
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)$.
ncm_spectral_compute_chebyshev_coeffs_adaptive_weighted
Computes Chebyshev coefficients of $F(x(t)) \sqrt{1-t^2} h$ adaptively using nested Chebyshev-Lobatto nodes, where $h = (b-a)/2$. The weight factor $\sqrt{1-t^2} \cdot h$ enables direct integral computation: the integral $\int_a^b F(x)dx = \pi \cdot$ coeffs[0].
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.