コード例 #1
0
        static public void ReorderArray(double[] data)
        {
            Debug.Assert(data != null);

            int length = data.Length / 2;

            Debug.Assert(FourierUtils.IsPowerOf2(length) == true);
            Debug.Assert(length >= cMinLength);
            Debug.Assert(length <= cMaxLength);

            int[] reversedBits = FourierUtils.GetReversedBits(FourierUtils.Log2(length));
            for (int i = 0; i < length; i++)
            {
                int swap = reversedBits[i];
                if (swap > i)
                {
                    FourierUtils.Swap(ref data[i << 1], ref data[swap << 1]);
                    FourierUtils.Swap(ref data[i << 1 + 1], ref data[swap << 1 + 1]);
                }
            }
        }
コード例 #2
0
        static public void ReorderArray(ComplexF[] data)
        {
            Debug.Assert(data != null);

            int length = data.Length;

            Debug.Assert(FourierUtils.IsPowerOf2(length) == true);
            Debug.Assert(length >= cMinLength);
            Debug.Assert(length <= cMaxLength);

            int[] reversedBits = FourierUtils.GetReversedBits(FourierUtils.Log2(length));
            for (int i = 0; i < length; i++)
            {
                int swap = reversedBits[i];
                if (swap > i)
                {
                    ComplexF temp = data[i];
                    data[i]    = data[swap];
                    data[swap] = temp;
                }
            }
        }