FftFlat 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package FftFlat --version 0.1.0
NuGet\Install-Package FftFlat -Version 0.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FftFlat" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FftFlat --version 0.1.0
#r "nuget: FftFlat, 0.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install FftFlat as a Cake Addin
#addin nuget:?package=FftFlat&version=0.1.0

// Install FftFlat as a Cake Tool
#tool nuget:?package=FftFlat&version=0.1.0

FftFlat

The purpose of this library is to provide a reasonably fast FFT implementation, all in pure C#. This library is a port of KISS FFT, adapted to work with the .NET Standard complex number type.

Installation

The NuGet package is available:

Install-Package FftFlat

If you don't want to add a DLL, copy FastFourierTransform.cs into your project.

Usage

First, add a using statement for the FftFlat namespace.

using FftFlat;

To perform FFT or IFFT, create a FastFourierTransform instance and call the appropriate method.

var signal = new Complex[1024];
signal[0] = 1;

var fft = new FastFourierTransform(1024);
fft.ForwardInplace(signal);

Performance

The following is a benchmark comparing this with other pure C# FFT implementations. In this benchmark, the time taken to perform FFT and IFFT on a random signal was measured. The FFT lengths used were powers of two, ranging from 256 to 8192.

Method Length Mean Error StdDev Gen0 Allocated
FftFlat 256 4.965 μs 0.0114 μs 0.0101 μs - -
FftSharp 256 20.235 μs 0.0619 μs 0.0549 μs - -
MathNet 256 7.910 μs 0.0236 μs 0.0221 μs - -
FftFlat 512 12.296 μs 0.0236 μs 0.0221 μs - -
FftSharp 512 43.121 μs 0.0755 μs 0.0707 μs - -
MathNet 512 16.256 μs 0.0512 μs 0.0454 μs - -
FftFlat 1024 23.508 μs 0.0351 μs 0.0328 μs - -
FftSharp 1024 94.384 μs 0.1486 μs 0.1390 μs - -
MathNet 1024 39.840 μs 0.3345 μs 0.3129 μs 1.5869 20925 B
FftFlat 2048 56.615 μs 0.1714 μs 0.1603 μs - -
FftSharp 2048 205.460 μs 0.4828 μs 0.4280 μs - -
MathNet 2048 78.428 μs 0.5052 μs 0.4726 μs 1.8311 24474 B
FftFlat 4096 109.523 μs 0.2409 μs 0.2253 μs - -
FftSharp 4096 444.830 μs 2.3125 μs 2.1631 μs - -
MathNet 4096 186.309 μs 1.2405 μs 1.1604 μs 2.4414 33174 B
FftFlat 8192 257.211 μs 0.9387 μs 0.8781 μs - -
FftSharp 8192 952.966 μs 1.6605 μs 1.4720 μs - 1 B
MathNet 8192 323.204 μs 0.6870 μs 0.5737 μs 3.4180 46602 B

Todo

  • ✅ FFT for powers of two
  • ⬜ FFT for non-powers of two
  • ⬜ Cosine transform
  • ⬜ Speedup via multithreading
  • ⬜ Speedup via SIMD

License

FftFlat is available under the BSD 3-Clause license.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on FftFlat:

Package Downloads
NumFlat

A numerical computation library for C#

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 259 1/13/2024
1.0.0 90 1/10/2024
0.3.1 94 1/7/2024
0.3.0 107 12/28/2023
0.2.1 100 12/16/2023
0.2.0 106 12/15/2023
0.1.0 171 10/24/2023