Skip to content

File util_core.h

FileList > inc > util > util_core.h

Go to the source code of this file

Util module — public C API. More...

  • #include "clib_common.h"
  • #include "jm_perf.h"
  • #include <math.h>

Public Static Functions

Type Name
JM_FORCEINLINE float complex square_clip (float complex y, float lin)
Square-clip a complex sample: clip the real and imaginary parts independently to [-lin, lin] (a square region in the IQ plane, not a circular magnitude limit). Each component is passed through unchanged when its magnitude is within the threshold and clamped to the nearest boundary otherwise.

Detailed Description

The util functions are header-only and JM_FORCEINLINE: any caller that includes this header inlines them with zero call overhead, and the util Python extension module exposes the very same definitions. There is one source of truth per function, here.

Public Static Functions Documentation

function square_clip

Square-clip a complex sample: clip the real and imaginary parts independently to [-lin, lin] (a square region in the IQ plane, not a circular magnitude limit). Each component is passed through unchanged when its magnitude is within the threshold and clamped to the nearest boundary otherwise.

static JM_FORCEINLINE float complex square_clip (
    float complex y,
    float lin
) 

Parameters:

  • y Complex CF32 input sample.
  • lin Per-component clip threshold (linear amplitude, >= 0). Values outside [-lin, lin] are clamped; values on the boundary are preserved exactly.

Returns:

Sample with each component limited to [-lin, lin].

>>> from doppler.util import square_clip
>>> square_clip(0.5+0.25j, 1.0)   # within bounds, passed through
(0.5+0.25j)
>>> square_clip(2.0+0.5j, 1.0)    # real clipped, imag unchanged
(1+0.5j)
>>> square_clip(3.0-4.0j, 1.0)    # both components clipped
(1-1j)
>>> square_clip(0.5+0.5j, 0.25)   # smaller threshold clips both
(0.25+0.25j)
>>> square_clip(-2.0+0.0j, 1.0)   # negative real clipped
(-1+0j)



The documentation for this class was generated from the following file native/inc/util/util_core.h