public class Scramble extends Object
Modifier and Type | Method and Description |
---|---|
static int[] |
createScrambleTable(int length)
Create a table of indexes for scrambling an array for FFT.
|
static int |
permute(int n,
int length)
Permute the bits of a number to reverse order.
|
public static int permute(int n, int length)
For example, if n
is 5 and the transform
length is 256, the permutation is (in binary)
00000101 → 10100000
n
- The number whose bits to reverse.length
- The FFT transform length for which the bit reversal to perform.n
reversed.public static int[] createScrambleTable(int length)
The returned table contains pairs of indexes that should be swapped
to scramble an array. For example, for transform length 8 the
returned table contains { 1, 4, 3, 6 }
to indicate
that the array elements [1] and [4] should be swapped, and the elements
[3] and [6] should be swapped.
length
- The FFT transform length for which the scrambling table is created.Copyright © 2017. All rights reserved.