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(map_r2r_kind)24 rdft_kind *X(map_r2r_kind)(int rank, const X(r2r_kind) * kind)
25 {
26      int i;
27      rdft_kind *k;
28 
29      A(FINITE_RNK(rank));
30      k = (rdft_kind *) MALLOC((unsigned)rank * sizeof(rdft_kind), PROBLEMS);
31      for (i = 0; i < rank; ++i) {
32 	  rdft_kind m;
33           switch (kind[i]) {
34 	      case FFTW_R2HC: m = R2HC; break;
35 	      case FFTW_HC2R: m = HC2R; break;
36 	      case FFTW_DHT: m = DHT; break;
37 	      case FFTW_REDFT00: m = REDFT00; break;
38 	      case FFTW_REDFT01: m = REDFT01; break;
39 	      case FFTW_REDFT10: m = REDFT10; break;
40 	      case FFTW_REDFT11: m = REDFT11; break;
41 	      case FFTW_RODFT00: m = RODFT00; break;
42 	      case FFTW_RODFT01: m = RODFT01; break;
43 	      case FFTW_RODFT10: m = RODFT10; break;
44 	      case FFTW_RODFT11: m = RODFT11; break;
45 	      default: m = R2HC; A(0);
46           }
47 	  k[i] = m;
48      }
49      return k;
50 }
51