Class

NumCosmoMathFftlog

Description [src]

abstract class NumCosmoMath.Fftlog : GObject.Object
{
  /* No available fields */
}

Abstract class for implementing logarithm fast fourier transform.

This class provides the tools to compute the Fast Fourier Transform of any function, which is assumed to be a periodic sequence of logarithmically spaced points. It is inspired on the approach FFTLog developed by [Hamilton (2000)][XHamilton2000] [arXiv], which was extended as described below.

A function $G(r)$ is written as \begin{equation}\label{eq:Gr} G(r) = \int_0^\infty F(k) \ K(kr) dk, \end{equation} where $F(k)$ is defined in the fundamental interval $[\ln k_0 - L/2, \ln k_0 + L/2]$, $L$ is the period, $\ln k_0$ is the center value and $K(kr)$ is a kernel function. Assuming that $F(k)$ can be written in terms of the $N$ lowest Fourier modes, we have

$$F(k) = \sum_{n} c_n e^{\frac{2\pi i n}{L} \ln\left(\frac{k}{k_0}\right)}.$$ Substituting $F(k)$ in Eq. \eqref{eq:Gr} and changing the variable $k \rightarrow t = kr$, thus \begin{align}\label{eq:Gr_decomp} r G(r) &= \sum_n c_n \int_0^\infty \frac{k}{k_0}^{\frac{2\pi i n}{L}} K(kr)^2 d(kr) \ &= \sum_n c_n \int_0^\infty \frac{t}{k_0 r}^{\frac{2\pi i n}{L}} K(t) dt \ &= \sum_n c_n e^{-\frac{2\pi i n}{L} \ln\left(\frac{r}{r_0}\right)} e^{-\frac{2\pi i n}{L} \ln(k_0 r_0)} Y_n, \end{align} where $$Y_n = \int_0^\infty t^{\frac{2\pi i n}{L}} K(t) dt,$$ and the Fourier coefficients are $$c_n = \frac{1}{N} \sum_m F(k_m) e^{- \frac{2\pi i nm}{N}}.$$ The total number of points $N$ corresponds to the number of knots in the fundamental interval, which is equally spaced.

The variables discretization is different depending whether $N$ is even or odd, in general $$ k_n = k_0 \mathrm{e}^{n L / N}, \qquad r_m = r_0 \mathrm{e}^{m L / N}. $$ If $N$ is odd, $n$ and $m$ runs from $[-\lfloor N/2\rfloor, \lfloor N/2\rfloor]$, where $\lfloor N/2\rfloor$ is the round-down (largest integer smaller than $N/2$) of $N/2$. In this case \begin{align} \ln\left(k_{-\lfloor N/2\rfloor}\right) = \ln(k_0) - \frac{(N-1)}{N} \frac{L}{2}, \ \ln\left(k_{+\lfloor N/2\rfloor}\right) = \ln(k_0) + \frac{(N-1)}{N} \frac{L}{2}. \end{align} This means that for odd $N$ the values of $k_n$ (and $r_n$) never touches the borders $\ln(k_0) \pm L/2$ and $\ln(r_0) \pm L/2$. On the other hand if $N$ is even ($\lfloor N/2\rfloor = N/2$) \begin{align} \ln\left(k_{-\lfloor N/2\rfloor}\right) = \ln(k_0) - \frac{L}{2}, \ \ln\left(k_{+\lfloor N/2\rfloor}\right) = \ln(k_0) + \frac{L}{2}. \end{align} However, since we are assuming that these functions are periodic with period $L$ these two points refer to the same value of the functions. Thus, we do not need to include both points and in the case of even $N$ we include the point $\ln(k_0) - \frac{L}{2}$ only. In the original [FFTLog][XHamilton2000] paper they include both points but give them a $1/2$ weight, here we avoid this complication by using the lower end point only.

The user must provide the following input values: $\ln k_0$ - ncm_fftlog_set_lnk0(), $\ln r_0$ - ncm_fftlog_set_lnr0(), $L$ - ncm_fftlog_set_length(), padding percentage - ncm_fftlog_set_padding(), $N$ - ncm_fftlog_set_size(), $F(k)$ (or $F(k_m)$ — see description below).

  • Since the algorithm assumes that the function to be decomposed is periodic, it is worth extending the interval in $\ln k$ such that $F(k) \equiv 0$ in the intervals $\left[\ln k_0 -\frac{L_T}{2}, \ln k_0 - \frac{L}{2} \right)$ and $ \left(\ln k_0 + \frac{L}{2}, \ln k_0 + \frac{L_T}{2}\right]$, where the total period $L_T$ is defined by the final number of knots, i.e., $N_f = N (1 + \mathrm{padding})$.
  • $N$ knots are equally distributed in the fundamental interval and $N \times \mathrm{padding}$ knots are distributed in the two symmetric intervals as mentioned above.
  • For the sake of optimization, the final number of points $N_f$ is substituted by the smallest number $N_f^\prime$ (bigger than $N_f$) which can be decomposed as $N_f \leq N_f^\prime = N^\prime (1 + \mathrm{padding}) = 2^a 3^b 5^c 7^d$, where $a$, $b$, $c$ and $d$ are positive integers.
  • The function $F(k)$ can be provided as:
  • a gsl_function - ncm_fftlog_eval_by_gsl_function() - whose values are computed at the knots within the fundamental interval, and set to zero within the padding intervals.
  • as a vector - ncm_fftlog_eval_by_vector() - first one must get the vector of $\ln k$ knots, ncm_fftlog_get_lnk_vector(), and then pass a vector containing the values of the function computed at each knot.

  • Regarding $Y_n$, see the different implementations of NcmFftlog, e.g., NcmFftlogTophatwin2 and NcmFftlogGausswin2.

Ancestors

Functions

ncm_fftlog_clear

If fftlog is different from NULL, decreases the reference count of fftlog by one and sets fftlog to NULL.

Instance methods

ncm_fftlog_calibrate_size

Increases the original (input) number of knots until the $G(r)$ splines reach the required precision reltol.

ncm_fftlog_calibrate_size_gsl

Increases the original (input) number of knots until the $G(r)$ splines reach the required precision reltol.

ncm_fftlog_eval_by_function

Evaluates the function Fk at each knot $\ln k_m$.

ncm_fftlog_eval_by_gsl_function

Evaluates the function Fk at each knot $\ln k_m$.

ncm_fftlog_eval_by_vector

Fk is a vector which contains the values of the function at each knot $\ln k_m$.

ncm_fftlog_eval_output

Evaluates the function $G(r)$, or the nderiv-th derivative, at the point lnr.

ncm_fftlog_free

Decreases the reference count of fftlog by one.

ncm_fftlog_get_Ym

Computes the $Y_m$ vector.

ncm_fftlog_get_array_index

Gets the array index i of the Fourier decomposition. This index corresponds the position in the fft array of the element $n$ in Eq. \eqref{eq:Gr_decomp}.

ncm_fftlog_get_eval_r_max
No description available.

ncm_fftlog_get_eval_r_min
No description available.

ncm_fftlog_get_full_length

Gets the value of the total period, i.e., period defined by the fundamental interval plus the padding size.

ncm_fftlog_get_full_size

Gets the number of knots $N_f^\prime$ where the integrated function is evaluated plus padding.

ncm_fftlog_get_length

Gets the value of the “physical” period, i.e., period of the fundamental interval.

ncm_fftlog_get_lnk0

Gets the center of the transform input $\ln(k_0)$.

ncm_fftlog_get_lnk_vector

Computes the $\ln k$ vector.

ncm_fftlog_get_lnr0

Gets the center of the transform output.

ncm_fftlog_get_max_size

Gets the maximum number of knots in the fundamental interval.

ncm_fftlog_get_mode_index

Gets the index of the mode i of the Fourier decomposition. This index corresponds to the label $n$ in Eq. \eqref{eq:Gr_decomp}.

ncm_fftlog_get_nderivs

Gets the number of derivatives the object is currently calculating.

ncm_fftlog_get_noring
No description available.

ncm_fftlog_get_norma

Gets the number of knots $N_f^\prime$ where the integrated function is evaluated plus padding.

ncm_fftlog_get_padding

Gets the padding percentage.

ncm_fftlog_get_size

Gets the number of knots $N^\prime$ where the integrated function is evaluated.

ncm_fftlog_get_smooth_padding_scale

Gets the log10 of the current value of the smoothing scale $s$.

ncm_fftlog_get_vector_Gr

Gets the vector of the transformed function $G(r)$, nderiv = 0, or its nderiv-th derivative with respect to $\ln r$.

ncm_fftlog_get_vector_lnr

Gets the vector of the $\ln r$ knots.

ncm_fftlog_peek_name

This function peeks the fftlogs associated name.

ncm_fftlog_peek_output_vector

Peeks the output vector respective to $G(r)$, nderiv = 0, or its comp-th derivative with respect to $\ln r$.

ncm_fftlog_peek_spline_Gr

Peeks the spline of $G(r)$, nderiv = 0, or the spline of the nderiv-th derivative of $G(r)$ with respect to $\ln r$.

ncm_fftlog_prepare_splines

Prepares the set of splines respective to the function $G(r)$ and, if required, its n-order derivatives.

ncm_fftlog_ref

Increases the reference count of fftlog by one.

ncm_fftlog_reset

Reset the evaluation and internal coefficients forcing their recomputation.

ncm_fftlog_set_eval_r_max

Sets $r_\mathrm{max}$ to r_max.

ncm_fftlog_set_eval_r_min

Sets $r_\mathrm{min}$ to r_min.

ncm_fftlog_set_length

Sets the length of the period Lk, where the function is periodic in logarithmic space $\ln k$.

ncm_fftlog_set_lnk0

Sets the center of the transform input $\ln(k_0)$.

ncm_fftlog_set_lnr0

Sets the center of the transform output $\ln(r_0)$.

ncm_fftlog_set_max_size

Sets the maximum number of knots in the fundamental interval.

ncm_fftlog_set_nderivs

Sets nderivs as the number of derivatives to calculate.

ncm_fftlog_set_noring

Sets whether to use the no-ringing adjustment of $\ln(r_0)$.

ncm_fftlog_set_padding

Sets the size of the padding in percentage of the interval.

ncm_fftlog_set_size

Sets the number of knots $N_f^\prime$ where the integrated function is evaluated, given the input number of knots n, plus padding.

ncm_fftlog_set_smooth_padding_scale

Sets the value of the smoothing scale $s$ which is used if ncm_fftlog_use_smooth_padding() is turned on.

ncm_fftlog_use_eval_interval

Sets whether to use a restricted evaluation interval $[r_\mathrm{min}, r_\mathrm{max}]$. See ncm_fftlog_set_eval_r_min() and ncm_fftlog_set_eval_r_max().

ncm_fftlog_use_smooth_padding

Sets whether to use pad the fft using a power-law continuation of the input function which is continuous at the border and drops to a scale determined by ncm_fftlog_set_smooth_padding_scale().

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

NumCosmoMath.Fftlog:Lk

The function $F(k)$’s period in natural logarithm base.

NumCosmoMath.Fftlog:N

The number of knots in the fundamental interval.

NumCosmoMath.Fftlog:eval-r-max

The maximum value of the evaluation interval.

NumCosmoMath.Fftlog:eval-r-min

The minimum value of the evaluation interval.

NumCosmoMath.Fftlog:lnk0

The Center value for $\ln(k)$.

NumCosmoMath.Fftlog:lnr0

The Center value for $\ln(r)$.

NumCosmoMath.Fftlog:max-n

The maximum number of knots in the fundamental interval. This limit is used when calibrating the number of knots.

NumCosmoMath.Fftlog:name

FFTW Plan wisdom’s name to perform the transformation.

NumCosmoMath.Fftlog:nderivs

The number of derivatives to be estimated.

NumCosmoMath.Fftlog:no-ringing

True to use the no-ringing adjustment of $\ln(r_0)$ and False otherwise.

NumCosmoMath.Fftlog:padding

The padding percentage of the number of knots $N$.

NumCosmoMath.Fftlog:smooth-padding-scale

Log10 of the smoothing scale.

NumCosmoMath.Fftlog:use-eval-int

Whether to use evaluation interval.

NumCosmoMath.Fftlog:use-smooth-padding

Whether to use a smooth padding.

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.

Class structure

struct NumCosmoMathFftlogClass {
  void (* compute_Ym) (
    NcmFftlog* fftlog,
    gpointer Ym_0
  );
  
}

No description available.

Class members
compute_Ym: void (* compute_Ym) ( NcmFftlog* fftlog, gpointer Ym_0 )

No description available.

Virtual methods

NumCosmoMath.FftlogClass.compute_Ym
No description available.