3 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or (at
8 * your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 void FUNCTION(test,trap) (void);
23 FUNCTION(test,trap) (void)
30 BASE * real_data = &real_x ;
31 BASE * complex_data = &complex_x ;
33 TYPE(gsl_fft_complex_wavetable) * cw;
34 TYPE(gsl_fft_real_wavetable) * rw;
35 TYPE(gsl_fft_halfcomplex_wavetable) * hcw;
37 TYPE(gsl_fft_complex_workspace) * cwork;
38 TYPE(gsl_fft_real_workspace) * rwork;
42 cw = FUNCTION(gsl_fft_complex_wavetable,alloc) (0);
43 gsl_test (cw != 0, "trap for n = 0 in " NAME(gsl_fft_complex_wavetable) "_alloc");
45 rw = FUNCTION(gsl_fft_real_wavetable,alloc) (0);
46 gsl_test (rw != 0, "trap for n = 0 in " NAME(gsl_fft_real_wavetable) "_alloc" );
48 hcw = FUNCTION(gsl_fft_halfcomplex_wavetable,alloc) (0);
49 gsl_test (hcw != 0, "trap for n = 0 in " NAME(gsl_fft_halfcomplex_wavetable) "_alloc");
51 cwork = FUNCTION(gsl_fft_complex_workspace,alloc) (0);
52 gsl_test (cw != 0, "trap for n = 0 in " NAME(gsl_fft_complex_workspace) "_alloc");
54 rwork = FUNCTION(gsl_fft_real_workspace,alloc) (0);
55 gsl_test (rw != 0, "trap for n = 0 in " NAME(gsl_fft_real_workspace) "_alloc" );
57 cw = FUNCTION(gsl_fft_complex_wavetable,alloc) (10);
58 hcw = FUNCTION(gsl_fft_halfcomplex_wavetable,alloc) (10);
59 rw = FUNCTION(gsl_fft_real_wavetable,alloc) (10);
61 cwork = FUNCTION(gsl_fft_complex_workspace,alloc) (10);
62 rwork = FUNCTION(gsl_fft_real_workspace,alloc) (10);
64 /* n = 0 in fft forward */
66 status = FUNCTION(gsl_fft_complex,forward) (complex_data, 1, 0, cw, cwork);
67 gsl_test (!status, "trap for n = 0 in " NAME(gsl_fft_complex) "_forward");
69 status = FUNCTION(gsl_fft_real,transform) (real_data, 1, 0, rw, rwork);
70 gsl_test (!status, "trap for n = 0 in " NAME(gsl_fft_real) "_transform");
72 status = FUNCTION(gsl_fft_halfcomplex,transform) (real_data, 1, 0, hcw, rwork);
73 gsl_test (!status, "trap for n = 0 in " NAME(gsl_fft_halfcomplex) "_transform");
75 status = FUNCTION(gsl_fft_complex,radix2_forward) (complex_data, 1, 0);
76 gsl_test (!status, "trap for n = 0 in " NAME(gsl_fft_complex) "_radix2_forward");
78 /* n = 0 in fft backward */
80 status = FUNCTION(gsl_fft_complex,backward) (complex_data, 1, 0, cw, cwork);
81 gsl_test (!status, "trap for n = 0 in " NAME(gsl_fft_complex) "_backward");
83 status = FUNCTION(gsl_fft_complex,radix2_backward) (complex_data, 1, 0);
84 gsl_test (!status, "trap for n = 0 in " NAME(gsl_fft_complex) "_radix2_backward");
86 /* n = 0 in fft inverse */
88 status = FUNCTION(gsl_fft_complex,inverse) (complex_data, 1, 0, cw, cwork);
89 gsl_test (!status, "trap for n = 0 in " NAME(gsl_fft_complex) "_inverse");
91 status = FUNCTION(gsl_fft_complex,radix2_inverse) (complex_data, 1, 0);
92 gsl_test (!status, "trap for n = 0 in " NAME(gsl_fft_complex) "_radix2_inverse");
94 /* n != 2^k in power of 2 routines */
96 status = FUNCTION(gsl_fft_complex,radix2_forward) (complex_data, 1, 17);
97 gsl_test (!status, "trap for n != 2^k in " NAME(gsl_fft_complex) "_radix2_forward");
99 status = FUNCTION(gsl_fft_complex,radix2_backward) (complex_data, 1, 17);
100 gsl_test (!status, "trap for n != 2^k in " NAME(gsl_fft_complex) "_radix2_backward");
102 status = FUNCTION(gsl_fft_complex,radix2_inverse) (complex_data, 1, 17);
103 gsl_test (!status, "trap for n != 2^k in " NAME(gsl_fft_complex) "_radix2_inverse");
105 /* n != wavetable.n in mixed radix routines */
108 status = FUNCTION(gsl_fft_complex,forward) (complex_data, 1, 4, cw, cwork);
109 gsl_test (!status, "trap for n != nw in " NAME(gsl_fft_complex) "_forward");
112 status = FUNCTION(gsl_fft_complex,backward) (complex_data, 1, 4, cw, cwork);
113 gsl_test (!status, "trap for n != nw in " NAME(gsl_fft_complex) "_backward");
116 status = FUNCTION(gsl_fft_complex,inverse) (complex_data, 1, 4, cw, cwork);
117 gsl_test (!status, "trap for n != nw in " NAME(gsl_fft_complex) "_inverse");
120 status = FUNCTION(gsl_fft_real,transform) (real_data, 1, 4, rw, rwork);
121 gsl_test (!status, "trap for n != nw in " NAME(gsl_fft_real) "_transform");
124 status = FUNCTION(gsl_fft_halfcomplex,transform) (real_data, 1, 4, hcw, rwork);
125 gsl_test (!status, "trap for n != nw in " NAME(gsl_fft_halfcomplex) "_transform");
127 FUNCTION (gsl_fft_halfcomplex_wavetable,free) (hcw) ;
128 FUNCTION (gsl_fft_real_wavetable,free) (rw) ;
129 FUNCTION (gsl_fft_complex_wavetable,free) (cw) ;
131 FUNCTION (gsl_fft_real_workspace,free) (rwork) ;
132 FUNCTION (gsl_fft_complex_workspace,free) (cwork) ;