Line | Count | Source |
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 RDFTs (nothing to do) */ |
23 | | |
24 | | #include "rdft/rdft.h" |
25 | | |
26 | | static void apply(const plan *ego_, R *I, R *O) |
27 | | { |
28 | | UNUSED(ego_); |
29 | | UNUSED(I); |
30 | | UNUSED(O); |
31 | | } |
32 | | |
33 | | static int applicable(const solver *ego_, const problem *p_) |
34 | | { |
35 | | const problem_rdft *p = (const problem_rdft *) p_; |
36 | | UNUSED(ego_); |
37 | | return 0 |
38 | | /* case 1 : -infty vector rank */ |
39 | | || (p->vecsz->rnk == RNK_MINFTY) |
40 | | |
41 | | /* case 2 : rank-0 in-place rdft */ |
42 | | || (1 |
43 | | && p->sz->rnk == 0 |
44 | | && FINITE_RNK(p->vecsz->rnk) |
45 | | && p->O == p->I |
46 | | && X(tensor_inplace_strides)(p->vecsz) |
47 | | ); |
48 | | } |
49 | | |
50 | | static void print(const plan *ego, printer *p) |
51 | | { |
52 | | UNUSED(ego); |
53 | | p->print(p, "(rdft-nop)"); |
54 | | } |
55 | | |
56 | | static plan *mkplan(const solver *ego, const problem *p, planner *plnr) |
57 | | { |
58 | | static const plan_adt padt = { |
59 | | X(rdft_solve), X(null_awake), print, X(plan_null_destroy) |
60 | | }; |
61 | | plan_rdft *pln; |
62 | | |
63 | | UNUSED(plnr); |
64 | | |
65 | | if (!applicable(ego, p)) |
66 | | return (plan *) 0; |
67 | | pln = MKPLAN_RDFT(plan_rdft, &padt, apply); |
68 | | X(ops_zero)(&pln->super.ops); |
69 | | |
70 | | return &(pln->super); |
71 | | } |
72 | | |
73 | | static solver *mksolver(void) |
74 | | { |
75 | | static const solver_adt sadt = { PROBLEM_RDFT, mkplan, 0 }; |
76 | | return MKSOLVER(solver, &sadt); |
77 | | } |
78 | | |
79 | | void X(rdft_nop_register)(planner *p) |
80 | 1 | { |
81 | 1 | REGISTER_SOLVER(p, mksolver()); |
82 | 1 | } |