comparison src/fftw-3.3.3/libbench2/verify.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 #include "bench.h"
22
23 typedef bench_real R;
24 typedef bench_complex C;
25
26 typedef struct dofft_closure_s {
27 void (*apply)(struct dofft_closure_s *k,
28 bench_complex *in, bench_complex *out);
29 int recopy_input;
30 } dofft_closure;
31
32 double dmax(double x, double y);
33
34 typedef void (*aconstrain)(C *a, int n);
35
36 void arand(C *a, int n);
37 void mkreal(C *A, int n);
38 void mkhermitian(C *A, int rank, const bench_iodim *dim, int stride);
39 void mkhermitian1(C *a, int n);
40 void aadd(C *c, C *a, C *b, int n);
41 void asub(C *c, C *a, C *b, int n);
42 void arol(C *b, C *a, int n, int nb, int na);
43 void aphase_shift(C *b, C *a, int n, int nb, int na, double sign);
44 void ascale(C *a, C alpha, int n);
45 double acmp(C *a, C *b, int n, const char *test, double tol);
46 double mydrand(void);
47 double impulse(dofft_closure *k,
48 int n, int vecn,
49 C *inA, C *inB, C *inC,
50 C *outA, C *outB, C *outC,
51 C *tmp, int rounds, double tol);
52 double linear(dofft_closure *k, int realp,
53 int n, C *inA, C *inB, C *inC, C *outA,
54 C *outB, C *outC, C *tmp, int rounds, double tol);
55 void preserves_input(dofft_closure *k, aconstrain constrain,
56 int n, C *inA, C *inB, C *outB, int rounds);
57
58 enum { TIME_SHIFT, FREQ_SHIFT };
59 double tf_shift(dofft_closure *k, int realp, const bench_tensor *sz,
60 int n, int vecn, double sign,
61 C *inA, C *inB, C *outA, C *outB, C *tmp,
62 int rounds, double tol, int which_shift);
63
64 typedef struct dotens2_closure_s {
65 void (*apply)(struct dotens2_closure_s *k,
66 int indx0, int ondx0, int indx1, int ondx1);
67 } dotens2_closure;
68
69 void bench_dotens2(const bench_tensor *sz0,
70 const bench_tensor *sz1, dotens2_closure *k);
71
72 void accuracy_test(dofft_closure *k, aconstrain constrain,
73 int sign, int n, C *a, C *b, int rounds, int impulse_rounds,
74 double t[6]);
75
76 void accuracy_dft(bench_problem *p, int rounds, int impulse_rounds,
77 double t[6]);
78 void accuracy_rdft2(bench_problem *p, int rounds, int impulse_rounds,
79 double t[6]);
80 void accuracy_r2r(bench_problem *p, int rounds, int impulse_rounds,
81 double t[6]);
82
83 #if defined(BENCHFFT_LDOUBLE) && HAVE_COSL
84 typedef long double trigreal;
85 # define COS cosl
86 # define SIN sinl
87 # define TAN tanl
88 # define KTRIG(x) (x##L)
89 #elif defined(BENCHFFT_QUAD) && HAVE_LIBQUADMATH
90 typedef __float128 trigreal;
91 # define COS cosq
92 # define SIN sinq
93 # define TAN tanq
94 # define KTRIG(x) (x##Q)
95 extern trigreal cosq(trigreal);
96 extern trigreal sinq(trigreal);
97 extern trigreal tanq(trigreal);
98 #else
99 typedef double trigreal;
100 # define COS cos
101 # define SIN sin
102 # define TAN tan
103 # define KTRIG(x) (x)
104 #endif
105 #define K2PI KTRIG(6.2831853071795864769252867665590057683943388)