fn

sinc

Tensor
sinc(x: Tensor)
source

Normalised sinc function with the standard removable singularity at 0.

The "normalised" sinc carries a factor of π\pi inside the sine, so its zeros coincide with the non-zero integers — the convention used in signal processing.

Parameters

xTensor
Input tensor. Any floating-point dtype.

Returns

Tensor

Element-wise normalised sinc with sinc(0) = 1.

Notes

Mathematical definition:

sinc(x)={sin(πx)πx,x0,1,x=0.\operatorname{sinc}(x) = \begin{cases} \dfrac{\sin(\pi x)}{\pi x}, & x \neq 0, \\ 1, & x = 0. \end{cases}

The composite uses lucid.where to substitute the limit value at x = 0 so the gradient flows cleanly through the removable singularity.

Examples

>>> import lucid
>>> x = lucid.tensor([0.0, 0.5, 1.0])
>>> lucid.sinc(x)
Tensor([1.    , 0.6366, 0.    ])