1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00
Sprout/sprout/numeric/dft/detail/sinusoid.hpp

37 lines
1.3 KiB
C++
Raw Normal View History

/*=============================================================================
2015-01-10 10:13:57 +00:00
Copyright (c) 2011-2015 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SPROUT_NUMERIC_DFT_DETAIL_SINUSOID_HPP
#define SPROUT_NUMERIC_DFT_DETAIL_SINUSOID_HPP
#include <sprout/config.hpp>
#include <sprout/math/constants.hpp>
#include <sprout/math/sin.hpp>
namespace sprout {
namespace detail {
template<typename T, typename Index>
inline SPROUT_CONSTEXPR T
sinusoid_value(T const& amplitude, T const& phase, T const& d, Index i) {
using sprout::sin;
return amplitude * sin(d * T(i) + phase);
}
template<typename T, typename Size>
inline SPROUT_CONSTEXPR T
sinusoid_value_d(T const& frequency, Size size) {
return sprout::math::two_pi<T>() * frequency / T(size);
}
template<typename T>
inline SPROUT_CONSTEXPR T
sinusoid_value_d(T const& frequency) {
return sprout::math::two_pi<T>() * frequency;
}
} // namespace detail
} // namespace sprout
#endif // #ifndef SPROUT_NUMERIC_DFT_DETAIL_SINUSOID_HPP