mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2024-11-12 21:09:01 +00:00
add C++17 transform_exclusive_scan, transform_inclusive_scan
This commit is contained in:
parent
9ce83b0863
commit
786c4f3b1e
26 changed files with 893 additions and 1 deletions
|
@ -12,6 +12,8 @@
|
|||
#include <sprout/numeric/cxx14/partial_sum.hpp>
|
||||
#include <sprout/numeric/cxx14/exclusive_scan.hpp>
|
||||
#include <sprout/numeric/cxx14/inclusive_scan.hpp>
|
||||
#include <sprout/numeric/cxx14/transform_exclusive_scan.hpp>
|
||||
#include <sprout/numeric/cxx14/transform_inclusive_scan.hpp>
|
||||
#include <sprout/numeric/cxx14/adjacent_difference.hpp>
|
||||
#include <sprout/numeric/cxx14/iota.hpp>
|
||||
|
||||
|
|
42
sprout/numeric/cxx14/transform_exclusive_scan.hpp
Normal file
42
sprout/numeric/cxx14/transform_exclusive_scan.hpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2017 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_CXX14_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
||||
#define SPROUT_NUMERIC_CXX14_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/utility/move.hpp>
|
||||
#include <sprout/iterator/type_traits/is_iterator_of.hpp>
|
||||
#include <sprout/type_traits/enabler_if.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// 29.8.9 Transform exclusive scan
|
||||
//
|
||||
template<
|
||||
typename InputIterator, typename OutputIterator, typename T, typename BinaryOperation, typename UnaryOperation,
|
||||
typename sprout::enabler_if<sprout::is_iterator_outputable<OutputIterator>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CXX14_CONSTEXPR OutputIterator
|
||||
transform_exclusive_scan(InputIterator first, InputIterator last, OutputIterator result, T init, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
|
||||
value_type sum = sprout::move(init);
|
||||
*result = sum;
|
||||
if (first == last) {
|
||||
return ++result;
|
||||
}
|
||||
value_type temp = unary_op(*first);
|
||||
while (++first != last) {
|
||||
sum = binary_op(sum, temp);
|
||||
*++result = sum;
|
||||
temp = unary_op(*first);
|
||||
}
|
||||
return ++result;
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_NUMERIC_CXX14_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
60
sprout/numeric/cxx14/transform_inclusive_scan.hpp
Normal file
60
sprout/numeric/cxx14/transform_inclusive_scan.hpp
Normal file
|
@ -0,0 +1,60 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2017 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_CXX14_TRANSFORM_INCLUSIVE_SCAN_HPP
|
||||
#define SPROUT_NUMERIC_CXX14_TRANSFORM_INCLUSIVE_SCAN_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/utility/move.hpp>
|
||||
#include <sprout/iterator/type_traits/is_iterator_of.hpp>
|
||||
#include <sprout/type_traits/enabler_if.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// 29.8.10 Transform inclusive scan
|
||||
//
|
||||
template<
|
||||
typename InputIterator, typename OutputIterator, typename BinaryOperation, typename UnaryOperation, typename T,
|
||||
typename sprout::enabler_if<sprout::is_iterator_outputable<OutputIterator>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CXX14_CONSTEXPR OutputIterator
|
||||
transform_inclusive_scan(InputIterator first, InputIterator last, OutputIterator result, BinaryOperation binary_op, UnaryOperation unary_op, T init) {
|
||||
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
|
||||
value_type sum = sprout::move(init);
|
||||
*result = sum;
|
||||
if (first == last) {
|
||||
return ++result;
|
||||
}
|
||||
sum = binary_op(sum, unary_op(*first));
|
||||
*++result = sum;
|
||||
while (++first != last) {
|
||||
sum = binary_op(sum, unary_op(*first));
|
||||
*++result = sum;
|
||||
}
|
||||
return ++result;
|
||||
}
|
||||
template<
|
||||
typename InputIterator, typename OutputIterator, typename BinaryOperation, typename UnaryOperation,
|
||||
typename sprout::enabler_if<sprout::is_iterator_outputable<OutputIterator>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CXX14_CONSTEXPR OutputIterator
|
||||
transform_inclusive_scan(InputIterator first, InputIterator last, OutputIterator result, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
|
||||
if (first == last) {
|
||||
return result;
|
||||
}
|
||||
value_type sum = unary_op(*first);
|
||||
*result = sum;
|
||||
while (++first != last) {
|
||||
sum = binary_op(sum, unary_op(*first));
|
||||
*++result = sum;
|
||||
}
|
||||
return ++result;
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_NUMERIC_CXX14_TRANSFORM_INCLUSIVE_SCAN_HPP
|
|
@ -12,6 +12,8 @@
|
|||
#include <sprout/numeric/fit/partial_sum.hpp>
|
||||
#include <sprout/numeric/fit/exclusive_scan.hpp>
|
||||
#include <sprout/numeric/fit/inclusive_scan.hpp>
|
||||
#include <sprout/numeric/fit/transform_exclusive_scan.hpp>
|
||||
#include <sprout/numeric/fit/transform_inclusive_scan.hpp>
|
||||
#include <sprout/numeric/fit/adjacent_difference.hpp>
|
||||
#include <sprout/numeric/fit/iota.hpp>
|
||||
|
||||
|
|
51
sprout/numeric/fit/transform_exclusive_scan.hpp
Normal file
51
sprout/numeric/fit/transform_exclusive_scan.hpp
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2017 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_FIT_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
||||
#define SPROUT_NUMERIC_FIT_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/numeric/fixed/transform_exclusive_scan.hpp>
|
||||
#include <sprout/algorithm/fit/results.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include <sprout/iterator/type_traits/category.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename InputIterator, typename Result, typename T, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::results::algorithm<Result>::type
|
||||
transform_exclusive_scan_impl(
|
||||
InputIterator const& first, InputIterator const& last, Result const& result, T init, BinaryOperation binary_op, UnaryOperation unary_op,
|
||||
typename sprout::container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
typedef typename std::iterator_traits<InputIterator>::difference_type diff_type;
|
||||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::transform_exclusive_scan(first, last, result, init, binary_op, unary_op)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min<diff_type>(sprout::distance(first, last), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// transform_exclusive_scan
|
||||
//
|
||||
template<typename InputIterator, typename Result, typename T, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::results::algorithm<Result>::type
|
||||
transform_exclusive_scan(InputIterator first, InputIterator last, Result const& result, T init, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
|
||||
return sprout::fit::detail::transform_exclusive_scan_impl(first, last, result, init, binary_op, unary_op, sprout::internal_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_NUMERIC_FIT_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
77
sprout/numeric/fit/transform_inclusive_scan.hpp
Normal file
77
sprout/numeric/fit/transform_inclusive_scan.hpp
Normal file
|
@ -0,0 +1,77 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2017 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_FIT_TRANSFORM_INCLUSIVE_SCAN_HPP
|
||||
#define SPROUT_NUMERIC_FIT_TRANSFORM_INCLUSIVE_SCAN_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/numeric/fixed/transform_inclusive_scan.hpp>
|
||||
#include <sprout/algorithm/fit/results.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include <sprout/iterator/type_traits/category.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename InputIterator, typename Result, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::results::algorithm<Result>::type
|
||||
transform_inclusive_scan_impl(
|
||||
InputIterator const& first, InputIterator const& last, Result const& result, BinaryOperation binary_op, UnaryOperation unary_op,
|
||||
typename sprout::container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
typedef typename std::iterator_traits<InputIterator>::difference_type diff_type;
|
||||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::transform_inclusive_scan(first, last, result, binary_op, unary_op)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min<diff_type>(sprout::distance(first, last), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// transform_inclusive_scan
|
||||
//
|
||||
template<typename InputIterator, typename Result, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::results::algorithm<Result>::type
|
||||
transform_inclusive_scan(InputIterator first, InputIterator last, Result const& result, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
|
||||
return sprout::fit::detail::transform_inclusive_scan_impl(first, last, result, binary_op, unary_op, sprout::internal_begin_offset(result));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename InputIterator, typename Result, typename BinaryOperation, typename UnaryOperation, typename T>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::results::algorithm<Result>::type
|
||||
transform_inclusive_scan_impl(
|
||||
InputIterator const& first, InputIterator const& last, Result const& result, BinaryOperation binary_op, UnaryOperation unary_op, T init,
|
||||
typename sprout::container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
typedef typename std::iterator_traits<InputIterator>::difference_type diff_type;
|
||||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::transform_inclusive_scan(first, last, result, binary_op, unary_op, init)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min<diff_type>(sprout::distance(first, last) + 1, sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// transform_inclusive_scan
|
||||
//
|
||||
template<typename InputIterator, typename Result, typename BinaryOperation, typename UnaryOperation, typename T>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::results::algorithm<Result>::type
|
||||
transform_inclusive_scan(InputIterator first, InputIterator last, Result const& result, BinaryOperation binary_op, UnaryOperation unary_op, T init) {
|
||||
static_assert(sprout::is_forward_iterator<InputIterator>::value, "Sorry, not implemented.");
|
||||
return sprout::fit::detail::transform_inclusive_scan_impl(first, last, result, binary_op, unary_op, init, sprout::internal_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_NUMERIC_FIT_TRANSFORM_INCLUSIVE_SCAN_HPP
|
|
@ -12,6 +12,8 @@
|
|||
#include <sprout/numeric/fixed/partial_sum.hpp>
|
||||
#include <sprout/numeric/fixed/exclusive_scan.hpp>
|
||||
#include <sprout/numeric/fixed/inclusive_scan.hpp>
|
||||
#include <sprout/numeric/fixed/transform_exclusive_scan.hpp>
|
||||
#include <sprout/numeric/fixed/transform_inclusive_scan.hpp>
|
||||
#include <sprout/numeric/fixed/adjacent_difference.hpp>
|
||||
#include <sprout/numeric/fixed/iota.hpp>
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include <sprout/algorithm/fixed/results.hpp>
|
||||
#include <sprout/pit/pit.hpp>
|
||||
#include <sprout/detail/container_complate.hpp>
|
||||
#include <sprout/numeric/fixed/exclusive_scan.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#ifndef SPROUT_NUMERIC_FIXED_INCLUSIVE_SCAN_HPP
|
||||
#define SPROUT_NUMERIC_FIXED_INCLUSIVE_SCAN_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
|
|
126
sprout/numeric/fixed/transform_exclusive_scan.hpp
Normal file
126
sprout/numeric/fixed/transform_exclusive_scan.hpp
Normal file
|
@ -0,0 +1,126 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2017 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_FIXED_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
||||
#define SPROUT_NUMERIC_FIXED_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/type_traits/is_iterator_of.hpp>
|
||||
#include <sprout/type_traits/enabler_if.hpp>
|
||||
#include <sprout/algorithm/fixed/results.hpp>
|
||||
#include <sprout/pit/pit.hpp>
|
||||
#include <sprout/detail/container_complate.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename InputIterator, typename Result, typename BinaryOperation, typename UnaryOperation, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == sizeof...(Args) + 1,
|
||||
typename sprout::fixed::results::algorithm<Result>::type
|
||||
>::type
|
||||
transform_exclusive_scan_impl_1(
|
||||
InputIterator const&, InputIterator const&, Result const& result, BinaryOperation, UnaryOperation,
|
||||
typename sprout::container_traits<Result>::size_type,
|
||||
typename sprout::container_traits<Result>::value_type const& value,
|
||||
typename sprout::container_traits<Result>::value_type const& temp,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sprout::remake<Result>(result, sprout::size(result), args..., value);
|
||||
}
|
||||
template<typename InputIterator, typename Result, typename BinaryOperation, typename UnaryOperation, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != sizeof...(Args) + 1,
|
||||
typename sprout::fixed::results::algorithm<Result>::type
|
||||
>::type
|
||||
transform_exclusive_scan_impl_1(
|
||||
InputIterator const& first, InputIterator const& last, Result const& result, BinaryOperation binary_op, UnaryOperation unary_op,
|
||||
typename sprout::container_traits<Result>::size_type size,
|
||||
typename sprout::container_traits<Result>::value_type const& value,
|
||||
typename sprout::container_traits<Result>::value_type const& temp,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return first != last && sizeof...(Args) + 1 < size
|
||||
? transform_exclusive_scan_impl_1(sprout::next(first), last, result, binary_op, unary_op, size, binary_op(value, temp), unary_op(*first), args..., value)
|
||||
: sprout::detail::container_complate(result, args..., value)
|
||||
;
|
||||
}
|
||||
template<typename InputIterator, typename Result, typename T, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == 0,
|
||||
typename sprout::fixed::results::algorithm<Result>::type
|
||||
>::type
|
||||
transform_exclusive_scan_impl(
|
||||
InputIterator, InputIterator, Result const& result, T, BinaryOperation, UnaryOperation,
|
||||
typename sprout::container_traits<Result>::size_type
|
||||
)
|
||||
{
|
||||
return sprout::detail::container_complate(result);
|
||||
}
|
||||
template<typename InputIterator, typename Result, typename T, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == 1,
|
||||
typename sprout::fixed::results::algorithm<Result>::type
|
||||
>::type
|
||||
transform_exclusive_scan_impl(
|
||||
InputIterator, InputIterator, Result const& result, T init, BinaryOperation, UnaryOperation,
|
||||
typename sprout::container_traits<Result>::size_type
|
||||
)
|
||||
{
|
||||
return sprout::detail::container_complate(result, init);
|
||||
}
|
||||
template<typename InputIterator, typename Result, typename T, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
(sprout::container_traits<Result>::static_size > 1),
|
||||
typename sprout::fixed::results::algorithm<Result>::type
|
||||
>::type
|
||||
transform_exclusive_scan_impl(
|
||||
InputIterator const& first, InputIterator const& last, Result const& result, T init, BinaryOperation binary_op, UnaryOperation unary_op,
|
||||
typename sprout::container_traits<Result>::size_type size
|
||||
)
|
||||
{
|
||||
return first != last
|
||||
? transform_exclusive_scan_impl_1(sprout::next(first), last, result, binary_op, unary_op, size, init, unary_op(*first))
|
||||
: sprout::detail::container_complate(result, init)
|
||||
;
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// transform_exclusive_scan
|
||||
//
|
||||
template<typename InputIterator, typename Result, typename T, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
|
||||
transform_exclusive_scan(InputIterator first, InputIterator last, Result const& result, T init, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
return sprout::fixed::detail::transform_exclusive_scan_impl(first, last, result, init, binary_op, unary_op, sprout::size(result));
|
||||
}
|
||||
template<typename Result, typename InputIterator, typename T, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
|
||||
transform_exclusive_scan(InputIterator first, InputIterator last, T init, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
return sprout::fixed::transform_exclusive_scan(first, last, sprout::pit<Result>(), init, binary_op, unary_op);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
template<
|
||||
typename InputIterator, typename Result, typename T, typename BinaryOperation, typename UnaryOperation,
|
||||
typename sprout::enabler_if<!sprout::is_iterator_outputable<Result>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
|
||||
transform_exclusive_scan(InputIterator first, InputIterator last, Result const& result, T init, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
return sprout::fixed::transform_exclusive_scan(first, last, result, init, binary_op, unary_op);
|
||||
}
|
||||
template<typename Result, typename InputIterator, typename T, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
|
||||
transform_exclusive_scan(InputIterator first, InputIterator last, T init, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
return sprout::fixed::transform_exclusive_scan<Result>(first, last, init, binary_op, unary_op);
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_NUMERIC_FIXED_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
183
sprout/numeric/fixed/transform_inclusive_scan.hpp
Normal file
183
sprout/numeric/fixed/transform_inclusive_scan.hpp
Normal file
|
@ -0,0 +1,183 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2017 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_FIXED_TRANSFORM_INCLUSIVE_SCAN_HPP
|
||||
#define SPROUT_NUMERIC_FIXED_TRANSFORM_INCLUSIVE_SCAN_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/iterator/type_traits/is_iterator_of.hpp>
|
||||
#include <sprout/type_traits/enabler_if.hpp>
|
||||
#include <sprout/algorithm/fixed/results.hpp>
|
||||
#include <sprout/pit/pit.hpp>
|
||||
#include <sprout/detail/container_complate.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename InputIterator, typename Result, typename BinaryOperation, typename UnaryOperation, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == sizeof...(Args) + 1,
|
||||
typename sprout::fixed::results::algorithm<Result>::type
|
||||
>::type
|
||||
transform_inclusive_scan_impl_1(
|
||||
InputIterator const&, InputIterator const&, Result const& result, BinaryOperation, UnaryOperation,
|
||||
typename sprout::container_traits<Result>::size_type,
|
||||
typename sprout::container_traits<Result>::value_type const& value,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sprout::remake<Result>(result, sprout::size(result), args..., value);
|
||||
}
|
||||
template<typename InputIterator, typename Result, typename BinaryOperation, typename UnaryOperation, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != sizeof...(Args) + 1,
|
||||
typename sprout::fixed::results::algorithm<Result>::type
|
||||
>::type
|
||||
transform_inclusive_scan_impl_1(
|
||||
InputIterator const& first, InputIterator const& last, Result const& result, BinaryOperation binary_op, UnaryOperation unary_op,
|
||||
typename sprout::container_traits<Result>::size_type size,
|
||||
typename sprout::container_traits<Result>::value_type const& value,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return first != last && sizeof...(Args) + 1 < size
|
||||
? transform_inclusive_scan_impl_1(sprout::next(first), last, result, binary_op, unary_op, size, binary_op(value, unary_op(*first)), args..., value)
|
||||
: sprout::detail::container_complate(result, args..., value)
|
||||
;
|
||||
}
|
||||
template<typename InputIterator, typename Result, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == 0,
|
||||
typename sprout::fixed::results::algorithm<Result>::type
|
||||
>::type
|
||||
transform_inclusive_scan_impl(
|
||||
InputIterator, InputIterator, Result const& result, BinaryOperation, UnaryOperation,
|
||||
typename sprout::container_traits<Result>::size_type
|
||||
)
|
||||
{
|
||||
return sprout::remake<Result>(result, sprout::size(result));
|
||||
}
|
||||
template<typename InputIterator, typename Result, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != 0,
|
||||
typename sprout::fixed::results::algorithm<Result>::type
|
||||
>::type
|
||||
transform_inclusive_scan_impl(
|
||||
InputIterator const& first, InputIterator const& last, Result const& result, BinaryOperation binary_op, UnaryOperation unary_op,
|
||||
typename sprout::container_traits<Result>::size_type size
|
||||
)
|
||||
{
|
||||
return first != last
|
||||
? transform_inclusive_scan_impl_1(sprout::next(first), last, result, binary_op, unary_op, size, unary_op(*first))
|
||||
: sprout::detail::container_complate(result)
|
||||
;
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// transform_inclusive_scan
|
||||
//
|
||||
template<typename InputIterator, typename Result, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
|
||||
transform_inclusive_scan(InputIterator first, InputIterator last, Result const& result, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
return sprout::fixed::detail::transform_inclusive_scan_impl(first, last, result, binary_op, unary_op, sprout::size(result));
|
||||
}
|
||||
template<typename Result, typename InputIterator, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
|
||||
transform_inclusive_scan(InputIterator first, InputIterator last, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
return sprout::fixed::transform_inclusive_scan(first, last, sprout::pit<Result>(), binary_op, unary_op);
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename InputIterator, typename Result, typename BinaryOperation, typename UnaryOperation, typename T>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == 0,
|
||||
typename sprout::fixed::results::algorithm<Result>::type
|
||||
>::type
|
||||
transform_inclusive_scan_impl(
|
||||
InputIterator, InputIterator, Result const& result, BinaryOperation, T,
|
||||
typename sprout::container_traits<Result>::size_type
|
||||
)
|
||||
{
|
||||
return sprout::remake<Result>(result, sprout::size(result));
|
||||
}
|
||||
template<typename InputIterator, typename Result, typename BinaryOperation, typename UnaryOperation, typename T>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == 1,
|
||||
typename sprout::fixed::results::algorithm<Result>::type
|
||||
>::type
|
||||
transform_inclusive_scan_impl(
|
||||
InputIterator, InputIterator, Result const& result, BinaryOperation, T init,
|
||||
typename sprout::container_traits<Result>::size_type
|
||||
)
|
||||
{
|
||||
return sprout::remake<Result>(result, sprout::size(result), init);
|
||||
}
|
||||
template<typename InputIterator, typename Result, typename BinaryOperation, typename UnaryOperation, typename T>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
(sprout::container_traits<Result>::static_size > 1),
|
||||
typename sprout::fixed::results::algorithm<Result>::type
|
||||
>::type
|
||||
transform_inclusive_scan_impl(
|
||||
InputIterator const& first, InputIterator const& last, Result const& result, BinaryOperation binary_op, UnaryOperation unary_op, T init,
|
||||
typename sprout::container_traits<Result>::size_type size
|
||||
)
|
||||
{
|
||||
return first != last
|
||||
? transform_inclusive_scan_impl_1(first, last, result, binary_op, unary_op, size, init)
|
||||
: sprout::detail::container_complate(result, init)
|
||||
;
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// transform_inclusive_scan
|
||||
//
|
||||
template<typename InputIterator, typename Result, typename BinaryOperation, typename UnaryOperation, typename T>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
|
||||
transform_inclusive_scan(InputIterator first, InputIterator last, Result const& result, BinaryOperation binary_op, UnaryOperation unary_op, T init) {
|
||||
return sprout::fixed::detail::transform_inclusive_scan_impl(first, last, result, binary_op, unary_op, init, sprout::size(result));
|
||||
}
|
||||
template<typename Result, typename InputIterator, typename BinaryOperation, typename UnaryOperation, typename T>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
|
||||
transform_inclusive_scan(InputIterator first, InputIterator last, BinaryOperation binary_op, UnaryOperation unary_op, T init) {
|
||||
return sprout::fixed::transform_inclusive_scan(first, last, sprout::pit<Result>(), binary_op, unary_op, init);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
template<
|
||||
typename InputIterator, typename Result, typename BinaryOperation, typename UnaryOperation,
|
||||
typename sprout::enabler_if<!sprout::is_iterator_outputable<Result>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
|
||||
transform_inclusive_scan(InputIterator first, InputIterator last, Result const& result, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
return sprout::fixed::transform_inclusive_scan(first, last, result, binary_op, unary_op);
|
||||
}
|
||||
template<typename Result, typename InputIterator, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
|
||||
transform_inclusive_scan(InputIterator first, InputIterator last, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
return sprout::fixed::transform_inclusive_scan<Result>(first, last, binary_op, unary_op);
|
||||
}
|
||||
|
||||
template<
|
||||
typename InputIterator, typename Result, typename BinaryOperation, typename UnaryOperation, typename T,
|
||||
typename sprout::enabler_if<!sprout::is_iterator_outputable<Result>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
|
||||
transform_inclusive_scan(InputIterator first, InputIterator last, Result const& result, BinaryOperation binary_op, UnaryOperation unary_op, T init) {
|
||||
return sprout::fixed::transform_inclusive_scan(first, last, result, binary_op, unary_op, init);
|
||||
}
|
||||
template<typename Result, typename InputIterator, typename BinaryOperation, typename UnaryOperation, typename T>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
|
||||
transform_inclusive_scan(InputIterator first, InputIterator last, BinaryOperation binary_op, UnaryOperation unary_op, T init) {
|
||||
return sprout::fixed::transform_inclusive_scan<Result>(first, last, binary_op, unary_op, unary_op, init);
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_NUMERIC_FIXED_TRANSFORM_INCLUSIVE_SCAN_HPP
|
16
sprout/numeric/transform_exclusive_scan.hpp
Normal file
16
sprout/numeric/transform_exclusive_scan.hpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2017 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_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
||||
#define SPROUT_NUMERIC_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/numeric/fixed/transform_exclusive_scan.hpp>
|
||||
#include <sprout/numeric/fit/transform_exclusive_scan.hpp>
|
||||
#include <sprout/numeric/cxx14/transform_exclusive_scan.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_NUMERIC_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
16
sprout/numeric/transform_inclusive_scan.hpp
Normal file
16
sprout/numeric/transform_inclusive_scan.hpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2017 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_TRANSFORM_INCLUSIVE_SCAN_HPP
|
||||
#define SPROUT_NUMERIC_TRANSFORM_INCLUSIVE_SCAN_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/numeric/fixed/transform_inclusive_scan.hpp>
|
||||
#include <sprout/numeric/fit/transform_inclusive_scan.hpp>
|
||||
#include <sprout/numeric/cxx14/transform_inclusive_scan.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_NUMERIC_TRANSFORM_INCLUSIVE_SCAN_HPP
|
|
@ -12,6 +12,8 @@
|
|||
#include <sprout/range/numeric/cxx14/partial_sum.hpp>
|
||||
#include <sprout/range/numeric/cxx14/exclusive_scan.hpp>
|
||||
#include <sprout/range/numeric/cxx14/inclusive_scan.hpp>
|
||||
#include <sprout/range/numeric/cxx14/transform_exclusive_scan.hpp>
|
||||
#include <sprout/range/numeric/cxx14/transform_inclusive_scan.hpp>
|
||||
#include <sprout/range/numeric/cxx14/adjacent_difference.hpp>
|
||||
#include <sprout/range/numeric/cxx14/iota.hpp>
|
||||
|
||||
|
|
34
sprout/range/numeric/cxx14/transform_exclusive_scan.hpp
Normal file
34
sprout/range/numeric/cxx14/transform_exclusive_scan.hpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2017 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_RANGE_NUMERIC_CXX14_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
||||
#define SPROUT_RANGE_NUMERIC_CXX14_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/type_traits/is_iterator_of.hpp>
|
||||
#include <sprout/type_traits/enabler_if.hpp>
|
||||
#include <sprout/numeric/cxx14/transform_exclusive_scan.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace range {
|
||||
//
|
||||
// transform_exclusive_scan
|
||||
//
|
||||
template<
|
||||
typename InputRange, typename OutputIterator, typename T, typename BinaryOperation, typename UnaryOperation,
|
||||
typename sprout::enabler_if<sprout::is_iterator_outputable<OutputIterator>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR OutputIterator
|
||||
transform_exclusive_scan(InputRange const& rng, OutputIterator result, T init, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
return sprout::transform_exclusive_scan(sprout::begin(rng), sprout::end(rng), result, init, binary_op, unary_op);
|
||||
}
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_NUMERIC_CXX14_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
42
sprout/range/numeric/cxx14/transform_inclusive_scan.hpp
Normal file
42
sprout/range/numeric/cxx14/transform_inclusive_scan.hpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2017 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_RANGE_NUMERIC_CXX14_TRANSFORM_INCLUSIVE_SCAN_HPP
|
||||
#define SPROUT_RANGE_NUMERIC_CXX14_TRANSFORM_INCLUSIVE_SCAN_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/type_traits/is_iterator_of.hpp>
|
||||
#include <sprout/type_traits/enabler_if.hpp>
|
||||
#include <sprout/numeric/cxx14/transform_inclusive_scan.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace range {
|
||||
//
|
||||
// transform_inclusive_scan
|
||||
//
|
||||
template<
|
||||
typename InputRange, typename OutputIterator, typename BinaryOperation, typename UnaryOperation,
|
||||
typename sprout::enabler_if<sprout::is_iterator_outputable<OutputIterator>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR OutputIterator
|
||||
transform_inclusive_scan(InputRange const& rng, OutputIterator result, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
return sprout::transform_inclusive_scan(sprout::begin(rng), sprout::end(rng), result, binary_op, unary_op);
|
||||
}
|
||||
template<
|
||||
typename InputRange, typename OutputIterator, typename BinaryOperation, typename UnaryOperation, typename T,
|
||||
typename sprout::enabler_if<sprout::is_iterator_outputable<OutputIterator>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR OutputIterator
|
||||
transform_inclusive_scan(InputRange const& rng, OutputIterator result, BinaryOperation binary_op, UnaryOperation unary_op, T init) {
|
||||
return sprout::transform_inclusive_scan(sprout::begin(rng), sprout::end(rng), result, binary_op, unary_op, init);
|
||||
}
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_NUMERIC_CXX14_TRANSFORM_INCLUSIVE_SCAN_HPP
|
|
@ -11,5 +11,6 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/range/numeric/fixed/exclusive_scan.hpp>
|
||||
#include <sprout/range/numeric/fit/exclusive_scan.hpp>
|
||||
#include <sprout/range/numeric/cxx14/exclusive_scan.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_NUMERIC_EXCLUSIVE_SCAN_HPP
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#include <sprout/range/numeric/fit/partial_sum.hpp>
|
||||
#include <sprout/range/numeric/fit/exclusive_scan.hpp>
|
||||
#include <sprout/range/numeric/fit/inclusive_scan.hpp>
|
||||
#include <sprout/range/numeric/fit/transform_exclusive_scan.hpp>
|
||||
#include <sprout/range/numeric/fit/transform_inclusive_scan.hpp>
|
||||
#include <sprout/range/numeric/fit/adjacent_difference.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_NUMERIC_FIT_HPP
|
||||
|
|
38
sprout/range/numeric/fit/transform_exclusive_scan.hpp
Normal file
38
sprout/range/numeric/fit/transform_exclusive_scan.hpp
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2017 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_RANGE_NUMERIC_FIT_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
||||
#define SPROUT_RANGE_NUMERIC_FIT_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/fit/results.hpp>
|
||||
#include <sprout/numeric/fit/transform_exclusive_scan.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace range {
|
||||
namespace fit {
|
||||
//
|
||||
// transform_exclusive_scan
|
||||
//
|
||||
template<typename InputRange, typename Result, typename T, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::results::algorithm<Result>::type
|
||||
transform_exclusive_scan(InputRange const& rng, Result const& result, T init, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
return sprout::fit::transform_exclusive_scan(sprout::begin(rng), sprout::end(rng), result, init, binary_op, unary_op);
|
||||
}
|
||||
|
||||
template<typename Result, typename InputRange, typename T, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::results::algorithm<Result>::type
|
||||
transform_exclusive_scan(InputRange const& rng, T init, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
return sprout::fit::transform_exclusive_scan<Result>(sprout::begin(rng), sprout::end(rng), init, binary_op, unary_op);
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_NUMERIC_FIT_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
53
sprout/range/numeric/fit/transform_inclusive_scan.hpp
Normal file
53
sprout/range/numeric/fit/transform_inclusive_scan.hpp
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2017 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_RANGE_NUMERIC_FIT_TRANSFORM_INCLUSIVE_SCAN_HPP
|
||||
#define SPROUT_RANGE_NUMERIC_FIT_TRANSFORM_INCLUSIVE_SCAN_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/fit/results.hpp>
|
||||
#include <sprout/numeric/fit/transform_inclusive_scan.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace range {
|
||||
namespace fit {
|
||||
//
|
||||
// transform_inclusive_scan
|
||||
//
|
||||
template<typename InputRange, typename Result, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::results::algorithm<Result>::type
|
||||
transform_inclusive_scan(InputRange const& rng, Result const& result, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
return sprout::fit::transform_inclusive_scan(sprout::begin(rng), sprout::end(rng), result, binary_op, unary_op);
|
||||
}
|
||||
template<typename InputRange, typename Result, typename BinaryOperation, typename UnaryOperation, typename T>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::results::algorithm<Result>::type
|
||||
transform_inclusive_scan(InputRange const& rng, Result const& result, BinaryOperation binary_op, UnaryOperation unary_op, T init) {
|
||||
return sprout::fit::transform_inclusive_scan(sprout::begin(rng), sprout::end(rng), result, binary_op, unary_op, init);
|
||||
}
|
||||
|
||||
template<typename Result, typename InputRange>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::results::algorithm<Result>::type
|
||||
transform_inclusive_scan(InputRange const& rng) {
|
||||
return sprout::fit::transform_inclusive_scan<Result>(sprout::begin(rng), sprout::end(rng));
|
||||
}
|
||||
template<typename Result, typename InputRange, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::results::algorithm<Result>::type
|
||||
transform_inclusive_scan(InputRange const& rng, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
return sprout::fit::transform_inclusive_scan<Result>(sprout::begin(rng), sprout::end(rng), binary_op, unary_op);
|
||||
}
|
||||
template<typename Result, typename InputRange, typename BinaryOperation, typename UnaryOperation, typename T>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fit::results::algorithm<Result>::type
|
||||
transform_inclusive_scan(InputRange const& rng, BinaryOperation binary_op, UnaryOperation unary_op, T init) {
|
||||
return sprout::fit::transform_inclusive_scan<Result>(sprout::begin(rng), sprout::end(rng), binary_op, unary_op, init);
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_NUMERIC_FIT_TRANSFORM_INCLUSIVE_SCAN_HPP
|
|
@ -12,6 +12,8 @@
|
|||
#include <sprout/range/numeric/fixed/partial_sum.hpp>
|
||||
#include <sprout/range/numeric/fixed/exclusive_scan.hpp>
|
||||
#include <sprout/range/numeric/fixed/inclusive_scan.hpp>
|
||||
#include <sprout/range/numeric/fixed/transform_exclusive_scan.hpp>
|
||||
#include <sprout/range/numeric/fixed/transform_inclusive_scan.hpp>
|
||||
#include <sprout/range/numeric/fixed/adjacent_difference.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_NUMERIC_FIXED_HPP
|
||||
|
|
45
sprout/range/numeric/fixed/transform_exclusive_scan.hpp
Normal file
45
sprout/range/numeric/fixed/transform_exclusive_scan.hpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2017 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_RANGE_NUMERIC_FIXED_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
||||
#define SPROUT_RANGE_NUMERIC_FIXED_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/type_traits/is_iterator_of.hpp>
|
||||
#include <sprout/type_traits/enabler_if.hpp>
|
||||
#include <sprout/algorithm/fixed/results.hpp>
|
||||
#include <sprout/numeric/fixed/transform_exclusive_scan.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace range {
|
||||
namespace fixed {
|
||||
//
|
||||
// transform_exclusive_scan
|
||||
//
|
||||
template<
|
||||
typename InputRange, typename Result, typename T, typename BinaryOperation, typename UnaryOperation,
|
||||
typename sprout::enabler_if<!sprout::is_iterator_outputable<Result>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
|
||||
transform_exclusive_scan(InputRange const& rng, Result const& result, T init, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
return sprout::fixed::transform_exclusive_scan(sprout::begin(rng), sprout::end(rng), result, init, binary_op, unary_op);
|
||||
}
|
||||
|
||||
template<typename Result, typename InputRange, typename T, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
|
||||
transform_exclusive_scan(InputRange const& rng, T init, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
return sprout::fixed::transform_exclusive_scan<Result>(sprout::begin(rng), sprout::end(rng), init, binary_op, unary_op);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::range::fixed::transform_exclusive_scan;
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_NUMERIC_FIXED_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
63
sprout/range/numeric/fixed/transform_inclusive_scan.hpp
Normal file
63
sprout/range/numeric/fixed/transform_inclusive_scan.hpp
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2017 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_RANGE_NUMERIC_FIXED_TRANSFORM_INCLUSIVE_SCAN_HPP
|
||||
#define SPROUT_RANGE_NUMERIC_FIXED_TRANSFORM_INCLUSIVE_SCAN_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/type_traits/is_iterator_of.hpp>
|
||||
#include <sprout/type_traits/enabler_if.hpp>
|
||||
#include <sprout/algorithm/fixed/results.hpp>
|
||||
#include <sprout/numeric/fixed/transform_inclusive_scan.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace range {
|
||||
namespace fixed {
|
||||
//
|
||||
// transform_inclusive_scan
|
||||
//
|
||||
template<
|
||||
typename InputRange, typename Result, typename BinaryOperation, typename UnaryOperation,
|
||||
typename sprout::enabler_if<!sprout::is_iterator_outputable<Result>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
|
||||
transform_inclusive_scan(InputRange const& rng, Result const& result, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
return sprout::fixed::transform_inclusive_scan(sprout::begin(rng), sprout::end(rng), result, binary_op, unary_op);
|
||||
}
|
||||
template<
|
||||
typename InputRange, typename Result, typename BinaryOperation, typename UnaryOperation, typename T,
|
||||
typename sprout::enabler_if<!sprout::is_iterator_outputable<Result>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
|
||||
transform_inclusive_scan(InputRange const& rng, Result const& result, BinaryOperation binary_op, UnaryOperation unary_op, T init) {
|
||||
return sprout::fixed::transform_inclusive_scan(sprout::begin(rng), sprout::end(rng), result, binary_op, unary_op, init);
|
||||
}
|
||||
|
||||
template<typename Result, typename InputRange>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
|
||||
transform_inclusive_scan(InputRange const& rng) {
|
||||
return sprout::fixed::transform_inclusive_scan<Result>(sprout::begin(rng), sprout::end(rng));
|
||||
}
|
||||
template<typename Result, typename InputRange, typename BinaryOperation, typename UnaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
|
||||
transform_inclusive_scan(InputRange const& rng, BinaryOperation binary_op, UnaryOperation unary_op) {
|
||||
return sprout::fixed::transform_inclusive_scan<Result>(sprout::begin(rng), sprout::end(rng), binary_op, unary_op);
|
||||
}
|
||||
template<typename Result, typename InputRange, typename BinaryOperation, typename UnaryOperation, typename T>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
|
||||
transform_inclusive_scan(InputRange const& rng, BinaryOperation binary_op, UnaryOperation unary_op, T init) {
|
||||
return sprout::fixed::transform_inclusive_scan<Result>(sprout::begin(rng), sprout::end(rng), binary_op, unary_op, init);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::range::fixed::transform_inclusive_scan;
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_NUMERIC_FIXED_TRANSFORM_INCLUSIVE_SCAN_HPP
|
|
@ -11,5 +11,6 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/range/numeric/fixed/inclusive_scan.hpp>
|
||||
#include <sprout/range/numeric/fit/inclusive_scan.hpp>
|
||||
#include <sprout/range/numeric/cxx14/inclusive_scan.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_NUMERIC_INCLUSIVE_SCAN_HPP
|
||||
|
|
16
sprout/range/numeric/transform_exclusive_scan.hpp
Normal file
16
sprout/range/numeric/transform_exclusive_scan.hpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2017 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_RANGE_NUMERIC_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
||||
#define SPROUT_RANGE_NUMERIC_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/range/numeric/fixed/transform_exclusive_scan.hpp>
|
||||
#include <sprout/range/numeric/fit/transform_exclusive_scan.hpp>
|
||||
#include <sprout/range/numeric/cxx14/transform_exclusive_scan.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_NUMERIC_TRANSFORM_EXCLUSIVE_SCAN_HPP
|
16
sprout/range/numeric/transform_inclusive_scan.hpp
Normal file
16
sprout/range/numeric/transform_inclusive_scan.hpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2017 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_RANGE_NUMERIC_TRANSFORM_INCLUSIVE_SCAN_HPP
|
||||
#define SPROUT_RANGE_NUMERIC_TRANSFORM_INCLUSIVE_SCAN_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/range/numeric/fixed/transform_inclusive_scan.hpp>
|
||||
#include <sprout/range/numeric/fit/transform_inclusive_scan.hpp>
|
||||
#include <sprout/range/numeric/cxx14/transform_inclusive_scan.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_NUMERIC_TRANSFORM_INCLUSIVE_SCAN_HPP
|
Loading…
Reference in a new issue