예제 #1
0
        //Вычисление 6-точечного БПФ
        static public Complex[] fft6(Complex[] vector)
        {
            //Создание двумерного массива исходных значений
            Complex[,] x = new Complex[3, 2];
            for (var i = 0; i < 3; ++i)
            {
                for (var j = 0; j < 2; ++j)
                {
                    x[i, j] = vector[2 * i + j];
                }
            }

            //Итоговый массив
            Complex[,] result = new Complex[3, 2];

            //3-точечные ДПФ cтолбцов
            for (var s = 0; s < 2; ++s)
            {
                Complex[] tempIn = new Complex[3];
                for (var r = 0; r < 3; ++r)
                {
                    tempIn[r] = x[r, s];
                }

                Complex[] tempOut = new Complex[3];
                tempOut = FFT.dft3(tempIn);

                for (var r = 0; r < 3; ++r)
                {
                    result[r, s] = tempOut[r];
                }
            }

            for (var i = 0; i < 3; ++i)
            {
                for (var j = 0; j < 2; ++j)
                {
                    result[i, j] = result[i, j] * new Complex(1, Math.PI * i * j / 3);
                }
            }
            OperationCount += 3 * 2;

            //2-точечные ДПФ cтрок
            for (var r = 0; r < 3; ++r)
            {
                Complex[] tempIn = new Complex[2];
                for (var s = 0; s < 2; ++s)
                {
                    tempIn[s] = result[r, s];
                }

                Complex[] tempOut = new Complex[2];
                tempOut = FFT.dft2(tempIn);

                for (var s = 0; s < 2; ++s)
                {
                    result[r, s] = tempOut[s];
                }
            }

            Complex[] resultVector = new Complex[6];
            for (var j = 0; j < 2; ++j)
            {
                for (var i = 0; i < 3; ++i)
                {
                    resultVector[3 * j + i] = result[i, j];
                }
            }


            return(resultVector);
        }
예제 #2
0
        //Вычисление 54-точечного БПФ
        static public Complex[] fft54(Complex[] vector)
        {
            //Создание двумерного массива исходных значений
            Complex[,] x = new Complex[9, 6];
            for (var i = 0; i < 9; ++i)
            {
                for (var j = 0; j < 6; ++j)
                {
                    x[i, j] = vector[6 * i + j];
                }
            }

            //Итоговый вектор
            Complex[,] result = new Complex[9, 6];

            //9-точечные БПФ cтолбцов
            for (var s = 0; s < 6; ++s)
            {
                Complex[] tempIn = new Complex[9];
                for (var r = 0; r < 9; ++r)
                {
                    tempIn[r] = x[r, s];
                }

                Complex[] tempOut = new Complex[9];
                tempOut = FFT.fft9(tempIn);

                for (var r = 0; r < 9; ++r)
                {
                    result[r, s] = tempOut[r];
                }
            }

            for (var i = 0; i < 9; ++i)
            {
                for (var j = 0; j < 6; ++j)
                {
                    result[i, j] = result[i, j] * new Complex(1, 2 * Math.PI * i * j / 54);
                }
            }
            OperationCount += 9 * 6;

            //6-точечные БПФ cтрок
            for (var r = 0; r < 9; ++r)
            {
                Complex[] tempIn = new Complex[6];
                for (var s = 0; s < 6; ++s)
                {
                    tempIn[s] = result[r, s];
                }

                Complex[] tempOut = new Complex[6];
                tempOut = FFT.fft6(tempIn);

                for (var s = 0; s < 6; ++s)
                {
                    result[r, s] = tempOut[s];
                }
            }

            Complex[] resultVector = new Complex[54];
            for (var j = 0; j < 6; ++j)
            {
                for (var i = 0; i < 9; ++i)
                {
                    resultVector[9 * j + i] = result[i, j];
                }
            }


            return(resultVector);
        }