Bolt  1.1
C++ template library with support for OpenCL
Functions
CL-min_element

Functions

template<typename ForwardIterator >
ForwardIterator bolt::cl::min_element (bolt::cl::control &ctl, ForwardIterator first, ForwardIterator last, const std::string &cl_code="")
 The min_element returns the location of the first minimum element in the specified range.
 
template<typename ForwardIterator >
ForwardIterator bolt::cl::min_element (ForwardIterator first, ForwardIterator last, const std::string &cl_code="")
 
template<typename ForwardIterator , typename BinaryPredicate >
ForwardIterator bolt::cl::min_element (bolt::cl::control &ctl, ForwardIterator first, ForwardIterator last, BinaryPredicate binary_op, const std::string &cl_code="")
 The min_element returns the location of the first minimum element in the specified range using the specified binary_op.
 
template<typename ForwardIterator , typename BinaryPredicate >
ForwardIterator bolt::cl::min_element (ForwardIterator first, ForwardIterator last, BinaryPredicate binary_op, const std::string &cl_code="")
 

Detailed Description

Function Documentation

template<typename ForwardIterator >
ForwardIterator bolt::cl::min_element ( bolt::cl::control ctl,
ForwardIterator  first,
ForwardIterator  last,
const std::string &  cl_code = "" 
)

The min_element returns the location of the first minimum element in the specified range.

Parameters
ctlOptional Control structure to control command-queue, debug, tuning, etc. See bolt::cl::control.
firstA forward iterator addressing the position of the first element in the range to be searched for the minimum element
lastA forward iterator addressing the position one past the final element in the range to be searched for the minimum element
cl_codeOptional OpenCL(TM) code to be passed to the OpenCL compiler. The cl_code is inserted first in the generated code, before the cl_code trait.
Template Parameters
ForwardIteratorAn iterator that can be dereferenced for an object, and can be incremented to get to the next element in a sequence.
Returns
The position of the min_element.

The following code example shows how to find the position of the min_element of 10 numbers, using the default BinaryPredicate.

int a[10] = {4, 8, 6, 1, 5, 3, 10, 2, 9, 7};
int min_pos = bolt::cl::min_element(a, a+10);
// min_pos = 3
See Also
http://www.sgi.com/tech/stl/min_element.html
template<typename ForwardIterator , typename BinaryPredicate >
ForwardIterator bolt::cl::min_element ( bolt::cl::control ctl,
ForwardIterator  first,
ForwardIterator  last,
BinaryPredicate  binary_op,
const std::string &  cl_code = "" 
)

The min_element returns the location of the first minimum element in the specified range using the specified binary_op.

Parameters
ctlOptional Control structure to control command-queue, debug, tuning, etc. See bolt::cl::control.
firstA forward iterator addressing the position of the first element in the range to be searched for the minimum element
lastA forward iterator addressing the position one past the final element in the range to be searched for the minimum element
binary_opThe binary operation used to combine two values. By default, the binary operation is less<>().
cl_codeOptional OpenCL(TM) code to be passed to the OpenCL compiler. The cl_code is inserted first in the generated code, before the cl_code trait.
Template Parameters
ForwardIteratorAn iterator that can be dereferenced for an object, and can be incremented to get to the next element in a sequence.
BinaryPredicateA function object defining an operation that is applied to consecutive elements in the sequence.
Returns
The position of the min_element.

The following code example shows how to find the position of the max_element of 10 numbers, using the default less operator.

int a[10] = {4, 8, 6, 1, 5, 3, 10, 2, 9, 7};
int min_pos = bolt::cl::min_element(a, a+10, bolt::cl::less<T>());
// min_pos = 3
See Also
http://www.sgi.com/tech/stl/min_element.html