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