pi = 2 * asin(1.0);
49std::complex<double> om = std::complex<double>(
50cos(2 * pi / n), sin(2 * pi / n));
52 auto*pe =
newstd::complex<double>[n / 2];
54 auto*po =
newstd::complex<double>[n / 2];
57 for(
intj = 0; j < n; j++) {
66std::complex<double> *ye =
69std::complex<double> *yo =
72 auto*y =
newstd::complex<double>[n];
76 for(
inti = 0; i < n / 2; i++) {
78ye[k1] + pow(om, i) * yo[k2];
80ye[k1] - pow(om, i) * yo[k2];
108 auto*t1 =
newstd::complex<double>[2];
109 auto*t2 =
newstd::complex<double>[4];
120std::vector<std::complex<double>> r1 = {
123std::vector<std::complex<double>> r2 = {
124{10, 0}, {-2, -2}, {-2, 0}, {-2, 2}};
127std::complex<double> *t3 =
130std::complex<double> *t4 =
132 for(uint8_t i = 0; i < n1; i++) {
133assert((r1[i].real() - o1->real() < 0.000000000001) &&
134(r1[i].imag() - o1->imag() <
140 for(uint8_t i = 0; i < n2; i++) {
141assert((r2[i].real() - o2->real() < 0.000000000001) &&
142(r2[i].imag() - o2->imag() <
152std::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