...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::min_element
// In header: <boost/compute/algorithm/min_element.hpp> template<typename InputIterator, typename Compare> InputIterator min_element(InputIterator first, InputIterator last, Compare compare, command_queue & queue = system::default_queue()); template<typename InputIterator> InputIterator min_element(InputIterator first, InputIterator last, command_queue & queue = system::default_queue());
Returns an iterator pointing to the element in range [first
, last
) with the minimum value.
For example, to find int2
value with minimum 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 min = boost::compute::min_element(data.begin(), data.end(), compare_first, queue);
Space complexity on CPUs: \Omega(1)
Space complexity on GPUs: \Omega(N)
See Also:
max_element()
Parameters: |
|