...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::compute::max_element
// In header: <boost/compute/algorithm/max_element.hpp> template<typename InputIterator, typename Compare> InputIterator max_element(InputIterator first, InputIterator last, Compare compare, command_queue & queue = system::default_queue()); template<typename InputIterator> InputIterator max_element(InputIterator first, InputIterator last, command_queue & queue = system::default_queue());
Returns an iterator pointing to the element in the range [first
, last
) with the maximum value.
For example, to find int2
value with maximum first component in given vector:
// comparison function object BOOST_COMPUTE_FUNCTION(bool, compare_first, (const int2_ &a, const int2_ &b), { return a.x < b.x; }); // create vector boost::compute::vector<uint2_> data = ... boost::compute::vector<uint2_>::iterator max = boost::compute::max_element(data.begin(), data.end(), compare_first, queue);
Space complexity on CPUs: \Omega(1)
Space complexity on GPUs: \Omega(N)
See Also:
min_element()
Parameters: |
|