1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

add math fmod

fix math cos
This commit is contained in:
bolero-MURAKAMI 2012-12-02 17:06:37 +09:00
parent d57b6e2b18
commit 18b479e3ac
15 changed files with 123 additions and 89 deletions

View file

@ -8,6 +8,7 @@
#include <sprout/container/functions.hpp>
#include <sprout/iterator/generator_iterator.hpp>
#include <sprout/range/range_container.hpp>
#include <sprout/range/adaptor/detail/adapted_range_default.hpp>
#include <sprout/range/algorithm/copy.hpp>
#include <sprout/type_traits/lvalue_reference.hpp>
#include <sprout/utility/forward.hpp>
@ -23,24 +24,23 @@ namespace sprout {
//
template<typename Value, typename UniformRandomNumberGenerator, typename Range = void>
class white_noise_range
: public sprout::range::range_container<
: public sprout::adaptors::detail::adapted_range_default<
Range,
sprout::generator_iterator<
sprout::random::random_result<UniformRandomNumberGenerator, sprout::random::normal_distribution<Value> >
>
>
, public sprout::detail::container_nosy_static_size<Range>
, public sprout::detail::container_nosy_fixed_size<Range>
{
public:
typedef Range range_type;
typedef sprout::range::range_container<
typedef sprout::adaptors::detail::adapted_range_default<
Range,
sprout::generator_iterator<
sprout::random::random_result<UniformRandomNumberGenerator, sprout::random::normal_distribution<Value> >
>
> base_type;
typedef typename base_type::range_type range_type;
typedef typename base_type::iterator iterator;
typedef typename base_type::value_type value_type;
typedef typename base_type::difference_type difference_type;
typedef typename iterator::generator_type generator_type;
typedef typename generator_type::engine_type engine_type;
typedef typename generator_type::distribution_type distribution_type;
@ -57,10 +57,10 @@ namespace sprout {
iterator()
)
{}
SPROUT_CONSTEXPR engine_type const& engine() const {
SPROUT_CONSTEXPR engine_type engine() const {
return base_type::begin().generator().engine();
}
SPROUT_CONSTEXPR value_type const& sigma() const {
SPROUT_CONSTEXPR value_type sigma() const {
return base_type::begin().generator().distribution().sigma();
}
};
@ -81,7 +81,6 @@ namespace sprout {
> base_type;
typedef typename base_type::iterator iterator;
typedef typename base_type::value_type value_type;
typedef typename base_type::difference_type difference_type;
typedef typename iterator::generator_type generator_type;
typedef typename generator_type::engine_type engine_type;
typedef typename generator_type::distribution_type distribution_type;
@ -97,10 +96,10 @@ namespace sprout {
iterator()
)
{}
SPROUT_CONSTEXPR engine_type const& engine() const {
SPROUT_CONSTEXPR engine_type engine() const {
return base_type::begin().generator().engine();
}
SPROUT_CONSTEXPR value_type const& sigma() const {
SPROUT_CONSTEXPR value_type sigma() const {
return base_type::begin().generator().distribution().sigma();
}
};
@ -154,28 +153,9 @@ namespace sprout {
// container_construct_traits
//
template<typename Value, typename UniformRandomNumberGenerator, typename Range>
struct container_construct_traits<sprout::compost::waves::white_noise_range<Value, UniformRandomNumberGenerator, Range> > {
public:
typedef typename sprout::container_construct_traits<Range>::copied_type copied_type;
public:
template<typename Cont>
static SPROUT_CONSTEXPR copied_type deep_copy(Cont&& cont) {
return sprout::range::fixed::copy(sprout::forward<Cont>(cont), sprout::pit<copied_type>());
}
template<typename... Args>
static SPROUT_CONSTEXPR copied_type make(Args&&... args) {
return sprout::make<copied_type>(sprout::forward<Args>(args)...);
}
template<typename Cont, typename... Args>
static SPROUT_CONSTEXPR copied_type remake(
Cont&& cont,
typename sprout::container_traits<sprout::compost::waves::white_noise_range<Value, UniformRandomNumberGenerator, Range> >::difference_type size,
Args&&... args
)
{
return sprout::remake<copied_type>(sprout::forward<Cont>(cont), size, sprout::forward<Args>(args)...);
}
};
struct container_construct_traits<sprout::compost::waves::white_noise_range<Value, UniformRandomNumberGenerator, Range> >
: public sprout::container_construct_traits<typename sprout::compost::waves::white_noise_range<Value, UniformRandomNumberGenerator, Range>::base_type>
{};
} // namespace sprout
#endif // #ifndef SPROUT_COMPOST_WAVES_WHITE_NOISE_HPP