Coverage Report

Created: 2025-07-11 06:55

/src/fftw3/rdft/rdft2-tensor-max-index.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
#include "rdft/rdft.h"
23
24
/* like X(tensor_max_index), but takes into account the special n/2+1
25
   final dimension for the complex output/input of an R2HC/HC2R transform. */
26
INT X(rdft2_tensor_max_index)(const tensor *sz, rdft_kind k)
27
0
{
28
0
     int i;
29
0
     INT n = 0;
30
31
0
     A(FINITE_RNK(sz->rnk));
32
0
     for (i = 0; i + 1 < sz->rnk; ++i) {
33
0
          const iodim *p = sz->dims + i;
34
0
          n += (p->n - 1) * X(imax)(X(iabs)(p->is), X(iabs)(p->os));
35
0
     }
36
0
     if (i < sz->rnk) {
37
0
    const iodim *p = sz->dims + i;
38
0
    INT is, os;
39
0
    X(rdft2_strides)(k, p, &is, &os);
40
0
    n += X(imax)((p->n - 1) * X(iabs)(is), (p->n/2) * X(iabs)(os));
41
0
     }
42
0
     return n;
43
0
}