LanczosWindow<T>

Models & Types · AiDotNet.WindowFunctions

Implements the Lanczos window function for signal processing applications.

Implements: IWindowFunction<T>

For Beginners

A window function is like a special filter that helps analyze signals more accurately.

The Lanczos window:

  • Creates a smooth curve based on the sinc function (sin(x)/x)
  • Provides good preservation of the main signal features
  • Is particularly useful for resampling and interpolation tasks

Think of the Lanczos window like a special camera filter that helps capture more detail without distortion. The sinc function it’s based on is fundamental in signal processing because it has ideal frequency characteristics - it can perfectly reconstruct bandwidth-limited signals. In practice, the Lanczos window is commonly used when resizing images, resampling audio, or analyzing data where preserving the main features of the signal is important.

How It Works

The Lanczos window is based on the Lanczos kernel (sinc function) and is defined by the equation: w(n) = sinc(2n/(N-1) - 1) where n is the sample index, N is the window size, and sinc(x) = sin(px)/(px) for x ? 0 and sinc(0) = 1. The Lanczos window provides good frequency resolution while reducing side lobe amplitude.

Example

using AiDotNet.WindowFunctions;
using AiDotNet.Tensors.LinearAlgebra;

var window = new LanczosWindow<double>();
Vector<double> w = window.Create(16);
Console.WriteLine($"LanczosWindow: {w.Length}-point window, center = {w[w.Length / 2]:F4}");

Constructors

Constructor Summary
LanczosWindow() Initializes a new instance of the LanczosWindow class.

Methods

Method Summary
Vector<T> Create(int windowSize) Creates a Lanczos window of the specified size.
WindowFunctionType GetWindowFunctionType() Gets the type identifier for this window function.