Coverage Report

Created: 2025-07-11 06:55

/src/fftw3/rdft/nop2.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 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/rdft.h"
27
28
static void apply(const plan *ego_, R *r0, R *r1, R *cr, R *ci)
29
0
{
30
0
     UNUSED(ego_);
31
0
     UNUSED(r0);
32
0
     UNUSED(r1);
33
0
     UNUSED(cr);
34
0
     UNUSED(ci);
35
0
}
36
37
static int applicable(const solver *ego_, const problem *p_)
38
0
{
39
0
     const problem_rdft2 *p = (const problem_rdft2 *) p_;
40
0
     UNUSED(ego_);
41
42
0
     return(0
43
      /* case 1 : -infty vector rank */
44
0
      || (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
0
      || (1
50
0
    && p->kind != R2HC
51
0
    && p->sz->rnk == 0
52
0
    && FINITE_RNK(p->vecsz->rnk)
53
0
    && (p->r0 == p->cr)
54
0
    && X(rdft2_inplace_strides)(p, RNK_MINFTY)
55
0
     ));
56
0
}
57
58
static void print(const plan *ego, printer *p)
59
0
{
60
0
     UNUSED(ego);
61
0
     p->print(p, "(rdft2-nop)");
62
0
}
63
64
static plan *mkplan(const solver *ego, const problem *p, planner *plnr)
65
0
{
66
0
     static const plan_adt padt = {
67
0
    X(rdft2_solve), X(null_awake), print, X(plan_null_destroy)
68
0
     };
69
0
     plan_rdft2 *pln;
70
71
0
     UNUSED(plnr);
72
73
0
     if (!applicable(ego, p))
74
0
          return (plan *) 0;
75
0
     pln = MKPLAN_RDFT2(plan_rdft2, &padt, apply);
76
0
     X(ops_zero)(&pln->super.ops);
77
78
0
     return &(pln->super);
79
0
}
80
81
static solver *mksolver(void)
82
1
{
83
1
     static const solver_adt sadt = { PROBLEM_RDFT2, mkplan, 0 };
84
1
     return MKSOLVER(solver, &sadt);
85
1
}
86
87
void X(rdft2_nop_register)(planner *p)
88
1
{
89
1
     REGISTER_SOLVER(p, mksolver());
90
1
}