Module dsp::complex_dsp
DSP Complex Numbers
Value-type complex numbers built for the rest of std/dsp/'s spectral code (fft.h/dft.h's butterflies and twiddle factors, convolution.h's frequency-domain multiply) — distinct from std/complex.h's C99-style API, which represents a complex number as a float[2]/double[2] out- array and writes results through a pointer on every operation. That shape matches C99 <complex.h> closely, but every FFT butterfly doing several arithmetic ops back-to-back would need a temporary out-array per intermediate result; a plain value type with operators (SafeC supports operator overloading — see reference/functions.md) reads the same way the math does: 'w * a + b', not a chain of cmul_d/cadd_d calls each writing through a pointer.
Two variants, matching std/dsp's two numeric domains:
struct Complex — double re/im, for the float-precision DSP path.
struct FComplex — Fixed (Q8.24) re/im, for the fixed-point path.
Structs
| Complex | |
| Complex32 | Single-precision complex: the float counterpart of Complex, with the same layout (re then im). The _f32 DSP functions (fft_f32, stft_forward_f32, ...) take it. Not to be confused with FComplex below, which is fixed point. |
| FComplex |