|
Oakfield API Documentation 1.0.0
Numerical core APIs
|
Runtime field-statistics configuration, accumulation, and profiling helpers. More...


Go to the source code of this file.
Classes | |
| struct | SimPhaseCoherenceConfig |
| Controls thresholded phase-coherence metrics and phase-lock detection. More... | |
| struct | SimFieldStatsComputeConfig |
| Feature selection for one field-statistics computation. More... | |
| struct | SimFieldStatsComputeTimings |
| Wall-clock timings captured for one statistics computation. More... | |
| struct | SimFieldStatsRuntimeProfile |
| Rolling counters for runtime field-statistics requests and costs. More... | |
| struct | SimFieldStatsAccumulator |
| Streaming accumulator for incrementally building SimFieldStats. More... | |
Macros | |
| #define | SIM_FIELD_STATS_FEATURE_MASK_NONE 0u |
| #define | SIM_FIELD_STATS_FEATURE_MASK_DEFAULT |
Typedefs | |
| typedef struct SimPhaseCoherenceConfig | SimPhaseCoherenceConfig |
| Controls thresholded phase-coherence metrics and phase-lock detection. | |
| typedef enum SimFieldStatsFeature | SimFieldStatsFeature |
| Optional field-statistics feature families. | |
| typedef struct SimFieldStatsComputeConfig | SimFieldStatsComputeConfig |
| Feature selection for one field-statistics computation. | |
| typedef struct SimFieldStatsComputeTimings | SimFieldStatsComputeTimings |
| Wall-clock timings captured for one statistics computation. | |
| typedef enum SimFieldStatsProfileSource | SimFieldStatsProfileSource |
| Source path recorded for the most recent stats request or computation. | |
| typedef struct SimFieldStatsRuntimeProfile | SimFieldStatsRuntimeProfile |
| Rolling counters for runtime field-statistics requests and costs. | |
| typedef SimBufferDataType | SimFieldDataType |
| Legacy field-data type alias backed by SimBufferDataType. | |
| typedef SimBufferView | SimFieldView |
| Legacy field view alias backed by SimBufferView. | |
| typedef struct SimFieldStatsAccumulator | SimFieldStatsAccumulator |
| Streaming accumulator for incrementally building SimFieldStats. | |
Functions | |
| uint32_t | sim_field_stats_normalize_feature_mask (uint32_t feature_mask) |
| Clamp and expand a stats feature mask to supported dependencies. | |
| SimFieldStatsComputeConfig | sim_field_stats_default_compute_config (void) |
| Return the default stats compute configuration. | |
| bool | sim_field_stats_feature_enabled (const SimFieldStatsComputeConfig *config, uint32_t feature) |
Test whether feature is enabled in a compute config. | |
| SimFieldView | sim_field_view_from_field (SimField *field) |
| Build a generic field view over a SimField. | |
| void | sim_field_stats_accumulator_begin_with_config (SimFieldStatsAccumulator *acc, SimFieldStats *stats, const SimFieldStatsComputeConfig *config) |
| Initialize a streaming accumulator with an explicit compute config. | |
| void | sim_field_stats_accumulator_begin (SimFieldStatsAccumulator *acc, SimFieldStats *stats) |
| Initialize a streaming accumulator with the default compute config. | |
| void | sim_field_stats_accumulate_real (SimFieldStatsAccumulator *acc, double value) |
| Accumulate one real sample. | |
| void | sim_field_stats_accumulate_complex (SimFieldStatsAccumulator *acc, double real, double imag) |
| Accumulate one complex sample. | |
| void | sim_field_stats_accumulator_finish (SimFieldStatsAccumulator *acc) |
| Finalize accumulated statistics into the destination snapshot. | |
| void | sim_field_stats_compute_with_config (const struct SimField *field, SimFieldStats *out, const SimFieldStatsComputeConfig *config, SimFieldStatsComputeTimings *timings) |
| Compute field statistics with optional feature selection and timings. | |
| bool | sim_field_stats_compute_spectral_view (const SimFieldView *view, SimFieldStats *stats, size_t *out_dominant_k) |
| Compute FFT-derived spectral metrics for a generic field view. | |
| void | sim_field_stats_compute_phase_metrics (const SimFieldView *view, SimFieldStats *stats, const SimPhaseCoherenceConfig *config, size_t dominant_k) |
| Compute thresholded, weighted, and deramped phase metrics for a view. | |
| void | sim_field_stats_update_phase_lock (struct SimContext *context, size_t field_index, SimFieldStats *stats) |
| Update per-field EMA phase lock state and write it into stats. | |
| void | sim_field_stats_set_phase_config (const SimPhaseCoherenceConfig *config) |
| Replace the global phase-coherence configuration. | |
| const SimPhaseCoherenceConfig * | sim_field_stats_get_phase_config (void) |
| Return the global phase-coherence configuration. | |
| void | sim_field_stats_set_phase_thresholds (double abs_threshold, double rel_threshold) |
| Update global absolute and relative phase sample thresholds. | |
| void | sim_field_stats_set_phase_weighted (bool weighted) |
| Select whether phase-lock decisions use weighted coherence. | |
| void | sim_field_stats_set_phase_lock_thresholds (double on_threshold, double off_threshold) |
| Update global phase-lock hysteresis thresholds. | |
| void | sim_field_stats_set_phase_smoothing (double smoothing_seconds) |
| Update the global phase-lock EMA smoothing time constant. | |
| void | sim_field_stats_set_phase_deramp (bool enabled) |
| Enable or disable dominant-bin deramping for advanced phase metrics. | |
| void | sim_field_stats_reset_topology_fields (SimFieldStats *stats) |
| Clear topology-related fields in a stats snapshot. | |
| void | sim_field_stats_profile_reset (SimFieldStatsRuntimeProfile *profile, const SimFieldStatsComputeConfig *config) |
| Reset runtime stats profiling counters. | |
| void | sim_field_stats_profile_record_request (SimFieldStatsRuntimeProfile *profile, size_t field_index, size_t step_index, SimFieldStatsProfileSource source) |
| Record a field-statistics request and its cache/source path. | |
| void | sim_field_stats_profile_record_compute (SimFieldStatsRuntimeProfile *profile, size_t field_index, size_t step_index, SimFieldStatsProfileSource source, const SimFieldStatsComputeTimings *timings) |
| Record a field-statistics computation and optional timings. | |
| void | sim_field_stats_profile_record_phase_lock (SimFieldStatsRuntimeProfile *profile, uint64_t phase_lock_ns) |
| Record phase-lock update duration. | |
Runtime field-statistics configuration, accumulation, and profiling helpers.
This header extends the public SimFieldStats snapshot with optional feature masks, phase-coherence controls, generic field views, and runtime profiling counters used by contexts, visual caches, and drift evaluation paths.
| #define SIM_FIELD_STATS_FEATURE_MASK_DEFAULT |
Default feature mask used when callers omit an explicit compute config.
| #define SIM_FIELD_STATS_FEATURE_MASK_NONE 0u |
Empty optional field-statistics feature mask.
| anonymous enum |
Legacy field-data type constants mapped to buffer storage constants.
| enum SimFieldStatsFeature |
Source path recorded for the most recent stats request or computation.
| void sim_field_stats_accumulate_complex | ( | SimFieldStatsAccumulator * | acc, |
| double | real, | ||
| double | imag | ||
| ) |
Accumulate one complex sample.
| acc | Accumulator to update. |
| real | Real component. |
| imag | Imaginary component. |
| void sim_field_stats_accumulate_real | ( | SimFieldStatsAccumulator * | acc, |
| double | value | ||
| ) |
Accumulate one real sample.
| acc | Accumulator to update. |
| value | Real sample value. |
| void sim_field_stats_accumulator_begin | ( | SimFieldStatsAccumulator * | acc, |
| SimFieldStats * | stats | ||
| ) |
Initialize a streaming accumulator with the default compute config.
| [out] | acc | Accumulator to initialize; NULL is ignored. |
| [out] | stats | Destination stats snapshot finalized by finish(); may be NULL. |
| void sim_field_stats_accumulator_begin_with_config | ( | SimFieldStatsAccumulator * | acc, |
| SimFieldStats * | stats, | ||
| const SimFieldStatsComputeConfig * | config | ||
| ) |
Initialize a streaming accumulator with an explicit compute config.
| [out] | acc | Accumulator to initialize; NULL is ignored. |
| [out] | stats | Destination stats snapshot finalized by finish(); may be NULL. |
| config | Optional feature config; NULL selects the default config. |
| void sim_field_stats_accumulator_finish | ( | SimFieldStatsAccumulator * | acc | ) |
Finalize accumulated statistics into the destination snapshot.
| acc | Accumulator created by sim_field_stats_accumulator_begin(). |
| void sim_field_stats_compute_phase_metrics | ( | const SimFieldView * | view, |
| SimFieldStats * | stats, | ||
| const SimPhaseCoherenceConfig * | config, | ||
| size_t | dominant_k | ||
| ) |
Compute thresholded, weighted, and deramped phase metrics for a view.
| view | View to inspect. | |
| [in,out] | stats | Stats snapshot receiving phase fields. |
| config | Optional phase config; NULL uses the global phase config. | |
| dominant_k | Dominant spectral bin used for deramping. |
| bool sim_field_stats_compute_spectral_view | ( | const SimFieldView * | view, |
| SimFieldStats * | stats, | ||
| size_t * | out_dominant_k | ||
| ) |
Compute FFT-derived spectral metrics for a generic field view.
| view | View to inspect. | |
| [in,out] | stats | Stats snapshot receiving spectral fields. |
| [out] | out_dominant_k | Optional dominant spectral bin receiver. |
| void sim_field_stats_compute_with_config | ( | const struct SimField * | field, |
| SimFieldStats * | out, | ||
| const SimFieldStatsComputeConfig * | config, | ||
| SimFieldStatsComputeTimings * | timings | ||
| ) |
Compute field statistics with optional feature selection and timings.
| field | Field to inspect. | |
| [out] | out | Destination stats snapshot. |
| config | Optional feature config; NULL selects the default config. | |
| [out] | timings | Optional receiver for compute-stage timings. |
| SimFieldStatsComputeConfig sim_field_stats_default_compute_config | ( | void | ) |
Return the default stats compute configuration.
| bool sim_field_stats_feature_enabled | ( | const SimFieldStatsComputeConfig * | config, |
| uint32_t | feature | ||
| ) |
Test whether feature is enabled in a compute config.
| config | Optional config; NULL selects the default config. |
| feature | Feature bit to test. |
feature. | const SimPhaseCoherenceConfig * sim_field_stats_get_phase_config | ( | void | ) |
Return the global phase-coherence configuration.
| uint32_t sim_field_stats_normalize_feature_mask | ( | uint32_t | feature_mask | ) |
Clamp and expand a stats feature mask to supported dependencies.
| feature_mask | Caller-supplied feature mask. |
| void sim_field_stats_profile_record_compute | ( | SimFieldStatsRuntimeProfile * | profile, |
| size_t | field_index, | ||
| size_t | step_index, | ||
| SimFieldStatsProfileSource | source, | ||
| const SimFieldStatsComputeTimings * | timings | ||
| ) |
Record a field-statistics computation and optional timings.
| profile | Profile to update; NULL is ignored. |
| field_index | Field index associated with the event. |
| step_index | Step index associated with the event. |
| source | Compute source to record. |
| timings | Optional timings to accumulate. |
| void sim_field_stats_profile_record_phase_lock | ( | SimFieldStatsRuntimeProfile * | profile, |
| uint64_t | phase_lock_ns | ||
| ) |
Record phase-lock update duration.
| profile | Profile to update; NULL is ignored. |
| phase_lock_ns | Duration in nanoseconds. |
| void sim_field_stats_profile_record_request | ( | SimFieldStatsRuntimeProfile * | profile, |
| size_t | field_index, | ||
| size_t | step_index, | ||
| SimFieldStatsProfileSource | source | ||
| ) |
Record a field-statistics request and its cache/source path.
| profile | Profile to update; NULL is ignored. |
| field_index | Field index associated with the event. |
| step_index | Step index associated with the event. |
| source | Request source to record. |
| void sim_field_stats_profile_reset | ( | SimFieldStatsRuntimeProfile * | profile, |
| const SimFieldStatsComputeConfig * | config | ||
| ) |
Reset runtime stats profiling counters.
| [out] | profile | Profile to reset; NULL is ignored. |
| config | Optional compute config to store in the profile. |
| void sim_field_stats_reset_topology_fields | ( | SimFieldStats * | stats | ) |
Clear topology-related fields in a stats snapshot.
| stats | Stats snapshot to update; NULL is ignored. |
| void sim_field_stats_set_phase_config | ( | const SimPhaseCoherenceConfig * | config | ) |
Replace the global phase-coherence configuration.
Invalid negative thresholds are clamped and lock thresholds are ordered.
| config | Configuration to copy; NULL is ignored. |
| void sim_field_stats_set_phase_deramp | ( | bool | enabled | ) |
Enable or disable dominant-bin deramping for advanced phase metrics.
| enabled | true to compute k0 coherence after deramping. |
| void sim_field_stats_set_phase_lock_thresholds | ( | double | on_threshold, |
| double | off_threshold | ||
| ) |
Update global phase-lock hysteresis thresholds.
| on_threshold | Threshold that enters the locked state. |
| off_threshold | Threshold that exits the locked state. |
| void sim_field_stats_set_phase_smoothing | ( | double | smoothing_seconds | ) |
Update the global phase-lock EMA smoothing time constant.
| smoothing_seconds | Non-negative smoothing constant in seconds. |
| void sim_field_stats_set_phase_thresholds | ( | double | abs_threshold, |
| double | rel_threshold | ||
| ) |
Update global absolute and relative phase sample thresholds.
| abs_threshold | Non-negative absolute threshold; negative values leave it unchanged. |
| rel_threshold | Non-negative relative threshold; negative values leave it unchanged. |
| void sim_field_stats_set_phase_weighted | ( | bool | weighted | ) |
Select whether phase-lock decisions use weighted coherence.
| weighted | true to use magnitude-weighted coherence. |
| void sim_field_stats_update_phase_lock | ( | struct SimContext * | context, |
| size_t | field_index, | ||
| SimFieldStats * | stats | ||
| ) |
Update per-field EMA phase lock state and write it into stats.
| context | Simulation context containing phase-lock runtime arrays. | |
| field_index | Field index to update. | |
| [in,out] | stats | Stats snapshot receiving EMA and lock state. |
| SimFieldView sim_field_view_from_field | ( | SimField * | field | ) |
Build a generic field view over a SimField.
| field | Field to view. |