Class

NumCosmoMathStatsDist1dSpline

Description [src]

final class NumCosmoMath.StatsDist1dSpline : NumCosmoMath.StatsDist1d
{
  /* No available fields */
}

One-dimensional distribution tabulated by a spline, of $-2\ln p(x)$ or of $p(x)$.

Exactly one of NcmStatsDist1dSpline:m2lnp and NcmStatsDist1dSpline:density is set. The support is the spline’s knot range, which ncm_stats_dist1d_prepare() sets as $[x_i, x_f]$, replacing any value set before. The density need not be normalized.

With NcmStatsDist1dSpline:m2lnp, a spline $m_2(x)$, the density is $p(x) = e^{-[m_2(x) - m_\mathrm{min}]/2}$, with $m_\mathrm{min}$ the smallest knot value, so ncm_stats_dist1d_eval_norma() is relative to $e^{-m_\mathrm{min}/2}$. Outside the knot range, at a distance $\delta$ from the nearest bound $x_b$, $m_2$ continues as $m_2(x_b) \pm m_2^\prime(x_b)\,\delta + c\,\delta^2/2$ with $c = \max[m_2^{\prime\prime}(x_b), 1/(x_f - x_i)^2, s^2/2]$, where the last term enters only when the outward slope $s$ is negative. The continuation matches the value and the slope at $x_b$, and also the second derivative when that is the largest term. It grows to $+\infty$, so the density goes to zero, and $m_2$ dips below $m_2(x_b)$ by at most 1.

With NcmStatsDist1dSpline:density, a spline $P(x)$, the density is $\max[P(x), 0]$ in the knot range and zero outside it.

Constructors

ncm_stats_dist1d_spline_new

Creates a new NcmStatsDist1dSpline with NcmStatsDist1dSpline:m2lnp set to m2lnp; ncm_stats_dist1d_prepare() prepares m2lnp.

ncm_stats_dist1d_spline_new_from_density

Creates a new NcmStatsDist1dSpline with NcmStatsDist1dSpline:density set to p; ncm_stats_dist1d_prepare() prepares p.

Instance methods

Methods inherited from NcmStatsDist1d (18)
ncm_stats_dist1d_eval_inv_pdf

Evaluates the inverse of the cumulative distribution, the $x$ with $\int_{x_i}^x p(x^\prime)\,\mathrm{d}x^\prime = u$. Returns $x_i$ for $u \leq 0$ and $x_f$ for $u \geq 1$. Requires NcmStatsDist1d:compute-cdf.

ncm_stats_dist1d_eval_inv_pdf_tail

Evaluates the $x$ with $\int_x^{x_f} p(x^\prime)\,\mathrm{d}x^\prime = v$, that is ncm_stats_dist1d_eval_inv_pdf() at $1 - v$, so v below $\epsilon$ is not resolved. Returns $x_f$ for $v \leq 0$ and $x_i$ for $v \geq 1$. Requires NcmStatsDist1d:compute-cdf.

ncm_stats_dist1d_eval_m2lnp

Evaluates $-2\ln p(x)$ of the density as given by the subclass, without the normalization, see ncm_stats_dist1d_eval_norma().

ncm_stats_dist1d_eval_mode

Locates the maximum of the density: the minimum of $-2\ln p$ on 1000 equally spaced points, refined by Brent’s method between the two neighbouring grid points to a relative tolerance $\sqrt{\mathrm{reltol}}$ and an absolute tolerance, the larger of NcmStatsDist1d:abstol and $\sqrt{\mathrm{reltol}}$ times the grid spacing. The absolute tolerance is what stops the refinement of a mode at zero. When the two best grid points tie, Brent’s method refines between them. The grid point is returned when it is $x_i$ or $x_f$, or when a neighbour has zero density. Warns if the refinement stops before its tolerance, or leaves its bracket unchanged for ten iterations.

ncm_stats_dist1d_eval_norma

Gets the integral of the subclass density over $[x_i, x_f]$, computed by ncm_stats_dist1d_prepare(); 1 without NcmStatsDist1d:compute-cdf.

ncm_stats_dist1d_eval_p

Evaluates the density at x divided by the normalization. Without NcmStatsDist1d:compute-cdf the normalization is 1 and the density is not normalized.

ncm_stats_dist1d_eval_pdf

Evaluates the cumulative distribution $\int_{x_i}^x p(x^\prime)\,\mathrm{d}x^\prime$. Requires NcmStatsDist1d:compute-cdf; x is not checked.

ncm_stats_dist1d_free

Decreases the reference count of sd1.

ncm_stats_dist1d_gen

Draws a value from the distribution by inverting the cumulative distribution at a uniform deviate. Requires NcmStatsDist1d:compute-cdf.

ncm_stats_dist1d_get_compute_cdf
No description available.

ncm_stats_dist1d_get_current_h

Gets the kernel bandwidth of a kernel density estimate. Aborts for a subclass that does not implement it.

ncm_stats_dist1d_get_xf
No description available.

ncm_stats_dist1d_get_xi
No description available.

ncm_stats_dist1d_prepare

Calls the subclass prepare and then, when $x_i \neq x_f$ and NcmStatsDist1d:compute-cdf is TRUE, locates the mode, integrates the cumulative distribution and the normalization, and builds the inverse. Must be called after changing $x_i$, $x_f$ or the density. Aborts if $x_f < x_i$ or if the density at the mode is not positive and finite.

ncm_stats_dist1d_ref

Increases the reference count of sd1.

ncm_stats_dist1d_set_compute_cdf

Sets NcmStatsDist1d:compute-cdf. Without it ncm_stats_dist1d_prepare() computes neither the normalization nor the cumulative distribution and its inverse.

ncm_stats_dist1d_set_xf

Sets NcmStatsDist1d:xf.

ncm_stats_dist1d_set_xi

Sets NcmStatsDist1d:xi.

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

NumCosmoMath.StatsDist1dSpline:density
No description available.

NumCosmoMath.StatsDist1dSpline:m2lnp
No description available.

Properties inherited from NcmStatsDist1d (6)
NumCosmoMath.StatsDist1d:abstol
No description available.

NumCosmoMath.StatsDist1d:compute-cdf
No description available.

NumCosmoMath.StatsDist1d:norma
No description available.

NumCosmoMath.StatsDist1d:reltol
No description available.

NumCosmoMath.StatsDist1d:xf
No description available.

NumCosmoMath.StatsDist1d:xi
No description available.

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 NumCosmoMathStatsDist1dSplineClass {
  NcmStatsDist1dClass parent_class;
  
}

No description available.

Class members
parent_class: NcmStatsDist1dClass

No description available.