Bolt  1.3
C++ template library with support for OpenCL
Functions
AMP-max_element

Functions

template<typename ForwardIterator >
ForwardIterator bolt::amp::max_element (bolt::amp::control &ctl, ForwardIterator first, ForwardIterator last)
 The max_element returns the location of the first maximum element in the specified range.
 
template<typename ForwardIterator >
ForwardIterator bolt::amp::max_element (ForwardIterator first, ForwardIterator last)
 
template<typename ForwardIterator , typename BinaryPredicate >
ForwardIterator bolt::amp::max_element (bolt::amp::control &ctl, ForwardIterator first, ForwardIterator last, BinaryPredicate binary_op)
 The max_element returns the location of the first maximum element in the specified range using the specified binary_op.
 
template<typename ForwardIterator , typename BinaryPredicate >
ForwardIterator bolt::amp::max_element (ForwardIterator first, ForwardIterator last, BinaryPredicate binary_op)
 

Detailed Description

Function Documentation

template<typename ForwardIterator >
ForwardIterator bolt::amp::max_element ( bolt::amp::control ctl,
ForwardIterator  first,
ForwardIterator  last 
)

The max_element returns the location of the first maximum element in the specified range.

Parameters
ctlOptional Control structure to control accelerator, debug, tuning, etc.See bolt::amp::control.
firstA forward iterator addressing the position of the first element in the range to be searched for the maximum element
lastA forward iterator addressing the position one past the final element in the range to be searched for the maximum element
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 max_element.

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

#include <bolt/amp/max_element.h>
int a[10] = {4, 8, 6, 1, 5, 3, 10, 2, 9, 7};
int max_pos = bolt::amp::max_element(a, a+10);
// max_pos = 6
See Also
http://www.sgi.com/tech/stl/max_element.html
template<typename ForwardIterator , typename BinaryPredicate >
ForwardIterator bolt::amp::max_element ( bolt::amp::control ctl,
ForwardIterator  first,
ForwardIterator  last,
BinaryPredicate  binary_op 
)

The max_element returns the location of the first maximum element in the specified range using the specified binary_op.

Parameters
ctlOptional Control structure to control accelerator, debug, tuning, etc.See bolt::amp::control.
firstA forward iterator addressing the position of the first element in the range to be searched for the maximum element
lastA forward iterator addressing the position one past the final element in the range to be searched for the maximum element
binary_opThe binary operation used to combine two values. By default, the binary operation is less<>().
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 max_element.

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

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