2012-04-10 03:54:38 +00:00
|
|
|
#ifndef SPROUT_NUMERIC_DFT_FIXED_IDFT_ELEMENT_HPP
|
|
|
|
#define SPROUT_NUMERIC_DFT_FIXED_IDFT_ELEMENT_HPP
|
2012-02-25 14:59:46 +00:00
|
|
|
|
|
|
|
#include <iterator>
|
|
|
|
#include <sprout/config.hpp>
|
2012-04-10 03:54:38 +00:00
|
|
|
#include <sprout/numeric/dft/detail/dft_element_gen.hpp>
|
2012-02-25 14:59:46 +00:00
|
|
|
#include <sprout/math/constants.hpp>
|
2012-04-01 13:15:09 +00:00
|
|
|
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT
|
2012-02-25 14:59:46 +00:00
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
namespace detail {
|
|
|
|
template<typename InputIterator, typename Size>
|
2012-04-04 13:23:41 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::value_type idft_element_impl(
|
2012-02-25 14:59:46 +00:00
|
|
|
InputIterator first,
|
|
|
|
InputIterator last,
|
|
|
|
typename std::iterator_traits<InputIterator>::difference_type i,
|
|
|
|
Size size
|
|
|
|
)
|
|
|
|
{
|
|
|
|
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
|
|
|
|
typedef typename value_type::value_type elem_type;
|
|
|
|
return sprout::detail::dft_element_gen(
|
|
|
|
first,
|
|
|
|
last,
|
|
|
|
2 * sprout::math::pi<elem_type>() * i / size
|
|
|
|
)
|
|
|
|
/ static_cast<elem_type>(size)
|
|
|
|
;
|
|
|
|
}
|
|
|
|
} // namespace detail
|
|
|
|
//
|
|
|
|
// idft_element
|
|
|
|
//
|
|
|
|
template<typename InputIterator>
|
2012-04-04 13:23:41 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::value_type idft_element(
|
2012-02-25 14:59:46 +00:00
|
|
|
InputIterator first,
|
|
|
|
InputIterator last,
|
|
|
|
typename std::iterator_traits<InputIterator>::difference_type i
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return sprout::detail::idft_element_impl(
|
|
|
|
first,
|
|
|
|
last,
|
|
|
|
i,
|
2012-04-01 13:15:09 +00:00
|
|
|
NS_SSCRISK_CEL_OR_SPROUT::distance(first, last)
|
2012-02-25 14:59:46 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
} // namespace sprout
|
|
|
|
|
2012-04-10 03:54:38 +00:00
|
|
|
#endif // #ifndef SPROUT_NUMERIC_DFT_FIXED_IDFT_ELEMENT_HPP
|