Bolt
1.1
C++ template library with support for OpenCL
|
Functions | |
template<typename ForwardIterator , typename T > | |
bool | bolt::cl::binary_search (bolt::cl::control &ctl, ForwardIterator first, ForwardIterator last, const T &value, const std::string &cl_code="") |
This version of binary search returns true if the search value is present within the given input range and false otherwise. The routine requires the elements to be arranged in ascending/descending order. It returns true iff there exists an iterator i in [first, last) such that *i < value and value < *i are both false. | |
template<typename ForwardIterator , typename T > | |
bool | bolt::cl::binary_search (ForwardIterator first, ForwardIterator last, const T &value, const std::string &cl_code="") |
template<typename ForwardIterator , typename T , typename StrictWeakOrdering > | |
bool | bolt::cl::binary_search (bolt::cl::control &ctl, ForwardIterator first, ForwardIterator last, const T &value, StrictWeakOrdering comp, const std::string &cl_code="") |
This version of binary search returns true if the search value is present within the given input range and false otherwise. The routine requires the elements to be arranged in ascending/descending order. It returns true iff there exists an iterator i in [first, last) such that comp(*i, value) and comp(value, *i) are both false. | |
template<typename ForwardIterator , typename T , typename StrictWeakOrdering > | |
bool | bolt::cl::binary_search (ForwardIterator first, ForwardIterator last, const T &value, StrictWeakOrdering comp, const std::string &cl_code="") |
bool bolt::cl::binary_search | ( | bolt::cl::control & | ctl, |
ForwardIterator | first, | ||
ForwardIterator | last, | ||
const T & | value, | ||
const std::string & | cl_code = "" |
||
) |
This version of binary search returns true if the search value is present within the given input range and false otherwise. The routine requires the elements to be arranged in ascending/descending order. It returns true iff there exists an iterator i in [first, last) such that *i < value and value < *i are both false.
The binary_search
operation is analogus to the std::binary_search function.
ctl | Optional Control structure to control command-queue, debug, tuning, etc. See bolt::cl::control. |
first | The first position in the sequence to search. |
last | The last position in the sequence to search. |
value | The value to search. |
cl_code | Optional OpenCL(TM) code to be passed to the OpenCL compiler. The cl_code is inserted first in the generated code, before the cl_code traits. This can be used for any extra cl code that is to be passed when compiling the OpenCl Kernel. |
ForwardIterator | An iterator that can be dereferenced for an object, and can be incremented to get to the next element in a sequence. |
T | The type of the search element. |
The following code example shows the use of binary_search
on the elements in the ascending order.
bool bolt::cl::binary_search | ( | bolt::cl::control & | ctl, |
ForwardIterator | first, | ||
ForwardIterator | last, | ||
const T & | value, | ||
StrictWeakOrdering | comp, | ||
const std::string & | cl_code = "" |
||
) |
This version of binary search returns true if the search value is present within the given input range and false otherwise. The routine requires the elements to be arranged in ascending/descending order. It returns true iff there exists an iterator i in [first, last) such that comp(*i, value) and comp(value, *i) are both false.
The binary_search
operation is analogus to the std::binary_search function.
ctl | Optional Control structure to control command-queue, debug, tuning, etc. See bolt::cl::control. |
first | The first position in the sequence to search. |
last | The last position in the sequence to search. |
value | The value to search. |
comp | The comparison operation used to compare two values. |
cl_code | Optional OpenCL(TM) code to be passed to the OpenCL compiler. The cl_code is inserted first in the generated code, before the cl_code traits. This can be used for any extra cl code that is to be passed when compiling the OpenCl Kernel. |
ForwardIterator | An iterator that can be dereferenced for an object, and can be incremented to get to the next element in a sequence. |
T | The type of the search element. |
The following code example shows the use of binary_search
on the elements in the descending order.