Bolt  1.1
C++ template library with support for OpenCL
Functions
Amp-transform

Functions

template<typename InputIterator , typename OutputIterator , typename UnaryFunction >
void bolt::amp::transform (control &ctl, InputIterator first, InputIterator last, OutputIterator result, UnaryFunction op)
 
template<typename InputIterator , typename OutputIterator , typename UnaryFunction >
void bolt::amp::transform (InputIterator first, InputIterator last, OutputIterator result, UnaryFunction op)
 
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename BinaryFunction >
void bolt::amp::transform (control &ctl, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result, BinaryFunction op)
 
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename BinaryFunction >
void bolt::amp::transform (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result, BinaryFunction op)
 

Detailed Description

Function Documentation

template<typename InputIterator , typename OutputIterator , typename UnaryFunction >
void bolt::amp::transform ( control &  ctl,
InputIterator  first,
InputIterator  last,
OutputIterator  result,
UnaryFunction  op 
)

This version of transform applies a unary function to 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 accelerator, debug, tuning, etc.See bolt::amp::control.
firstThe beginning of the first input sequence.
lastThe end of the first input sequence.
resultThe beginning of the output sequence.
opThe tranformation operation.
Returns
The end of the output sequence.
Template Parameters
InputIteratoris a model of InputIterator and InputIterator's value_type is convertible to UnaryFunction's second_argument_type.
OutputIteratoris a model of OutputIterator
UnaryFunctionis a model of UnaryFunction and UnaryFunction's result_type is convertible to OutputIterator's value_type.

The following code snippet demonstrates how to use transform.

int input[10] = {-5, 0, 2, 3, 2, 4, -2, 1, 2, 3};
int output[10];
//Create an AMP Control object using the default accelerator
::Concurrency::accelerator accel(::Concurrency::accelerator::default_accelerator);
bolt::amp::control ctl(accel);
bolt::amp::transform(ctl, input, input + 10, output, op);
// output is now {5, 0, -2, -3, -2, - 4, 2, -1, -2, -3};
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::amp::transform ( control &  ctl,
InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
OutputIterator  result,
BinaryFunction  op 
)

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 accelerator, debug, tuning, etc.See bolt::amp::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.
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[10] = {-5, 0, 2, 3, 2, 4, -2, 1, 2, 3};
int input2[10] = { 3, 6, -2, 1, 2, 3, -5, 0, 3, 3};
int output[10];
//Create an AMP Control object using the default accelerator
::Concurrency::accelerator accel(::Concurrency::accelerator::default_accelerator);
bolt::amp::control ctl(accel);
bolt::plus<int> op;
bolt::amp::transform(ctl, input1, input1 + 10, input2, output, op);
// output is now {-2, 6, 0, 4, 4, 7, -7, 1, 5, 6};
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