Module_Extensions_FFTW - vorcyc/Vorcyc.Mathematics GitHub Wiki
Location: Home / FFTW extension
Vorcyc.Mathematics.Extensions.FFTW is a standalone NuGet package that provides a .NET wrapper around the FFTW (Fastest Fourier Transform in the West) native library. The extension depends on the main library Vorcyc.Mathematics and uses its PinnableArray<T>, ComplexFp32, Complex<T>, and related types for efficient memory pinning and complex arithmetic.
Assembly name: Vorcyc.Mathematics.Extensions.FFTW
Namespace: Vorcyc.Mathematics.Extensions.FFTW
Package version: 0.10.20 (aligned withVorcyc.Mathematics; no FFTW API change)
Dependencies: Vorcyc.Mathematics (main library) + FFTW native DLL (shipped with the package underruntimes/win-x64/native)
πContents
- π Single-precision DFT
- π Double-precision DFT
- π Dft1D β 1D transform (double precision)
- π Dft2D β 2D transform (double precision)
- π Dft3D β 3D transform (double precision)
- π DftND β N-dimensional transform (double precision)
- π RealToRealTransforms β real-to-real transforms (double precision)
- π Utilities β utility methods (double precision)
- π HilbertTransform class
- π EnvelopeComputer class
- π SignalExtension class
- π PinnableArraySignalExtension class
The following classes are static (partial) classes in namespace Vorcyc.Mathematics.Extensions.FFTW. Input/output uses ComplexFp32 (single-precision complex) or float.
Provides static methods for one-dimensional discrete Fourier transforms, wrapping the FFTW single-precision interface.
| Method | Description |
|---|---|
Forward(...) |
Complex-to-complex forward DFT (non-in-place) |
Inverse(...) |
Complex-to-complex inverse DFT (non-in-place) |
ForwardInPlace(...) |
Complex-to-complex forward DFT (in-place) |
InverseInPlace(...) |
Complex-to-complex inverse DFT (in-place) |
Forward(ReadOnlySpan<float>, ...) |
Real-to-complex (R2C) forward DFT |
Inverse(..., Span<float>, ...) |
Complex-to-real (C2R) inverse DFT |
Each method provides overloads for PinnableArray<T>, Span<T>, and raw pointers.
Note: FFTW does not normalize by default; inverse transforms typically require scaling by
1/N. C2R overloads provide an optionalscaleparameter.
Provides forward and inverse two-dimensional complex-to-complex (C2C) DFT.
| Method | Description |
|---|---|
Forward(input, output, nx, ny, ...) |
2D C2C forward DFT |
Inverse(input, output, nx, ny, ...) |
2D C2C inverse DFT |
Provides forward and inverse three-dimensional complex-to-complex (C2C) DFT.
| Method | Description |
|---|---|
Forward(input, output, nx, ny, nz, ...) |
3D C2C forward DFT |
Inverse(input, output, nx, ny, nz, ...) |
3D C2C inverse DFT |
Provides C2C, R2C, and C2R transforms of arbitrary dimensionality.
| Method | Description |
|---|---|
Forward(input, output, dims, ...) |
N-dimensional C2C forward DFT |
Inverse(input, output, dims, ...) |
N-dimensional C2C inverse DFT |
Forward(ReadOnlySpan<float>, ..., dims) |
N-dimensional R2C forward DFT |
Inverse(..., Span<float>, dims, ...) |
N-dimensional C2R inverse DFT |
Real-to-real (R2R) transforms based on FFTW fftw_kind, supporting 1D / 2D / 3D / N-D.
| Method | Description |
|---|---|
R2HC1D(...) |
1D real-to-half-complex spectrum |
HC2R1D(...) |
1D half-complex spectrum to real |
DHT1D(...) |
1D discrete Hartley transform |
R2R_2D(...) |
2D R2R transform |
R2R_3D(...) |
3D R2R transform |
R2R_ND(...) |
N-dimensional R2R transform |
| Method | Description |
|---|---|
EstimateFlops(...) |
Estimates floating-point operations for a 1D C2C DFT (adds, muls, fmas) |
PrintPlan(...) |
Prints a human-readable description of an FFTW plan |
Structurally identical to the single-precision version, using Complex<double> or double types. All classes are partial and share class names with the single-precision classes (organized across partial files).
Double-precision 1D C2C, R2C, and C2R transforms; API is symmetric with the single-precision version.
Double-precision 2D C2C transforms.
Double-precision 3D C2C transforms.
Double-precision C2C, R2C, and C2R transforms of arbitrary dimensionality.
Double-precision R2R transforms (1D / 2D / 3D / N-D); API is symmetric with the single-precision version.
Double-precision FLOPs estimation and plan printing utilities.
Computes the Hilbert transform of real-valued signals using FFT-based analytic signal construction. Commonly used to form analytic signals, extract instantaneous phase and amplitude, or perform envelope detection.
| Method | Description |
|---|---|
ComputeHilbertTransform(ReadOnlySpan<float>) |
Computes the Hilbert transform of a single-precision real-valued signal |
ComputeHilbertTransform(ReadOnlySpan<double>) |
Computes the Hilbert transform of a double-precision real-valued signal |
Computes signal envelopes using the Hilbert transform and peak detection.
| Value | Description |
|---|---|
Symmetric |
Lower envelope is the negation of the upper envelope (assumes signal oscillates symmetrically around zero) |
Independent |
Lower envelope is computed independently (negate the signal first, then apply the Hilbert transform) |
| Method | Description |
|---|---|
ComputeHilbertEnvelope(...) |
Computes upper/lower envelopes of a signal |
Provides FFTW-based frequency-domain transform extension methods for the standard SignalProcessing.Signals APIs (Signal, SignalSegment, ModifiableTimeDomainSignal). Because FFTW supports DFT of arbitrary length, signals do not need to be zero-padded to a power of two.
| Extension target | Method | Description |
|---|---|---|
Signal |
TransformToFrequencyDomainFFTW(WindowType?) |
Transforms a signal to the frequency domain, with optional window function |
SignalSegment |
TransformToFrequencyDomainFFTW(WindowType?) |
Transforms a signal segment to the frequency domain |
ModifiableTimeDomainSignal |
TransformToFrequencyDomainFFTW(WindowType?) |
Transforms a modifiable signal to the frequency domain |
Provides signal/spectrum-related extension methods for PinnableArray<float> and PinnableArray<double>.
| Extension target | Method | Description |
|---|---|---|
PinnableArray<float> |
ScaleInPlace() |
Scales in place by 1/N (for inverse FFT normalization) |
PinnableArray<double> |
ScaleInPlace() |
Scales in place by 1/N (double-precision version) |