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 #include "api/api.h"
22 #include "rdft/rdft.h"
23 
X(plan_many_dft_r2c)24 X(plan) X(plan_many_dft_r2c)(int rank, const int *n,
25 			     int howmany,
26 			     R *in, const int *inembed,
27 			     int istride, int idist,
28 			     C *out, const int *onembed,
29 			     int ostride, int odist, unsigned flags)
30 {
31      R *ro, *io;
32      int *nfi, *nfo;
33      int inplace;
34      X(plan) p;
35 
36      if (!X(many_kosherp)(rank, n, howmany)) return 0;
37 
38      EXTRACT_REIM(FFT_SIGN, out, &ro, &io);
39      inplace = in == ro;
40 
41      p = X(mkapiplan)(
42 	  0, flags,
43 	  X(mkproblem_rdft2_d_3pointers)(
44 	       X(mktensor_rowmajor)(
45 		    rank, n,
46 		    X(rdft2_pad)(rank, n, inembed, inplace, 0, &nfi),
47 		    X(rdft2_pad)(rank, n, onembed, inplace, 1, &nfo),
48 		    istride, 2 * ostride),
49 	       X(mktensor_1d)(howmany, idist, 2 * odist),
50 	       TAINT_UNALIGNED(in, flags),
51 	       TAINT_UNALIGNED(ro, flags), TAINT_UNALIGNED(io, flags),
52 	       R2HC));
53 
54      X(ifree0)(nfi);
55      X(ifree0)(nfo);
56      return p;
57 }
58