diff --git a/sprout/range/numeric/non_modifying.hpp b/sprout/range/numeric/non_modifying.hpp index e3f632e4..0d86c0b7 100644 --- a/sprout/range/numeric/non_modifying.hpp +++ b/sprout/range/numeric/non_modifying.hpp @@ -4,5 +4,7 @@ #include #include #include +#include +#include #endif // #ifndef SPROUT_RANGE_NUMERIC_NON_MODIFYIING_HPP diff --git a/sprout/range/numeric/unstable_accumulate.hpp b/sprout/range/numeric/unstable_accumulate.hpp new file mode 100644 index 00000000..98fd2d0e --- /dev/null +++ b/sprout/range/numeric/unstable_accumulate.hpp @@ -0,0 +1,26 @@ +#ifndef SPROUT_RANGE_NUMERIC_UNSTABLE_ACCUMLATE_HPP +#define SPROUT_RANGE_NUMERIC_UNSTABLE_ACCUMLATE_HPP + +#include +#include + +namespace sprout { + namespace range { + // + // unstable_accumulate + // + template + 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 + 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 diff --git a/sprout/range/numeric/unstable_inner_product.hpp b/sprout/range/numeric/unstable_inner_product.hpp new file mode 100644 index 00000000..01ba669d --- /dev/null +++ b/sprout/range/numeric/unstable_inner_product.hpp @@ -0,0 +1,30 @@ +#ifndef SPROUT_RANGE_NUMERIC_UNSTABLE_INNER_PRODUCT_HPP +#define SPROUT_RANGE_NUMERIC_UNSTABLE_INNER_PRODUCT_HPP + +#include +#include + +namespace sprout { + namespace range { + // + // unstable_inner_product + // + template + 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 + 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