Struct

NumCosmoXcorKernelIntegrand

Description [src]

struct NcXcorKernelIntegrand {
  guint len;
  NcXcorKernelIntegrandEval eval_func;
  NcXcorKernelIntegrandGetRange get_range_func;
  gpointer data;
  GDestroyNotify data_free;
  NcXcorKernelIntegrandGetKnots get_knots_func;
  NcXcorKernelIntegrandGetRangeComp get_range_comp_func;
  NcXcorKernelIntegrandEvalComps eval_comps_func;
  NcXcorKernelIntegrandGetSpectral get_spectral_func;
  NcXcorKernelIntegrandGetPanels get_panels_func;
  NcXcorKernelIntegrandPeekPanel peek_panel_func;
  NcXcorKernelIntegrandRestrict restrict_func;
  NcmMatrix* residuals;
  gdouble reltol;
  gdouble peak_epsilon;
}

A reference-counted closure for computing kernel integrands.

One integrand must be evaluated by one thread at a time. A spline-backed integrand keeps a scratch vector for the result of each evaluation, so concurrent nc_xcor_kernel_integrand_eval() calls on the same integrand would race on it.

NcXcorSolver satisfies this by construction rather than by convention: an integrand is built for one (kernel, ell-block) pair, and the ell block is the unit of parallelism — one integrator per block, blocks distributed across the OpenMP team, kernels shared and read-only throughout. No two threads ever hold the same integrand. Anything that made kernel pairs the unit of parallelism instead would share integrands across threads and would need per-thread evaluation scratch. The eval_func function should fill len values in the W array for the given wavenumber k.

Structure members
len: guint

Number of components in the integrand.

eval_func: NcXcorKernelIntegrandEval

Function to evaluate the integrand at k, filling W[len].

get_range_func: NcXcorKernelIntegrandGetRange

Function to get the valid k range for this integrand.

data: gpointer

User data passed to eval_func, get_range_func and get_knots_func.

data_free: GDestroyNotify

Function to free data, or NULL if no cleanup needed.

get_knots_func: NcXcorKernelIntegrandGetKnots

Function to get the integrand’s knots, or NULL when it is not spline-backed.

get_range_comp_func: NcXcorKernelIntegrandGetRangeComp

Function to get the valid k range of one component, or NULL when every component covers the whole range.

eval_comps_func: NcXcorKernelIntegrandEvalComps

Function to evaluate a run of components, or NULL when only the whole vector can be evaluated at once.

get_spectral_func: NcXcorKernelIntegrandGetSpectral

No description available.

get_panels_func: NcXcorKernelIntegrandGetPanels

No description available.

peek_panel_func: NcXcorKernelIntegrandPeekPanel

No description available.

restrict_func: NcXcorKernelIntegrandRestrict

No description available.

residuals: NcmMatrix

No description available.

reltol: gdouble

The relative half of the fit criterion this integrand was built to, or 0.0 when it is exact or unknown.

peak_epsilon: gdouble

The floor of that criterion, as a fraction of the fitted function’s own peak, or 0.0 when there was none.

Constructors

nc_xcor_kernel_integrand_new

Creates a new NcXcorKernelIntegrand with reference count of 1.

Functions

nc_xcor_kernel_integrand_clear

If *integrand is not NULL, decreases its reference count and sets the pointer to NULL.

Instance methods

nc_xcor_kernel_integrand_eval

Evaluates the integrand at wavenumber k, storing len results in W.

nc_xcor_kernel_integrand_eval_array

Evaluates the integrand at wavenumber k and returns the results in a newly allocated GArray. This is a convenience wrapper around nc_xcor_kernel_integrand_eval() that handles array allocation.

nc_xcor_kernel_integrand_eval_comps

Evaluates components [offset, offset + len) at wavenumber k, writing them at their own indices in W. Integrands that can only evaluate every component at once do so, filling the whole of W; either way the entries the caller asked for are valid.

nc_xcor_kernel_integrand_get_len

Gets the number of components in the integrand.

nc_xcor_kernel_integrand_get_n_panels
No description available.

nc_xcor_kernel_integrand_get_peak_epsilon
No description available.

nc_xcor_kernel_integrand_get_range

Gets the valid k range for this integrand.

nc_xcor_kernel_integrand_get_range_comp

Gets the k range component i is supported on, which can be a part of the range nc_xcor_kernel_integrand_get_range() reports for the whole integrand: a block of multipoles shares one domain, and under the Limber approximation each of them vanishes outside its own band within it. Integrating a component over its own range keeps that band edge on an integration limit instead of leaving a step inside the interval.

nc_xcor_kernel_integrand_get_reltol
No description available.

nc_xcor_kernel_integrand_peek_knots

Peeks the knots integrand‘s components are represented on, shared by every component (multipole) it carries, or NULL when integrand is not spline-backed.

nc_xcor_kernel_integrand_peek_panel

Peeks one panel. Panels are contiguous and ascending, so panel i ends where panel i + 1 begins.

nc_xcor_kernel_integrand_peek_residuals

Peeks the achieved fit residuals, or NULL when the closure was built without residual tracking. See nc_xcor_kernel_integrand_set_residuals().

nc_xcor_kernel_integrand_peek_spectral

Peeks integrand‘s Chebyshev expansion, when it has one.

nc_xcor_kernel_integrand_ref

Increases the reference count of integrand by one atomically.

nc_xcor_kernel_integrand_restrict

Produces integrand‘s coefficients on [a, b], which has to lie inside a single panel.

nc_xcor_kernel_integrand_set_eval_comps

Installs the accessor evaluating a contiguous run of integrand‘s components, for callers that integrate the run on its own. Left unset by nc_xcor_kernel_integrand_new(), in which case a run is served by evaluating every component.

nc_xcor_kernel_integrand_set_get_knots

Declares integrand as spline-backed, by installing the accessor returning the knots its components are represented on. Left unset by nc_xcor_kernel_integrand_new(), so integrands that are not spline-backed report no knots.

nc_xcor_kernel_integrand_set_get_range_comp

Installs the accessor returning the k range a single component of integrand is supported on. Left unset by nc_xcor_kernel_integrand_new(), in which case every component reports the whole range.

nc_xcor_kernel_integrand_set_get_spectral

Installs the accessor reporting integrand‘s Chebyshev expansion. Left unset by nc_xcor_kernel_integrand_new(), in which case integrand has none and nc_xcor_kernel_integrand_peek_spectral() returns FALSE.

nc_xcor_kernel_integrand_set_panel_accessors

Installs the accessors enumerating integrand‘s panels, for a spectral representation split into more than one.

nc_xcor_kernel_integrand_set_residuals

Records the residual the fit achieved on each knot interval, one row per knot of nc_xcor_kernel_integrand_peek_knots() and one column per component, as produced by ncm_function_sample_set_get_residuals().

nc_xcor_kernel_integrand_set_restrict

Installs the accessor producing coefficients on a subinterval of a panel.

nc_xcor_kernel_integrand_set_tolerances

Records the criterion integrand was fitted to, in the two parts it actually has. ncm_function_sample_set_refine() accepts a point when.

nc_xcor_kernel_integrand_unref

Decreases the reference count of integrand by one atomically. When the reference count reaches zero, frees integrand and its associated data using the free function provided at creation time (if any).