diff --git a/sprout/iterator/amplitude_spectrum_iterator.hpp b/sprout/iterator/amplitude_spectrum_iterator.hpp new file mode 100644 index 00000000..58af95c0 --- /dev/null +++ b/sprout/iterator/amplitude_spectrum_iterator.hpp @@ -0,0 +1,37 @@ +#ifndef SPROUT_ITERATOR_AMPLITUDE_SPECTRUM_ITERATOR_HPP +#define SPROUT_ITERATOR_AMPLITUDE_SPECTRUM_ITERATOR_HPP + +#include +#include +#include +#include + +namespace sprout { + // + // amplitude_value + // + template + class amplitude_value { + public: + typedef typename T::value_type result_type; + typedef T argument_type; + public: + SPROUT_CONSTEXPR amplitude_value() {} + SPROUT_CONSTEXPR typename T::value_type operator()(T const& value) const { + return sprout::amplitude_spectrum_value(value); + } + }; + + // + // make_amplitude_spectrum_iterator + // + template + inline SPROUT_CONSTEXPR sprout::transform_iterator::value_type>, Iterator> + make_amplitude_spectrum_iterator(Iterator it) { + return sprout::transform_iterator::value_type>, Iterator>( + it, sprout::amplitude_value::value_type>() + ); + } +} // namespace sprout + +#endif // #ifndef SPROUT_ITERATOR_AMPLITUDE_SPECTRUM_ITERATOR_HPP diff --git a/sprout/iterator/dft.hpp b/sprout/iterator/dft.hpp index 2ca894a5..c58bcbca 100644 --- a/sprout/iterator/dft.hpp +++ b/sprout/iterator/dft.hpp @@ -4,5 +4,7 @@ #include #include #include +#include +#include #endif // #ifndef SPROUT_ITERATOR_DFT_HPP diff --git a/sprout/iterator/phase_spectrum_iterator.hpp b/sprout/iterator/phase_spectrum_iterator.hpp new file mode 100644 index 00000000..189bf5da --- /dev/null +++ b/sprout/iterator/phase_spectrum_iterator.hpp @@ -0,0 +1,37 @@ +#ifndef SPROUT_ITERATOR_PHASE_SPECTRUM_ITERATOR_HPP +#define SPROUT_ITERATOR_PHASE_SPECTRUM_ITERATOR_HPP + +#include +#include +#include +#include + +namespace sprout { + // + // phase_value + // + template + class phase_value { + public: + typedef typename T::value_type result_type; + typedef T argument_type; + public: + SPROUT_CONSTEXPR phase_value() {} + SPROUT_CONSTEXPR typename T::value_type operator()(T const& value) const { + return sprout::phase_spectrum_value(value); + } + }; + + // + // make_phase_spectrum_iterator + // + template + inline SPROUT_CONSTEXPR sprout::transform_iterator::value_type>, Iterator> + make_phase_spectrum_iterator(Iterator it) { + return sprout::transform_iterator::value_type>, Iterator>( + it, sprout::phase_value::value_type>() + ); + } +} // namespace sprout + +#endif // #ifndef SPROUT_ITERATOR_PHASE_SPECTRUM_ITERATOR_HPP diff --git a/sprout/iterator/replace_if_iterator.hpp b/sprout/iterator/replace_if_iterator.hpp index 50fb658b..a1cc3a72 100644 --- a/sprout/iterator/replace_if_iterator.hpp +++ b/sprout/iterator/replace_if_iterator.hpp @@ -1,5 +1,5 @@ -#ifndef SPROUT_ITERATOR_REPLACE_ITERATOR_HPP -#define SPROUT_ITERATOR_REPLACE_ITERATOR_HPP +#ifndef SPROUT_ITERATOR_REPLACE_IF_ITERATOR_HPP +#define SPROUT_ITERATOR_REPLACE_IF_ITERATOR_HPP #include #include @@ -13,7 +13,7 @@ namespace sprout { public: typedef Predicate predicate_type; typedef T result_type; - typedef T const& argument_type; + typedef T argument_type; private: Predicate pred_; T new_; @@ -39,4 +39,4 @@ namespace sprout { } } // namespace sprout -#endif // #ifndef SPROUT_ITERATOR_REPLACE_ITERATOR_HPP +#endif // #ifndef SPROUT_ITERATOR_REPLACE_IF_ITERATOR_HPP diff --git a/sprout/iterator/replace_iterator.hpp b/sprout/iterator/replace_iterator.hpp index 01c46bad..927012ee 100644 --- a/sprout/iterator/replace_iterator.hpp +++ b/sprout/iterator/replace_iterator.hpp @@ -1,5 +1,5 @@ -#ifndef SPROUT_ITERATOR_REPLACE_IF_ITERATOR_HPP -#define SPROUT_ITERATOR_REPLACE_IF_ITERATOR_HPP +#ifndef SPROUT_ITERATOR_REPLACE_ITERATOR_HPP +#define SPROUT_ITERATOR_REPLACE_ITERATOR_HPP #include #include @@ -38,4 +38,4 @@ namespace sprout { } } // namespace sprout -#endif // #ifndef SPROUT_ITERATOR_REPLACE_IF_ITERATOR_HPP +#endif // #ifndef SPROUT_ITERATOR_REPLACE_ITERATOR_HPP diff --git a/sprout/numeric/dft.hpp b/sprout/numeric/dft.hpp index 056fcfa0..f3ca3200 100644 --- a/sprout/numeric/dft.hpp +++ b/sprout/numeric/dft.hpp @@ -2,13 +2,7 @@ #define SPROUT_NUMERIC_DFT_HPP #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include #endif // #ifndef SPROUT_NUMERIC_DFT_HPP diff --git a/sprout/numeric/dft/dft_element.hpp b/sprout/numeric/dft/dft_element.hpp index 223d8fe7..702182e2 100644 --- a/sprout/numeric/dft/dft_element.hpp +++ b/sprout/numeric/dft/dft_element.hpp @@ -3,9 +3,9 @@ #include #include -#include #include #include +#include namespace sprout { namespace detail { diff --git a/sprout/numeric/dft/fit.hpp b/sprout/numeric/dft/fit.hpp new file mode 100644 index 00000000..d58c4dfb --- /dev/null +++ b/sprout/numeric/dft/fit.hpp @@ -0,0 +1,10 @@ +#ifndef SPROUT_NUMERIC_DFT_FIT_HPP +#define SPROUT_NUMERIC_DFT_FIT_HPP + +#include +#include +#include +#include +#include + +#endif // #ifndef SPROUT_NUMERIC_DFT_FIT_HPP diff --git a/sprout/numeric/dft/fit/amplitude_spectrum.hpp b/sprout/numeric/dft/fit/amplitude_spectrum.hpp index d878e7e3..494cb63e 100644 --- a/sprout/numeric/dft/fit/amplitude_spectrum.hpp +++ b/sprout/numeric/dft/fit/amplitude_spectrum.hpp @@ -2,13 +2,15 @@ #define SPROUT_NUMERIC_DFT_FIT_AMPLITUDE_SPECTRUM_HPP #include +#include #include #include #include #include #include -#include +#include #include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include namespace sprout { namespace fit { @@ -33,8 +35,15 @@ namespace sprout { template inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type amplitude_spectrum(InputIterator first, InputIterator last, Result const& result) { + static_assert(sprout::is_forward_iterator::value, "Sorry, not implemented."); return sprout::fit::detail::amplitude_spectrum_impl(first, last, result, sprout::internal_begin_offset(result)); } + + template + inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type + amplitude_spectrum(InputIterator first, InputIterator last) { + return sprout::fit::amplitude_spectrum(first, last, sprout::pit()); + } } // namespace fit } // namespace sprout diff --git a/sprout/numeric/dft/fit/dft.hpp b/sprout/numeric/dft/fit/dft.hpp index e7174207..318d43a7 100644 --- a/sprout/numeric/dft/fit/dft.hpp +++ b/sprout/numeric/dft/fit/dft.hpp @@ -2,21 +2,22 @@ #define SPROUT_NUMERIC_DFT_FIT_DFT_HPP #include +#include #include #include #include #include #include -#include +#include #include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { namespace detail { - template + template inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type dft_impl( - InputIterator first, InputIterator last, Result const& result, + ForwardIterator first, ForwardIterator last, Result const& result, typename sprout::container_traits::difference_type offset ) { @@ -30,11 +31,17 @@ namespace sprout { // // dft // - template + template inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type - dft(InputIterator first, InputIterator last, Result const& result) { + dft(ForwardIterator first, ForwardIterator last, Result const& result) { return sprout::fit::detail::dft_impl(first, last, result, sprout::internal_begin_offset(result)); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + dft(ForwardIterator first, ForwardIterator last) { + return sprout::fit::dft(first, last, sprout::pit()); + } } // namespace fit } // namespace sprout diff --git a/sprout/numeric/dft/fit/idft.hpp b/sprout/numeric/dft/fit/idft.hpp index 70ef18e9..8ad9a61c 100644 --- a/sprout/numeric/dft/fit/idft.hpp +++ b/sprout/numeric/dft/fit/idft.hpp @@ -2,21 +2,22 @@ #define SPROUT_NUMERIC_DFT_FIT_IDFT_HPP #include +#include #include #include #include #include #include -#include +#include #include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT namespace sprout { namespace fit { namespace detail { - template + template inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type idft_impl( - InputIterator first, InputIterator last, Result const& result, + ForwardIterator first, ForwardIterator last, Result const& result, typename sprout::container_traits::difference_type offset ) { @@ -30,11 +31,17 @@ namespace sprout { // // idft // - template + template inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type - idft(InputIterator first, InputIterator last, Result const& result) { + idft(ForwardIterator first, ForwardIterator last, Result const& result) { return sprout::fit::detail::idft_impl(first, last, result, sprout::internal_begin_offset(result)); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + idft(ForwardIterator first, ForwardIterator last) { + return sprout::fit::idft(first, last, sprout::pit()); + } } // namespace fit } // namespace sprout diff --git a/sprout/numeric/dft/fit/phase_spectrum.hpp b/sprout/numeric/dft/fit/phase_spectrum.hpp index 15dc20f6..e883fc55 100644 --- a/sprout/numeric/dft/fit/phase_spectrum.hpp +++ b/sprout/numeric/dft/fit/phase_spectrum.hpp @@ -2,13 +2,15 @@ #define SPROUT_NUMERIC_DFT_FIT_PHASE_SPECTRUM_HPP #include +#include #include #include #include #include #include -#include +#include #include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include namespace sprout { namespace fit { @@ -33,8 +35,15 @@ namespace sprout { template inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type phase_spectrum(InputIterator first, InputIterator last, Result const& result) { + static_assert(sprout::is_forward_iterator::value, "Sorry, not implemented."); return sprout::fit::detail::phase_spectrum_impl(first, last, result, sprout::internal_begin_offset(result)); } + + template + inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type + phase_spectrum(InputIterator first, InputIterator last) { + return sprout::fit::phase_spectrum(first, last, sprout::pit()); + } } // namespace fit } // namespace sprout diff --git a/sprout/numeric/dft/fit/sawtooth.hpp b/sprout/numeric/dft/fit/sawtooth.hpp index 3d146529..c22bb99d 100644 --- a/sprout/numeric/dft/fit/sawtooth.hpp +++ b/sprout/numeric/dft/fit/sawtooth.hpp @@ -7,6 +7,7 @@ #include #include #include +#include namespace sprout { namespace fit { @@ -40,7 +41,18 @@ namespace sprout { typename sprout::container_traits::value_type const& phase = 0 ) { - return sprout::fit::detail::sawtooth_impl(cont, frequency, amplitude, sprout::internal_begin_offset(cont)); + return sprout::fit::detail::sawtooth_impl(cont, frequency, amplitude, phase, sprout::internal_begin_offset(cont)); + } + + template + inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type + sawtooth( + typename sprout::container_traits::value_type const& frequency = 1, + typename sprout::container_traits::value_type const& amplitude = 1, + typename sprout::container_traits::value_type const& phase = 0 + ) + { + return sprout::fit::sawtooth(sprout::pit(), frequency, amplitude, phase); } } // namespace fit } // namespace sprout diff --git a/sprout/numeric/dft/fit/sinusoid.hpp b/sprout/numeric/dft/fit/sinusoid.hpp index 5070ff36..19c5eb26 100644 --- a/sprout/numeric/dft/fit/sinusoid.hpp +++ b/sprout/numeric/dft/fit/sinusoid.hpp @@ -7,6 +7,7 @@ #include #include #include +#include namespace sprout { namespace fit { @@ -40,7 +41,18 @@ namespace sprout { typename sprout::container_traits::value_type const& phase = 0 ) { - return sprout::fit::detail::sinusoid_impl(cont, frequency, amplitude, sprout::internal_begin_offset(cont)); + return sprout::fit::detail::sinusoid_impl(cont, frequency, amplitude, phase, sprout::internal_begin_offset(cont)); + } + + template + inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type + sinusoid( + typename sprout::container_traits::value_type const& frequency = 1, + typename sprout::container_traits::value_type const& amplitude = 1, + typename sprout::container_traits::value_type const& phase = 0 + ) + { + return sprout::fit::sinusoid(sprout::pit(), frequency, amplitude, phase); } } // namespace fit } // namespace sprout diff --git a/sprout/numeric/dft/fit/spectrum.hpp b/sprout/numeric/dft/fit/spectrum.hpp index 88f3715a..4409a14b 100644 --- a/sprout/numeric/dft/fit/spectrum.hpp +++ b/sprout/numeric/dft/fit/spectrum.hpp @@ -15,6 +15,12 @@ namespace sprout { spectrum(InputIterator first, InputIterator last, Result const& result) { return sprout::fit::amplitude_spectrum(first, last, result); } + + template + inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type + spectrum(InputIterator first, InputIterator last) { + return sprout::fit::amplitude_spectrum(first, last); + } } // namespace fit } // namespace sprout diff --git a/sprout/numeric/dft/fit/square.hpp b/sprout/numeric/dft/fit/square.hpp index ec9b6499..a18da0b4 100644 --- a/sprout/numeric/dft/fit/square.hpp +++ b/sprout/numeric/dft/fit/square.hpp @@ -7,6 +7,7 @@ #include #include #include +#include namespace sprout { namespace fit { @@ -42,7 +43,19 @@ namespace sprout { typename sprout::container_traits::value_type const& duty = 0.5 ) { - return sprout::fit::detail::square_impl(cont, frequency, amplitude, duty, sprout::internal_begin_offset(cont)); + return sprout::fit::detail::square_impl(cont, frequency, amplitude, phase, duty, sprout::internal_begin_offset(cont)); + } + + template + inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type + square( + typename sprout::container_traits::value_type const& frequency = 1, + typename sprout::container_traits::value_type const& amplitude = 1, + typename sprout::container_traits::value_type const& phase = 0, + typename sprout::container_traits::value_type const& duty = 0.5 + ) + { + return sprout::fit::square(sprout::pit(), frequency, amplitude, phase, duty); } } // namespace fit } // namespace sprout diff --git a/sprout/numeric/dft/fit/triangle.hpp b/sprout/numeric/dft/fit/triangle.hpp index 39228ddf..e9e3c863 100644 --- a/sprout/numeric/dft/fit/triangle.hpp +++ b/sprout/numeric/dft/fit/triangle.hpp @@ -7,6 +7,7 @@ #include #include #include +#include namespace sprout { namespace fit { @@ -40,7 +41,18 @@ namespace sprout { typename sprout::container_traits::value_type const& phase = 0 ) { - return sprout::fit::detail::triangle_impl(cont, frequency, amplitude, sprout::internal_begin_offset(cont)); + return sprout::fit::detail::triangle_impl(cont, frequency, amplitude, phase, sprout::internal_begin_offset(cont)); + } + + template + inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type + triangle( + typename sprout::container_traits::value_type const& frequency = 1, + typename sprout::container_traits::value_type const& amplitude = 1, + typename sprout::container_traits::value_type const& phase = 0 + ) + { + return sprout::fit::triangle(sprout::pit(), frequency, amplitude, phase); } } // namespace fit } // namespace sprout diff --git a/sprout/numeric/dft/fixed.hpp b/sprout/numeric/dft/fixed.hpp new file mode 100644 index 00000000..ab97255c --- /dev/null +++ b/sprout/numeric/dft/fixed.hpp @@ -0,0 +1,10 @@ +#ifndef SPROUT_NUMERIC_DFT_FIXED_HPP +#define SPROUT_NUMERIC_DFT_FIXED_HPP + +#include +#include +#include +#include +#include + +#endif // #ifndef SPROUT_NUMERIC_DFT_FIXED_HPP diff --git a/sprout/numeric/dft/fixed/amplitude_spectrum.hpp b/sprout/numeric/dft/fixed/amplitude_spectrum.hpp index 9117d3d2..9ad282dc 100644 --- a/sprout/numeric/dft/fixed/amplitude_spectrum.hpp +++ b/sprout/numeric/dft/fixed/amplitude_spectrum.hpp @@ -1,21 +1,27 @@ #ifndef SPROUT_NUMERIC_DFT_FIXED_AMPLITUDE_SPECTRUM_HPP #define SPROUT_NUMERIC_DFT_FIXED_AMPLITUDE_SPECTRUM_HPP +#include +#include #include #include #include #include #include +#include #include +#include +#include #include +#include namespace sprout { namespace fixed { namespace detail { - template + template inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type - amplitude_spectrum_impl( - InputIterator first, InputIterator last, Result const& result, + amplitude_spectrum_impl_ra( + RandomAccessIterator first, RandomAccessIterator last, Result const& result, sprout::index_tuple, typename sprout::container_traits::difference_type offset, typename sprout::container_traits::size_type size, @@ -23,27 +29,93 @@ namespace sprout { ) { return sprout::remake( - result, - size, - (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size - ? sprout::amplitude_spectrum_value(*sprout::next(first, Indexes)) + result, size, + (Indexes >= offset && sprout::math::less(Indexes, offset + size) && sprout::math::less(Indexes, offset + input_size) + ? sprout::amplitude_spectrum_value(first[Indexes]) : *sprout::next(sprout::internal_begin(result), Indexes) )... ); } - template + template inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type - amplitude_spectrum(InputIterator first, InputIterator last, Result const& result) { - return sprout::fixed::detail::amplitude_spectrum_impl( - first, - last, - result, + amplitude_spectrum( + RandomAccessIterator first, RandomAccessIterator last, Result const& result, + std::random_access_iterator_tag* + ) + { + return sprout::fixed::detail::amplitude_spectrum_impl_ra( + first, last, result, sprout::index_range<0, sprout::container_traits::static_size>::make(), sprout::internal_begin_offset(result), sprout::size(result), sprout::distance(first, last) ); } + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::container_traits::static_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type + amplitude_spectrum_impl( + ForwardIterator first, ForwardIterator last, Result const& result, + typename sprout::container_traits::size_type size, + Args const&... args + ) + { + return sprout::remake(result, sprout::size(result), args...); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::container_traits::static_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type + amplitude_spectrum_impl( + ForwardIterator first, ForwardIterator last, Result const& result, + typename sprout::container_traits::size_type size, + Args const&... args + ) + { + return first != last && sizeof...(Args) < size + ? sprout::fixed::detail::amplitude_spectrum_impl( + sprout::next(first), last, result, size, + args..., sprout::amplitude_spectrum_value(*first) + ) + : sprout::detail::container_complate(result, args...) + ; + } + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + amplitude_spectrum( + ForwardIterator first, ForwardIterator last, Result const& result, + void* + ) + { + return sprout::fixed::detail::amplitude_spectrum_impl(first, last, result, sprout::size(result)); + } + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::is_fixed_container::value, + typename sprout::fixed::result_of::algorithm::type + >::type + amplitude_spectrum(InputIterator first, InputIterator last, Result const& result) { + typedef typename std::iterator_traits::iterator_category* category; + return sprout::fixed::detail::amplitude_spectrum(first, last, result, category()); + } + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::is_fixed_container::value, + typename sprout::fixed::result_of::algorithm::type + >::type + amplitude_spectrum(InputIterator first, InputIterator last, Result const& result) { + return sprout::remake( + result, sprout::size(result), + sprout::make_amplitude_spectrum_iterator(first), + sprout::make_amplitude_spectrum_iterator(last) + ); + } } // namespace detail // // amplitude_spectrum @@ -53,6 +125,12 @@ namespace sprout { amplitude_spectrum(InputIterator first, InputIterator last, Result const& result) { return sprout::fixed::detail::amplitude_spectrum(first, last, result); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + amplitude_spectrum(ForwardIterator first, ForwardIterator last) { + return sprout::fixed::amplitude_spectrum(first, last, sprout::pit()); + } } // namespace fixed using sprout::fixed::amplitude_spectrum; diff --git a/sprout/numeric/dft/fixed/dft.hpp b/sprout/numeric/dft/fixed/dft.hpp index 7b013b10..e84d10ed 100644 --- a/sprout/numeric/dft/fixed/dft.hpp +++ b/sprout/numeric/dft/fixed/dft.hpp @@ -1,21 +1,27 @@ #ifndef SPROUT_NUMERIC_DFT_FIXED_DFT_HPP #define SPROUT_NUMERIC_DFT_FIXED_DFT_HPP +#include +#include #include #include #include #include #include +#include #include +#include +#include #include +#include namespace sprout { namespace fixed { namespace detail { - template + template inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type - dft_impl( - InputIterator first, InputIterator last, Result const& result, + dft_impl_ra( + RandomAccessIterator first, RandomAccessIterator last, Result const& result, sprout::index_tuple, typename sprout::container_traits::difference_type offset, typename sprout::container_traits::size_type size, @@ -23,36 +29,110 @@ namespace sprout { ) { return sprout::remake( - result, - size, - (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size + result, size, + (Indexes >= offset && sprout::math::less(Indexes, offset + size) && sprout::math::less(Indexes, offset + input_size) ? sprout::detail::dft_element_impl(first, last, Indexes - offset, input_size) : *sprout::next(sprout::internal_begin(result), Indexes) )... ); } - template + template inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type - dft(InputIterator first, InputIterator last, Result const& result) { - return sprout::fixed::detail::dft_impl( - first, - last, - result, + dft( + RandomAccessIterator first, RandomAccessIterator last, Result const& result, + std::random_access_iterator_tag* + ) + { + return sprout::fixed::detail::dft_impl_ra( + first, last, result, sprout::index_range<0, sprout::container_traits::static_size>::make(), sprout::internal_begin_offset(result), sprout::size(result), sprout::distance(first, last) ); } + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::container_traits::static_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type + dft_impl( + ForwardIterator first, ForwardIterator last, Result const& result, + typename sprout::container_traits::size_type size, + ForwardIterator first_, typename sprout::container_traits::difference_type i, + Args const&... args + ) + { + return sprout::remake(result, sprout::size(result), args...); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::container_traits::static_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type + dft_impl( + ForwardIterator first, ForwardIterator last, Result const& result, + typename sprout::container_traits::size_type size, + ForwardIterator first_, typename sprout::container_traits::difference_type i, + Args const&... args + ) + { + return first != last && sizeof...(Args) < size + ? sprout::fixed::detail::dft_impl( + sprout::next(first), last, result, size, first_, i + 1, + args..., sprout::detail::dft_element_impl(first_, last, i, size) + ) + : sprout::detail::container_complate(result, args...) + ; + } + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + dft( + ForwardIterator first, ForwardIterator last, Result const& result, + void* + ) + { + return sprout::fixed::detail::dft_impl(first, last, result, sprout::size(result), first, 0); + } + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::is_fixed_container::value, + typename sprout::fixed::result_of::algorithm::type + >::type + dft(ForwardIterator first, ForwardIterator last, Result const& result) { + typedef typename std::iterator_traits::iterator_category* category; + return sprout::fixed::detail::dft(first, last, result, category()); + } + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::is_fixed_container::value, + typename sprout::fixed::result_of::algorithm::type + >::type + dft(ForwardIterator first, ForwardIterator last, Result const& result) { + return sprout::remake( + result, sprout::size(result), + sprout::make_dft_iterator(first, last), + sprout::make_dft_iterator(first, last, sprout::distance(first, last)) + ); + } } // namespace detail // // dft // - template + template inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type - dft(InputIterator first, InputIterator last, Result const& result) { + dft(ForwardIterator first, ForwardIterator last, Result const& result) { return sprout::fixed::detail::dft(first, last, result); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + dft(ForwardIterator first, ForwardIterator last) { + return sprout::fixed::dft(first, last, sprout::pit()); + } } // namespace fixed using sprout::fixed::dft; diff --git a/sprout/numeric/dft/fixed/idft.hpp b/sprout/numeric/dft/fixed/idft.hpp index 6c7f0501..2c687886 100644 --- a/sprout/numeric/dft/fixed/idft.hpp +++ b/sprout/numeric/dft/fixed/idft.hpp @@ -1,21 +1,27 @@ #ifndef SPROUT_NUMERIC_DFT_FIXED_IDFT_HPP #define SPROUT_NUMERIC_DFT_FIXED_IDFT_HPP +#include +#include #include #include #include #include #include +#include #include +#include +#include #include +#include namespace sprout { namespace fixed { namespace detail { - template + template inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type - idft_impl( - InputIterator first, InputIterator last, Result const& result, + idft_impl_ra( + RandomAccessIterator first, RandomAccessIterator last, Result const& result, sprout::index_tuple, typename sprout::container_traits::difference_type offset, typename sprout::container_traits::size_type size, @@ -23,36 +29,110 @@ namespace sprout { ) { return sprout::remake( - result, - size, - (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size + result, size, + (Indexes >= offset && sprout::math::less(Indexes, offset + size) && sprout::math::less(Indexes, offset + input_size) ? sprout::detail::idft_element_impl(first, last, Indexes - offset, input_size) : *sprout::next(sprout::internal_begin(result), Indexes) )... ); } - template + template inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type - idft(InputIterator first, InputIterator last, Result const& result) { - return sprout::fixed::detail::idft_impl( - first, - last, - result, + idft( + RandomAccessIterator first, RandomAccessIterator last, Result const& result, + std::random_access_iterator_tag* + ) + { + return sprout::fixed::detail::idft_impl_ra( + first, last, result, sprout::index_range<0, sprout::container_traits::static_size>::make(), sprout::internal_begin_offset(result), sprout::size(result), sprout::distance(first, last) ); } + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::container_traits::static_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type + idft_impl( + ForwardIterator first, ForwardIterator last, Result const& result, + typename sprout::container_traits::size_type size, + ForwardIterator first_, typename sprout::container_traits::difference_type i, + Args const&... args + ) + { + return sprout::remake(result, sprout::size(result), args...); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::container_traits::static_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type + idft_impl( + ForwardIterator first, ForwardIterator last, Result const& result, + typename sprout::container_traits::size_type size, + ForwardIterator first_, typename sprout::container_traits::difference_type i, + Args const&... args + ) + { + return first != last && sizeof...(Args) < size + ? sprout::fixed::detail::idft_impl( + sprout::next(first), last, result, size, first_, i + 1, + args..., sprout::detail::idft_element_impl(first_, last, i, size) + ) + : sprout::detail::container_complate(result, args...) + ; + } + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + idft( + ForwardIterator first, ForwardIterator last, Result const& result, + void* + ) + { + return sprout::fixed::detail::idft_impl(first, last, result, sprout::size(result), first, 0); + } + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::is_fixed_container::value, + typename sprout::fixed::result_of::algorithm::type + >::type + idft(ForwardIterator first, ForwardIterator last, Result const& result) { + typedef typename std::iterator_traits::iterator_category* category; + return sprout::fixed::detail::idft(first, last, result, category()); + } + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::is_fixed_container::value, + typename sprout::fixed::result_of::algorithm::type + >::type + idft(ForwardIterator first, ForwardIterator last, Result const& result) { + return sprout::remake( + result, sprout::size(result), + sprout::make_idft_iterator(first, last), + sprout::make_idft_iterator(first, last, sprout::distance(first, last)) + ); + } } // namespace detail // // idft // - template + template inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type - idft(InputIterator first, InputIterator last, Result const& result) { + idft(ForwardIterator first, ForwardIterator last, Result const& result) { return sprout::fixed::detail::idft(first, last, result); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + idft(ForwardIterator first, ForwardIterator last) { + return sprout::fixed::idft(first, last, sprout::pit()); + } } // namespace fixed using sprout::fixed::idft; diff --git a/sprout/numeric/dft/fixed/phase_spectrum.hpp b/sprout/numeric/dft/fixed/phase_spectrum.hpp index 08a49511..ad0fdc73 100644 --- a/sprout/numeric/dft/fixed/phase_spectrum.hpp +++ b/sprout/numeric/dft/fixed/phase_spectrum.hpp @@ -1,42 +1,49 @@ #ifndef SPROUT_NUMERIC_DFT_FIXED_PHASE_SPECTRUM_HPP #define SPROUT_NUMERIC_DFT_FIXED_PHASE_SPECTRUM_HPP +#include +#include #include #include #include #include #include +#include #include +#include +#include #include +#include namespace sprout { namespace fixed { namespace detail { - template + template inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type - phase_spectrum_impl( - InputIterator first, InputIterator last, Result const& result, + phase_spectrum_impl_ra( + RandomAccessIterator first, RandomAccessIterator last, Result const& result, sprout::index_tuple, typename sprout::container_traits::difference_type offset, typename sprout::container_traits::size_type size, typename sprout::container_traits::size_type input_size ) { - using sprout::real; - using sprout::imag; return sprout::remake( - result, - size, - (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size - ? sprout::phase_spectrum_value(*sprout::next(first, Indexes)) + result, size, + (Indexes >= offset && sprout::math::less(Indexes, offset + size) && sprout::math::less(Indexes, offset + input_size) + ? sprout::phase_spectrum_value(first[Indexes]) : *sprout::next(sprout::internal_begin(result), Indexes) )... ); } - template + template inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type - phase_spectrum(InputIterator first, InputIterator last, Result const& result) { - return sprout::fixed::detail::phase_spectrum_impl( + phase_spectrum( + RandomAccessIterator first, RandomAccessIterator last, Result const& result, + std::random_access_iterator_tag* + ) + { + return sprout::fixed::detail::phase_spectrum_impl_ra( first, last, result, sprout::index_range<0, sprout::container_traits::static_size>::make(), sprout::internal_begin_offset(result), @@ -44,6 +51,71 @@ namespace sprout { sprout::distance(first, last) ); } + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::container_traits::static_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type + phase_spectrum_impl( + ForwardIterator first, ForwardIterator last, Result const& result, + typename sprout::container_traits::size_type size, + Args const&... args + ) + { + return sprout::remake(result, sprout::size(result), args...); + } + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::container_traits::static_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type + phase_spectrum_impl( + ForwardIterator first, ForwardIterator last, Result const& result, + typename sprout::container_traits::size_type size, + Args const&... args + ) + { + return first != last && sizeof...(Args) < size + ? sprout::fixed::detail::phase_spectrum_impl( + sprout::next(first), last, result, size, + args..., sprout::phase_spectrum_value(*first) + ) + : sprout::detail::container_complate(result, args...) + ; + } + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + phase_spectrum( + ForwardIterator first, ForwardIterator last, Result const& result, + void* + ) + { + return sprout::fixed::detail::phase_spectrum_impl(first, last, result, sprout::size(result)); + } + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + sprout::is_fixed_container::value, + typename sprout::fixed::result_of::algorithm::type + >::type + phase_spectrum(InputIterator first, InputIterator last, Result const& result) { + typedef typename std::iterator_traits::iterator_category* category; + return sprout::fixed::detail::phase_spectrum(first, last, result, category()); + } + + template + inline SPROUT_CONSTEXPR typename std::enable_if< + !sprout::is_fixed_container::value, + typename sprout::fixed::result_of::algorithm::type + >::type + phase_spectrum(InputIterator first, InputIterator last, Result const& result) { + return sprout::remake( + result, sprout::size(result), + sprout::make_phase_spectrum_iterator(first), + sprout::make_phase_spectrum_iterator(last) + ); + } } // namespace detail // // phase_spectrum @@ -53,6 +125,12 @@ namespace sprout { phase_spectrum(InputIterator first, InputIterator last, Result const& result) { return sprout::fixed::detail::phase_spectrum(first, last, result); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + phase_spectrum(ForwardIterator first, ForwardIterator last) { + return sprout::fixed::phase_spectrum(first, last, sprout::pit()); + } } // namespace fixed using sprout::fixed::phase_spectrum; diff --git a/sprout/numeric/dft/fixed/sawtooth.hpp b/sprout/numeric/dft/fixed/sawtooth.hpp index ebbfe8de..b1eb153c 100644 --- a/sprout/numeric/dft/fixed/sawtooth.hpp +++ b/sprout/numeric/dft/fixed/sawtooth.hpp @@ -7,7 +7,10 @@ #include #include #include +#include +#include #include +#include namespace sprout { namespace fixed { @@ -33,8 +36,7 @@ namespace sprout { { typedef typename sprout::container_traits::value_type value_type; return sprout::remake( - cont, - size, + cont, size, (Indexes >= offset && Indexes < offset + size ? amplitude * sprout::fixed::detail::sawtooth_value(frequency * value_type(Indexes) + phase) : *sprout::next(sprout::internal_begin(cont), Indexes) @@ -76,6 +78,17 @@ namespace sprout { { return sprout::fixed::detail::sawtooth(cont, frequency, amplitude, phase); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + sawtooth( + typename sprout::container_traits::value_type const& frequency = 1, + typename sprout::container_traits::value_type const& amplitude = 1, + typename sprout::container_traits::value_type const& phase = 0 + ) + { + return sprout::fixed::sawtooth(sprout::pit(), frequency, amplitude, phase); + } } // namespace fixed using sprout::fixed::sawtooth; diff --git a/sprout/numeric/dft/fixed/sinusoid.hpp b/sprout/numeric/dft/fixed/sinusoid.hpp index a5585a82..3d4c09df 100644 --- a/sprout/numeric/dft/fixed/sinusoid.hpp +++ b/sprout/numeric/dft/fixed/sinusoid.hpp @@ -7,8 +7,11 @@ #include #include #include +#include +#include #include #include +#include namespace sprout { namespace fixed { @@ -28,8 +31,7 @@ namespace sprout { typedef typename sprout::container_traits::value_type value_type; using sprout::sin; return sprout::remake( - cont, - size, + cont, size, (Indexes >= offset && Indexes < offset + size ? amplitude * sin(d * value_type(Indexes) + phase) : *sprout::next(sprout::internal_begin(cont), Indexes) @@ -71,6 +73,17 @@ namespace sprout { { return sprout::fixed::detail::sinusoid(cont, frequency, amplitude, phase); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + sinusoid( + typename sprout::container_traits::value_type const& frequency = 1, + typename sprout::container_traits::value_type const& amplitude = 1, + typename sprout::container_traits::value_type const& phase = 0 + ) + { + return sprout::fixed::sinusoid(sprout::pit(), frequency, amplitude, phase); + } } // namespace fixed using sprout::fixed::sinusoid; diff --git a/sprout/numeric/dft/fixed/spectrum.hpp b/sprout/numeric/dft/fixed/spectrum.hpp index 33755dec..c32d8bb6 100644 --- a/sprout/numeric/dft/fixed/spectrum.hpp +++ b/sprout/numeric/dft/fixed/spectrum.hpp @@ -15,6 +15,12 @@ namespace sprout { spectrum(InputIterator first, InputIterator last, Result const& result) { return sprout::fixed::amplitude_spectrum(first, last, result); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + spectrum(InputIterator first, InputIterator last) { + return sprout::fixed::amplitude_spectrum(first, last); + } } // namespace fixed using sprout::fixed::spectrum; diff --git a/sprout/numeric/dft/fixed/square.hpp b/sprout/numeric/dft/fixed/square.hpp index 94f9ff84..f6960b65 100644 --- a/sprout/numeric/dft/fixed/square.hpp +++ b/sprout/numeric/dft/fixed/square.hpp @@ -7,7 +7,10 @@ #include #include #include +#include +#include #include +#include namespace sprout { namespace fixed { @@ -33,8 +36,7 @@ namespace sprout { { typedef typename sprout::container_traits::value_type value_type; return sprout::remake( - cont, - size, + cont, size, (Indexes >= offset && Indexes < offset + size ? amplitude * sprout::fixed::detail::square_value(frequency * value_type(Indexes) + phase, duty) : *sprout::next(sprout::internal_begin(cont), Indexes) @@ -79,6 +81,18 @@ namespace sprout { { return sprout::fixed::detail::square(cont, frequency, amplitude, phase, duty); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + square( + typename sprout::container_traits::value_type const& frequency = 1, + typename sprout::container_traits::value_type const& amplitude = 1, + typename sprout::container_traits::value_type const& phase = 0, + typename sprout::container_traits::value_type const& duty = 0.5 + ) + { + return sprout::fixed::square(sprout::pit(), frequency, amplitude, phase, duty); + } } // namespace fixed using sprout::fixed::square; diff --git a/sprout/numeric/dft/fixed/triangle.hpp b/sprout/numeric/dft/fixed/triangle.hpp index 55e782f7..767ba216 100644 --- a/sprout/numeric/dft/fixed/triangle.hpp +++ b/sprout/numeric/dft/fixed/triangle.hpp @@ -7,9 +7,12 @@ #include #include #include +#include +#include #include #include #include +#include namespace sprout { namespace fixed { @@ -36,8 +39,7 @@ namespace sprout { { typedef typename sprout::container_traits::value_type value_type; return sprout::remake( - cont, - size, + cont, size, (Indexes >= offset && Indexes < offset + size ? amplitude * sprout::fixed::detail::triangle_value(frequency * value_type(Indexes) + phase) : *sprout::next(sprout::internal_begin(cont), Indexes) @@ -79,6 +81,17 @@ namespace sprout { { return sprout::fixed::detail::triangle(cont, frequency, amplitude, phase); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + triangle( + typename sprout::container_traits::value_type const& frequency = 1, + typename sprout::container_traits::value_type const& amplitude = 1, + typename sprout::container_traits::value_type const& phase = 0 + ) + { + return sprout::fixed::triangle(sprout::pit(), frequency, amplitude, phase); + } } // namespace fixed using sprout::fixed::triangle; diff --git a/sprout/numeric/dft/idft_element.hpp b/sprout/numeric/dft/idft_element.hpp index 0543574a..9972a2d9 100644 --- a/sprout/numeric/dft/idft_element.hpp +++ b/sprout/numeric/dft/idft_element.hpp @@ -3,9 +3,9 @@ #include #include -#include #include #include +#include namespace sprout { namespace detail { diff --git a/sprout/numeric/dft/modifying.hpp b/sprout/numeric/dft/modifying.hpp new file mode 100644 index 00000000..180770ea --- /dev/null +++ b/sprout/numeric/dft/modifying.hpp @@ -0,0 +1,8 @@ +#ifndef SPROUT_NUMERIC_DFT_MODIFYIING_HPP +#define SPROUT_NUMERIC_DFT_MODIFYIING_HPP + +#include +#include +#include + +#endif // #ifndef SPROUT_NUMERIC_DFT_MODIFYIING_HPP diff --git a/sprout/numeric/dft/non_modifying.hpp b/sprout/numeric/dft/non_modifying.hpp new file mode 100644 index 00000000..9c95b2db --- /dev/null +++ b/sprout/numeric/dft/non_modifying.hpp @@ -0,0 +1,10 @@ +#ifndef SPROUT_NUMERIC_DFT_NON_MODIFYIING_HPP +#define SPROUT_NUMERIC_DFT_NON_MODIFYIING_HPP + +#include +#include +#include +#include +#include + +#endif // #ifndef SPROUT_NUMERIC_DFT_NON_MODIFYIING_HPP diff --git a/sprout/numeric/fit/adjacent_difference.hpp b/sprout/numeric/fit/adjacent_difference.hpp index d31a5f6b..d8e02667 100644 --- a/sprout/numeric/fit/adjacent_difference.hpp +++ b/sprout/numeric/fit/adjacent_difference.hpp @@ -2,13 +2,14 @@ #define SPROUT_NUMERIC_FIT_ADJACENT_DIFFERENCE_HPP #include +#include #include #include #include #include #include -#include #include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include namespace sprout { namespace fit { @@ -33,6 +34,7 @@ namespace sprout { template inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type adjacent_difference(InputIterator first, InputIterator last, Result const& result) { + static_assert(sprout::is_forward_iterator::value, "Sorry, not implemented."); return sprout::fit::detail::adjacent_difference_impl(first, last, result, sprout::internal_begin_offset(result)); } @@ -57,6 +59,7 @@ namespace sprout { template inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type adjacent_difference(InputIterator first, InputIterator last, Result const& result, BinaryOperation binary_op) { + static_assert(sprout::is_forward_iterator::value, "Sorry, not implemented."); return sprout::fit::detail::adjacent_difference_impl(first, last, result, binary_op, sprout::internal_begin_offset(result)); } } // namespace fit diff --git a/sprout/numeric/fit/partial_sum.hpp b/sprout/numeric/fit/partial_sum.hpp index 033d24ac..64df4b3a 100644 --- a/sprout/numeric/fit/partial_sum.hpp +++ b/sprout/numeric/fit/partial_sum.hpp @@ -2,13 +2,14 @@ #define SPROUT_NUMERIC_FIT_PARTIAL_SUM_HPP #include +#include #include #include #include #include #include -#include #include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT +#include namespace sprout { namespace fit { @@ -33,6 +34,7 @@ namespace sprout { template inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type partial_sum(InputIterator first, InputIterator last, Result const& result) { + static_assert(sprout::is_forward_iterator::value, "Sorry, not implemented."); return sprout::fit::detail::partial_sum_impl(first, last, result, sprout::internal_begin_offset(result)); } @@ -57,6 +59,7 @@ namespace sprout { template inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type partial_sum(InputIterator first, InputIterator last, Result const& result, BinaryOperation binary_op) { + static_assert(sprout::is_forward_iterator::value, "Sorry, not implemented."); return sprout::fit::detail::partial_sum_impl(first, last, result, binary_op, sprout::internal_begin_offset(result)); } } // namespace fit diff --git a/sprout/range/numeric/dft.hpp b/sprout/range/numeric/dft.hpp index 0c05ae47..1ded06ba 100644 --- a/sprout/range/numeric/dft.hpp +++ b/sprout/range/numeric/dft.hpp @@ -2,10 +2,7 @@ #define SPROUT_RANGE_NUMERIC_DFT_HPP #include -#include -#include -#include -#include -#include +#include +#include #endif // #ifndef SPROUT_RANGE_NUMERIC_DFT_HPP diff --git a/sprout/range/numeric/dft/fit.hpp b/sprout/range/numeric/dft/fit.hpp new file mode 100644 index 00000000..a6efc120 --- /dev/null +++ b/sprout/range/numeric/dft/fit.hpp @@ -0,0 +1,9 @@ +#ifndef SPROUT_RANGE_NUMERIC_DFT_FIT_HPP +#define SPROUT_RANGE_NUMERIC_DFT_FIT_HPP + +#include +#include +#include +#include + +#endif // #ifndef SPROUT_RANGE_NUMERIC_DFT_FIT_HPP diff --git a/sprout/range/numeric/dft/fit/amplitude_spectrum.hpp b/sprout/range/numeric/dft/fit/amplitude_spectrum.hpp index ec69f189..b08e38f1 100644 --- a/sprout/range/numeric/dft/fit/amplitude_spectrum.hpp +++ b/sprout/range/numeric/dft/fit/amplitude_spectrum.hpp @@ -18,6 +18,12 @@ namespace sprout { amplitude_spectrum(Input const& input, Result const& result) { return sprout::fit::amplitude_spectrum(sprout::begin(input), sprout::end(input), result); } + + template + inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type + amplitude_spectrum(Input const& input) { + return sprout::fit::amplitude_spectrum(sprout::begin(input), sprout::end(input)); + } } // namespace fit } // namespace range } // namespace sprout diff --git a/sprout/range/numeric/dft/fit/dft.hpp b/sprout/range/numeric/dft/fit/dft.hpp index c64a85ae..b1c5b5e6 100644 --- a/sprout/range/numeric/dft/fit/dft.hpp +++ b/sprout/range/numeric/dft/fit/dft.hpp @@ -18,6 +18,12 @@ namespace sprout { dft(Input const& input, Result const& result) { return sprout::fit::dft(sprout::begin(input), sprout::end(input), result); } + + template + inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type + dft(Input const& input) { + return sprout::fit::dft(sprout::begin(input), sprout::end(input)); + } } // namespace fit } // namespace range } // namespace sprout diff --git a/sprout/range/numeric/dft/fit/idft.hpp b/sprout/range/numeric/dft/fit/idft.hpp index 84a86388..32ad8431 100644 --- a/sprout/range/numeric/dft/fit/idft.hpp +++ b/sprout/range/numeric/dft/fit/idft.hpp @@ -18,6 +18,12 @@ namespace sprout { idft(Input const& input, Result const& result) { return sprout::fit::idft(sprout::begin(input), sprout::end(input), result); } + + template + inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type + idft(Input const& input) { + return sprout::fit::idft(sprout::begin(input), sprout::end(input)); + } } // namespace fit } // namespace range } // namespace sprout diff --git a/sprout/range/numeric/dft/fit/phase_spectrum.hpp b/sprout/range/numeric/dft/fit/phase_spectrum.hpp index 5661be5c..d633b2af 100644 --- a/sprout/range/numeric/dft/fit/phase_spectrum.hpp +++ b/sprout/range/numeric/dft/fit/phase_spectrum.hpp @@ -18,6 +18,12 @@ namespace sprout { phase_spectrum(Input const& input, Result const& result) { return sprout::fit::phase_spectrum(sprout::begin(input), sprout::end(input), result); } + + template + inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type + phase_spectrum(Input const& input) { + return sprout::fit::phase_spectrum(sprout::begin(input), sprout::end(input)); + } } // namespace fit } // namespace range } // namespace sprout diff --git a/sprout/range/numeric/dft/fit/spectrum.hpp b/sprout/range/numeric/dft/fit/spectrum.hpp index 1bb12833..f5c9e4f9 100644 --- a/sprout/range/numeric/dft/fit/spectrum.hpp +++ b/sprout/range/numeric/dft/fit/spectrum.hpp @@ -18,6 +18,12 @@ namespace sprout { spectrum(Input const& input, Result const& result) { return sprout::fit::spectrum(sprout::begin(input), sprout::end(input), result); } + + template + inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type + spectrum(Input const& input) { + return sprout::fit::spectrum(sprout::begin(input), sprout::end(input)); + } } // namespace fit } // namespace range } // namespace sprout diff --git a/sprout/range/numeric/dft/fixed.hpp b/sprout/range/numeric/dft/fixed.hpp new file mode 100644 index 00000000..76dc46b1 --- /dev/null +++ b/sprout/range/numeric/dft/fixed.hpp @@ -0,0 +1,9 @@ +#ifndef SPROUT_RANGE_NUMERIC_DFT_FIXED_HPP +#define SPROUT_RANGE_NUMERIC_DFT_FIXED_HPP + +#include +#include +#include +#include + +#endif // #ifndef SPROUT_RANGE_NUMERIC_DFT_FIXED_HPP diff --git a/sprout/range/numeric/dft/fixed/amplitude_spectrum.hpp b/sprout/range/numeric/dft/fixed/amplitude_spectrum.hpp index 8e500c42..702e6c93 100644 --- a/sprout/range/numeric/dft/fixed/amplitude_spectrum.hpp +++ b/sprout/range/numeric/dft/fixed/amplitude_spectrum.hpp @@ -18,6 +18,12 @@ namespace sprout { amplitude_spectrum(Input const& input, Result const& result) { return sprout::fixed::amplitude_spectrum(sprout::begin(input), sprout::end(input), result); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + amplitude_spectrum(Input const& input) { + return sprout::fixed::amplitude_spectrum(sprout::begin(input), sprout::end(input)); + } } // namespace fixed using sprout::range::fixed::amplitude_spectrum; diff --git a/sprout/range/numeric/dft/fixed/dft.hpp b/sprout/range/numeric/dft/fixed/dft.hpp index ebcf67ae..da78cee1 100644 --- a/sprout/range/numeric/dft/fixed/dft.hpp +++ b/sprout/range/numeric/dft/fixed/dft.hpp @@ -18,6 +18,12 @@ namespace sprout { dft(Input const& input, Result const& result) { return sprout::fixed::dft(sprout::begin(input), sprout::end(input), result); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + dft(Input const& input) { + return sprout::fixed::dft(sprout::begin(input), sprout::end(input)); + } } // namespace fixed using sprout::range::fixed::dft; diff --git a/sprout/range/numeric/dft/fixed/idft.hpp b/sprout/range/numeric/dft/fixed/idft.hpp index 3b7620c1..52fce1ec 100644 --- a/sprout/range/numeric/dft/fixed/idft.hpp +++ b/sprout/range/numeric/dft/fixed/idft.hpp @@ -18,6 +18,12 @@ namespace sprout { idft(Input const& input, Result const& result) { return sprout::fixed::idft(sprout::begin(input), sprout::end(input), result); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + idft(Input const& input) { + return sprout::fixed::idft(sprout::begin(input), sprout::end(input)); + } } // namespace fixed using sprout::range::fixed::idft; diff --git a/sprout/range/numeric/dft/fixed/phase_spectrum.hpp b/sprout/range/numeric/dft/fixed/phase_spectrum.hpp index 4b3bb15f..28556e2e 100644 --- a/sprout/range/numeric/dft/fixed/phase_spectrum.hpp +++ b/sprout/range/numeric/dft/fixed/phase_spectrum.hpp @@ -18,6 +18,12 @@ namespace sprout { phase_spectrum(Input const& input, Result const& result) { return sprout::fixed::phase_spectrum(sprout::begin(input), sprout::end(input), result); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + phase_spectrum(Input const& input) { + return sprout::fixed::phase_spectrum(sprout::begin(input), sprout::end(input)); + } } // namespace fixed using sprout::range::fixed::phase_spectrum; diff --git a/sprout/range/numeric/dft/fixed/spectrum.hpp b/sprout/range/numeric/dft/fixed/spectrum.hpp index f3200c27..df1db2d3 100644 --- a/sprout/range/numeric/dft/fixed/spectrum.hpp +++ b/sprout/range/numeric/dft/fixed/spectrum.hpp @@ -18,6 +18,12 @@ namespace sprout { spectrum(Input const& input, Result const& result) { return sprout::fixed::spectrum(sprout::begin(input), sprout::end(input), result); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + spectrum(Input const& input) { + return sprout::fixed::spectrum(sprout::begin(input), sprout::end(input)); + } } // namespace fixed using sprout::range::fixed::spectrum; diff --git a/sprout/range/numeric/dft/modifying.hpp b/sprout/range/numeric/dft/modifying.hpp new file mode 100644 index 00000000..7f609630 --- /dev/null +++ b/sprout/range/numeric/dft/modifying.hpp @@ -0,0 +1,8 @@ +#ifndef SPROUT_RANGE_NUMERIC_DFT_MODIFYIING_HPP +#define SPROUT_RANGE_NUMERIC_DFT_MODIFYIING_HPP + +#include +#include +#include + +#endif // #ifndef SPROUT_RANGE_NUMERIC_DFT_MODIFYIING_HPP diff --git a/sprout/range/numeric/dft/non_modifying.hpp b/sprout/range/numeric/dft/non_modifying.hpp new file mode 100644 index 00000000..48755f86 --- /dev/null +++ b/sprout/range/numeric/dft/non_modifying.hpp @@ -0,0 +1,8 @@ +#ifndef SPROUT_RANGE_NUMERIC_DFT_NON_MODIFYIING_HPP +#define SPROUT_RANGE_NUMERIC_DFT_NON_MODIFYIING_HPP + +#include +#include +#include + +#endif // #ifndef SPROUT_RANGE_NUMERIC_DFT_NON_MODIFYIING_HPP diff --git a/sprout/range/numeric/fit/adjacent_difference.hpp b/sprout/range/numeric/fit/adjacent_difference.hpp index 5b51f8f8..6715c9a4 100644 --- a/sprout/range/numeric/fit/adjacent_difference.hpp +++ b/sprout/range/numeric/fit/adjacent_difference.hpp @@ -23,6 +23,17 @@ namespace sprout { adjacent_difference(Input const& input, Result const& result, BinaryOperation binary_op) { return sprout::fit::adjacent_difference(sprout::begin(input), sprout::end(input), result, binary_op); } + + template + inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type + adjacent_difference(Input const& input) { + return sprout::fit::adjacent_difference(sprout::begin(input), sprout::end(input)); + } + template + inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type + adjacent_difference(Input const& input, BinaryOperation binary_op) { + return sprout::fit::adjacent_difference(sprout::begin(input), sprout::end(input), binary_op); + } } // namespace fit } // namespace range } // namespace sprout diff --git a/sprout/range/numeric/fit/partial_sum.hpp b/sprout/range/numeric/fit/partial_sum.hpp index 608aec9d..8b2778dd 100644 --- a/sprout/range/numeric/fit/partial_sum.hpp +++ b/sprout/range/numeric/fit/partial_sum.hpp @@ -23,6 +23,17 @@ namespace sprout { partial_sum(Input const& input, Result const& result, BinaryOperation binary_op) { return sprout::fit::partial_sum(sprout::begin(input), sprout::end(input), result, binary_op); } + + template + inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type + partial_sum(Input const& input) { + return sprout::fit::partial_sum(sprout::begin(input), sprout::end(input)); + } + template + inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm::type + partial_sum(Input const& input, BinaryOperation binary_op) { + return sprout::fit::partial_sum(sprout::begin(input), sprout::end(input), binary_op); + } } // namespace fit } // namespace range } // namespace sprout diff --git a/sprout/range/numeric/fixed/adjacent_difference.hpp b/sprout/range/numeric/fixed/adjacent_difference.hpp index 3e978dd0..7d7d6508 100644 --- a/sprout/range/numeric/fixed/adjacent_difference.hpp +++ b/sprout/range/numeric/fixed/adjacent_difference.hpp @@ -23,6 +23,17 @@ namespace sprout { adjacent_difference(Input const& input, Result const& result, BinaryOperation binary_op) { return sprout::fixed::adjacent_difference(sprout::begin(input), sprout::end(input), result, binary_op); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + adjacent_difference(Input const& input) { + return sprout::fixed::adjacent_difference(sprout::begin(input), sprout::end(input)); + } + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + adjacent_difference(Input const& input, BinaryOperation binary_op) { + return sprout::fixed::adjacent_difference(sprout::begin(input), sprout::end(input), binary_op); + } } // namespace fixed using sprout::range::fixed::adjacent_difference; diff --git a/sprout/range/numeric/fixed/partial_sum.hpp b/sprout/range/numeric/fixed/partial_sum.hpp index 29f94b1f..41d46685 100644 --- a/sprout/range/numeric/fixed/partial_sum.hpp +++ b/sprout/range/numeric/fixed/partial_sum.hpp @@ -23,6 +23,17 @@ namespace sprout { partial_sum(Input const& input, Result const& result, BinaryOperation binary_op) { return sprout::fixed::partial_sum(sprout::begin(input), sprout::end(input), result, binary_op); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + partial_sum(Input const& input) { + return sprout::fixed::partial_sum(sprout::begin(input), sprout::end(input)); + } + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + partial_sum(Input const& input, BinaryOperation binary_op) { + return sprout::fixed::partial_sum(sprout::begin(input), sprout::end(input), binary_op); + } } // namespace fixed using sprout::range::fixed::partial_sum;