/* Fttest.c Test case for two-dimensional Fourier transform. From Claerbout (1985) p. 69. Usage: fttest >outfile Compile: cc fttestc.c ft2dc.c colmft.c fft.c -lm -o fttestc */ /* Get the usual standard output and math definitions */ #include #include /* #define N 1024 */ /* Declare the structure to hold complex numbers */ struct complex { float re; float im; }; /* Enter main part of program */ main(ac, av) int ac; char **av; { /* Declare all variables */ int it, nt, ix, nx; /* float p[N][N]; struct complex cp[N][N]; * Use rows of time * */ float *p; struct complex *cp; /* Assign sizes */ /* nx = N; nt = N; */ if (ac != 2) nx = 512; else nx = atoi(av[1]); nt = nx; p = (float *)malloc(nx*nt*sizeof(float)); allocerr(p, nx*nt*sizeof(float), "p"); cp = (struct complex *)malloc(nx*nt*sizeof(struct complex)); allocerr(cp, nx*nt*sizeof(struct complex), "cp"); /* Nested loops to set complex array to zero; time varies fastest */ for(ix=0; ix 100000000) fprintf(EROUT, "Don't be so greedy!\n"); exit(-1); } return(0); }