add range::unstable_accumulate, range::unstable_inner_product

This commit is contained in:
bolero-MURAKAMI 2012-12-22 22:06:21 +09:00
parent 26dd9dabca
commit 6a6fc03806
3 changed files with 58 additions and 0 deletions

View file

@ -4,5 +4,7 @@
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/range/numeric/accumulate.hpp> #include <sprout/range/numeric/accumulate.hpp>
#include <sprout/range/numeric/inner_product.hpp> #include <sprout/range/numeric/inner_product.hpp>
#include <sprout/range/numeric/unstable_accumulate.hpp>
#include <sprout/range/numeric/unstable_inner_product.hpp>
#endif // #ifndef SPROUT_RANGE_NUMERIC_NON_MODIFYIING_HPP #endif // #ifndef SPROUT_RANGE_NUMERIC_NON_MODIFYIING_HPP

View file

@ -0,0 +1,26 @@
#ifndef SPROUT_RANGE_NUMERIC_UNSTABLE_ACCUMLATE_HPP
#define SPROUT_RANGE_NUMERIC_UNSTABLE_ACCUMLATE_HPP
#include <sprout/config.hpp>
#include <sprout/numeric/unstable_accumulate.hpp>
namespace sprout {
namespace range {
//
// unstable_accumulate
//
template<typename Range, typename T, typename BinaryOperation>
inline SPROUT_CONSTEXPR T
unstable_accumulate(Range const& range, T init, BinaryOperation binary_op) {
return sprout::unstable_accumulate(sprout::begin(range), sprout::end(range), init, binary_op);
}
template<typename Range, typename T>
inline SPROUT_CONSTEXPR T
unstable_accumulate(Range const& range, T init) {
return sprout::unstable_accumulate(sprout::begin(range), sprout::end(range), init);
}
} // namespace range
} // namespace sprout
#endif // #ifndef SPROUT_RANGE_NUMERIC_UNSTABLE_ACCUMLATE_HPP

View file

@ -0,0 +1,30 @@
#ifndef SPROUT_RANGE_NUMERIC_UNSTABLE_INNER_PRODUCT_HPP
#define SPROUT_RANGE_NUMERIC_UNSTABLE_INNER_PRODUCT_HPP
#include <sprout/config.hpp>
#include <sprout/numeric/unstable_inner_product.hpp>
namespace sprout {
namespace range {
//
// unstable_inner_product
//
template<typename Range1, typename Range2, typename T, typename BinaryOperation1, typename BinaryOperation2>
inline SPROUT_CONSTEXPR T
unstable_inner_product(
Range1 const& range1, Range2 const& range2, T init,
BinaryOperation1 binary_op1, BinaryOperation2 binary_op2
)
{
return sprout::unstable_inner_product(sprout::begin(range1), sprout::end(range1), sprout::begin(range2), init, binary_op1, binary_op2);
}
template<typename Range1, typename Range2, typename T>
inline SPROUT_CONSTEXPR T
unstable_inner_product(Range1 const& range1, Range2 const& range2, T init) {
return sprout::unstable_inner_product(sprout::begin(range1), sprout::end(range1), sprout::begin(range2), init);
}
} // namespace range
} // namespace sprout
#endif // #ifndef SPROUT_RANGE_NUMERIC_UNSTABLE_INNER_PRODUCT_HPP