NcmPowspec

NcmPowspec — Abstrac class for power spectrum implementation.

Stability Level

Stable, unless otherwise indicated

Functions

Properties

double kmax Read / Write / Construct
double kmin Read / Write / Construct
double reltol Read / Write / Construct
double zf Read / Write / Construct
double zi Read / Write / Construct

Types and Values

Object Hierarchy

    GObject
    ╰── NcmPowspec
        ├── NcPowspecML
        ╰── NcPowspecMNL

Includes

#include <numcosmo/math/ncm_powspec.h>

Description

This module comprises the set of functions to compute a power spectrum and derived quantities.

Given a field $\delta(\vec{x})$ at position $\vec{x}$, the power spectrum is defined as the Fourier transform of the two-point correlation point, i.e., $$\xi(\vec{x} - \vec{x}^\prime) = \int \frac{d^3 k}{(2 \pi)^3} e^{i \vec{k}.(\vec{x} - \vec{x}^\prime)} P(k),$$ where $\langle \delta(\vec{k} - \vec{k}^\prime)\rangle = (2\pi)^3 \delta_D(\vec{k} - \vec{k}^\prime) P(k)$ and $\delta_D$ is the Dirac's delta function. The standard output is the dimensional power spectrum, not the dimensionless one $\Delta(k)^2$, $$P(k) \equiv \frac{2 \pi^2 \Delta(k)^2}{k^3}.$$

Functions

ncm_powspec_ref ()

NcmPowspec *
ncm_powspec_ref (NcmPowspec *powspec);

Increases the reference count of powspec by one atomically.

Parameters

powspec

a NcmPowspec

 

Returns

powspec .

[transfer full]


ncm_powspec_free ()

void
ncm_powspec_free (NcmPowspec *powspec);

Atomically decrements the reference count of powspec by one. If the reference count drops to 0, all memory allocated by powspec is released.

Parameters

powspec

a NcmPowspec

 

ncm_powspec_clear ()

void
ncm_powspec_clear (NcmPowspec **powspec);

If powspec is different from NULL, atomically decrements the reference count of powspec by one. If the reference count drops to 0, all memory allocated by powspec is released and powspec is set to NULL.

Parameters

powspec

a NcmPowspec

 

ncm_powspec_set_zi ()

void
ncm_powspec_set_zi (NcmPowspec *powspec,
                    const gdouble zi);

Sets the initial time $z_i$.

Parameters

powspec

a NcmPowspec

 

zi

initial time $z_i$

 

ncm_powspec_set_zf ()

void
ncm_powspec_set_zf (NcmPowspec *powspec,
                    const gdouble zf);

Sets the final time $z_f$.

Parameters

powspec

a NcmPowspec

 

zf

final time $z_f$

 

ncm_powspec_set_kmin ()

void
ncm_powspec_set_kmin (NcmPowspec *powspec,
                      const gdouble kmin);

Sets the minimum mode value $k_\mathrm{min}$.

Parameters

powspec

a NcmPowspec

 

kmin

minimum mode $k_\mathrm{min}$

 

ncm_powspec_set_kmax ()

void
ncm_powspec_set_kmax (NcmPowspec *powspec,
                      const gdouble kmax);

Sets the maximum mode value $k_\mathrm{max}$.

Parameters

powspec

a NcmPowspec

 

kmax

maxmimum mode $k_\mathrm{max}$

 

ncm_powspec_set_reltol_spline ()

void
ncm_powspec_set_reltol_spline (NcmPowspec *powspec,
                               const gdouble reltol);

Sets the relative tolerance for interpolation errors to reltol .

Parameters

powspec

a NcmPowspec

 

reltol

relative tolerance for interpolation errors

 

ncm_powspec_require_zi ()

void
ncm_powspec_require_zi (NcmPowspec *powspec,
                        const gdouble zi);

Requires the initial time to be less or equal to $z_i$.

Parameters

powspec

a NcmPowspec

 

zi

initial time $z_i$

 

ncm_powspec_require_zf ()

void
ncm_powspec_require_zf (NcmPowspec *powspec,
                        const gdouble zf);

Requires the final time to be greater or equal to $z_f$.

Parameters

powspec

a NcmPowspec

 

zf

final time $z_f$

 

ncm_powspec_require_kmin ()

void
ncm_powspec_require_kmin (NcmPowspec *powspec,
                          const gdouble kmin);

Requires the minimum mode value to be less or equal to $k_\mathrm{min}$.

Parameters

powspec

a NcmPowspec

 

kmin

minimum mode $k_\mathrm{min}$

 

ncm_powspec_require_kmax ()

void
ncm_powspec_require_kmax (NcmPowspec *powspec,
                          const gdouble kmax);

Sets the maximum mode value $k_\mathrm{max}$.

Parameters

powspec

a NcmPowspec

 

kmax

maxmimum mode $k_\mathrm{max}$

 

ncm_powspec_get_zi ()

gdouble
ncm_powspec_get_zi (NcmPowspec *powspec);

Gets the initial value $z_i$.

Parameters

powspec

a NcmPowspec

 

ncm_powspec_get_zf ()

gdouble
ncm_powspec_get_zf (NcmPowspec *powspec);

Gets the final value $z_f$.

Parameters

powspec

a NcmPowspec

 

ncm_powspec_get_kmin ()

gdouble
ncm_powspec_get_kmin (NcmPowspec *powspec);

Gets the minimum mode value $k_\mathrm{min}$.

Parameters

powspec

a NcmPowspec

 

ncm_powspec_get_kmax ()

gdouble
ncm_powspec_get_kmax (NcmPowspec *powspec);

Gets the maximum mode value $k_\mathrm{max}$.

Parameters

powspec

a NcmPowspec

 

ncm_powspec_get_reltol_spline ()

gdouble
ncm_powspec_get_reltol_spline (NcmPowspec *powspec);

Gets the relative tolerance for interpolation errors.

Parameters

powspec

a NcmPowspec

 

Returns

the relative tolerance for interpolation errors.


ncm_powspec_get_nknots ()

void
ncm_powspec_get_nknots (NcmPowspec *powspec,
                        guint *Nz,
                        guint *Nk);

Gets the number of knots used to calculate the power spectrum.

[virtual get_nknots]

Parameters

powspec

a NcmPowspec

 

Nz

number of knots in $z$.

[out]

Nk

number of knots in $k$.

[out]

ncm_powspec_prepare ()

void
ncm_powspec_prepare (NcmPowspec *powspec,
                     NcmModel *model);

Prepares the power spectrum powspec using the model model .

Parameters

powspec

a NcmPowspec

 

model

a NcmModel

 

ncm_powspec_prepare_if_needed ()

void
ncm_powspec_prepare_if_needed (NcmPowspec *powspec,
                               NcmModel *model);

Prepares the object powspec using the model model if it was changed since last preparation.

Parameters

powspec

a NcmPowspec

 

model

a NcmModel

 

ncm_powspec_eval ()

gdouble
ncm_powspec_eval (NcmPowspec *powspec,
                  NcmModel *model,
                  const gdouble z,
                  const gdouble k);

Evaluates the power spectrum powspec at $(z, k)$.

Parameters

powspec

a NcmPowspec

 

model

a NcmModel

 

z

time $z$

 

k

mode $k$

 

Returns

$P(z, k)$.


ncm_powspec_eval_vec ()

void
ncm_powspec_eval_vec (NcmPowspec *powspec,
                      NcmModel *model,
                      const gdouble z,
                      NcmVector *k,
                      NcmVector *Pk);

Evaluates the power spectrum powspec at $z$ and in the knots contained in k and puts the result in Pk .

Parameters

powspec

a NcmPowspec

 

model

a NcmModel

 

z

time $z$

 

k

a NcmVector

 

Pk

a NcmVector

 

ncm_powspec_get_spline_2d ()

NcmSpline2d *
ncm_powspec_get_spline_2d (NcmPowspec *powspec,
                           NcmModel *model);

Compute a 2D spline for the power spectrum.

Parameters

powspec

a NcmPowspec

 

model

a NcmModel compatible with powspec

 

Returns

a NcmSpline2d interpolating spline as a function of $(z, k)$.

[transfer full]


ncm_powspec_peek_model_ctrl ()

NcmModelCtrl *
ncm_powspec_peek_model_ctrl (NcmPowspec *powspec);

Gets the NcmModelCtrl used by powspec .

Parameters

powspec

a NcmPowspec

 

Returns

the NcmModelCtrl used by powspec .

[transfer none]


ncm_powspec_var_tophat_R ()

gdouble
ncm_powspec_var_tophat_R (NcmPowspec *powspec,
                          NcmModel *model,
                          const gdouble reltol,
                          const gdouble z,
                          const gdouble R);

This function computes the value of the linearly extrapolated rms fluctuations of mass in a sphere of radius $R$ applying a top-hat filter at redshift $z$, $$\sigma_{R}^{2}(z) = \frac{1}{2\pi^2} \int_{k_{\mathrm{min}}}^{k_\mathrm{max}} W^{2}_{TH}(kR) \, P(k,z) \, k^2 \, \mathrm{d}k \, .$$ Where, $W_{TH}(t)$ is the top-hat filter in Fourier space, $$W_{TH}(t) = \frac{3}{t^3} \left( \sin t - t \cos t \right) = \frac{3}{t} j_{1}(t),$$ and $j_1(t)$ is the first order spherical Bessel function of the first kind. This function is recommended for a small set of $z$ and $R$ values. For a wide range of values it is best to apply NcmPowspecFilter, instead.

Parameters

powspec

a NcmPowspec

 

model

a NcmModel

 

reltol

relative tolerance for integration

 

z

the value of $z$

 

R

the value of $R$

 

Returns

$\sigma_{R}^{2}(z)$.


ncm_powspec_sigma_tophat_R ()

gdouble
ncm_powspec_sigma_tophat_R (NcmPowspec *powspec,
                            NcmModel *model,
                            const gdouble reltol,
                            const gdouble z,
                            const gdouble R);

Computes $\sigma_R(z) = \sqrt{\sigma_{R}^{2}(z)}$. See ncm_powspec_var_tophat_R().

Parameters

powspec

a NcmPowspec

 

model

a NcmModel

 

reltol

relative tolerance for integration

 

z

the value of $z$

 

R

the value of $R$

 

Returns

$\sigma_R(z)$.


ncm_powspec_corr3d ()

gdouble
ncm_powspec_corr3d (NcmPowspec *powspec,
                    NcmModel *model,
                    const gdouble reltol,
                    const gdouble z,
                    const gdouble r);

Computes the spatial correlation function in configuration space at redshift $z$ and position $r$, $$\xi(r,z) = \frac{1}{2\pi^2} \int_{k_{\mathrm{min}}}^{k_\mathrm{max}} P(k,z) \, j_{0}(kr) \, k^2 \, \mathrm{d}k \, ,$$ where, $j_0(t)$ is the zero order spherical Bessel function of the first kind. This function is recommended for a small set of $r$ and $z$ values. For a wide range of values it is best to apply NcmPowspecCorr3d, instead.

Parameters

powspec

a NcmPowspec

 

model

a NcmModel

 

reltol

relative tolerance for integration

 

z

the value of $z$

 

r

the value of $r$

 

Returns

$\xi(r,z)$.


ncm_powspec_sproj ()

gdouble
ncm_powspec_sproj (NcmPowspec *powspec,
                   NcmModel *model,
                   const gdouble reltol,
                   const gint ell,
                   const gdouble z1,
                   const gdouble z2,
                   const gdouble xi1,
                   const gdouble xi2);

Computes (C_\ell (z_1, z_2) = \int\dots). This method calculates the angular power spectrum directly from the power spectrum by integrating over the wave-numbers. It is slow and intended for testing purposes only.

Parameters

powspec

a NcmPowspec

 

model

a NcmModel

 

reltol

relative tolerance for integration

 

ell

the value of $\ell$

 

z1

the value of $z_1$

 

z2

the value of $z_2$

 

xi1

the value of $\xi_1$

 

xi2

the value of $\xi_2$

 

Types and Values

NCM_TYPE_POWSPEC

#define NCM_TYPE_POWSPEC (ncm_powspec_get_type ())

struct NcmPowspecClass

struct NcmPowspecClass {
};

NcmPowspec

typedef struct _NcmPowspec NcmPowspec;

Property Details

The “kmax” property

  “kmax”                     double

The maximum mode (wave-number) value to compute $P(k,z)$.

Owner: NcmPowspec

Flags: Read / Write / Construct

Allowed values: >= 0

Default value: 1


The “kmin” property

  “kmin”                     double

The minimum mode (wave-number) value to compute $P(k,z)$.

Owner: NcmPowspec

Flags: Read / Write / Construct

Allowed values: >= 0

Default value: 1e-05


The “reltol” property

  “reltol”                   double

The relative tolerance on the interpolation error.

Owner: NcmPowspec

Flags: Read / Write / Construct

Allowed values: [2.22045e-16,1]

Default value: 1.49012e-08


The “zf” property

  “zf”                       double

The final time (redshift) to compute $P(k,z)$.

Owner: NcmPowspec

Flags: Read / Write / Construct

Allowed values: >= 0

Default value: 1


The “zi” property

  “zi”                       double

The initial time (redshift) to compute $P(k,z)$.

Owner: NcmPowspec

Flags: Read / Write / Construct

Allowed values: >= 0

Default value: 0