// gcc tutorial.c -lsleef -lsleefdft -lm #include #include #include #include #include #include "sleef.h" #include "sleefdft.h" #define THRES 1e-4 typedef double complex cmpl; cmpl omega(double n, double kn) { return cexp((-2 * M_PI * _Complex_I / n) * kn); } void forward(cmpl *ts, cmpl *fs, int len) { for(int k=0;k THRES) || (fabs(sy[(i*2+1)] - cimag(fs[i])) > THRES)) { success = 0; } } printf("%s\n", success ? "OK" : "NG"); free(fs); free(ts); Sleef_free(sy); Sleef_free(sx); SleefDFT_dispose(p); exit(success); }