A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://TheAlgorithms.github.io/C-Plus-Plus/d8/d9a/fast__fourier__transform_8cpp_source.html below:

TheAlgorithms/C++: numerical_methods/fast_fourier_transform.cpp Source File

Go to the documentation of this file. 47 double

pi = 2 * asin(1.0);

49

std::complex<double> om = std::complex<double>(

50

cos(2 * pi / n), sin(2 * pi / n));

52 auto

*pe =

new

std::complex<double>[n / 2];

54 auto

*po =

new

std::complex<double>[n / 2];

57 for

(

int

j = 0; j < n; j++) {

66

std::complex<double> *ye =

69

std::complex<double> *yo =

72 auto

*y =

new

std::complex<double>[n];

76 for

(

int

i = 0; i < n / 2; i++) {

78

ye[k1] + pow(om, i) * yo[k2];

80

ye[k1] - pow(om, i) * yo[k2];

108 auto

*t1 =

new

std::complex<double>[2];

109 auto

*t2 =

new

std::complex<double>[4];

120

std::vector<std::complex<double>> r1 = {

123

std::vector<std::complex<double>> r2 = {

124

{10, 0}, {-2, -2}, {-2, 0}, {-2, 2}};

127

std::complex<double> *t3 =

130

std::complex<double> *t4 =

132 for

(uint8_t i = 0; i < n1; i++) {

133

assert((r1[i].real() - o1->real() < 0.000000000001) &&

134

(r1[i].imag() - o1->imag() <

140 for

(uint8_t i = 0; i < n2; i++) {

141

assert((r2[i].real() - o2->real() < 0.000000000001) &&

142

(r2[i].imag() - o2->imag() <

152

std::cout <<

"All tests have successfully passed!\n"

;

static void test()

Self-test implementations.

int main()

Main function calls automated test function to test the working of fast fourier transform.

std::complex< double > * FastFourierTransform(std::complex< double > *p, uint8_t n)

FastFourierTransform is a recursive function which returns list of complex numbers.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4