mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-10-05 13:00:00 +00:00
porting sscrisk/CEL
This commit is contained in:
parent
ad60c8c530
commit
db20f64991
181 changed files with 2531 additions and 607 deletions
25
sprout/numeric/accumulate.hpp
Normal file
25
sprout/numeric/accumulate.hpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
#ifndef SPROUT_NUMERIC_ACCUMLATE_HPP
|
||||
#define SPROUT_NUMERIC_ACCUMLATE_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <sprout/config.hpp>
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
// Copyright (C) 2011 RiSK (sscrisk)
|
||||
|
||||
// 26.7.2 Accumulate
|
||||
template<class InputIterator, typename T, typename BinaryOperation>
|
||||
SPROUT_CONSTEXPR T accumulate(InputIterator first, InputIterator last, T init, BinaryOperation binary_op) {
|
||||
return first == last ? init
|
||||
: sprout::accumulate(first + 1, last, binary_op(init, *first), binary_op)
|
||||
;
|
||||
}
|
||||
|
||||
template<class InputIterator, typename T>
|
||||
SPROUT_CONSTEXPR T accumulate(InputIterator first, InputIterator last, T init) {
|
||||
return sprout::accumulate(first, last, init, NS_SSCRISK_CEL_OR_SPROUT::plus<typename std::iterator_traits<InputIterator>::value_type>());
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_NUMERIC_ACCUMLATE_HPP
|
|
@ -7,8 +7,8 @@
|
|||
#include <sprout/numeric/fixed/adjacent_difference.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
|
@ -24,7 +24,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::adjacent_difference(first, last, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result))
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
@ -54,7 +54,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::adjacent_difference(first, last, result, binary_op)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result))
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#include <sprout/numeric/fixed/partial_sum.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
|
@ -24,7 +24,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::partial_sum(first, last, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result))
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
@ -54,7 +54,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::partial_sum(first, last, result, binary_op)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result))
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
54
sprout/numeric/inner_product.hpp
Normal file
54
sprout/numeric/inner_product.hpp
Normal file
|
@ -0,0 +1,54 @@
|
|||
#ifndef SPROUT_NUMERIC_INNNER_PRODUCT_HPP
|
||||
#define SPROUT_NUMERIC_INNNER_PRODUCT_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
// Copyright (C) 2011 RiSK (sscrisk)
|
||||
|
||||
// 26.7.3 Inner product
|
||||
template<class InputIterator1, class InputIterator2, typename T, typename BinaryOperation1, typename BinaryOperation2>
|
||||
SPROUT_CONSTEXPR T inner_product(
|
||||
InputIterator1 first1,
|
||||
InputIterator1 last1,
|
||||
InputIterator2 first2,
|
||||
T init,
|
||||
BinaryOperation1 binary_op1,
|
||||
BinaryOperation2 binary_op2
|
||||
)
|
||||
{
|
||||
return first1 == last1 ? init
|
||||
: sprout::inner_product(
|
||||
sprout::next(first1),
|
||||
last1,
|
||||
sprout::next(first2),
|
||||
binary_op1(init, binary_op2(*first1, *first2)),
|
||||
binary_op1,
|
||||
binary_op2
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
template<class InputIterator1, typename InputIterator2, typename T>
|
||||
SPROUT_CONSTEXPR T inner_product(
|
||||
InputIterator1 first1,
|
||||
InputIterator1 last1,
|
||||
InputIterator2 first2,
|
||||
T init
|
||||
)
|
||||
{
|
||||
return sprout::inner_product(
|
||||
first1,
|
||||
last1,
|
||||
first2,
|
||||
init,
|
||||
sprout::plus<typename std::iterator_traits<InputIterator1>::value_type>(),
|
||||
NS_SSCRISK_CEL_OR_SPROUT::multiplies<typename std::iterator_traits<InputIterator1>::value_type>()
|
||||
);
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_NUMERIC_INNNER_PRODUCT_HPP
|
8
sprout/numeric/modifying.hpp
Normal file
8
sprout/numeric/modifying.hpp
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef SPROUT_NUMERIC_MODIFYIING_HPP
|
||||
#define SPROUT_NUMERIC_MODIFYIING_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/numeric/fixed.hpp>
|
||||
#include <sprout/numeric/fit.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_NUMERIC_MODIFYIING_HPP
|
8
sprout/numeric/non_modifying.hpp
Normal file
8
sprout/numeric/non_modifying.hpp
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef SPROUT_NUMERIC_NON_MODIFYIING_HPP
|
||||
#define SPROUT_NUMERIC_NON_MODIFYIING_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/numeric/accumulate.hpp>
|
||||
#include <sprout/numeric/inner_product.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_NUMERIC_NON_MODIFYIING_HPP
|
Loading…
Add table
Add a link
Reference in a new issue