mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
sprout/functional/dft.hpp 追加
sprout/complex.hpp 修正
This commit is contained in:
parent
aa96f9ce73
commit
10c73ea3e3
17 changed files with 453 additions and 24 deletions
50
sprout/functional/dft/idft_element.hpp
Normal file
50
sprout/functional/dft/idft_element.hpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#ifndef SPROUT_FUNCTIONAL_DFT_FIXED_IDFT_ELEMENT_HPP
|
||||
#define SPROUT_FUNCTIONAL_DFT_FIXED_IDFT_ELEMENT_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/functional/dft/detail/dft_element_gen.hpp>
|
||||
#include <sprout/math/constants.hpp>
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace detail {
|
||||
template<typename InputIterator, typename Size>
|
||||
SPROUT_CONSTEXPR inline typename std::iterator_traits<InputIterator>::value_type idft_element_impl(
|
||||
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>
|
||||
SPROUT_CONSTEXPR inline typename std::iterator_traits<InputIterator>::value_type idft_element(
|
||||
InputIterator first,
|
||||
InputIterator last,
|
||||
typename std::iterator_traits<InputIterator>::difference_type i
|
||||
)
|
||||
{
|
||||
return sprout::detail::idft_element_impl(
|
||||
first,
|
||||
last,
|
||||
i,
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last)
|
||||
);
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FUNCTIONAL_DFT_FIXED_IDFT_ELEMENT_HPP
|
Loading…
Add table
Add a link
Reference in a new issue