https://github.com/tambapps/fourier-transform-library
  
  
    A Fast Fourier Transform library written in Java 
    https://github.com/tambapps/fourier-transform-library
  
fft fourier-transform fourier-transform-library java
        Last synced: 6 months ago 
        JSON representation
    
A Fast Fourier Transform library written in Java
- Host: GitHub
 - URL: https://github.com/tambapps/fourier-transform-library
 - Owner: tambapps
 - License: mit
 - Created: 2018-10-23T13:23:52.000Z (about 7 years ago)
 - Default Branch: master
 - Last Pushed: 2022-12-22T12:38:59.000Z (almost 3 years ago)
 - Last Synced: 2025-04-08T14:11:53.487Z (7 months ago)
 - Topics: fft, fourier-transform, fourier-transform-library, java
 - Language: Java
 - Homepage:
 - Size: 225 KB
 - Stars: 14
 - Watchers: 0
 - Forks: 1
 - Open Issues: 0
 - 
            Metadata Files:
            
- Readme: README.md
 - License: LICENSE
 
 
Awesome Lists containing this project
README
          
# Java Fourier Transform Library
This is a library for computing 1-2 dimensional Fourier Transform. It was written with Java 8, and should be Android-compatible (you can use it in an Android project).
This library was written **without any compile dependencies**. 
You can import it with maven.
If you are more familiar with the old implementation (version 1.0), consult the [legacy branch](https://github.com/tambapps/fourier-transform-library/tree/legacy)
```xml
  com.tambapps.fft4j
  fft4j
  2.0
```
## Fast Fourier Transform
Here is an example of a 1D fast fourier transform. There are several algorithms to perform FFT
You can see all of them on the FastFouriers class.
```groovy
double[] inputRe = getInputDataRe();
double[] inputIm = getInputDataIm();
double[] outputRe = new double[inputRe.length];
double[] outputIm = new double[inputRe.length];
FastFouriers.BASIC.transform(inputRe, inputIm, outputRe, outputIm);
// consult result in outputRe and outputIm
```
You can also use a `Signal` which encapsulates a real and imaginary double arrays.
```groovy
Signal input = inputData();
Signal output = FastFouriers.BASIC.transform(input);
```
3 different Fast Fourier Algorithms were implemented
### Basic
This is a trivial implementation of a Fourier Transform using the basic Fourier Transform formula
### Recursive Cooley–Tukey
A recursive implementation of the [Cooley–Tukey FFT algorithm](https://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm).
Note that this algorithm requires the input length to be a power of 2.
### Iterative Cooley–Tukey
An iterative implementation of the [Cooley–Tukey FFT algorithm](https://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm)
Note that this algorithm requires the input length to be a power of 2.
## 2D Fast Fourier Transform
You can apply 2D FFT with a FastFourierTransformer2D. You can change the algorithm used by the transformer
to compute fft by setting the AlgorithmChooser.
```groovy
Signal2d signal2d = new Signal2d(M, N);
fill(signal2d);
FastFourier2d transformer2D = new FastFourier2d();
transformer2D.transform(signal2d);
// do some things with the fourier transform
transformer2D.inverse(signal2d);
// don't forget to shut it down as it uses an executor service
transformer2D.shutdown();
```
## Example use case
You can consult the [fft-image-processing repo](https://github.com/nelson888/fft-image-processing), an app that transforms images using FFT

