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_EXCLUSIVE_SCAN_HPP
0012 #define BOOST_COMPUTE_ALGORITHM_EXCLUSIVE_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
0054
0055 template<class InputIterator, class OutputIterator, class T, class BinaryOperator>
0056 inline OutputIterator
0057 exclusive_scan(InputIterator first,
0058 InputIterator last,
0059 OutputIterator result,
0060 T init,
0061 BinaryOperator binary_op,
0062 command_queue &queue = system::default_queue())
0063 {
0064 BOOST_STATIC_ASSERT(is_device_iterator<InputIterator>::value);
0065 BOOST_STATIC_ASSERT(is_device_iterator<OutputIterator>::value);
0066 return detail::scan(first, last, result, true, init, binary_op, queue);
0067 }
0068
0069
0070 template<class InputIterator, class OutputIterator, class T>
0071 inline OutputIterator
0072 exclusive_scan(InputIterator first,
0073 InputIterator last,
0074 OutputIterator result,
0075 T init,
0076 command_queue &queue = system::default_queue())
0077 {
0078 BOOST_STATIC_ASSERT(is_device_iterator<InputIterator>::value);
0079 BOOST_STATIC_ASSERT(is_device_iterator<OutputIterator>::value);
0080 typedef typename
0081 std::iterator_traits<OutputIterator>::value_type output_type;
0082
0083 return detail::scan(first, last, result, true,
0084 init, boost::compute::plus<output_type>(),
0085 queue);
0086 }
0087
0088
0089 template<class InputIterator, class OutputIterator>
0090 inline OutputIterator
0091 exclusive_scan(InputIterator first,
0092 InputIterator last,
0093 OutputIterator result,
0094 command_queue &queue = system::default_queue())
0095 {
0096 BOOST_STATIC_ASSERT(is_device_iterator<InputIterator>::value);
0097 BOOST_STATIC_ASSERT(is_device_iterator<OutputIterator>::value);
0098 typedef typename
0099 std::iterator_traits<OutputIterator>::value_type output_type;
0100
0101 return detail::scan(first, last, result, true,
0102 output_type(0), boost::compute::plus<output_type>(),
0103 queue);
0104 }
0105
0106 }
0107 }
0108
0109 #endif