Mercurial > hg > sv-dependency-builds
comparison src/fftw-3.3.3/api/f77funcs.h @ 10:37bf6b4a2645
Add FFTW3
author | Chris Cannam |
---|---|
date | Wed, 20 Mar 2013 15:35:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
9:c0fb53affa76 | 10:37bf6b4a2645 |
---|---|
1 /* | |
2 * Copyright (c) 2003, 2007-11 Matteo Frigo | |
3 * Copyright (c) 2003, 2007-11 Massachusetts Institute of Technology | |
4 * | |
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 2 of the License, or | |
8 * (at your option) any later version. | |
9 * | |
10 * This program is distributed in the hope that it will be useful, | |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 * GNU General Public License for more details. | |
14 * | |
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 | |
18 * | |
19 */ | |
20 | |
21 /* Functions in the FFTW Fortran API, mangled according to the | |
22 F77(...) macro. This file is designed to be #included by | |
23 f77api.c, possibly multiple times in order to support multiple | |
24 compiler manglings (via redefinition of F77). */ | |
25 | |
26 FFTW_VOIDFUNC F77(execute, EXECUTE)(X(plan) * const p) | |
27 { | |
28 plan *pln = (*p)->pln; | |
29 pln->adt->solve(pln, (*p)->prb); | |
30 } | |
31 | |
32 FFTW_VOIDFUNC F77(destroy_plan, DESTROY_PLAN)(X(plan) *p) | |
33 { | |
34 X(destroy_plan)(*p); | |
35 } | |
36 | |
37 FFTW_VOIDFUNC F77(cleanup, CLEANUP)(void) | |
38 { | |
39 X(cleanup)(); | |
40 } | |
41 | |
42 FFTW_VOIDFUNC F77(forget_wisdom, FORGET_WISDOM)(void) | |
43 { | |
44 X(forget_wisdom)(); | |
45 } | |
46 | |
47 FFTW_VOIDFUNC F77(export_wisdom, EXPORT_WISDOM)(void (*f77_write_char)(char *, void *), | |
48 void *data) | |
49 { | |
50 write_char_data ad; | |
51 ad.f77_write_char = f77_write_char; | |
52 ad.data = data; | |
53 X(export_wisdom)(write_char, (void *) &ad); | |
54 } | |
55 | |
56 FFTW_VOIDFUNC F77(import_wisdom, IMPORT_WISDOM)(int *isuccess, | |
57 void (*f77_read_char)(int *, void *), | |
58 void *data) | |
59 { | |
60 read_char_data ed; | |
61 ed.f77_read_char = f77_read_char; | |
62 ed.data = data; | |
63 *isuccess = X(import_wisdom)(read_char, (void *) &ed); | |
64 } | |
65 | |
66 FFTW_VOIDFUNC F77(import_system_wisdom, IMPORT_SYSTEM_WISDOM)(int *isuccess) | |
67 { | |
68 *isuccess = X(import_system_wisdom)(); | |
69 } | |
70 | |
71 FFTW_VOIDFUNC F77(print_plan, PRINT_PLAN)(X(plan) * const p) | |
72 { | |
73 X(print_plan)(*p); | |
74 fflush(stdout); | |
75 } | |
76 | |
77 FFTW_VOIDFUNC F77(flops,FLOPS)(X(plan) *p, double *add, double *mul, double *fma) | |
78 { | |
79 X(flops)(*p, add, mul, fma); | |
80 } | |
81 | |
82 FFTW_VOIDFUNC F77(estimate_cost,ESTIMATE_COST)(double *cost, X(plan) * const p) | |
83 { | |
84 *cost = X(estimate_cost)(*p); | |
85 } | |
86 | |
87 FFTW_VOIDFUNC F77(cost,COST)(double *cost, X(plan) * const p) | |
88 { | |
89 *cost = X(cost)(*p); | |
90 } | |
91 | |
92 FFTW_VOIDFUNC F77(set_timelimit,SET_TIMELIMIT)(double *t) | |
93 { | |
94 X(set_timelimit)(*t); | |
95 } | |
96 | |
97 /******************************** DFT ***********************************/ | |
98 | |
99 FFTW_VOIDFUNC F77(plan_dft, PLAN_DFT)(X(plan) *p, int *rank, const int *n, | |
100 C *in, C *out, int *sign, int *flags) | |
101 { | |
102 int *nrev = reverse_n(*rank, n); | |
103 *p = X(plan_dft)(*rank, nrev, in, out, *sign, *flags); | |
104 X(ifree0)(nrev); | |
105 } | |
106 | |
107 FFTW_VOIDFUNC F77(plan_dft_1d, PLAN_DFT_1D)(X(plan) *p, int *n, C *in, C *out, | |
108 int *sign, int *flags) | |
109 { | |
110 *p = X(plan_dft_1d)(*n, in, out, *sign, *flags); | |
111 } | |
112 | |
113 FFTW_VOIDFUNC F77(plan_dft_2d, PLAN_DFT_2D)(X(plan) *p, int *nx, int *ny, | |
114 C *in, C *out, int *sign, int *flags) | |
115 { | |
116 *p = X(plan_dft_2d)(*ny, *nx, in, out, *sign, *flags); | |
117 } | |
118 | |
119 FFTW_VOIDFUNC F77(plan_dft_3d, PLAN_DFT_3D)(X(plan) *p, int *nx, int *ny, int *nz, | |
120 C *in, C *out, | |
121 int *sign, int *flags) | |
122 { | |
123 *p = X(plan_dft_3d)(*nz, *ny, *nx, in, out, *sign, *flags); | |
124 } | |
125 | |
126 FFTW_VOIDFUNC F77(plan_many_dft, PLAN_MANY_DFT)(X(plan) *p, int *rank, const int *n, | |
127 int *howmany, | |
128 C *in, const int *inembed, | |
129 int *istride, int *idist, | |
130 C *out, const int *onembed, | |
131 int *ostride, int *odist, | |
132 int *sign, int *flags) | |
133 { | |
134 int *nrev = reverse_n(*rank, n); | |
135 int *inembedrev = reverse_n(*rank, inembed); | |
136 int *onembedrev = reverse_n(*rank, onembed); | |
137 *p = X(plan_many_dft)(*rank, nrev, *howmany, | |
138 in, inembedrev, *istride, *idist, | |
139 out, onembedrev, *ostride, *odist, | |
140 *sign, *flags); | |
141 X(ifree0)(onembedrev); | |
142 X(ifree0)(inembedrev); | |
143 X(ifree0)(nrev); | |
144 } | |
145 | |
146 FFTW_VOIDFUNC F77(plan_guru_dft, PLAN_GURU_DFT)(X(plan) *p, int *rank, const int *n, | |
147 const int *is, const int *os, | |
148 int *howmany_rank, const int *h_n, | |
149 const int *h_is, const int *h_os, | |
150 C *in, C *out, int *sign, int *flags) | |
151 { | |
152 X(iodim) *dims = make_dims(*rank, n, is, os); | |
153 X(iodim) *howmany_dims = make_dims(*howmany_rank, h_n, h_is, h_os); | |
154 *p = X(plan_guru_dft)(*rank, dims, *howmany_rank, howmany_dims, | |
155 in, out, *sign, *flags); | |
156 X(ifree0)(howmany_dims); | |
157 X(ifree0)(dims); | |
158 } | |
159 | |
160 FFTW_VOIDFUNC F77(plan_guru_split_dft, PLAN_GURU_SPLIT_DFT)(X(plan) *p, int *rank, const int *n, | |
161 const int *is, const int *os, | |
162 int *howmany_rank, const int *h_n, | |
163 const int *h_is, const int *h_os, | |
164 R *ri, R *ii, R *ro, R *io, int *flags) | |
165 { | |
166 X(iodim) *dims = make_dims(*rank, n, is, os); | |
167 X(iodim) *howmany_dims = make_dims(*howmany_rank, h_n, h_is, h_os); | |
168 *p = X(plan_guru_split_dft)(*rank, dims, *howmany_rank, howmany_dims, | |
169 ri, ii, ro, io, *flags); | |
170 X(ifree0)(howmany_dims); | |
171 X(ifree0)(dims); | |
172 } | |
173 | |
174 FFTW_VOIDFUNC F77(execute_dft, EXECUTE_DFT)(X(plan) * const p, C *in, C *out) | |
175 { | |
176 plan_dft *pln = (plan_dft *) (*p)->pln; | |
177 if ((*p)->sign == FFT_SIGN) | |
178 pln->apply((plan *) pln, in[0], in[0]+1, out[0], out[0]+1); | |
179 else | |
180 pln->apply((plan *) pln, in[0]+1, in[0], out[0]+1, out[0]); | |
181 } | |
182 | |
183 FFTW_VOIDFUNC F77(execute_split_dft, EXECUTE_SPLIT_DFT)(X(plan) * const p, | |
184 R *ri, R *ii, R *ro, R *io) | |
185 { | |
186 plan_dft *pln = (plan_dft *) (*p)->pln; | |
187 pln->apply((plan *) pln, ri, ii, ro, io); | |
188 } | |
189 | |
190 /****************************** DFT r2c *********************************/ | |
191 | |
192 FFTW_VOIDFUNC F77(plan_dft_r2c, PLAN_DFT_R2C)(X(plan) *p, int *rank, const int *n, | |
193 R *in, C *out, int *flags) | |
194 { | |
195 int *nrev = reverse_n(*rank, n); | |
196 *p = X(plan_dft_r2c)(*rank, nrev, in, out, *flags); | |
197 X(ifree0)(nrev); | |
198 } | |
199 | |
200 FFTW_VOIDFUNC F77(plan_dft_r2c_1d, PLAN_DFT_R2C_1D)(X(plan) *p, int *n, R *in, C *out, | |
201 int *flags) | |
202 { | |
203 *p = X(plan_dft_r2c_1d)(*n, in, out, *flags); | |
204 } | |
205 | |
206 FFTW_VOIDFUNC F77(plan_dft_r2c_2d, PLAN_DFT_R2C_2D)(X(plan) *p, int *nx, int *ny, | |
207 R *in, C *out, int *flags) | |
208 { | |
209 *p = X(plan_dft_r2c_2d)(*ny, *nx, in, out, *flags); | |
210 } | |
211 | |
212 FFTW_VOIDFUNC F77(plan_dft_r2c_3d, PLAN_DFT_R2C_3D)(X(plan) *p, | |
213 int *nx, int *ny, int *nz, | |
214 R *in, C *out, | |
215 int *flags) | |
216 { | |
217 *p = X(plan_dft_r2c_3d)(*nz, *ny, *nx, in, out, *flags); | |
218 } | |
219 | |
220 FFTW_VOIDFUNC F77(plan_many_dft_r2c, PLAN_MANY_DFT_R2C)( | |
221 X(plan) *p, int *rank, const int *n, | |
222 int *howmany, | |
223 R *in, const int *inembed, int *istride, int *idist, | |
224 C *out, const int *onembed, int *ostride, int *odist, | |
225 int *flags) | |
226 { | |
227 int *nrev = reverse_n(*rank, n); | |
228 int *inembedrev = reverse_n(*rank, inembed); | |
229 int *onembedrev = reverse_n(*rank, onembed); | |
230 *p = X(plan_many_dft_r2c)(*rank, nrev, *howmany, | |
231 in, inembedrev, *istride, *idist, | |
232 out, onembedrev, *ostride, *odist, | |
233 *flags); | |
234 X(ifree0)(onembedrev); | |
235 X(ifree0)(inembedrev); | |
236 X(ifree0)(nrev); | |
237 } | |
238 | |
239 FFTW_VOIDFUNC F77(plan_guru_dft_r2c, PLAN_GURU_DFT_R2C)( | |
240 X(plan) *p, int *rank, const int *n, | |
241 const int *is, const int *os, | |
242 int *howmany_rank, const int *h_n, | |
243 const int *h_is, const int *h_os, | |
244 R *in, C *out, int *flags) | |
245 { | |
246 X(iodim) *dims = make_dims(*rank, n, is, os); | |
247 X(iodim) *howmany_dims = make_dims(*howmany_rank, h_n, h_is, h_os); | |
248 *p = X(plan_guru_dft_r2c)(*rank, dims, *howmany_rank, howmany_dims, | |
249 in, out, *flags); | |
250 X(ifree0)(howmany_dims); | |
251 X(ifree0)(dims); | |
252 } | |
253 | |
254 FFTW_VOIDFUNC F77(plan_guru_split_dft_r2c, PLAN_GURU_SPLIT_DFT_R2C)( | |
255 X(plan) *p, int *rank, const int *n, | |
256 const int *is, const int *os, | |
257 int *howmany_rank, const int *h_n, | |
258 const int *h_is, const int *h_os, | |
259 R *in, R *ro, R *io, int *flags) | |
260 { | |
261 X(iodim) *dims = make_dims(*rank, n, is, os); | |
262 X(iodim) *howmany_dims = make_dims(*howmany_rank, h_n, h_is, h_os); | |
263 *p = X(plan_guru_split_dft_r2c)(*rank, dims, *howmany_rank, howmany_dims, | |
264 in, ro, io, *flags); | |
265 X(ifree0)(howmany_dims); | |
266 X(ifree0)(dims); | |
267 } | |
268 | |
269 FFTW_VOIDFUNC F77(execute_dft_r2c, EXECUTE_DFT_R2C)(X(plan) * const p, R *in, C *out) | |
270 { | |
271 plan_rdft2 *pln = (plan_rdft2 *) (*p)->pln; | |
272 problem_rdft2 *prb = (problem_rdft2 *) (*p)->prb; | |
273 pln->apply((plan *) pln, in, in + (prb->r1 - prb->r0), out[0], out[0]+1); | |
274 } | |
275 | |
276 FFTW_VOIDFUNC F77(execute_split_dft_r2c, EXECUTE_SPLIT_DFT_R2C)(X(plan) * const p, | |
277 R *in, R *ro, R *io) | |
278 { | |
279 plan_rdft2 *pln = (plan_rdft2 *) (*p)->pln; | |
280 problem_rdft2 *prb = (problem_rdft2 *) (*p)->prb; | |
281 pln->apply((plan *) pln, in, in + (prb->r1 - prb->r0), ro, io); | |
282 } | |
283 | |
284 /****************************** DFT c2r *********************************/ | |
285 | |
286 FFTW_VOIDFUNC F77(plan_dft_c2r, PLAN_DFT_C2R)(X(plan) *p, int *rank, const int *n, | |
287 C *in, R *out, int *flags) | |
288 { | |
289 int *nrev = reverse_n(*rank, n); | |
290 *p = X(plan_dft_c2r)(*rank, nrev, in, out, *flags); | |
291 X(ifree0)(nrev); | |
292 } | |
293 | |
294 FFTW_VOIDFUNC F77(plan_dft_c2r_1d, PLAN_DFT_C2R_1D)(X(plan) *p, int *n, C *in, R *out, | |
295 int *flags) | |
296 { | |
297 *p = X(plan_dft_c2r_1d)(*n, in, out, *flags); | |
298 } | |
299 | |
300 FFTW_VOIDFUNC F77(plan_dft_c2r_2d, PLAN_DFT_C2R_2D)(X(plan) *p, int *nx, int *ny, | |
301 C *in, R *out, int *flags) | |
302 { | |
303 *p = X(plan_dft_c2r_2d)(*ny, *nx, in, out, *flags); | |
304 } | |
305 | |
306 FFTW_VOIDFUNC F77(plan_dft_c2r_3d, PLAN_DFT_C2R_3D)(X(plan) *p, | |
307 int *nx, int *ny, int *nz, | |
308 C *in, R *out, | |
309 int *flags) | |
310 { | |
311 *p = X(plan_dft_c2r_3d)(*nz, *ny, *nx, in, out, *flags); | |
312 } | |
313 | |
314 FFTW_VOIDFUNC F77(plan_many_dft_c2r, PLAN_MANY_DFT_C2R)( | |
315 X(plan) *p, int *rank, const int *n, | |
316 int *howmany, | |
317 C *in, const int *inembed, int *istride, int *idist, | |
318 R *out, const int *onembed, int *ostride, int *odist, | |
319 int *flags) | |
320 { | |
321 int *nrev = reverse_n(*rank, n); | |
322 int *inembedrev = reverse_n(*rank, inembed); | |
323 int *onembedrev = reverse_n(*rank, onembed); | |
324 *p = X(plan_many_dft_c2r)(*rank, nrev, *howmany, | |
325 in, inembedrev, *istride, *idist, | |
326 out, onembedrev, *ostride, *odist, | |
327 *flags); | |
328 X(ifree0)(onembedrev); | |
329 X(ifree0)(inembedrev); | |
330 X(ifree0)(nrev); | |
331 } | |
332 | |
333 FFTW_VOIDFUNC F77(plan_guru_dft_c2r, PLAN_GURU_DFT_C2R)( | |
334 X(plan) *p, int *rank, const int *n, | |
335 const int *is, const int *os, | |
336 int *howmany_rank, const int *h_n, | |
337 const int *h_is, const int *h_os, | |
338 C *in, R *out, int *flags) | |
339 { | |
340 X(iodim) *dims = make_dims(*rank, n, is, os); | |
341 X(iodim) *howmany_dims = make_dims(*howmany_rank, h_n, h_is, h_os); | |
342 *p = X(plan_guru_dft_c2r)(*rank, dims, *howmany_rank, howmany_dims, | |
343 in, out, *flags); | |
344 X(ifree0)(howmany_dims); | |
345 X(ifree0)(dims); | |
346 } | |
347 | |
348 FFTW_VOIDFUNC F77(plan_guru_split_dft_c2r, PLAN_GURU_SPLIT_DFT_C2R)( | |
349 X(plan) *p, int *rank, const int *n, | |
350 const int *is, const int *os, | |
351 int *howmany_rank, const int *h_n, | |
352 const int *h_is, const int *h_os, | |
353 R *ri, R *ii, R *out, int *flags) | |
354 { | |
355 X(iodim) *dims = make_dims(*rank, n, is, os); | |
356 X(iodim) *howmany_dims = make_dims(*howmany_rank, h_n, h_is, h_os); | |
357 *p = X(plan_guru_split_dft_c2r)(*rank, dims, *howmany_rank, howmany_dims, | |
358 ri, ii, out, *flags); | |
359 X(ifree0)(howmany_dims); | |
360 X(ifree0)(dims); | |
361 } | |
362 | |
363 FFTW_VOIDFUNC F77(execute_dft_c2r, EXECUTE_DFT_C2R)(X(plan) * const p, C *in, R *out) | |
364 { | |
365 plan_rdft2 *pln = (plan_rdft2 *) (*p)->pln; | |
366 problem_rdft2 *prb = (problem_rdft2 *) (*p)->prb; | |
367 pln->apply((plan *) pln, out, out + (prb->r1 - prb->r0), in[0], in[0]+1); | |
368 } | |
369 | |
370 FFTW_VOIDFUNC F77(execute_split_dft_c2r, EXECUTE_SPLIT_DFT_C2R)(X(plan) * const p, | |
371 R *ri, R *ii, R *out) | |
372 { | |
373 plan_rdft2 *pln = (plan_rdft2 *) (*p)->pln; | |
374 problem_rdft2 *prb = (problem_rdft2 *) (*p)->prb; | |
375 pln->apply((plan *) pln, out, out + (prb->r1 - prb->r0), ri, ii); | |
376 } | |
377 | |
378 /****************************** r2r *********************************/ | |
379 | |
380 FFTW_VOIDFUNC F77(plan_r2r, PLAN_R2R)(X(plan) *p, int *rank, const int *n, | |
381 R *in, R *out, | |
382 int *kind, int *flags) | |
383 { | |
384 int *nrev = reverse_n(*rank, n); | |
385 X(r2r_kind) *k = ints2kinds(*rank, kind); | |
386 *p = X(plan_r2r)(*rank, nrev, in, out, k, *flags); | |
387 X(ifree0)(k); | |
388 X(ifree0)(nrev); | |
389 } | |
390 | |
391 FFTW_VOIDFUNC F77(plan_r2r_1d, PLAN_R2R_1D)(X(plan) *p, int *n, R *in, R *out, | |
392 int *kind, int *flags) | |
393 { | |
394 *p = X(plan_r2r_1d)(*n, in, out, (X(r2r_kind)) *kind, *flags); | |
395 } | |
396 | |
397 FFTW_VOIDFUNC F77(plan_r2r_2d, PLAN_R2R_2D)(X(plan) *p, int *nx, int *ny, | |
398 R *in, R *out, | |
399 int *kindx, int *kindy, int *flags) | |
400 { | |
401 *p = X(plan_r2r_2d)(*ny, *nx, in, out, | |
402 (X(r2r_kind)) *kindy, (X(r2r_kind)) *kindx, *flags); | |
403 } | |
404 | |
405 FFTW_VOIDFUNC F77(plan_r2r_3d, PLAN_R2R_3D)(X(plan) *p, | |
406 int *nx, int *ny, int *nz, | |
407 R *in, R *out, | |
408 int *kindx, int *kindy, int *kindz, | |
409 int *flags) | |
410 { | |
411 *p = X(plan_r2r_3d)(*nz, *ny, *nx, in, out, | |
412 (X(r2r_kind)) *kindz, (X(r2r_kind)) *kindy, | |
413 (X(r2r_kind)) *kindx, *flags); | |
414 } | |
415 | |
416 FFTW_VOIDFUNC F77(plan_many_r2r, PLAN_MANY_R2R)( | |
417 X(plan) *p, int *rank, const int *n, | |
418 int *howmany, | |
419 R *in, const int *inembed, int *istride, int *idist, | |
420 R *out, const int *onembed, int *ostride, int *odist, | |
421 int *kind, int *flags) | |
422 { | |
423 int *nrev = reverse_n(*rank, n); | |
424 int *inembedrev = reverse_n(*rank, inembed); | |
425 int *onembedrev = reverse_n(*rank, onembed); | |
426 X(r2r_kind) *k = ints2kinds(*rank, kind); | |
427 *p = X(plan_many_r2r)(*rank, nrev, *howmany, | |
428 in, inembedrev, *istride, *idist, | |
429 out, onembedrev, *ostride, *odist, | |
430 k, *flags); | |
431 X(ifree0)(k); | |
432 X(ifree0)(onembedrev); | |
433 X(ifree0)(inembedrev); | |
434 X(ifree0)(nrev); | |
435 } | |
436 | |
437 FFTW_VOIDFUNC F77(plan_guru_r2r, PLAN_GURU_R2R)( | |
438 X(plan) *p, int *rank, const int *n, | |
439 const int *is, const int *os, | |
440 int *howmany_rank, const int *h_n, | |
441 const int *h_is, const int *h_os, | |
442 R *in, R *out, int *kind, int *flags) | |
443 { | |
444 X(iodim) *dims = make_dims(*rank, n, is, os); | |
445 X(iodim) *howmany_dims = make_dims(*howmany_rank, h_n, h_is, h_os); | |
446 X(r2r_kind) *k = ints2kinds(*rank, kind); | |
447 *p = X(plan_guru_r2r)(*rank, dims, *howmany_rank, howmany_dims, | |
448 in, out, k, *flags); | |
449 X(ifree0)(k); | |
450 X(ifree0)(howmany_dims); | |
451 X(ifree0)(dims); | |
452 } | |
453 | |
454 FFTW_VOIDFUNC F77(execute_r2r, EXECUTE_R2R)(X(plan) * const p, R *in, R *out) | |
455 { | |
456 plan_rdft *pln = (plan_rdft *) (*p)->pln; | |
457 pln->apply((plan *) pln, in, out); | |
458 } |