HaarWavelet<T>

Models & Types · AiDotNet.WaveletFunctions

Represents a Haar wavelet function implementation for signal processing and analysis.

Inheritance: WaveletFunctionBase<T> → HaarWavelet<T>

For Beginners

The Haar wavelet is like a digital “on/off” switch for analyzing data.

Think of the Haar wavelet as the simplest possible pattern-matching tool:

  • It’s a square wave that is +1 for half its width and -1 for the other half
  • It’s excellent at detecting sudden changes or edges in your data
  • It’s the oldest and simplest type of wavelet, discovered in 1909

The Haar wavelet is particularly good at finding abrupt transitions in your data, like the edge between a light and dark area in an image or a sudden change in a sound wave. It’s widely used in image compression, feature detection, and as a teaching tool for wavelet concepts.

How It Works

The Haar wavelet is the simplest possible wavelet, resembling a step function. It is discontinuous and represents the same wavelet as the Daubechies wavelet with one vanishing moment. This implementation provides methods for calculating wavelet values and decomposing signals using the Haar wavelet transform.

Example

using AiDotNet.WaveletFunctions;

var wavelet = new HaarWavelet<double>();
double value = wavelet.Calculate(0.5);
Console.WriteLine($"HaarWavelet: psi(0.5) = {value:F4}");

Constructors

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

Methods

Method Summary
T Calculate(T x) Calculates the Haar wavelet function value at the specified point.
ValueTuple<Vector<T>, Vector<T>> Decompose(Vector<T> input) Decomposes an input signal using the Haar wavelet transform.
Vector<T> GetScalingCoefficients() Gets the scaling coefficients used in the Haar wavelet transform.
Vector<T> GetWaveletCoefficients() Gets the wavelet coefficients used in the Haar wavelet transform.
Vector<T> Reconstruct(Vector<T> approximation, Vector<T> detail) Reconstructs the original signal from approximation and detail coefficients.