Chris@49
|
1 // Copyright (C) 2013 Conrad Sanderson
|
Chris@49
|
2 // Copyright (C) 2013 NICTA (www.nicta.com.au)
|
Chris@49
|
3 //
|
Chris@49
|
4 // This Source Code Form is subject to the terms of the Mozilla Public
|
Chris@49
|
5 // License, v. 2.0. If a copy of the MPL was not distributed with this
|
Chris@49
|
6 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
Chris@49
|
7
|
Chris@49
|
8
|
Chris@49
|
9 //! \addtogroup fn_fft
|
Chris@49
|
10 //! @{
|
Chris@49
|
11
|
Chris@49
|
12
|
Chris@49
|
13
|
Chris@49
|
14 // TODO: fft(real) -> complex [to be tested thoroughly]
|
Chris@49
|
15 // TODO: fft(complex) -> complex [to be tested thoroughly]
|
Chris@49
|
16 // TODO: ifft(complex) -> complex [to be tested thoroughly]
|
Chris@49
|
17
|
Chris@49
|
18
|
Chris@49
|
19 template<typename T1>
|
Chris@49
|
20 inline
|
Chris@49
|
21 typename
|
Chris@49
|
22 enable_if2
|
Chris@49
|
23 <
|
Chris@49
|
24 (is_arma_type<T1>::value && is_real<typename T1::elem_type>::value),
|
Chris@49
|
25 const mtOp<std::complex<typename T1::pod_type>, T1, op_fft_real>
|
Chris@49
|
26 >::result
|
Chris@49
|
27 fft(const T1& A)
|
Chris@49
|
28 {
|
Chris@49
|
29 arma_extra_debug_sigprint();
|
Chris@49
|
30
|
Chris@49
|
31 return mtOp<std::complex<typename T1::pod_type>, T1, op_fft_real>(A, uword(0), uword(1));
|
Chris@49
|
32 }
|
Chris@49
|
33
|
Chris@49
|
34
|
Chris@49
|
35
|
Chris@49
|
36 template<typename T1>
|
Chris@49
|
37 inline
|
Chris@49
|
38 typename
|
Chris@49
|
39 enable_if2
|
Chris@49
|
40 <
|
Chris@49
|
41 (is_arma_type<T1>::value && is_real<typename T1::elem_type>::value),
|
Chris@49
|
42 const mtOp<std::complex<typename T1::pod_type>, T1, op_fft_real>
|
Chris@49
|
43 >::result
|
Chris@49
|
44 fft(const T1& A, const uword N)
|
Chris@49
|
45 {
|
Chris@49
|
46 arma_extra_debug_sigprint();
|
Chris@49
|
47
|
Chris@49
|
48 return mtOp<std::complex<typename T1::pod_type>, T1, op_fft_real>(A, N, uword(0));
|
Chris@49
|
49 }
|
Chris@49
|
50
|
Chris@49
|
51
|
Chris@49
|
52
|
Chris@49
|
53 template<typename T1>
|
Chris@49
|
54 inline
|
Chris@49
|
55 typename
|
Chris@49
|
56 enable_if2
|
Chris@49
|
57 <
|
Chris@49
|
58 (is_arma_type<T1>::value && is_complex_strict<typename T1::elem_type>::value),
|
Chris@49
|
59 const Op<T1, op_fft_cx>
|
Chris@49
|
60 >::result
|
Chris@49
|
61 fft(const T1& A)
|
Chris@49
|
62 {
|
Chris@49
|
63 arma_extra_debug_sigprint();
|
Chris@49
|
64
|
Chris@49
|
65 return Op<T1, op_fft_cx>(A, uword(0), uword(1));
|
Chris@49
|
66 }
|
Chris@49
|
67
|
Chris@49
|
68
|
Chris@49
|
69
|
Chris@49
|
70 template<typename T1>
|
Chris@49
|
71 inline
|
Chris@49
|
72 typename
|
Chris@49
|
73 enable_if2
|
Chris@49
|
74 <
|
Chris@49
|
75 (is_arma_type<T1>::value && is_complex_strict<typename T1::elem_type>::value),
|
Chris@49
|
76 const Op<T1, op_fft_cx>
|
Chris@49
|
77 >::result
|
Chris@49
|
78 fft(const T1& A, const uword N)
|
Chris@49
|
79 {
|
Chris@49
|
80 arma_extra_debug_sigprint();
|
Chris@49
|
81
|
Chris@49
|
82 return Op<T1, op_fft_cx>(A, N, uword(0));
|
Chris@49
|
83 }
|
Chris@49
|
84
|
Chris@49
|
85
|
Chris@49
|
86
|
Chris@49
|
87 template<typename T1>
|
Chris@49
|
88 inline
|
Chris@49
|
89 typename
|
Chris@49
|
90 enable_if2
|
Chris@49
|
91 <
|
Chris@49
|
92 (is_arma_type<T1>::value && is_complex_strict<typename T1::elem_type>::value),
|
Chris@49
|
93 const Op<T1, op_ifft_cx>
|
Chris@49
|
94 >::result
|
Chris@49
|
95 ifft(const T1& A)
|
Chris@49
|
96 {
|
Chris@49
|
97 arma_extra_debug_sigprint();
|
Chris@49
|
98
|
Chris@49
|
99 return Op<T1, op_ifft_cx>(A, uword(0), uword(1));
|
Chris@49
|
100 }
|
Chris@49
|
101
|
Chris@49
|
102
|
Chris@49
|
103
|
Chris@49
|
104 template<typename T1>
|
Chris@49
|
105 inline
|
Chris@49
|
106 typename
|
Chris@49
|
107 enable_if2
|
Chris@49
|
108 <
|
Chris@49
|
109 (is_arma_type<T1>::value && is_complex_strict<typename T1::elem_type>::value),
|
Chris@49
|
110 const Op<T1, op_ifft_cx>
|
Chris@49
|
111 >::result
|
Chris@49
|
112 ifft(const T1& A, const uword N)
|
Chris@49
|
113 {
|
Chris@49
|
114 arma_extra_debug_sigprint();
|
Chris@49
|
115
|
Chris@49
|
116 return Op<T1, op_ifft_cx>(A, N, uword(0));
|
Chris@49
|
117 }
|
Chris@49
|
118
|
Chris@49
|
119
|
Chris@49
|
120
|
Chris@49
|
121 //! @}
|