26 #include <edsp/spectral/internal/fft_impl.hpp> 28 namespace edsp {
inline namespace spectral {
34 template <
typename Integer>
43 template <
typename Integer>
45 return 2 * (complex_size - 1);
64 template <
typename InputIt,
typename OutputIt>
65 inline void cdft(InputIt first, InputIt last, OutputIt d_first) {
66 using complex_t = meta::value_type_t<InputIt>;
67 using underlying_t =
typename complex_t::value_type;
68 const auto nfft =
static_cast<typename fft_impl<underlying_t>::size_type
>(
std::distance(first, last));
69 fft_impl<underlying_t> plan(nfft);
70 plan.dft(&(*first), &(*d_first));
88 template <
typename InputIt,
typename OutputIt>
89 inline void cidft(InputIt first, InputIt last, OutputIt d_first) {
90 using complex_t = meta::value_type_t<InputIt>;
91 using underlying_t =
typename complex_t::value_type;
92 const auto nfft =
static_cast<typename fft_impl<underlying_t>::size_type
>(
std::distance(first, last));
93 fft_impl<underlying_t> plan(nfft);
94 plan.idft(&(*first), &(*d_first));
95 plan.idft_scale(&(*d_first));
111 template <
typename InputIt,
typename OutputIt>
112 void dft(InputIt first, InputIt last, OutputIt d_first) {
113 using value_type =
typename std::iterator_traits<InputIt>::value_type;
115 plan.dft(&(*first), &(*d_first));
131 template <
typename InputIt,
typename OutputIt>
132 void idft(InputIt first, InputIt last, OutputIt d_first) {
133 using value_type =
typename std::iterator_traits<OutputIt>::value_type;
136 fft_impl<value_type> plan(nfft);
137 plan.idft(&(*first), &(*d_first));
138 plan.idft_scale(&(*d_first));
143 #endif // EDSP_DFT_HPP void cdft(InputIt first, InputIt last, OutputIt d_first)
Computes the complex-to-complex Discrete-Fourier-Transform of the range [first, last) and stores the ...
Definition: dft.hpp:65
constexpr void floor(InputIt first, InputIt last, OutputIt d_first)
For each element in the range [first, last) computes the largest integer value not greater than the e...
Definition: floor.hpp:40
void cidft(InputIt first, InputIt last, OutputIt d_first)
Computes the complex-to-complex Inverse-Discrete-Fourier-Transform of the range [first, last) and stores the result in another range, beginning at d_first.
Definition: dft.hpp:89
constexpr Integer make_fft_size(Integer real_size) noexcept
Computes the expected DFT size for a real-to-complex DFT transform.
Definition: dft.hpp:35
constexpr T distance(T x, T y) noexcept
Computes the distance between x and y.
Definition: numeric.hpp:328
constexpr Integer make_ifft_size(Integer complex_size) noexcept
Computes the expected IDFT size for a complex-to-real IDFT transform.
Definition: dft.hpp:44
void idft(InputIt first, InputIt last, OutputIt d_first)
Computes the complex-to-real Inverse-Discrete-Fourier-Transform of the complex range [first...
Definition: dft.hpp:132
Definition: amplifier.hpp:29
void dft(InputIt first, InputIt last, OutputIt d_first)
Computes the real-to-complex Discrete-Fourier-Transform of the range [first, last) and stores the res...
Definition: dft.hpp:112