Quantized Filter

template<typename T, T StepSize>
struct Quantized

Filter that quantizes values to discrete steps before comparison.

This filter rounds values to the nearest multiple of StepSize before comparing, creating discrete levels and reducing sensitivity to small changes.

Since

v0.1.0

// Example: Quantize to steps of 5
Signal<int, 10, Quantized<int, 5>> discrete(0);

Warning

  • Only accepts arithmetic types (integral and floating-point).

  • StepSize must be greater than 0.

Template Parameters:
typename T

Arithmetic type.

T StepSize

Size of quantization step.

Public Functions

inline bool operator()(const T &old_value, const T &new_value) const

See Also