本文整理汇总了C++中FFT::dynamic方法的典型用法代码示例。如果您正苦于以下问题:C++ FFT::dynamic方法的具体用法?C++ FFT::dynamic怎么用?C++ FFT::dynamic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FFT
的用法示例。
在下文中一共展示了FFT::dynamic方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_FFT_works
void Test::test_FFT_works() {
srand(time(0));
int n = 4;
Vector<Complex> P(n);
int randMin = -100, randMax = 100;
for(int i = 0; i < n; ++i) {
double real = rand()%(randMax-randMin)+randMin;
double imaginary = rand()%(randMax-randMin)+randMin;
P[i] = Complex(real, imaginary);
}
// P[0] = Complex(2,0);
// P[1] = Complex(2,0);
// P[2] = Complex(2,0);
// P[3] = Complex(2,0);
Vector<Complex> x = Vector<Complex> (n);
for(int i = 0; i < n; i++) {
x[i] = Complex(cos(2*PI/n * i), sin(2*PI/n * i));
}
FFT fft;
fft.preComputeRBS(n);
Vector<Complex> algebraic = fft.algebraic(P, n, x);
Vector<Complex> recursive = fft.recursive(P, n, x, 1);
Vector<Complex> dynamic = fft.dynamic(P, n, x);
for(int i = 0; i < n; ++i) {
std::cout << "A(" << i << "): " << algebraic[i] << std::endl;
std::cout << "R(" << i << "): " << recursive[i] << std::endl;
std::cout << "D(" << i << "): " << dynamic[i] << std::endl;
std::cout << std::endl;
}
}