File acc_cf64_core.h¶
FileList > acc_cf64 > acc_cf64_core.h
Go to the source code of this file
AccCf64 component API. More...
#include "clib_common.h"#include "jm_perf.h"#include "dp_state.h"
Classes¶
| Type | Name |
|---|---|
| struct | acc_cf64_state_t AccCf64 state. |
Public Functions¶
| Type | Name |
|---|---|
| void | acc_cf64_add2d (acc_cf64_state_t * state, const double complex * x, size_t x_len) Sum all elements of a (logically) 2-D complex array into the accumulator. The array is treated as a flat C-order buffer of x_len complex128 samples regardless of the original shape; the caller is responsible for passing the total element count. |
| acc_cf64_state_t * | acc_cf64_create (double _Complex acc) Double-precision complex scalar accumulator. Maintains one running complex sum ( acc ) across calls tostep ,steps ,madd ,add2d , andmadd2d . The signal path is double-precision complex (128-bit per sample); coefficient arrays formadd /madd2d are single-precision float to match typical FIR weight storage. Useget to read without side-effects ordump to read and zero atomically. |
| void | acc_cf64_destroy (acc_cf64_state_t * state) Release all memory owned by an AccCf64 instance. Passing NULL is safe; the function is a no-op in that case. After this call the pointer must not be used. |
| double complex | acc_cf64_dump (acc_cf64_state_t * state) Return the accumulated sum and atomically reset it to zero. This is the canonical "drain" primitive: read the period total, then start a fresh accumulation interval without a separate reset call. Both real and imaginary parts are zeroed unconditionally. |
| double complex | acc_cf64_get (acc_cf64_state_t * state) Return the current accumulated sum without resetting state. Identical to reading the acc property directly; retained as an explicit method so call sites that need the value can be uniform withdump without a conditional. |
| double _Complex | acc_cf64_get_acc (const acc_cf64_state_t * state) Return the current accumulator value without modifying state. Use this when you need to read the running sum mid-accumulation without disturbing it. For a read-and-reset in one call use acc_cf64_dump . |
| void | acc_cf64_get_state (const acc_cf64_state_t * state, void * blob) |
| void | acc_cf64_madd (acc_cf64_state_t * state, const double complex * x, size_t x_len, const float * h, size_t h_len) Dot-product accumulate with complex signal and float weights: acc += sum(x[i] * h[i]) fori in0 .. min(x_len, h_len) - 1 . The signal arrayx is double-precision complex; the coefficient arrayh is single-precision float (widened to double before multiplication). The shorter of the two arrays limits iteration. |
| void | acc_cf64_madd2d (acc_cf64_state_t * state, const double complex * x, size_t x_len, const float * h, size_t h_len) Dot-product accumulate over a flat 2-D complex buffer: acc += sum(x[i] * h[i]) fori in0 .. min(x_len, h_len) - 1 . Combinesadd2d andmadd semantics for 2-D data — a complex signal grid is weighted element-wise by a real coefficient buffer and folded into the running sum. |
| void | acc_cf64_reset (acc_cf64_state_t * state) Zero the accumulator, restoring the same state as a fresh AccCf64(0j) — regardless of the value supplied toacc_cf64_create . Both the real and imaginary parts are set to 0.0. Subsequentget /dump calls return0j until new samples are processed. |
| void | acc_cf64_set_acc (acc_cf64_state_t * state, double _Complex acc) Overwrite the accumulator with a new complex value. Useful for seeding the accumulator to a known baseline before processing a new segment without a full reset . |
| int | acc_cf64_set_state (acc_cf64_state_t * state, const void * blob) |
| size_t | acc_cf64_state_bytes (const acc_cf64_state_t * state) |
| JM_FORCEINLINE JM_HOT void | acc_cf64_step (acc_cf64_state_t * state, double complex x) Add one complex sample to the running sum ( acc += x ). This is the hot-path entry for sample-by-sample processing. For block inputs preferacc_cf64_steps to amortise call overhead. |
| void | acc_cf64_steps (acc_cf64_state_t * state, const double complex * input, size_t n) Add all samples in input to the running sum. Equivalent to callingacc_cf64_step for each element; iterates element-by-element over double-precision complex samples. |
Macros¶
| Type | Name |
|---|---|
| define | ACC_CF64_STATE_MAGIC [**DP\_FOURCC**](dp__state_8h.md#define-dp_fourcc) ('A', 'C', 'C', 'C') |
| define | ACC_CF64_STATE_VERSION 1u |
Detailed Description¶
Lifecycle: create -> (step / steps / reset)* -> destroy
Example:
acc_cf64_state_t *obj = acc_cf64_create(0.0 + 0.0 * I);
acc_cf64_step(obj, 1.0 + 0.5 * I);
double complex v = acc_cf64_get(obj); // v == 1.0 + 0.5 * I
acc_cf64_destroy(obj);
Public Functions Documentation¶
function acc_cf64_add2d¶
Sum all elements of a (logically) 2-D complex array into the accumulator. The array is treated as a flat C-order buffer of x_len complex128 samples regardless of the original shape; the caller is responsible for passing the total element count.
Parameters:
stateMust be non-NULL.xInput array (complex128, any shape — passed as flat buffer).x_lenNumber of elements inx.
function acc_cf64_create¶
Double-precision complex scalar accumulator. Maintains one running complex sum ( acc ) across calls tostep ,steps ,madd ,add2d , andmadd2d . The signal path is double-precision complex (128-bit per sample); coefficient arrays formadd /madd2d are single-precision float to match typical FIR weight storage. Useget to read without side-effects ordump to read and zero atomically.
Parameters:
accInitial accumulator value (default: 0j).
Returns:
Heap-allocated state, or NULL on allocation failure.
Note:
Caller must call acc_cf64_destroy() when done.
>>> from doppler.accumulator import AccCf64
>>> obj = AccCf64(0j)
>>> obj.get_acc()
0j
>>> obj.set_acc(3+4j)
>>> obj.get_acc()
(3+4j)
>>> obj.reset()
>>> obj.get_acc()
0j
function acc_cf64_destroy¶
Release all memory owned by an AccCf64 instance. Passing NULL is safe; the function is a no-op in that case. After this call the pointer must not be used.
function acc_cf64_dump¶
Return the accumulated sum and atomically reset it to zero. This is the canonical "drain" primitive: read the period total, then start a fresh accumulation interval without a separate reset call. Both real and imaginary parts are zeroed unconditionally.
Returns:
Value of acc just before the reset (complex).
>>> from doppler.accumulator import AccCf64
>>> obj = AccCf64(0j)
>>> obj.step(3+2j)
>>> obj.step(1+1j)
>>> obj.dump()
(4+3j)
>>> obj.get()
0j
function acc_cf64_get¶
Return the current accumulated sum without resetting state. Identical to reading the acc property directly; retained as an explicit method so call sites that need the value can be uniform withdump without a conditional.
Returns:
Current value of acc (complex).
>>> from doppler.accumulator import AccCf64
>>> obj = AccCf64(0j)
>>> obj.step(2+0j)
>>> obj.step(0+3j)
>>> obj.get()
(2+3j)
function acc_cf64_get_acc¶
Return the current accumulator value without modifying state. Use this when you need to read the running sum mid-accumulation without disturbing it. For a read-and-reset in one call use acc_cf64_dump .
Returns:
Current value of acc (complex).
>>> from doppler.accumulator import AccCf64
>>> obj = AccCf64(0j)
>>> obj.step(1+2j)
>>> obj.get_acc()
(1+2j)
function acc_cf64_get_state¶
function acc_cf64_madd¶
Dot-product accumulate with complex signal and float weights: acc += sum(x[i] * h[i]) fori in0 .. min(x_len, h_len) - 1 . The signal arrayx is double-precision complex; the coefficient arrayh is single-precision float (widened to double before multiplication). The shorter of the two arrays limits iteration.
void acc_cf64_madd (
acc_cf64_state_t * state,
const double complex * x,
size_t x_len,
const float * h,
size_t h_len
)
Parameters:
stateMust be non-NULL.xComplex signal samples (complex128 array).x_lenNumber of elements inx.hReal coefficient / weight array (float32 array).h_lenNumber of elements inh.
function acc_cf64_madd2d¶
Dot-product accumulate over a flat 2-D complex buffer: acc += sum(x[i] * h[i]) fori in0 .. min(x_len, h_len) - 1 . Combinesadd2d andmadd semantics for 2-D data — a complex signal grid is weighted element-wise by a real coefficient buffer and folded into the running sum.
void acc_cf64_madd2d (
acc_cf64_state_t * state,
const double complex * x,
size_t x_len,
const float * h,
size_t h_len
)
Parameters:
stateMust be non-NULL.xComplex signal samples (complex128, flat buffer).x_lenNumber of elements inx.hReal coefficient / weight array (float32).h_lenNumber of elements inh.
function acc_cf64_reset¶
Zero the accumulator, restoring the same state as a fresh AccCf64(0j) — regardless of the value supplied toacc_cf64_create . Both the real and imaginary parts are set to 0.0. Subsequentget /dump calls return0j until new samples are processed.
>>> from doppler.accumulator import AccCf64
>>> obj = AccCf64(0j)
>>> obj.step(3+2j)
>>> obj.reset()
>>> obj.get_acc()
0j
function acc_cf64_set_acc¶
Overwrite the accumulator with a new complex value. Useful for seeding the accumulator to a known baseline before processing a new segment without a full reset .
Parameters:
stateMust be non-NULL.accNew accumulator value (complex).
function acc_cf64_set_state¶
function acc_cf64_state_bytes¶
function acc_cf64_step¶
Add one complex sample to the running sum ( acc += x ). This is the hot-path entry for sample-by-sample processing. For block inputs preferacc_cf64_steps to amortise call overhead.
Parameters:
stateMust be non-NULL.xInput sample (complex).
function acc_cf64_steps¶
Add all samples in input to the running sum. Equivalent to callingacc_cf64_step for each element; iterates element-by-element over double-precision complex samples.
Parameters:
stateMust be non-NULL.inputInput samples (complex128 array).nNumber of elements ininput.
Macro Definition Documentation¶
define ACC_CF64_STATE_MAGIC¶
define ACC_CF64_STATE_VERSION¶
The documentation for this class was generated from the following file native/inc/acc_cf64/acc_cf64_core.h