public static double num_flops(int N) { double num1 = (double)N; double num2 = (double)FFT.log2(N); return((5.0 * num1 - 2.0) * num2 + 2.0 * (num1 + 1.0)); }
protected internal static void transform_internal(double[] data, int direction) { if (data.Length == 0) { return; } int n = data.Length / 2; if (n == 1) { return; } int num1 = FFT.log2(n); FFT.bitreverse(data); int num2 = 0; int num3 = 1; while (num2 < num1) { double num4 = 1.0; double num5 = 0.0; double a = 2.0 * (double)direction * Math.PI / (2.0 * (double)num3); double num6 = Math.Sin(a); double num7 = Math.Sin(a / 2.0); double num8 = 2.0 * num7 * num7; int num9 = 0; while (num9 < n) { int index1 = checked (2 * num9); int index2 = checked (2 * num9 + num3); double num10 = data[index2]; double num11 = data[checked (index2 + 1)]; data[index2] = data[index1] - num10; data[checked (index2 + 1)] = data[checked (index1 + 1)] - num11; data[index1] += num10; data[checked (index1 + 1)] += num11; checked { num9 += 2 * num3; } } int num12 = 1; while (num12 < num3) { double num10 = num4 - num6 * num5 - num8 * num4; double num11 = num5 + num6 * num4 - num8 * num5; num4 = num10; num5 = num11; int num13 = 0; while (num13 < n) { int index1 = checked (2 * num13 + num12); int index2 = checked (2 * num13 + num12 + num3); double num14 = data[index2]; double num15 = data[checked (index2 + 1)]; double num16 = num4 * num14 - num5 * num15; double num17 = num4 * num15 + num5 * num14; data[index2] = data[index1] - num16; data[checked (index2 + 1)] = data[checked (index1 + 1)] - num17; data[index1] += num16; data[checked (index1 + 1)] += num17; checked { num13 += 2 * num3; } } checked { ++num12; } } checked { ++num2; } checked { num3 *= 2; } } }