File indexing completed on 2025-01-18 09:29:56
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_COMPUTE_ALGORITHM_INCLUSIVE_SCAN_HPP
0012 #define BOOST_COMPUTE_ALGORITHM_INCLUSIVE_SCAN_HPP
0013
0014 #include <boost/static_assert.hpp>
0015
0016 #include <boost/compute/functional.hpp>
0017 #include <boost/compute/system.hpp>
0018 #include <boost/compute/command_queue.hpp>
0019 #include <boost/compute/algorithm/detail/scan.hpp>
0020 #include <boost/compute/type_traits/is_device_iterator.hpp>
0021
0022 namespace boost {
0023 namespace compute {
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053 template<class InputIterator, class OutputIterator, class BinaryOperator>
0054 inline OutputIterator
0055 inclusive_scan(InputIterator first,
0056 InputIterator last,
0057 OutputIterator result,
0058 BinaryOperator binary_op,
0059 command_queue &queue = system::default_queue())
0060 {
0061 BOOST_STATIC_ASSERT(is_device_iterator<InputIterator>::value);
0062 BOOST_STATIC_ASSERT(is_device_iterator<OutputIterator>::value);
0063 typedef typename
0064 std::iterator_traits<OutputIterator>::value_type output_type;
0065
0066 return detail::scan(first, last, result, false,
0067 output_type(0), binary_op,
0068 queue);
0069 }
0070
0071
0072 template<class InputIterator, class OutputIterator>
0073 inline OutputIterator
0074 inclusive_scan(InputIterator first,
0075 InputIterator last,
0076 OutputIterator result,
0077 command_queue &queue = system::default_queue())
0078 {
0079 BOOST_STATIC_ASSERT(is_device_iterator<InputIterator>::value);
0080 BOOST_STATIC_ASSERT(is_device_iterator<OutputIterator>::value);
0081 typedef typename
0082 std::iterator_traits<OutputIterator>::value_type output_type;
0083
0084 return detail::scan(first, last, result, false,
0085 output_type(0), boost::compute::plus<output_type>(),
0086 queue);
0087 }
0088
0089 }
0090 }
0091
0092 #endif