mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-01-23 20:46:37 +00:00
support STL container: numeric, numeric/dft
This commit is contained in:
parent
092910e2f7
commit
aace49ac65
51 changed files with 812 additions and 101 deletions
37
sprout/iterator/amplitude_spectrum_iterator.hpp
Normal file
37
sprout/iterator/amplitude_spectrum_iterator.hpp
Normal file
|
@ -0,0 +1,37 @@
|
|||
#ifndef SPROUT_ITERATOR_AMPLITUDE_SPECTRUM_ITERATOR_HPP
|
||||
#define SPROUT_ITERATOR_AMPLITUDE_SPECTRUM_ITERATOR_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/transform_iterator.hpp>
|
||||
#include <sprout/numeric/dft/amplitude_spectrum_value.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// amplitude_value
|
||||
//
|
||||
template<typename T>
|
||||
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<typename Iterator>
|
||||
inline SPROUT_CONSTEXPR sprout::transform_iterator<sprout::amplitude_value<typename std::iterator_traits<Iterator>::value_type>, Iterator>
|
||||
make_amplitude_spectrum_iterator(Iterator it) {
|
||||
return sprout::transform_iterator<sprout::amplitude_value<typename std::iterator_traits<Iterator>::value_type>, Iterator>(
|
||||
it, sprout::amplitude_value<typename std::iterator_traits<Iterator>::value_type>()
|
||||
);
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ITERATOR_AMPLITUDE_SPECTRUM_ITERATOR_HPP
|
|
@ -4,5 +4,7 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/dft_iterator.hpp>
|
||||
#include <sprout/iterator/idft_iterator.hpp>
|
||||
#include <sprout/iterator/amplitude_spectrum_iterator.hpp>
|
||||
#include <sprout/iterator/phase_spectrum_iterator.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ITERATOR_DFT_HPP
|
||||
|
|
37
sprout/iterator/phase_spectrum_iterator.hpp
Normal file
37
sprout/iterator/phase_spectrum_iterator.hpp
Normal file
|
@ -0,0 +1,37 @@
|
|||
#ifndef SPROUT_ITERATOR_PHASE_SPECTRUM_ITERATOR_HPP
|
||||
#define SPROUT_ITERATOR_PHASE_SPECTRUM_ITERATOR_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/transform_iterator.hpp>
|
||||
#include <sprout/numeric/dft/phase_spectrum_value.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// phase_value
|
||||
//
|
||||
template<typename T>
|
||||
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<typename Iterator>
|
||||
inline SPROUT_CONSTEXPR sprout::transform_iterator<sprout::phase_value<typename std::iterator_traits<Iterator>::value_type>, Iterator>
|
||||
make_phase_spectrum_iterator(Iterator it) {
|
||||
return sprout::transform_iterator<sprout::phase_value<typename std::iterator_traits<Iterator>::value_type>, Iterator>(
|
||||
it, sprout::phase_value<typename std::iterator_traits<Iterator>::value_type>()
|
||||
);
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ITERATOR_PHASE_SPECTRUM_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 <sprout/config.hpp>
|
||||
#include <sprout/iterator/transform_iterator.hpp>
|
||||
|
@ -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
|
||||
|
|
|
@ -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 <sprout/config.hpp>
|
||||
#include <sprout/iterator/transform_iterator.hpp>
|
||||
|
@ -38,4 +38,4 @@ namespace sprout {
|
|||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ITERATOR_REPLACE_IF_ITERATOR_HPP
|
||||
#endif // #ifndef SPROUT_ITERATOR_REPLACE_ITERATOR_HPP
|
||||
|
|
|
@ -2,13 +2,7 @@
|
|||
#define SPROUT_NUMERIC_DFT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/numeric/dft/dft.hpp>
|
||||
#include <sprout/numeric/dft/idft.hpp>
|
||||
#include <sprout/numeric/dft/dft_element.hpp>
|
||||
#include <sprout/numeric/dft/idft_element.hpp>
|
||||
#include <sprout/numeric/dft/spectrum.hpp>
|
||||
#include <sprout/numeric/dft/amplitude_spectrum_value.hpp>
|
||||
#include <sprout/numeric/dft/phase_spectrum_value.hpp>
|
||||
#include <sprout/numeric/dft/wave.hpp>
|
||||
#include <sprout/numeric/dft/non_modifying.hpp>
|
||||
#include <sprout/numeric/dft/modifying.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_NUMERIC_DFT_HPP
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
#include <iterator>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/numeric/dft/detail/dft_element_gen.hpp>
|
||||
#include <sprout/math/constants.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/numeric/dft/detail/dft_element_gen.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace detail {
|
||||
|
|
10
sprout/numeric/dft/fit.hpp
Normal file
10
sprout/numeric/dft/fit.hpp
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef SPROUT_NUMERIC_DFT_FIT_HPP
|
||||
#define SPROUT_NUMERIC_DFT_FIT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/numeric/dft/fit/dft.hpp>
|
||||
#include <sprout/numeric/dft/fit/idft.hpp>
|
||||
#include <sprout/numeric/dft/fit/spectrum.hpp>
|
||||
#include <sprout/numeric/dft/fit/wave.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_NUMERIC_DFT_FIT_HPP
|
|
@ -2,13 +2,15 @@
|
|||
#define SPROUT_NUMERIC_DFT_FIT_AMPLITUDE_SPECTRUM_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/numeric/dft/fixed/amplitude_spectrum.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/pit.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
|
@ -33,8 +35,15 @@ namespace sprout {
|
|||
template<typename InputIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
|
||||
amplitude_spectrum(InputIterator first, InputIterator last, Result const& result) {
|
||||
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
|
||||
return sprout::fit::detail::amplitude_spectrum_impl(first, last, result, sprout::internal_begin_offset(result));
|
||||
}
|
||||
|
||||
template<typename Result, typename InputIterator>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
|
||||
amplitude_spectrum(InputIterator first, InputIterator last) {
|
||||
return sprout::fit::amplitude_spectrum(first, last, sprout::pit<Result>());
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
|
|
|
@ -2,21 +2,22 @@
|
|||
#define SPROUT_NUMERIC_DFT_FIT_DFT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/numeric/dft/fixed/dft.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/pit.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename InputIterator, typename Result>
|
||||
template<typename ForwardIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
|
||||
dft_impl(
|
||||
InputIterator first, InputIterator last, Result const& result,
|
||||
ForwardIterator first, ForwardIterator last, Result const& result,
|
||||
typename sprout::container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
|
@ -30,11 +31,17 @@ namespace sprout {
|
|||
//
|
||||
// dft
|
||||
//
|
||||
template<typename InputIterator, typename Result>
|
||||
template<typename ForwardIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::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<typename Result, typename ForwardIterator>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
dft(ForwardIterator first, ForwardIterator last) {
|
||||
return sprout::fit::dft(first, last, sprout::pit<Result>());
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
|
|
|
@ -2,21 +2,22 @@
|
|||
#define SPROUT_NUMERIC_DFT_FIT_IDFT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/numeric/dft/fixed/idft.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/pit.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename InputIterator, typename Result>
|
||||
template<typename ForwardIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
|
||||
idft_impl(
|
||||
InputIterator first, InputIterator last, Result const& result,
|
||||
ForwardIterator first, ForwardIterator last, Result const& result,
|
||||
typename sprout::container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
|
@ -30,11 +31,17 @@ namespace sprout {
|
|||
//
|
||||
// idft
|
||||
//
|
||||
template<typename InputIterator, typename Result>
|
||||
template<typename ForwardIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::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<typename Result, typename ForwardIterator>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
idft(ForwardIterator first, ForwardIterator last) {
|
||||
return sprout::fit::idft(first, last, sprout::pit<Result>());
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
|
|
|
@ -2,13 +2,15 @@
|
|||
#define SPROUT_NUMERIC_DFT_FIT_PHASE_SPECTRUM_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/numeric/dft/fixed/phase_spectrum.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/pit.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
|
@ -33,8 +35,15 @@ namespace sprout {
|
|||
template<typename InputIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
|
||||
phase_spectrum(InputIterator first, InputIterator last, Result const& result) {
|
||||
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
|
||||
return sprout::fit::detail::phase_spectrum_impl(first, last, result, sprout::internal_begin_offset(result));
|
||||
}
|
||||
|
||||
template<typename Result, typename InputIterator>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
|
||||
phase_spectrum(InputIterator first, InputIterator last) {
|
||||
return sprout::fit::phase_spectrum(first, last, sprout::pit<Result>());
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <sprout/numeric/dft/fixed/sawtooth.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include <sprout/pit.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
|
@ -40,7 +41,18 @@ namespace sprout {
|
|||
typename sprout::container_traits<Container>::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<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Container>::type
|
||||
sawtooth(
|
||||
typename sprout::container_traits<Container>::value_type const& frequency = 1,
|
||||
typename sprout::container_traits<Container>::value_type const& amplitude = 1,
|
||||
typename sprout::container_traits<Container>::value_type const& phase = 0
|
||||
)
|
||||
{
|
||||
return sprout::fit::sawtooth(sprout::pit<Container>(), frequency, amplitude, phase);
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <sprout/numeric/dft/fixed/sinusoid.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include <sprout/pit.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
|
@ -40,7 +41,18 @@ namespace sprout {
|
|||
typename sprout::container_traits<Container>::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<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Container>::type
|
||||
sinusoid(
|
||||
typename sprout::container_traits<Container>::value_type const& frequency = 1,
|
||||
typename sprout::container_traits<Container>::value_type const& amplitude = 1,
|
||||
typename sprout::container_traits<Container>::value_type const& phase = 0
|
||||
)
|
||||
{
|
||||
return sprout::fit::sinusoid(sprout::pit<Container>(), frequency, amplitude, phase);
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
|
|
@ -15,6 +15,12 @@ namespace sprout {
|
|||
spectrum(InputIterator first, InputIterator last, Result const& result) {
|
||||
return sprout::fit::amplitude_spectrum(first, last, result);
|
||||
}
|
||||
|
||||
template<typename Result, typename InputIterator>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
|
||||
spectrum(InputIterator first, InputIterator last) {
|
||||
return sprout::fit::amplitude_spectrum<Result>(first, last);
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <sprout/numeric/dft/fixed/square.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include <sprout/pit.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
|
@ -42,7 +43,19 @@ namespace sprout {
|
|||
typename sprout::container_traits<Container>::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<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Container>::type
|
||||
square(
|
||||
typename sprout::container_traits<Container>::value_type const& frequency = 1,
|
||||
typename sprout::container_traits<Container>::value_type const& amplitude = 1,
|
||||
typename sprout::container_traits<Container>::value_type const& phase = 0,
|
||||
typename sprout::container_traits<Container>::value_type const& duty = 0.5
|
||||
)
|
||||
{
|
||||
return sprout::fit::square(sprout::pit<Container>(), frequency, amplitude, phase, duty);
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <sprout/numeric/dft/fixed/triangle.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include <sprout/pit.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
|
@ -40,7 +41,18 @@ namespace sprout {
|
|||
typename sprout::container_traits<Container>::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<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Container>::type
|
||||
triangle(
|
||||
typename sprout::container_traits<Container>::value_type const& frequency = 1,
|
||||
typename sprout::container_traits<Container>::value_type const& amplitude = 1,
|
||||
typename sprout::container_traits<Container>::value_type const& phase = 0
|
||||
)
|
||||
{
|
||||
return sprout::fit::triangle(sprout::pit<Container>(), frequency, amplitude, phase);
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
|
10
sprout/numeric/dft/fixed.hpp
Normal file
10
sprout/numeric/dft/fixed.hpp
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef SPROUT_NUMERIC_DFT_FIXED_HPP
|
||||
#define SPROUT_NUMERIC_DFT_FIXED_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/numeric/dft/fixed/dft.hpp>
|
||||
#include <sprout/numeric/dft/fixed/idft.hpp>
|
||||
#include <sprout/numeric/dft/fixed/spectrum.hpp>
|
||||
#include <sprout/numeric/dft/fixed/wave.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_NUMERIC_DFT_FIXED_HPP
|
|
@ -1,21 +1,27 @@
|
|||
#ifndef SPROUT_NUMERIC_DFT_FIXED_AMPLITUDE_SPECTRUM_HPP
|
||||
#define SPROUT_NUMERIC_DFT_FIXED_AMPLITUDE_SPECTRUM_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/index_tuple.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/iterator/amplitude_spectrum_iterator.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/pit.hpp>
|
||||
#include <sprout/math/comparison.hpp>
|
||||
#include <sprout/numeric/dft/amplitude_spectrum_value.hpp>
|
||||
#include <sprout/detail/container_complate.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename InputIterator, typename Result, sprout::index_t... Indexes>
|
||||
template<typename RandomAccessIterator, typename Result, sprout::index_t... Indexes>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::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<Indexes...>,
|
||||
typename sprout::container_traits<Result>::difference_type offset,
|
||||
typename sprout::container_traits<Result>::size_type size,
|
||||
|
@ -23,27 +29,93 @@ namespace sprout {
|
|||
)
|
||||
{
|
||||
return sprout::remake<Result>(
|
||||
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<typename InputIterator, typename Result>
|
||||
template<typename RandomAccessIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::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<Result>::static_size>::make(),
|
||||
sprout::internal_begin_offset(result),
|
||||
sprout::size(result),
|
||||
sprout::distance(first, last)
|
||||
);
|
||||
}
|
||||
|
||||
template<typename ForwardIterator, typename Result, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
amplitude_spectrum_impl(
|
||||
ForwardIterator first, ForwardIterator last, Result const& result,
|
||||
typename sprout::container_traits<Result>::size_type size,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sprout::remake<Result>(result, sprout::size(result), args...);
|
||||
}
|
||||
template<typename ForwardIterator, typename Result, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
amplitude_spectrum_impl(
|
||||
ForwardIterator first, ForwardIterator last, Result const& result,
|
||||
typename sprout::container_traits<Result>::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<typename ForwardIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::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<typename InputIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::is_fixed_container<Result>::value,
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
amplitude_spectrum(InputIterator first, InputIterator last, Result const& result) {
|
||||
typedef typename std::iterator_traits<InputIterator>::iterator_category* category;
|
||||
return sprout::fixed::detail::amplitude_spectrum(first, last, result, category());
|
||||
}
|
||||
|
||||
template<typename InputIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
!sprout::is_fixed_container<Result>::value,
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
amplitude_spectrum(InputIterator first, InputIterator last, Result const& result) {
|
||||
return sprout::remake<Result>(
|
||||
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<typename Result, typename ForwardIterator>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
amplitude_spectrum(ForwardIterator first, ForwardIterator last) {
|
||||
return sprout::fixed::amplitude_spectrum(first, last, sprout::pit<Result>());
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::amplitude_spectrum;
|
||||
|
|
|
@ -1,21 +1,27 @@
|
|||
#ifndef SPROUT_NUMERIC_DFT_FIXED_DFT_HPP
|
||||
#define SPROUT_NUMERIC_DFT_FIXED_DFT_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/index_tuple.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/iterator/dft_iterator.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/pit.hpp>
|
||||
#include <sprout/math/comparison.hpp>
|
||||
#include <sprout/numeric/dft/dft_element.hpp>
|
||||
#include <sprout/detail/container_complate.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename InputIterator, typename Result, sprout::index_t... Indexes>
|
||||
template<typename RandomAccessIterator, typename Result, sprout::index_t... Indexes>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
dft_impl(
|
||||
InputIterator first, InputIterator last, Result const& result,
|
||||
dft_impl_ra(
|
||||
RandomAccessIterator first, RandomAccessIterator last, Result const& result,
|
||||
sprout::index_tuple<Indexes...>,
|
||||
typename sprout::container_traits<Result>::difference_type offset,
|
||||
typename sprout::container_traits<Result>::size_type size,
|
||||
|
@ -23,36 +29,110 @@ namespace sprout {
|
|||
)
|
||||
{
|
||||
return sprout::remake<Result>(
|
||||
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<typename InputIterator, typename Result>
|
||||
template<typename RandomAccessIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::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<Result>::static_size>::make(),
|
||||
sprout::internal_begin_offset(result),
|
||||
sprout::size(result),
|
||||
sprout::distance(first, last)
|
||||
);
|
||||
}
|
||||
|
||||
template<typename ForwardIterator, typename Result, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
dft_impl(
|
||||
ForwardIterator first, ForwardIterator last, Result const& result,
|
||||
typename sprout::container_traits<Result>::size_type size,
|
||||
ForwardIterator first_, typename sprout::container_traits<Result>::difference_type i,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sprout::remake<Result>(result, sprout::size(result), args...);
|
||||
}
|
||||
template<typename ForwardIterator, typename Result, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
dft_impl(
|
||||
ForwardIterator first, ForwardIterator last, Result const& result,
|
||||
typename sprout::container_traits<Result>::size_type size,
|
||||
ForwardIterator first_, typename sprout::container_traits<Result>::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<typename ForwardIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::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<typename ForwardIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::is_fixed_container<Result>::value,
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
dft(ForwardIterator first, ForwardIterator last, Result const& result) {
|
||||
typedef typename std::iterator_traits<ForwardIterator>::iterator_category* category;
|
||||
return sprout::fixed::detail::dft(first, last, result, category());
|
||||
}
|
||||
|
||||
template<typename ForwardIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
!sprout::is_fixed_container<Result>::value,
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
dft(ForwardIterator first, ForwardIterator last, Result const& result) {
|
||||
return sprout::remake<Result>(
|
||||
result, sprout::size(result),
|
||||
sprout::make_dft_iterator(first, last),
|
||||
sprout::make_dft_iterator(first, last, sprout::distance(first, last))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// dft
|
||||
//
|
||||
template<typename InputIterator, typename Result>
|
||||
template<typename ForwardIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::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<typename Result, typename ForwardIterator>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
dft(ForwardIterator first, ForwardIterator last) {
|
||||
return sprout::fixed::dft(first, last, sprout::pit<Result>());
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::dft;
|
||||
|
|
|
@ -1,21 +1,27 @@
|
|||
#ifndef SPROUT_NUMERIC_DFT_FIXED_IDFT_HPP
|
||||
#define SPROUT_NUMERIC_DFT_FIXED_IDFT_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/index_tuple.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/iterator/idft_iterator.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/pit.hpp>
|
||||
#include <sprout/math/comparison.hpp>
|
||||
#include <sprout/numeric/dft/idft_element.hpp>
|
||||
#include <sprout/detail/container_complate.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename InputIterator, typename Result, sprout::index_t... Indexes>
|
||||
template<typename RandomAccessIterator, typename Result, sprout::index_t... Indexes>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
idft_impl(
|
||||
InputIterator first, InputIterator last, Result const& result,
|
||||
idft_impl_ra(
|
||||
RandomAccessIterator first, RandomAccessIterator last, Result const& result,
|
||||
sprout::index_tuple<Indexes...>,
|
||||
typename sprout::container_traits<Result>::difference_type offset,
|
||||
typename sprout::container_traits<Result>::size_type size,
|
||||
|
@ -23,36 +29,110 @@ namespace sprout {
|
|||
)
|
||||
{
|
||||
return sprout::remake<Result>(
|
||||
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<typename InputIterator, typename Result>
|
||||
template<typename RandomAccessIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::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<Result>::static_size>::make(),
|
||||
sprout::internal_begin_offset(result),
|
||||
sprout::size(result),
|
||||
sprout::distance(first, last)
|
||||
);
|
||||
}
|
||||
|
||||
template<typename ForwardIterator, typename Result, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
idft_impl(
|
||||
ForwardIterator first, ForwardIterator last, Result const& result,
|
||||
typename sprout::container_traits<Result>::size_type size,
|
||||
ForwardIterator first_, typename sprout::container_traits<Result>::difference_type i,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sprout::remake<Result>(result, sprout::size(result), args...);
|
||||
}
|
||||
template<typename ForwardIterator, typename Result, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
idft_impl(
|
||||
ForwardIterator first, ForwardIterator last, Result const& result,
|
||||
typename sprout::container_traits<Result>::size_type size,
|
||||
ForwardIterator first_, typename sprout::container_traits<Result>::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<typename ForwardIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::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<typename ForwardIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::is_fixed_container<Result>::value,
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
idft(ForwardIterator first, ForwardIterator last, Result const& result) {
|
||||
typedef typename std::iterator_traits<ForwardIterator>::iterator_category* category;
|
||||
return sprout::fixed::detail::idft(first, last, result, category());
|
||||
}
|
||||
|
||||
template<typename ForwardIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
!sprout::is_fixed_container<Result>::value,
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
idft(ForwardIterator first, ForwardIterator last, Result const& result) {
|
||||
return sprout::remake<Result>(
|
||||
result, sprout::size(result),
|
||||
sprout::make_idft_iterator(first, last),
|
||||
sprout::make_idft_iterator(first, last, sprout::distance(first, last))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// idft
|
||||
//
|
||||
template<typename InputIterator, typename Result>
|
||||
template<typename ForwardIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::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<typename Result, typename ForwardIterator>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
idft(ForwardIterator first, ForwardIterator last) {
|
||||
return sprout::fixed::idft(first, last, sprout::pit<Result>());
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::idft;
|
||||
|
|
|
@ -1,42 +1,49 @@
|
|||
#ifndef SPROUT_NUMERIC_DFT_FIXED_PHASE_SPECTRUM_HPP
|
||||
#define SPROUT_NUMERIC_DFT_FIXED_PHASE_SPECTRUM_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/index_tuple.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/iterator/phase_spectrum_iterator.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/pit.hpp>
|
||||
#include <sprout/math/comparison.hpp>
|
||||
#include <sprout/numeric/dft/phase_spectrum_value.hpp>
|
||||
#include <sprout/detail/container_complate.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename InputIterator, typename Result, sprout::index_t... Indexes>
|
||||
template<typename RandomAccessIterator, typename Result, sprout::index_t... Indexes>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::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<Indexes...>,
|
||||
typename sprout::container_traits<Result>::difference_type offset,
|
||||
typename sprout::container_traits<Result>::size_type size,
|
||||
typename sprout::container_traits<Result>::size_type input_size
|
||||
)
|
||||
{
|
||||
using sprout::real;
|
||||
using sprout::imag;
|
||||
return sprout::remake<Result>(
|
||||
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<typename InputIterator, typename Result>
|
||||
template<typename RandomAccessIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::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<Result>::static_size>::make(),
|
||||
sprout::internal_begin_offset(result),
|
||||
|
@ -44,6 +51,71 @@ namespace sprout {
|
|||
sprout::distance(first, last)
|
||||
);
|
||||
}
|
||||
|
||||
template<typename ForwardIterator, typename Result, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
phase_spectrum_impl(
|
||||
ForwardIterator first, ForwardIterator last, Result const& result,
|
||||
typename sprout::container_traits<Result>::size_type size,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sprout::remake<Result>(result, sprout::size(result), args...);
|
||||
}
|
||||
template<typename ForwardIterator, typename Result, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
phase_spectrum_impl(
|
||||
ForwardIterator first, ForwardIterator last, Result const& result,
|
||||
typename sprout::container_traits<Result>::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<typename ForwardIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::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<typename InputIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::is_fixed_container<Result>::value,
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
phase_spectrum(InputIterator first, InputIterator last, Result const& result) {
|
||||
typedef typename std::iterator_traits<InputIterator>::iterator_category* category;
|
||||
return sprout::fixed::detail::phase_spectrum(first, last, result, category());
|
||||
}
|
||||
|
||||
template<typename InputIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
!sprout::is_fixed_container<Result>::value,
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
phase_spectrum(InputIterator first, InputIterator last, Result const& result) {
|
||||
return sprout::remake<Result>(
|
||||
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<typename Result, typename ForwardIterator>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
phase_spectrum(ForwardIterator first, ForwardIterator last) {
|
||||
return sprout::fixed::phase_spectrum(first, last, sprout::pit<Result>());
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::phase_spectrum;
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/container/indexes.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/pit.hpp>
|
||||
#include <sprout/math/comparison.hpp>
|
||||
#include <sprout/math/floor.hpp>
|
||||
#include <sprout/detail/container_complate.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
|
@ -33,8 +36,7 @@ namespace sprout {
|
|||
{
|
||||
typedef typename sprout::container_traits<Container>::value_type value_type;
|
||||
return sprout::remake<Container>(
|
||||
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<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
sawtooth(
|
||||
typename sprout::container_traits<Container>::value_type const& frequency = 1,
|
||||
typename sprout::container_traits<Container>::value_type const& amplitude = 1,
|
||||
typename sprout::container_traits<Container>::value_type const& phase = 0
|
||||
)
|
||||
{
|
||||
return sprout::fixed::sawtooth(sprout::pit<Container>(), frequency, amplitude, phase);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::sawtooth;
|
||||
|
|
|
@ -7,8 +7,11 @@
|
|||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/container/indexes.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/pit.hpp>
|
||||
#include <sprout/math/comparison.hpp>
|
||||
#include <sprout/math/constants.hpp>
|
||||
#include <sprout/math/sin.hpp>
|
||||
#include <sprout/detail/container_complate.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
|
@ -28,8 +31,7 @@ namespace sprout {
|
|||
typedef typename sprout::container_traits<Container>::value_type value_type;
|
||||
using sprout::sin;
|
||||
return sprout::remake<Container>(
|
||||
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<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
sinusoid(
|
||||
typename sprout::container_traits<Container>::value_type const& frequency = 1,
|
||||
typename sprout::container_traits<Container>::value_type const& amplitude = 1,
|
||||
typename sprout::container_traits<Container>::value_type const& phase = 0
|
||||
)
|
||||
{
|
||||
return sprout::fixed::sinusoid(sprout::pit<Container>(), frequency, amplitude, phase);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::sinusoid;
|
||||
|
|
|
@ -15,6 +15,12 @@ namespace sprout {
|
|||
spectrum(InputIterator first, InputIterator last, Result const& result) {
|
||||
return sprout::fixed::amplitude_spectrum(first, last, result);
|
||||
}
|
||||
|
||||
template<typename Result, typename InputIterator>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
spectrum(InputIterator first, InputIterator last) {
|
||||
return sprout::fixed::amplitude_spectrum<Result>(first, last);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::spectrum;
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/container/indexes.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/pit.hpp>
|
||||
#include <sprout/math/comparison.hpp>
|
||||
#include <sprout/numeric/dft/fixed/sawtooth.hpp>
|
||||
#include <sprout/detail/container_complate.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
|
@ -33,8 +36,7 @@ namespace sprout {
|
|||
{
|
||||
typedef typename sprout::container_traits<Container>::value_type value_type;
|
||||
return sprout::remake<Container>(
|
||||
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<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
square(
|
||||
typename sprout::container_traits<Container>::value_type const& frequency = 1,
|
||||
typename sprout::container_traits<Container>::value_type const& amplitude = 1,
|
||||
typename sprout::container_traits<Container>::value_type const& phase = 0,
|
||||
typename sprout::container_traits<Container>::value_type const& duty = 0.5
|
||||
)
|
||||
{
|
||||
return sprout::fixed::square(sprout::pit<Container>(), frequency, amplitude, phase, duty);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::square;
|
||||
|
|
|
@ -7,9 +7,12 @@
|
|||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/container/indexes.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/pit.hpp>
|
||||
#include <sprout/math/comparison.hpp>
|
||||
#include <sprout/math/sin.hpp>
|
||||
#include <sprout/math/asin.hpp>
|
||||
#include <sprout/math/constants.hpp>
|
||||
#include <sprout/detail/container_complate.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
|
@ -36,8 +39,7 @@ namespace sprout {
|
|||
{
|
||||
typedef typename sprout::container_traits<Container>::value_type value_type;
|
||||
return sprout::remake<Container>(
|
||||
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<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
triangle(
|
||||
typename sprout::container_traits<Container>::value_type const& frequency = 1,
|
||||
typename sprout::container_traits<Container>::value_type const& amplitude = 1,
|
||||
typename sprout::container_traits<Container>::value_type const& phase = 0
|
||||
)
|
||||
{
|
||||
return sprout::fixed::triangle(sprout::pit<Container>(), frequency, amplitude, phase);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::triangle;
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
#include <iterator>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/numeric/dft/detail/dft_element_gen.hpp>
|
||||
#include <sprout/math/constants.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/numeric/dft/detail/dft_element_gen.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace detail {
|
||||
|
|
8
sprout/numeric/dft/modifying.hpp
Normal file
8
sprout/numeric/dft/modifying.hpp
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef SPROUT_NUMERIC_DFT_MODIFYIING_HPP
|
||||
#define SPROUT_NUMERIC_DFT_MODIFYIING_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/numeric/dft/fixed.hpp>
|
||||
#include <sprout/numeric/dft/fit.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_NUMERIC_DFT_MODIFYIING_HPP
|
10
sprout/numeric/dft/non_modifying.hpp
Normal file
10
sprout/numeric/dft/non_modifying.hpp
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef SPROUT_NUMERIC_DFT_NON_MODIFYIING_HPP
|
||||
#define SPROUT_NUMERIC_DFT_NON_MODIFYIING_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/numeric/dft/dft_element.hpp>
|
||||
#include <sprout/numeric/dft/idft_element.hpp>
|
||||
#include <sprout/numeric/dft/amplitude_spectrum_value.hpp>
|
||||
#include <sprout/numeric/dft/phase_spectrum_value.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_NUMERIC_DFT_NON_MODIFYIING_HPP
|
|
@ -2,13 +2,14 @@
|
|||
#define SPROUT_NUMERIC_FIT_ADJACENT_DIFFERENCE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/numeric/fixed/adjacent_difference.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
|
@ -33,6 +34,7 @@ namespace sprout {
|
|||
template<typename InputIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
|
||||
adjacent_difference(InputIterator first, InputIterator last, Result const& result) {
|
||||
static_assert(sprout::is_forward_iterator<InputIterator>::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<typename InputIterator, typename Result, typename BinaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
|
||||
adjacent_difference(InputIterator first, InputIterator last, Result const& result, BinaryOperation binary_op) {
|
||||
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
|
||||
return sprout::fit::detail::adjacent_difference_impl(first, last, result, binary_op, sprout::internal_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
|
|
|
@ -2,13 +2,14 @@
|
|||
#define SPROUT_NUMERIC_FIT_PARTIAL_SUM_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/numeric/fixed/partial_sum.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
|
@ -33,6 +34,7 @@ namespace sprout {
|
|||
template<typename InputIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
|
||||
partial_sum(InputIterator first, InputIterator last, Result const& result) {
|
||||
static_assert(sprout::is_forward_iterator<InputIterator>::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<typename InputIterator, typename Result, typename BinaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
|
||||
partial_sum(InputIterator first, InputIterator last, Result const& result, BinaryOperation binary_op) {
|
||||
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
|
||||
return sprout::fit::detail::partial_sum_impl(first, last, result, binary_op, sprout::internal_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
|
|
|
@ -2,10 +2,7 @@
|
|||
#define SPROUT_RANGE_NUMERIC_DFT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/range/numeric/dft/dft.hpp>
|
||||
#include <sprout/range/numeric/dft/idft.hpp>
|
||||
#include <sprout/range/numeric/dft/dft_element.hpp>
|
||||
#include <sprout/range/numeric/dft/idft_element.hpp>
|
||||
#include <sprout/range/numeric/dft/spectrum.hpp>
|
||||
#include <sprout/range/numeric/dft/non_modifying.hpp>
|
||||
#include <sprout/range/numeric/dft/modifying.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_NUMERIC_DFT_HPP
|
||||
|
|
9
sprout/range/numeric/dft/fit.hpp
Normal file
9
sprout/range/numeric/dft/fit.hpp
Normal file
|
@ -0,0 +1,9 @@
|
|||
#ifndef SPROUT_RANGE_NUMERIC_DFT_FIT_HPP
|
||||
#define SPROUT_RANGE_NUMERIC_DFT_FIT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/range/numeric/dft/fit/dft.hpp>
|
||||
#include <sprout/range/numeric/dft/fit/idft.hpp>
|
||||
#include <sprout/range/numeric/dft/fit/spectrum.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_NUMERIC_DFT_FIT_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<typename Result, typename Input>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
|
||||
amplitude_spectrum(Input const& input) {
|
||||
return sprout::fit::amplitude_spectrum<Result>(sprout::begin(input), sprout::end(input));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
|
|
@ -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<typename Result, typename Input>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
|
||||
dft(Input const& input) {
|
||||
return sprout::fit::dft<Result>(sprout::begin(input), sprout::end(input));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
|
|
@ -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<typename Result, typename Input>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
|
||||
idft(Input const& input) {
|
||||
return sprout::fit::idft<Result>(sprout::begin(input), sprout::end(input));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
|
|
@ -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<typename Result, typename Input>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
|
||||
phase_spectrum(Input const& input) {
|
||||
return sprout::fit::phase_spectrum<Result>(sprout::begin(input), sprout::end(input));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
|
|
@ -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<typename Result, typename Input>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
|
||||
spectrum(Input const& input) {
|
||||
return sprout::fit::spectrum<Result>(sprout::begin(input), sprout::end(input));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
|
9
sprout/range/numeric/dft/fixed.hpp
Normal file
9
sprout/range/numeric/dft/fixed.hpp
Normal file
|
@ -0,0 +1,9 @@
|
|||
#ifndef SPROUT_RANGE_NUMERIC_DFT_FIXED_HPP
|
||||
#define SPROUT_RANGE_NUMERIC_DFT_FIXED_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/range/numeric/dft/fixed/dft.hpp>
|
||||
#include <sprout/range/numeric/dft/fixed/idft.hpp>
|
||||
#include <sprout/range/numeric/dft/fixed/spectrum.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_NUMERIC_DFT_FIXED_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<typename Result, typename Input>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
amplitude_spectrum(Input const& input) {
|
||||
return sprout::fixed::amplitude_spectrum<Result>(sprout::begin(input), sprout::end(input));
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::range::fixed::amplitude_spectrum;
|
||||
|
|
|
@ -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<typename Result, typename Input>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
dft(Input const& input) {
|
||||
return sprout::fixed::dft<Result>(sprout::begin(input), sprout::end(input));
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::range::fixed::dft;
|
||||
|
|
|
@ -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<typename Result, typename Input>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
idft(Input const& input) {
|
||||
return sprout::fixed::idft<Result>(sprout::begin(input), sprout::end(input));
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::range::fixed::idft;
|
||||
|
|
|
@ -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<typename Result, typename Input>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
phase_spectrum(Input const& input) {
|
||||
return sprout::fixed::phase_spectrum<Result>(sprout::begin(input), sprout::end(input));
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::range::fixed::phase_spectrum;
|
||||
|
|
|
@ -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<typename Result, typename Input>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
spectrum(Input const& input) {
|
||||
return sprout::fixed::spectrum<Result>(sprout::begin(input), sprout::end(input));
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::range::fixed::spectrum;
|
||||
|
|
8
sprout/range/numeric/dft/modifying.hpp
Normal file
8
sprout/range/numeric/dft/modifying.hpp
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef SPROUT_RANGE_NUMERIC_DFT_MODIFYIING_HPP
|
||||
#define SPROUT_RANGE_NUMERIC_DFT_MODIFYIING_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/range/numeric/dft/fixed.hpp>
|
||||
#include <sprout/range/numeric/dft/fit.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_NUMERIC_DFT_MODIFYIING_HPP
|
8
sprout/range/numeric/dft/non_modifying.hpp
Normal file
8
sprout/range/numeric/dft/non_modifying.hpp
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef SPROUT_RANGE_NUMERIC_DFT_NON_MODIFYIING_HPP
|
||||
#define SPROUT_RANGE_NUMERIC_DFT_NON_MODIFYIING_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/range/numeric/dft/dft_element.hpp>
|
||||
#include <sprout/range/numeric/dft/idft_element.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_NUMERIC_DFT_NON_MODIFYIING_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<typename Result, typename Input>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
|
||||
adjacent_difference(Input const& input) {
|
||||
return sprout::fit::adjacent_difference<Result>(sprout::begin(input), sprout::end(input));
|
||||
}
|
||||
template<typename Result, typename Input, typename BinaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
|
||||
adjacent_difference(Input const& input, BinaryOperation binary_op) {
|
||||
return sprout::fit::adjacent_difference<Result>(sprout::begin(input), sprout::end(input), binary_op);
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
|
|
@ -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<typename Result, typename Input>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
|
||||
partial_sum(Input const& input) {
|
||||
return sprout::fit::partial_sum<Result>(sprout::begin(input), sprout::end(input));
|
||||
}
|
||||
template<typename Result, typename Input, typename BinaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::result_of::algorithm<Result>::type
|
||||
partial_sum(Input const& input, BinaryOperation binary_op) {
|
||||
return sprout::fit::partial_sum<Result>(sprout::begin(input), sprout::end(input), binary_op);
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
|
|
@ -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<typename Result, typename Input>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
adjacent_difference(Input const& input) {
|
||||
return sprout::fixed::adjacent_difference<Result>(sprout::begin(input), sprout::end(input));
|
||||
}
|
||||
template<typename Result, typename Input, typename BinaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
adjacent_difference(Input const& input, BinaryOperation binary_op) {
|
||||
return sprout::fixed::adjacent_difference<Result>(sprout::begin(input), sprout::end(input), binary_op);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::range::fixed::adjacent_difference;
|
||||
|
|
|
@ -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<typename Result, typename Input>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
partial_sum(Input const& input) {
|
||||
return sprout::fixed::partial_sum<Result>(sprout::begin(input), sprout::end(input));
|
||||
}
|
||||
template<typename Result, typename Input, typename BinaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
partial_sum(Input const& input, BinaryOperation binary_op) {
|
||||
return sprout::fixed::partial_sum<Result>(sprout::begin(input), sprout::end(input), binary_op);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::range::fixed::partial_sum;
|
||||
|
|
Loading…
Reference in a new issue