~ubuntu-branches/ubuntu/raring/fftw3/raring-proposed

« back to all changes in this revision

Viewing changes to reodft/redft00e-r2hc.c

  • Committer: Bazaar Package Importer
  • Author(s): Paul Brossier
  • Date: 2006-05-31 13:44:05 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060531134405-ol9hrbg6bh81sg0c
Tags: 3.1.1-1
* New upstream release (closes: #350327, #338487, #338501)
* Add --enable-portable-binary to use -mtune instead of -march
* Use --with-gcc-arch=G5 / pentium4 on powerpc / i386
* Updated Standards-Version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (c) 2003 Matteo Frigo
3
 
 * Copyright (c) 2003 Massachusetts Institute of Technology
 
2
 * Copyright (c) 2003, 2006 Matteo Frigo
 
3
 * Copyright (c) 2003, 2006 Massachusetts Institute of Technology
4
4
 *
5
5
 * This program is free software; you can redistribute it and/or modify
6
6
 * it under the terms of the GNU General Public License as published by
18
18
 *
19
19
 */
20
20
 
21
 
/* $Id: redft00e-r2hc.c,v 1.24 2003/04/08 20:48:08 stevenj Exp $ */
 
21
/* $Id: redft00e-r2hc.c,v 1.32 2006-01-27 02:10:50 athena Exp $ */
22
22
 
23
23
/* Do a REDFT00 problem via an R2HC problem, with some pre/post-processing.
24
24
 
36
36
   similar numerical difficulties seems to be the direct adaptation of
37
37
   the Cooley-Tukey decomposition for symmetric data, but this would
38
38
   require a whole new set of codelets and it's not clear that it's
39
 
   worth it at this point. */
 
39
   worth it at this point.  However, we did implement the latter
 
40
   algorithm for the specific case of odd n (logically adapting the
 
41
   split-radix algorithm); see reodft00e-splitradix.c. */
40
42
 
41
43
#include "reodft.h"
42
44
 
48
50
     plan_rdft super;
49
51
     plan *cld;
50
52
     twid *td;
51
 
     int is, os;
52
 
     int n;
53
 
     int vl;
54
 
     int ivs, ovs;
 
53
     INT is, os;
 
54
     INT n;
 
55
     INT vl;
 
56
     INT ivs, ovs;
55
57
} P;
56
58
 
57
59
static void apply(const plan *ego_, R *I, R *O)
58
60
{
59
61
     const P *ego = (const P *) ego_;
60
 
     int is = ego->is, os = ego->os;
61
 
     int i, n = ego->n;
62
 
     int iv, vl = ego->vl;
63
 
     int ivs = ego->ivs, ovs = ego->ovs;
 
62
     INT is = ego->is, os = ego->os;
 
63
     INT i, n = ego->n;
 
64
     INT iv, vl = ego->vl;
 
65
     INT ivs = ego->ivs, ovs = ego->ovs;
64
66
     R *W = ego->td->W;
65
67
     R *buf;
66
68
     E csum;
93
95
          O[0] = buf[0];
94
96
          O[os] = csum;
95
97
          for (i = 1; i + i < n; ++i) {
96
 
               int k = i + i;
 
98
               INT k = i + i;
97
99
               O[os * k] = buf[i];
98
100
               O[os * (k + 1)] = O[os * (k - 1)] - buf[n - i];
99
101
          }
105
107
     X(ifree)(buf);
106
108
}
107
109
 
108
 
static void awake(plan *ego_, int flg)
 
110
static void awake(plan *ego_, enum wakefulness wakefulness)
109
111
{
110
112
     P *ego = (P *) ego_;
111
113
     static const tw_instr redft00e_tw[] = {
114
116
          { TW_NEXT, 1, 0 }
115
117
     };
116
118
 
117
 
     AWAKE(ego->cld, flg);
118
 
     X(twiddle_awake)(flg, &ego->td, redft00e_tw, 2*ego->n, 1, (ego->n+1)/2);
 
119
     X(plan_awake)(ego->cld, wakefulness);
 
120
     X(twiddle_awake)(wakefulness,
 
121
                      &ego->td, redft00e_tw, 2*ego->n, 1, (ego->n+1)/2);
119
122
}
120
123
 
121
124
static void destroy(plan *ego_)
127
130
static void print(const plan *ego_, printer *p)
128
131
{
129
132
     const P *ego = (const P *) ego_;
130
 
     p->print(p, "(redft00e-r2hc-%d%v%(%p%))", ego->n + 1, ego->vl, ego->cld);
 
133
     p->print(p, "(redft00e-r2hc-%D%v%(%p%))", ego->n + 1, ego->vl, ego->cld);
131
134
}
132
135
 
133
136
static int applicable0(const solver *ego_, const problem *p_)
134
137
{
 
138
     const problem_rdft *p = (const problem_rdft *) p_;
135
139
     UNUSED(ego_);
136
 
     if (RDFTP(p_)) {
137
 
          const problem_rdft *p = (const problem_rdft *) p_;
138
 
          return (1
139
 
                  && p->sz->rnk == 1
140
 
                  && p->vecsz->rnk <= 1
141
 
                  && p->kind[0] == REDFT00
142
 
                  && p->sz->dims[0].n > 1  /* n == 1 is not well-defined */
143
 
               );
144
 
     }
145
140
 
146
 
     return 0;
 
141
     return (1
 
142
             && p->sz->rnk == 1
 
143
             && p->vecsz->rnk <= 1
 
144
             && p->kind[0] == REDFT00
 
145
             && p->sz->dims[0].n > 1  /* n == 1 is not well-defined */
 
146
          );
147
147
}
148
148
 
149
149
static int applicable(const solver *ego, const problem *p, const planner *plnr)
150
150
{
151
 
     return (!NO_UGLYP(plnr) && applicable0(ego, p));
 
151
     return (!NO_SLOWP(plnr) && applicable0(ego, p));
152
152
}
153
153
 
154
154
static plan *mkplan(const solver *ego_, const problem *p_, planner *plnr)
157
157
     const problem_rdft *p;
158
158
     plan *cld;
159
159
     R *buf;
160
 
     int n;
 
160
     INT n;
161
161
     opcnt ops;
162
162
 
163
163
     static const plan_adt padt = {
205
205
/* constructor */
206
206
static solver *mksolver(void)
207
207
{
208
 
     static const solver_adt sadt = { mkplan };
 
208
     static const solver_adt sadt = { PROBLEM_RDFT, mkplan };
209
209
     S *slv = MKSOLVER(S, &sadt);
210
210
     return &(slv->super);
211
211
}