public static void bitreverse ( DoubleVector data , int i0 , int stride ) { int n = data . length ( ) ; for ( int i = 0 , j = 0 ; i < n - 1 ; i ++ ) { int k = n / 2 ; if ( i < j ) { double tmp = data . get ( i0 + stride * i ) ; data . set ( i0 + stride * i , data . get ( i0 + stride * j ) ) ; data . set ( i0 + stride * j , tmp ) ; } while ( k <= j ) { j = j - k ; k = k / 2 ; } j += k ; } }
This is the Gold rader bit - reversal algorithm