MCPcopy Create free account
hub / github.com/TheAlgorithms/Java / fftBitReversal

Method fftBitReversal

src/main/java/com/thealgorithms/maths/FFT.java:232–241  ·  view source on GitHub ↗
(int n, int log2n, ArrayList<Complex> x)

Source from the content-addressed store, hash-verified

230
231 /* Swap the values of the signal with bit-reversal method */
232 public static ArrayList<Complex> fftBitReversal(int n, int log2n, ArrayList<Complex> x) {
233 int reverse;
234 for (int i = 0; i < n; i++) {
235 reverse = reverseBits(i, log2n);
236 if (i < reverse) {
237 Collections.swap(x, i, reverse);
238 }
239 }
240 return x;
241 }
242
243 /* Divide by n if we want the inverse FFT */
244 public static ArrayList<Complex> inverseFFT(int n, boolean inverse, ArrayList<Complex> x) {

Callers 1

fftMethod · 0.95

Calls 2

reverseBitsMethod · 0.95
swapMethod · 0.45

Tested by

no test coverage detected