SigPack - the C++ signal processing library
 
Loading...
Searching...
No Matches
fftw_loop.cpp

Output

Armadillo FFT Time = 46.8176
FFTW Loop[1]. Time = 0.052592
FFTW Loop[2]. Time = 0.003976
FFTW Loop[3]. Time = 0.003865
FFTW Loop[4]. Time = 0.003716

Source

#include "sigpack.h"
using namespace arma;
int main()
{
int N = 45191; // Large prime number
sp::FFTW ss( N, FFTW_ESTIMATE );
vec x( N );
cx_vec Sxx( N );
vec P( N );
clock_t tic;
x.randn();
tic = clock();
Sxx = fft( x );
cout << "Armadillo FFT Time = " << ( clock() - tic ) / double( CLOCKS_PER_SEC ) << endl;
tic = clock();
Sxx = fft( x );
cout << "Armadillo FFT Time = " << ( clock() - tic ) / double( CLOCKS_PER_SEC ) << endl;
for( int n = 1; n < 5; n++ )
{
x.randn();
tic = clock();
Sxx = ss.fft( x );
cout << "FFTW Loop[" << n << "]. Time = " << ( clock() - tic ) / double( CLOCKS_PER_SEC ) << endl;
}
return 0;
}
int main()
FFTW class.
Definition fftw.h:26
void fft(arma::vec &x, arma::cx_vec &Pxx)
FFT of real input.
Definition fftw.h:162