Struct
NumCosmoMathLaurentSeries
Description [src]
struct NcmLaurentSeries {
gint hmin;
gint hmax;
gint c_cap;
NcmComplex* c;
gatomicrefcount ref_count;
}
Complex Laurent-polynomial arithmetic (add/scale/convolve/conjugate) plus
the Jacobi-Anger reduction of a truncated Fourier series against a
von-Mises-shaped kernel to scaled modified Bessel functions, and
NcmLaurentSeriesTPS, a truncated power series (in a second, formal
variable) whose coefficients are NcmLaurentSeries. Generic
complex-analysis machinery with no physics content of its own, used and
independently tested by nc_wl_ellipticity_series.c (see
docs/theory/wl_shape_marginalization_series.qmd for the physics context
and derivation).
Two calling conventions for operations on a complex value (matching
nc_wl_ellipticity.h’s own convention): the plain name takes/returns
NcmComplex by value — fast, used internally, (skip)-ed from
introspection since C99 complex types are not GObject-introspectable —
and the _ptr-suffixed sibling takes/returns it by pointer, which is
introspectable and usable from Python. Functions with no complex-valued
parameter at all (e.g. add/conv/conj, jacobi_anger_reduce) have only one,
fully introspectable, form.
Every NcmLaurentSeries is independently heap-allocated: callers own
whatever they create and must free it themselves (or track a short-lived
batch, e.g. a GPtrArray with ncm_laurent_series_free() as its free
function, freed in one sweep at the end of a computation).
For hot loops that would otherwise allocate and free many of these per
call, ncm_laurent_series_reset() plus the _into-suffixed counterparts
of add/conv/scale/conj/new_single write into a caller-supplied,
already-allocated NcmLaurentSeries instead of allocating a new one
(grow-only, so a reused instance never reallocates once it reaches its
steady-state size) — NcmLaurentSeriesTPS‘s own coefficients and
ncm_laurent_series_tps_conv()’s private scratch are exactly such
long-lived, reused instances.
Structure members
hmin:gintNo description available.
hmax:gintNo description available.
c_cap:gintNo description available.
c:NcmComplexNo description available.
ref_count:gatomicrefcountNo description available.
Constructors
ncm_laurent_series_new
Creates a new zero-initialized NcmLaurentSeries with harmonics $h\in[hmin,hmax]$.
ncm_laurent_series_new_single
Creates a new NcmLaurentSeries with a single nonzero term $val\cdot w^h$.
Instance methods
ncm_laurent_series_add_into
Reuse counterpart of ncm_laurent_series_add(): writes $a+sb\cdot b$ into
out instead of allocating a new series.
ncm_laurent_series_conj_into
Reuse counterpart of ncm_laurent_series_conj(): writes
$\overline{a(1/w)}$ into out instead of allocating a new series.
ncm_laurent_series_conv_into
Reuse counterpart of ncm_laurent_series_conv(): writes the
Laurent-polynomial product $a\cdot b$ into out instead of allocating a
new series.
ncm_laurent_series_free
Decreases the reference count of a by one, freeing it once the count
reaches zero.
ncm_laurent_series_jacobi_anger_reduce
Exact reduction of
$\int_0^{2\pi} cm(\theta)\exp(z(\cos(\theta-\phi)-1))\,d\theta$
via the Jacobi-Anger identity, given cm‘s own harmonic content and
precomputed scaled Bessel values — no numerical quadrature over $\theta$
at all. Verified against direct numerical theta-integration
(test_ncm_laurent_series.c); note this includes the overall $2\pi$ factor
from the $\theta$-integral itself, so the return value is meaningful on
its own without relying on a caller-side normalization to supply it.
ncm_laurent_series_ref
Increases the reference count of a by one — also this boxed type’s
“copy” function (see the header’s own comment on why).
ncm_laurent_series_reset
Resizes a in place to harmonics $h\in[hmin,hmax]$, zeroing every
coefficient. Grow-only: reuses a‘s existing buffer (no allocation) when
it is already big enough, reallocates bigger otherwise — never shrinks
the underlying allocation. Lets a hot loop reuse one NcmLaurentSeries
across many calls instead of allocating fresh every time (see nc_galaxy_shape_factor_series_lensed.c).
ncm_laurent_series_scale_into
Reuse counterpart of ncm_laurent_series_scale(): writes $s\cdot a$ into
out instead of allocating a new series.
ncm_laurent_series_set_single_into
Reuse counterpart of ncm_laurent_series_new_single(): resets out to
$[h,h]$ and sets its one coefficient, instead of allocating.