Bolt  1.3
C++ template library with support for OpenCL
Functions
CL-merge

Functions

template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator >
OutputIterator bolt::cl::merge (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, const std::string &cl_code="")
 merge returns the result of combining the two sorted range [first1, last1] and [first2, last2] in to a single sorted range [result , result + (last1-first1) + ( last2-first2)]
 
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator >
OutputIterator bolt::cl::merge (bolt::cl::control &ctl, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, const std::string &cl_code="")
 
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename StrictWeakCompare >
OutputIterator bolt::cl::merge (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, StrictWeakCompare comp, const std::string &cl_code="")
 merge returns the result of combining the two sorted range [first1, last1] and [first2, last2] in to a single sorted range [result , result + (last1-first1) + ( last2-first2)]
 
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename StrictWeakCompare >
OutputIterator bolt::cl::merge (bolt::cl::control &ctl, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, StrictWeakCompare comp, const std::string &cl_code="")
 

Detailed Description

Function Documentation

template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator >
OutputIterator bolt::cl::merge ( InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
InputIterator2  last2,
OutputIterator  result,
const std::string &  cl_code = "" 
)

merge returns the result of combining the two sorted range [first1, last1] and [first2, last2] in to a single sorted range [result , result + (last1-first1) + ( last2-first2)]

The merge operation is similar the std::merge function

Parameters
ctlOptional Control structure to control command-queue, debug, tuning.
first1The beginning of the first input range.
last1The end of the first input range.
first2The beginning of the second input range.
last2The end of the second input range.
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
InputIterator1An iterator that can be dereferenced for an object, and can be incremented to get to the next element in a sequence.
InputIterator2An iterator that can be dereferenced for an object, and can be incremented to get to the next element in a sequence.
OutputIteratorisa model of Output Iterator
Returns
The beginning of the merge result

The following code example shows the use of merge operator.

#include <bolt/cl/merge.h>
int a[5] = {1,3, 5, 7, 9};
int b [5] = {2,4,6,8,10};
int r[10];
int *r_end = bolt::cl::merge(a, a+5,b,b+5,r);
// r = 1,2,3,4,5,6,7,8,9,10
See Also
http://www.sgi.com/tech/stl/merge.html
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename StrictWeakCompare >
OutputIterator bolt::cl::merge ( InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
InputIterator2  last2,
OutputIterator  result,
StrictWeakCompare  comp,
const std::string &  cl_code = "" 
)

merge returns the result of combining the two sorted range [first1, last1] and [first2, last2] in to a single sorted range [result , result + (last1-first1) + ( last2-first2)]

The merge operation is similar the std::merge function

Parameters
ctlOptional Control structure to control command-queue, debug, tuning.
first1The beginning of the first input range.
last1The end of the first input range.
first2The beginning of the second input range.
last2The end of the second input range.
compComparison operator.
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
InputIterator1An iterator that can be dereferenced for an object, and can be incremented to get to the next element in a sequence.
InputIterator2An iterator that can be dereferenced for an object, and can be incremented to get to the next element in a sequence.
OutputIteratorisa model of Output Iterator
StrictWeakCompareis a model of Strict Weak Ordering.
Returns
The beginning of the merge result.

The following code example shows the use of merge operator.

#include <bolt/cl/merge.h>
int a[5] = {9,7, 5, 3, 1};
int b [5] = {10,8,6,4,2};
int r[10];
int *r_end = bolt::cl::merge(a, a+5,b,b+5,r,bolt::cl::greater<int>());
// r = 10,9,8,7,6,5,4,3,2,1
See Also
http://www.sgi.com/tech/stl/merge.html