cannam@95
|
1 /*
|
cannam@95
|
2 * Copyright (c) 2003, 2007-11 Matteo Frigo
|
cannam@95
|
3 * Copyright (c) 2003, 2007-11 Massachusetts Institute of Technology
|
cannam@95
|
4 *
|
cannam@95
|
5 * This program is free software; you can redistribute it and/or modify
|
cannam@95
|
6 * it under the terms of the GNU General Public License as published by
|
cannam@95
|
7 * the Free Software Foundation; either version 2 of the License, or
|
cannam@95
|
8 * (at your option) any later version.
|
cannam@95
|
9 *
|
cannam@95
|
10 * This program is distributed in the hope that it will be useful,
|
cannam@95
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
cannam@95
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
cannam@95
|
13 * GNU General Public License for more details.
|
cannam@95
|
14 *
|
cannam@95
|
15 * You should have received a copy of the GNU General Public License
|
cannam@95
|
16 * along with this program; if not, write to the Free Software
|
cannam@95
|
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
cannam@95
|
18 *
|
cannam@95
|
19 */
|
cannam@95
|
20
|
cannam@95
|
21 #include "bench.h"
|
cannam@95
|
22
|
cannam@95
|
23 typedef bench_real R;
|
cannam@95
|
24 typedef bench_complex C;
|
cannam@95
|
25
|
cannam@95
|
26 typedef struct dofft_closure_s {
|
cannam@95
|
27 void (*apply)(struct dofft_closure_s *k,
|
cannam@95
|
28 bench_complex *in, bench_complex *out);
|
cannam@95
|
29 int recopy_input;
|
cannam@95
|
30 } dofft_closure;
|
cannam@95
|
31
|
cannam@95
|
32 double dmax(double x, double y);
|
cannam@95
|
33
|
cannam@95
|
34 typedef void (*aconstrain)(C *a, int n);
|
cannam@95
|
35
|
cannam@95
|
36 void arand(C *a, int n);
|
cannam@95
|
37 void mkreal(C *A, int n);
|
cannam@95
|
38 void mkhermitian(C *A, int rank, const bench_iodim *dim, int stride);
|
cannam@95
|
39 void mkhermitian1(C *a, int n);
|
cannam@95
|
40 void aadd(C *c, C *a, C *b, int n);
|
cannam@95
|
41 void asub(C *c, C *a, C *b, int n);
|
cannam@95
|
42 void arol(C *b, C *a, int n, int nb, int na);
|
cannam@95
|
43 void aphase_shift(C *b, C *a, int n, int nb, int na, double sign);
|
cannam@95
|
44 void ascale(C *a, C alpha, int n);
|
cannam@95
|
45 double acmp(C *a, C *b, int n, const char *test, double tol);
|
cannam@95
|
46 double mydrand(void);
|
cannam@95
|
47 double impulse(dofft_closure *k,
|
cannam@95
|
48 int n, int vecn,
|
cannam@95
|
49 C *inA, C *inB, C *inC,
|
cannam@95
|
50 C *outA, C *outB, C *outC,
|
cannam@95
|
51 C *tmp, int rounds, double tol);
|
cannam@95
|
52 double linear(dofft_closure *k, int realp,
|
cannam@95
|
53 int n, C *inA, C *inB, C *inC, C *outA,
|
cannam@95
|
54 C *outB, C *outC, C *tmp, int rounds, double tol);
|
cannam@95
|
55 void preserves_input(dofft_closure *k, aconstrain constrain,
|
cannam@95
|
56 int n, C *inA, C *inB, C *outB, int rounds);
|
cannam@95
|
57
|
cannam@95
|
58 enum { TIME_SHIFT, FREQ_SHIFT };
|
cannam@95
|
59 double tf_shift(dofft_closure *k, int realp, const bench_tensor *sz,
|
cannam@95
|
60 int n, int vecn, double sign,
|
cannam@95
|
61 C *inA, C *inB, C *outA, C *outB, C *tmp,
|
cannam@95
|
62 int rounds, double tol, int which_shift);
|
cannam@95
|
63
|
cannam@95
|
64 typedef struct dotens2_closure_s {
|
cannam@95
|
65 void (*apply)(struct dotens2_closure_s *k,
|
cannam@95
|
66 int indx0, int ondx0, int indx1, int ondx1);
|
cannam@95
|
67 } dotens2_closure;
|
cannam@95
|
68
|
cannam@95
|
69 void bench_dotens2(const bench_tensor *sz0,
|
cannam@95
|
70 const bench_tensor *sz1, dotens2_closure *k);
|
cannam@95
|
71
|
cannam@95
|
72 void accuracy_test(dofft_closure *k, aconstrain constrain,
|
cannam@95
|
73 int sign, int n, C *a, C *b, int rounds, int impulse_rounds,
|
cannam@95
|
74 double t[6]);
|
cannam@95
|
75
|
cannam@95
|
76 void accuracy_dft(bench_problem *p, int rounds, int impulse_rounds,
|
cannam@95
|
77 double t[6]);
|
cannam@95
|
78 void accuracy_rdft2(bench_problem *p, int rounds, int impulse_rounds,
|
cannam@95
|
79 double t[6]);
|
cannam@95
|
80 void accuracy_r2r(bench_problem *p, int rounds, int impulse_rounds,
|
cannam@95
|
81 double t[6]);
|
cannam@95
|
82
|
cannam@95
|
83 #if defined(BENCHFFT_LDOUBLE) && HAVE_COSL
|
cannam@95
|
84 typedef long double trigreal;
|
cannam@95
|
85 # define COS cosl
|
cannam@95
|
86 # define SIN sinl
|
cannam@95
|
87 # define TAN tanl
|
cannam@95
|
88 # define KTRIG(x) (x##L)
|
cannam@95
|
89 #elif defined(BENCHFFT_QUAD) && HAVE_LIBQUADMATH
|
cannam@95
|
90 typedef __float128 trigreal;
|
cannam@95
|
91 # define COS cosq
|
cannam@95
|
92 # define SIN sinq
|
cannam@95
|
93 # define TAN tanq
|
cannam@95
|
94 # define KTRIG(x) (x##Q)
|
cannam@95
|
95 extern trigreal cosq(trigreal);
|
cannam@95
|
96 extern trigreal sinq(trigreal);
|
cannam@95
|
97 extern trigreal tanq(trigreal);
|
cannam@95
|
98 #else
|
cannam@95
|
99 typedef double trigreal;
|
cannam@95
|
100 # define COS cos
|
cannam@95
|
101 # define SIN sin
|
cannam@95
|
102 # define TAN tan
|
cannam@95
|
103 # define KTRIG(x) (x)
|
cannam@95
|
104 #endif
|
cannam@95
|
105 #define K2PI KTRIG(6.2831853071795864769252867665590057683943388)
|