Struct FastFourierTransform<T>
- Namespace
- AiDotNet.LinearAlgebra
- Assembly
- AiDotNet.dll
Implements the Fast Fourier Transform (FFT) algorithm for converting between time domain and frequency domain representations.
public readonly struct FastFourierTransform<T>
Type Parameters
TThe numeric type used for calculations (e.g., double, float).
- Inherited Members
Remarks
For Beginners: The Fast Fourier Transform is a mathematical technique that breaks down a signal (like sound or image data) into its component frequencies. Think of it like analyzing a musical chord to identify which individual notes are being played.
For example, if you have audio data that represents a recording of multiple instruments playing together, the FFT can help separate the different frequencies that make up that sound. This is useful in many applications like audio processing, image compression, and pattern recognition.
Constructors
FastFourierTransform()
Initializes a new instance of the FastFourierTransform struct.
public FastFourierTransform()
Remarks
For Beginners: This constructor prepares the FFT calculator by setting up the necessary mathematical operations for the specific number type you're using (like double or float).
Methods
Forward(Vector<T>)
Performs a forward Fast Fourier Transform, converting from time domain to frequency domain.
public Vector<Complex<T>> Forward(Vector<T> input)
Parameters
inputVector<T>The input vector in time domain.
Returns
- Vector<Complex<T>>
A vector of complex numbers representing the frequency domain.
Remarks
For Beginners: This method takes your original data (like a sound wave over time) and converts it to show which frequencies are present and how strong each frequency is.
For example, if your input represents a sound recording, the output will tell you which musical notes (frequencies) are present in that recording and how loud each note is.
Inverse(Vector<Complex<T>>)
Performs an inverse Fast Fourier Transform, converting from frequency domain back to time domain.
public Vector<T> Inverse(Vector<Complex<T>> input)
Parameters
inputVector<Complex<T>>The input vector in frequency domain (complex numbers).
Returns
- Vector<T>
A vector representing the time domain.
Remarks
For Beginners: This method does the opposite of the Forward method. It takes frequency information (which frequencies are present and how strong they are) and converts it back to the original form.
For example, if you have information about which musical notes are in a chord and how loud each note is, this method can reconstruct the actual sound wave of that chord.