Coverage Report

Created: 2023-09-25 07:08

/src/fftw3/dft/nop.c
Line
Count
Source (jump to first uncovered line)
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 DFTs (nothing to do) */
23
24
#include "dft/dft.h"
25
26
static void apply(const plan *ego_, R *ri, R *ii, R *ro, R *io)
27
60
{
28
60
     UNUSED(ego_);
29
60
     UNUSED(ri);
30
60
     UNUSED(ii);
31
60
     UNUSED(ro);
32
60
     UNUSED(io);
33
60
}
34
35
static int applicable(const solver *ego_, const problem *p_)
36
1.15k
{
37
1.15k
     const problem_dft *p = (const problem_dft *) p_;
38
39
1.15k
     UNUSED(ego_);
40
41
1.15k
     return 0
42
    /* case 1 : -infty vector rank */
43
1.15k
    || (!FINITE_RNK(p->vecsz->rnk))
44
45
    /* case 2 : rank-0 in-place dft */
46
1.15k
    || (1
47
953
        && p->sz->rnk == 0
48
953
        && FINITE_RNK(p->vecsz->rnk)
49
953
        && p->ro == p->ri
50
953
        && X(tensor_inplace_strides)(p->vecsz)
51
953
         );
52
1.15k
}
53
54
static void print(const plan *ego, printer *p)
55
0
{
56
0
     UNUSED(ego);
57
0
     p->print(p, "(dft-nop)");
58
0
}
59
60
static plan *mkplan(const solver *ego, const problem *p, planner *plnr)
61
1.49k
{
62
1.49k
     static const plan_adt padt = {
63
1.49k
    X(dft_solve), X(null_awake), print, X(plan_null_destroy)
64
1.49k
     };
65
1.49k
     plan_dft *pln;
66
67
1.49k
     UNUSED(plnr);
68
69
1.49k
     if (!applicable(ego, p))
70
1.29k
          return (plan *) 0;
71
205
     pln = MKPLAN_DFT(plan_dft, &padt, apply);
72
205
     X(ops_zero)(&pln->super.ops);
73
74
205
     return &(pln->super);
75
1.49k
}
76
77
static solver *mksolver(void)
78
2
{
79
2
     static const solver_adt sadt = { PROBLEM_DFT, mkplan, 0 };
80
2
     return MKSOLVER(solver, &sadt);
81
2
}
82
83
void X(dft_nop_register)(planner *p)
84
1
{
85
1
     REGISTER_SOLVER(p, mksolver());
86
1
}