comparison src/fftw-3.3.5/rdft/rdft2-tensor-max-index.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 #include "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 {
28 int i;
29 INT n = 0;
30
31 A(FINITE_RNK(sz->rnk));
32 for (i = 0; i + 1 < sz->rnk; ++i) {
33 const iodim *p = sz->dims + i;
34 n += (p->n - 1) * X(imax)(X(iabs)(p->is), X(iabs)(p->os));
35 }
36 if (i < sz->rnk) {
37 const iodim *p = sz->dims + i;
38 INT is, os;
39 X(rdft2_strides)(k, p, &is, &os);
40 n += X(imax)((p->n - 1) * X(iabs)(is), (p->n/2) * X(iabs)(os));
41 }
42 return n;
43 }