Merged muonspin/musrfit:root6 into master

This commit is contained in:
Zaher Salman 2019-10-28 09:21:05 +01:00
commit 4ef4316b97

View File

@ -3,12 +3,43 @@
#include <fftw3.h> #include <fftw3.h>
void fftw3_test_syntax() {
std::cout << std::endl;
std::cout << "fftw3_test [N [offset]]" << std::endl;
std::cout << " N: 2^N Fourier Power" << std::endl;
std::cout << " default value if not given: N=13 (2^13 = 8192)" << std::endl;
std::cout << " offset: allows to have a length != 2^N, namely 2^N + offset" << std::endl;
std::cout << " default value of offset if not given is 0." << std::endl;
std::cout << std::endl;
}
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
const unsigned int N=8192; unsigned int N=8192;
unsigned int offset=0;
if (argc > 3) {
fftw3_test_syntax();
return 1;
}
int a=-1;
for (int i=1; i<argc; i++) {
int status = sscanf(argv[i], "%d", &a);
if (status != 1) {
fftw3_test_syntax();
return 2;
}
if (i==1) // N
N = (unsigned int)pow(2.0, a);
if (i==2) // offset
offset = (unsigned int)a;
}
std::cout << "debug> N=" << N << ", offset=" << offset << std::endl;
fftw_complex *in, *out; fftw_complex *in, *out;
fftw_plan my_plan; fftw_plan my_plan;
N += offset;
in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*N); in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*N);
out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*N); out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*N);