Oakfield API Documentation 1.0.0
Numerical core APIs
Loading...
Searching...
No Matches
remainder.h File Reference

Remainder operator measuring f(warped) - f(reference) with optional accumulation. More...

#include "oakfield/operator_split.h"
#include <stdbool.h>
#include <stddef.h>
Include dependency graph for remainder.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SimRemainderOperatorConfig
 Configuration for the remainder operator. More...
 

Typedefs

typedef enum SimRemainderNonlinearity SimRemainderNonlinearity
 Available nonlinearities applied before differencing.
 
typedef enum SimRemainderComplexMode SimRemainderComplexMode
 Complex processing mode for remainder operator.
 
typedef struct SimRemainderOperatorConfig SimRemainderOperatorConfig
 Configuration for the remainder operator.
 

Enumerations

enum  SimRemainderNonlinearity {
  SIM_REMAINDER_NONLINEARITY_IDENTITY = 0 , SIM_REMAINDER_NONLINEARITY_ABS , SIM_REMAINDER_NONLINEARITY_LOG_ABS , SIM_REMAINDER_NONLINEARITY_POWER ,
  SIM_REMAINDER_NONLINEARITY_TANH
}
 Available nonlinearities applied before differencing. More...
 
enum  SimRemainderComplexMode { SIM_REMAINDER_COMPLEX_MODE_COMPONENT , SIM_REMAINDER_COMPLEX_MODE_POLAR }
 Complex processing mode for remainder operator. More...
 

Functions

SimResult sim_add_remainder_operator (struct SimContext *context, const SimRemainderOperatorConfig *config, size_t *out_index)
 Register a remainder operator that measures f(warped) - f(reference).
 
SimResult sim_remainder_config (struct SimContext *context, size_t operator_index, SimRemainderOperatorConfig *out_config)
 Copy the current remainder configuration from a registered operator.
 
SimResult sim_remainder_update (struct SimContext *context, size_t operator_index, const SimRemainderOperatorConfig *config)
 Replace or renormalize a registered remainder configuration.
 

Detailed Description

Remainder operator measuring f(warped) - f(reference) with optional accumulation.

Supports nonlinear transforms (abs, log_abs, power, tanh, identity) applied prior to differencing and works with real or complex fields (component-wise for complex). Weight and bias are applied after computing the residue. Accumulation optionally adds into the existing output field.

Complex field support: component-wise or polar mode (magnitude residue along warped phase).

Enumeration Type Documentation

◆ SimRemainderComplexMode

Complex processing mode for remainder operator.

Enumerator
SIM_REMAINDER_COMPLEX_MODE_COMPONENT 

Process real and imaginary parts independently.

SIM_REMAINDER_COMPLEX_MODE_POLAR 

Magnitude residue written along warped phase direction.

◆ SimRemainderNonlinearity

Available nonlinearities applied before differencing.

Enumerator
SIM_REMAINDER_NONLINEARITY_IDENTITY 

Identity transform.

SIM_REMAINDER_NONLINEARITY_ABS 

Absolute-value transform.

SIM_REMAINDER_NONLINEARITY_LOG_ABS 

Log-magnitude transform.

SIM_REMAINDER_NONLINEARITY_POWER 

Power-law transform.

SIM_REMAINDER_NONLINEARITY_TANH 

Hyperbolic tangent transform.

Function Documentation

◆ sim_add_remainder_operator()

SimResult sim_add_remainder_operator ( struct SimContext context,
const SimRemainderOperatorConfig config,
size_t *  out_index 
)

Register a remainder operator that measures f(warped) - f(reference).

Parameters
contextSimulation context that will own the operator.
configOptional remainder configuration; NULL selects normalized defaults.
[out]out_indexOptional destination for the registered operator index.
Returns
SIM_RESULT_OK on success, or an error code from argument validation, field/type compatibility checks, allocation, kernel registration, or split registration.

◆ sim_remainder_config()

SimResult sim_remainder_config ( struct SimContext context,
size_t  operator_index,
SimRemainderOperatorConfig out_config 
)

Copy the current remainder configuration from a registered operator.

Parameters
contextSimulation context containing the operator.
operator_indexIndex returned by sim_add_remainder_operator().
[out]out_configReceives the normalized configuration.
Returns
SIM_RESULT_OK on success, SIM_RESULT_INVALID_ARGUMENT for NULL pointers, SIM_RESULT_NOT_FOUND for a missing operator, or SIM_RESULT_INVALID_STATE when the operator has no remainder state.

◆ sim_remainder_update()

SimResult sim_remainder_update ( struct SimContext context,
size_t  operator_index,
const SimRemainderOperatorConfig config 
)

Replace or renormalize a registered remainder configuration.

Passing NULL for config keeps the current configuration and reapplies normalization. A successful update refreshes symbolic metadata and invalidates the scheduler plan.

Parameters
contextSimulation context containing the operator.
operator_indexIndex of the remainder operator to update.
configOptional replacement remainder configuration.
Returns
SIM_RESULT_OK on success, SIM_RESULT_INVALID_ARGUMENT for a NULL context, SIM_RESULT_NOT_FOUND for a missing operator, or SIM_RESULT_INVALID_STATE when the operator has no remainder state.