fn_fft.hpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
  2. // Copyright 2008-2016 National ICT Australia (NICTA)
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // ------------------------------------------------------------------------
  15. //! \addtogroup fn_fft
  16. //! @{
  17. // 1D FFT & 1D IFFT
  18. template<typename T1>
  19. arma_warn_unused
  20. inline
  21. typename
  22. enable_if2
  23. <
  24. (is_arma_type<T1>::value && is_real<typename T1::elem_type>::value),
  25. const mtOp<std::complex<typename T1::pod_type>, T1, op_fft_real>
  26. >::result
  27. fft(const T1& A)
  28. {
  29. arma_extra_debug_sigprint();
  30. return mtOp<std::complex<typename T1::pod_type>, T1, op_fft_real>(A, uword(0), uword(1));
  31. }
  32. template<typename T1>
  33. arma_warn_unused
  34. inline
  35. typename
  36. enable_if2
  37. <
  38. (is_arma_type<T1>::value && is_real<typename T1::elem_type>::value),
  39. const mtOp<std::complex<typename T1::pod_type>, T1, op_fft_real>
  40. >::result
  41. fft(const T1& A, const uword N)
  42. {
  43. arma_extra_debug_sigprint();
  44. return mtOp<std::complex<typename T1::pod_type>, T1, op_fft_real>(A, N, uword(0));
  45. }
  46. template<typename T1>
  47. arma_warn_unused
  48. inline
  49. typename
  50. enable_if2
  51. <
  52. (is_arma_type<T1>::value && (is_cx_float<typename T1::elem_type>::yes || is_cx_double<typename T1::elem_type>::yes)),
  53. const Op<T1, op_fft_cx>
  54. >::result
  55. fft(const T1& A)
  56. {
  57. arma_extra_debug_sigprint();
  58. return Op<T1, op_fft_cx>(A, uword(0), uword(1));
  59. }
  60. template<typename T1>
  61. arma_warn_unused
  62. inline
  63. typename
  64. enable_if2
  65. <
  66. (is_arma_type<T1>::value && (is_cx_float<typename T1::elem_type>::yes || is_cx_double<typename T1::elem_type>::yes)),
  67. const Op<T1, op_fft_cx>
  68. >::result
  69. fft(const T1& A, const uword N)
  70. {
  71. arma_extra_debug_sigprint();
  72. return Op<T1, op_fft_cx>(A, N, uword(0));
  73. }
  74. template<typename T1>
  75. arma_warn_unused
  76. inline
  77. typename
  78. enable_if2
  79. <
  80. (is_arma_type<T1>::value && (is_cx_float<typename T1::elem_type>::yes || is_cx_double<typename T1::elem_type>::yes)),
  81. const Op<T1, op_ifft_cx>
  82. >::result
  83. ifft(const T1& A)
  84. {
  85. arma_extra_debug_sigprint();
  86. return Op<T1, op_ifft_cx>(A, uword(0), uword(1));
  87. }
  88. template<typename T1>
  89. arma_warn_unused
  90. inline
  91. typename
  92. enable_if2
  93. <
  94. (is_arma_type<T1>::value && (is_cx_float<typename T1::elem_type>::yes || is_cx_double<typename T1::elem_type>::yes)),
  95. const Op<T1, op_ifft_cx>
  96. >::result
  97. ifft(const T1& A, const uword N)
  98. {
  99. arma_extra_debug_sigprint();
  100. return Op<T1, op_ifft_cx>(A, N, uword(0));
  101. }
  102. //! @}