comparison src/fftw-3.3.5/rdft/nop2.c @ 42:2cd0e3b3e1fd

Current fftw source
author Chris Cannam
date Tue, 18 Oct 2016 13:40:26 +0100
parents
children
comparison
equal deleted inserted replaced
41:481f5f8c5634 42:2cd0e3b3e1fd
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 /* plans for vrank -infty RDFT2s (nothing to do), as well as in-place
23 rank-0 HC2R. Note that in-place rank-0 R2HC is *not* a no-op, because
24 we have to set the imaginary parts of the output to zero. */
25
26 #include "rdft.h"
27
28 static void apply(const plan *ego_, R *r0, R *r1, R *cr, R *ci)
29 {
30 UNUSED(ego_);
31 UNUSED(r0);
32 UNUSED(r1);
33 UNUSED(cr);
34 UNUSED(ci);
35 }
36
37 static int applicable(const solver *ego_, const problem *p_)
38 {
39 const problem_rdft2 *p = (const problem_rdft2 *) p_;
40 UNUSED(ego_);
41
42 return(0
43 /* case 1 : -infty vector rank */
44 || (p->vecsz->rnk == RNK_MINFTY)
45
46 /* case 2 : rank-0 in-place rdft, except that
47 R2HC is not a no-op because it sets the imaginary
48 part to 0 */
49 || (1
50 && p->kind != R2HC
51 && p->sz->rnk == 0
52 && FINITE_RNK(p->vecsz->rnk)
53 && (p->r0 == p->cr)
54 && X(rdft2_inplace_strides)(p, RNK_MINFTY)
55 ));
56 }
57
58 static void print(const plan *ego, printer *p)
59 {
60 UNUSED(ego);
61 p->print(p, "(rdft2-nop)");
62 }
63
64 static plan *mkplan(const solver *ego, const problem *p, planner *plnr)
65 {
66 static const plan_adt padt = {
67 X(rdft2_solve), X(null_awake), print, X(plan_null_destroy)
68 };
69 plan_rdft2 *pln;
70
71 UNUSED(plnr);
72
73 if (!applicable(ego, p))
74 return (plan *) 0;
75 pln = MKPLAN_RDFT2(plan_rdft2, &padt, apply);
76 X(ops_zero)(&pln->super.ops);
77
78 return &(pln->super);
79 }
80
81 static solver *mksolver(void)
82 {
83 static const solver_adt sadt = { PROBLEM_RDFT2, mkplan, 0 };
84 return MKSOLVER(solver, &sadt);
85 }
86
87 void X(rdft2_nop_register)(planner *p)
88 {
89 REGISTER_SOLVER(p, mksolver());
90 }