Function min_element
boost::compute::min_element
Synopsis
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());Description
Возвращает итератор, указывающий на элемент в диапазоне [<first>,<last>]] с минимальным значением.
Например, чтобы найти значение<int2>с минимальным первым компонентом в данном векторе:
BOOST_COMPUTE_FUNCTION(bool, compare_first, (const int2_ &a, const int2_ &b),
{
return a.x < b.x;
});
boost::compute::vector<uint2_> data = ...
boost::compute::vector<uint2_>::iterator min =
boost::compute::min_element(data.begin(), data.end(), compare_first, queue);
См. также:
max_element()
Параметры: | |
compare
| объект функции сравнения, который возвращается истинным, если первый аргумент меньше (т.е. упорядочен до) второго. |
<first> | Первый элемент входного диапазона |
<last> | последний элемент во входном диапазоне |
<queue> | командная очередь для выполнения операции |