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

Functions

template<typename InputIterator , typename OutputIterator , typename UnaryFunction >
void bolt::cl::transform (::bolt::cl::control &ctl, InputIterator first, InputIterator last, OutputIterator result, UnaryFunction op, const std::string &user_code="")
 This version of transform applies a unary operation on input sequences and stores the result in the corresponding position in an output sequence.The input and output sequences can coincide, resulting in an in-place transformation.
 
template<typename InputIterator , typename OutputIterator , typename UnaryFunction >
void bolt::cl::transform (InputIterator first, InputIterator last, OutputIterator result, UnaryFunction op, const std::string &user_code="")
 
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename BinaryFunction >
void bolt::cl::transform (bolt::cl::control &ctl, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result, BinaryFunction op, const std::string &user_code="")
 This version of transform applies a binary function to each pair of elements from two input sequences and stores the result in the corresponding position in an output sequence. The input and output sequences can coincide, resulting in an in-place transformation.
 
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename BinaryFunction >
void bolt::cl::transform (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result, BinaryFunction op, const std::string &user_code="")
 

Detailed Description

Function Documentation

template<typename InputIterator , typename OutputIterator , typename UnaryFunction >
void bolt::cl::transform ( ::bolt::cl::control ctl,
InputIterator  first,
InputIterator  last,
OutputIterator  result,
UnaryFunction  op,
const std::string &  user_code = "" 
)

This version of transform applies a unary operation on input sequences and stores the result in the corresponding position in an output sequence.The input and output sequences can coincide, resulting in an in-place transformation.

Parameters
ctlOptional Control structure to control command-queue, debug, tuning, etc.See bolt::cl::control.
firstThe beginning of the first input sequence.
lastThe end of the first input sequence.
resultThe beginning of the output sequence.
opThe tranformation operation.
user_codeOptional OpenCL™ code to be passed to the OpenCL compiler. The cl_code is inserted first in the generated code, before the cl_code trait.
Returns
The end of the output sequence.
Template Parameters
InputIterator1is a model of InputIterator and InputIterator1's value_type is convertible to BinaryFunction's first_argument_type.
InputIterator2is a model of InputIterator and InputIterator2's value_type is convertible to BinaryFunction's second_argument_type.
OutputIteratoris a model of OutputIterator

The following code snippet demonstrates how to use transform

int input1[10] = {-5, 0, 2, 3, 2, 4, -2, 1, 2, 3};
int output[10];
bolt::cl::square<int> op;
bolt::cl::::transform(input1, input1 + 10, output, op);
// output is now {25, 0, 4, 9, 4, 16, 4, 1, 4, 9};
See Also
http://www.sgi.com/tech/stl/transform.html
http://www.sgi.com/tech/stl/InputIterator.html
http://www.sgi.com/tech/stl/OutputIterator.html
http://www.sgi.com/tech/stl/UnaryFunction.html
http://www.sgi.com/tech/stl/BinaryFunction.html
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename BinaryFunction >
void bolt::cl::transform ( bolt::cl::control ctl,
InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
OutputIterator  result,
BinaryFunction  op,
const std::string &  user_code = "" 
)

This version of transform applies a binary function to each pair of elements from two input sequences and stores the result in the corresponding position in an output sequence. The input and output sequences can coincide, resulting in an in-place transformation.

Parameters
ctlOptional Control structure to control command-queue, debug, tuning, etc.See bolt::cl::control.
first1The beginning of the first input sequence.
last1The end of the first input sequence.
first2The beginning of the second input sequence.
resultThe beginning of the output sequence.
opThe tranformation operation.
user_codeOptional OpenCL™ code to be passed to the OpenCL compiler. The cl_code is inserted first in the generated code, before the cl_code trait.
Returns
The end of the output sequence.
Template Parameters
InputIterator1is a model of InputIterator and InputIterator1's value_type is convertible to BinaryFunction's first_argument_type.
InputIterator2is a model of InputIterator and InputIterator2's value_type is convertible to BinaryFunction's second_argument_type.
OutputIteratoris a model of OutputIterator
BinaryFunctionis a model of BinaryFunction and BinaryFunction's result_type is convertible to OutputIterator's value_type.

The following code snippet demonstrates how to use transform.

int input1[6] = {-5, 0, 2, 3, 2, 4};
int input2[6] = { 3, 6, -2, 1, 2, 3};
int output[6];
bolt::cl::plus<int> op;
bolt::cl::::transform( input1, input1 + 6, input2, output, op);
// output is now {-2, 6, 0, 4, 4, 7};
See Also
http://www.sgi.com/tech/stl/transform.html
http://www.sgi.com/tech/stl/InputIterator.html
http://www.sgi.com/tech/stl/OutputIterator.html
http://www.sgi.com/tech/stl/UnaryFunction.html
http://www.sgi.com/tech/stl/BinaryFunction.html