mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
templateCufft.hpp
Go to the documentation of this file.
1 /** \file templateCufft.hpp
2  * \author Jared R. Males
3  * \brief A template interface to cufft
4  * \ingroup cuda_files
5  *
6  */
7 
8 //***********************************************************************//
9 // Copyright 2019,2020 Jared R. Males (jaredmales@gmail.com)
10 //
11 // This file is part of mxlib.
12 //
13 // mxlib is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
17 //
18 // mxlib is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with mxlib. If not, see <http://www.gnu.org/licenses/>.
25 //***********************************************************************//
26 
27 #ifndef math_templateCufft_hpp
28 #define math_templateCufft_hpp
29 
30 #include <complex>
31 #include <cuda_runtime.h>
32 #include <cufft.h>
33 
34 
35 namespace mx
36 {
37 namespace cuda
38 {
39 
40 template<typename inputT, typename outputT>
41 cufftResult cufftPlan2d( cufftHandle *plan,
42  int nx,
43  int ny
44  );
45 
46 template<>
47 cufftResult cufftPlan2d<std::complex<float>, std::complex<float>>( cufftHandle *plan,
48  int nx,
49  int ny
50  );
51 
52 template<>
53 cufftResult cufftPlan2d<cuComplex, cuComplex>( cufftHandle *plan,
54  int nx,
55  int ny
56  );
57 
58 template<>
59 cufftResult cufftPlan2d<std::complex<double>, std::complex<double>>( cufftHandle *plan,
60  int nx,
61  int ny
62  );
63 
64 template<>
65 cufftResult cufftPlan2d<cuDoubleComplex, cuDoubleComplex>( cufftHandle *plan,
66  int nx,
67  int ny
68  );
69 
70 template<typename inputT, typename outputT>
71 cufftResult cufftExec( cufftHandle plan,
72  inputT *idata,
73  inputT *odata,
74  int direction
75  );
76 
77 template<>
78 cufftResult cufftExec<std::complex<float>, std::complex<float>>( cufftHandle plan,
79  std::complex<float> *idata,
80  std::complex<float> *odata,
81  int direction
82  );
83 
84 template<>
85 cufftResult cufftExec<cuComplex, cuComplex>( cufftHandle plan,
86  cuComplex *idata,
87  cuComplex *odata,
88  int direction
89  );
90 
91 template<>
92 cufftResult cufftExec<std::complex<double>, std::complex<double>>( cufftHandle plan,
93  std::complex<double> *idata,
94  std::complex<double> *odata,
95  int direction
96  );
97 
98 template<>
99 cufftResult cufftExec<cuDoubleComplex, cuDoubleComplex>( cufftHandle plan,
100  cuDoubleComplex *idata,
101  cuDoubleComplex *odata,
102  int direction
103  );
104 
105 }//namespace cuda
106 }//namespace mx
107 
108 #endif // math_templateCufft_hpp
The mxlib c++ namespace.
Definition: mxError.hpp:107