To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

The primary repository for this project is hosted at https://github.com/sonic-visualiser/sv-dependency-builds .
This repository is a read-only copy which is updated automatically every hour.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / src / fftw-3.3.8 / dft / dftw-directsq.c @ 167:bd3cc4d1df30

History | View | Annotate | Download (3.96 KB)

1
/*
2
 * Copyright (c) 2003, 2007-14 Matteo Frigo
3
 * Copyright (c) 2003, 2007-14 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

    
22
#include "dft/ct.h"
23

    
24
typedef struct {
25
     ct_solver super;
26
     const ct_desc *desc;
27
     kdftwsq k;
28
} S;
29

    
30
typedef struct {
31
     plan_dftw super;
32
     kdftwsq k;
33
     INT r;
34
     stride rs, vs;
35
     INT m, ms, v, mb, me;
36
     twid *td;
37
     const S *slv;
38
} P;
39

    
40

    
41
static void apply(const plan *ego_, R *rio, R *iio)
42
{
43
     const P *ego = (const P *) ego_;
44
     INT mb = ego->mb, ms = ego->ms;
45
     ego->k(rio + mb*ms, iio + mb*ms, ego->td->W, ego->rs, ego->vs,
46
            mb, ego->me, ms);
47
}
48

    
49
static void awake(plan *ego_, enum wakefulness wakefulness)
50
{
51
     P *ego = (P *) ego_;
52

    
53
     X(twiddle_awake)(wakefulness, &ego->td, ego->slv->desc->tw,
54
                      ego->r * ego->m, ego->r, ego->m);
55
}
56

    
57
static void destroy(plan *ego_)
58
{
59
     P *ego = (P *) ego_;
60
     X(stride_destroy)(ego->rs);
61
     X(stride_destroy)(ego->vs);
62
}
63

    
64
static void print(const plan *ego_, printer *p)
65
{
66
     const P *ego = (const P *) ego_;
67
     const S *slv = ego->slv;
68
     const ct_desc *e = slv->desc;
69

    
70
     p->print(p, "(dftw-directsq-%D/%D%v \"%s\")",
71
              ego->r, X(twiddle_length)(ego->r, e->tw), ego->v, e->nam);
72
}
73

    
74
static int applicable(const S *ego,
75
                      INT r, INT irs, INT ors,
76
                      INT m, INT ms,
77
                      INT v, INT ivs, INT ovs,
78
                      INT mb, INT me,
79
                      R *rio, R *iio,
80
                      const planner *plnr)
81
{
82
     const ct_desc *e = ego->desc;
83
     UNUSED(v);
84

    
85
     return (
86
          1
87
          && r == e->radix
88

    
89
          /* transpose r, v */
90
          && r == v
91
          && irs == ovs
92
          && ivs == ors
93

    
94
          /* check for alignment/vector length restrictions */
95
          && e->genus->okp(e, rio, iio, irs, ivs, m, mb, me, ms, plnr)
96

    
97
          );
98
}
99

    
100
static plan *mkcldw(const ct_solver *ego_,
101
                    INT r, INT irs, INT ors,
102
                    INT m, INT ms,
103
                    INT v, INT ivs, INT ovs,
104
                    INT mstart, INT mcount,
105
                    R *rio, R *iio,
106
                    planner *plnr)
107
{
108
     const S *ego = (const S *) ego_;
109
     P *pln;
110
     const ct_desc *e = ego->desc;
111

    
112
     static const plan_adt padt = {
113
          0, awake, print, destroy
114
     };
115

    
116
     A(mstart >= 0 && mstart + mcount <= m);
117
     if (!applicable(ego,
118
                     r, irs, ors, m, ms, v, ivs, ovs, mstart, mstart + mcount,
119
                     rio, iio, plnr))
120
          return (plan *)0;
121

    
122
     pln = MKPLAN_DFTW(P, &padt, apply);
123

    
124
     pln->k = ego->k;
125
     pln->rs = X(mkstride)(r, irs);
126
     pln->vs = X(mkstride)(v, ivs);
127
     pln->td = 0;
128
     pln->r = r;
129
     pln->m = m;
130
     pln->ms = ms;
131
     pln->v = v;
132
     pln->mb = mstart;
133
     pln->me = mstart + mcount;
134
     pln->slv = ego;
135

    
136
     X(ops_zero)(&pln->super.super.ops);
137
     X(ops_madd2)(mcount/e->genus->vl, &e->ops, &pln->super.super.ops);
138

    
139
     return &(pln->super.super);
140
}
141

    
142
static void regone(planner *plnr, kdftwsq codelet,
143
                   const ct_desc *desc, int dec)
144
{
145
     S *slv = (S *)X(mksolver_ct)(sizeof(S), desc->radix, dec, mkcldw, 0);
146
     slv->k = codelet;
147
     slv->desc = desc;
148
     REGISTER_SOLVER(plnr, &(slv->super.super));
149
     if (X(mksolver_ct_hook)) {
150
          slv = (S *)X(mksolver_ct_hook)(sizeof(S), desc->radix, dec,
151
                                         mkcldw, 0);
152
          slv->k = codelet;
153
          slv->desc = desc;
154
          REGISTER_SOLVER(plnr, &(slv->super.super));
155
     }
156
}
157

    
158
void X(regsolver_ct_directwsq)(planner *plnr, kdftwsq codelet,
159
                               const ct_desc *desc, int dec)
160
{
161
     regone(plnr, codelet, desc, dec+TRANSPOSE);
162
}