thrust

Functions  
template<typename DerivedPolicy , typename InputIterator1 , typename InputIterator2 , typename OutputIterator >  
__host__ __device__ OutputIterator  thrust::inclusive_scan_by_key (const thrust::detail::execution_policy_base< DerivedPolicy > &exec, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result) 
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator >  
OutputIterator  thrust::inclusive_scan_by_key (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result) 
template<typename DerivedPolicy , typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename BinaryPredicate >  
__host__ __device__ OutputIterator  thrust::inclusive_scan_by_key (const thrust::detail::execution_policy_base< DerivedPolicy > &exec, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result, BinaryPredicate binary_pred) 
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename BinaryPredicate >  
OutputIterator  thrust::inclusive_scan_by_key (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result, BinaryPredicate binary_pred) 
template<typename DerivedPolicy , typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename BinaryPredicate , typename AssociativeOperator >  
__host__ __device__ OutputIterator  thrust::inclusive_scan_by_key (const thrust::detail::execution_policy_base< DerivedPolicy > &exec, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result, BinaryPredicate binary_pred, AssociativeOperator binary_op) 
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename BinaryPredicate , typename AssociativeOperator >  
OutputIterator  thrust::inclusive_scan_by_key (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result, BinaryPredicate binary_pred, AssociativeOperator binary_op) 
template<typename DerivedPolicy , typename InputIterator1 , typename InputIterator2 , typename OutputIterator >  
__host__ __device__ OutputIterator  thrust::exclusive_scan_by_key (const thrust::detail::execution_policy_base< DerivedPolicy > &exec, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result) 
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator >  
OutputIterator  thrust::exclusive_scan_by_key (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result) 
template<typename DerivedPolicy , typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename T >  
__host__ __device__ OutputIterator  thrust::exclusive_scan_by_key (const thrust::detail::execution_policy_base< DerivedPolicy > &exec, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result, T init) 
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename T >  
OutputIterator  thrust::exclusive_scan_by_key (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result, T init) 
template<typename DerivedPolicy , typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename T , typename BinaryPredicate >  
__host__ __device__ OutputIterator  thrust::exclusive_scan_by_key (const thrust::detail::execution_policy_base< DerivedPolicy > &exec, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result, T init, BinaryPredicate binary_pred) 
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename T , typename BinaryPredicate >  
OutputIterator  thrust::exclusive_scan_by_key (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result, T init, BinaryPredicate binary_pred) 
template<typename DerivedPolicy , typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename T , typename BinaryPredicate , typename AssociativeOperator >  
__host__ __device__ OutputIterator  thrust::exclusive_scan_by_key (const thrust::detail::execution_policy_base< DerivedPolicy > &exec, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result, T init, BinaryPredicate binary_pred, AssociativeOperator binary_op) 
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator , typename T , typename BinaryPredicate , typename AssociativeOperator >  
OutputIterator  thrust::exclusive_scan_by_key (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, OutputIterator result, T init, BinaryPredicate binary_pred, AssociativeOperator binary_op) 
__host__ __device__ OutputIterator thrust::exclusive_scan_by_key  (  const thrust::detail::execution_policy_base< DerivedPolicy > &  exec, 
InputIterator1  first1,  
InputIterator1  last1,  
InputIterator2  first2,  
OutputIterator  result  
) 
exclusive_scan_by_key
computes an exclusive segmented prefix
This version of exclusive_scan_by_key
uses the value 0
to initialize the exclusive scan operation.
This version of exclusive_scan_by_key
assumes plus
as the associative operator used to perform the prefix sum. When the input and output sequences are the same, the scan is performed inplace.
This version of exclusive_scan_by_key
assumes equal_to
as the binary predicate used to compare adjacent keys. Specifically, consecutive iterators i
and i+1
in the range [first1, last1
belong to the same segment if *i == *(i+1)
, and belong to different segments otherwise.
Refer to the most general form of exclusive_scan_by_key
for additional details.
The algorithm's execution is parallelized as determined by exec
.
exec  The execution policy to use for parallelization. 
first1  The beginning of the key sequence. 
last1  The end of the key sequence. 
first2  The beginning of the input value sequence. 
result  The beginning of the output value sequence. 
first1
may equal result
but the range [first1, last1)
and the range [result, result + (last1  first1))
shall not overlap otherwise. first2
may equal result
but the range [first2, first2 + (last1  first1)
and range [result, result + (last1  first1))
shall not overlap otherwise.The following code snippet demonstrates how to use exclusive_scan_by_key
using the thrust::host
execution policy for parallelization:
OutputIterator thrust::exclusive_scan_by_key  (  InputIterator1  first1, 
InputIterator1  last1,  
InputIterator2  first2,  
OutputIterator  result  
) 
exclusive_scan_by_key
computes an exclusive segmented prefix
This version of exclusive_scan_by_key
uses the value 0
to initialize the exclusive scan operation.
This version of exclusive_scan_by_key
assumes plus
as the associative operator used to perform the prefix sum. When the input and output sequences are the same, the scan is performed inplace.
This version of exclusive_scan_by_key
assumes equal_to
as the binary predicate used to compare adjacent keys. Specifically, consecutive iterators i
and i+1
in the range [first1, last1
belong to the same segment if *i == *(i+1)
, and belong to different segments otherwise.
Refer to the most general form of exclusive_scan_by_key
for additional details.
first1  The beginning of the key sequence. 
last1  The end of the key sequence. 
first2  The beginning of the input value sequence. 
result  The beginning of the output value sequence. 
first1
may equal result
but the range [first1, last1)
and the range [result, result + (last1  first1))
shall not overlap otherwise. first2
may equal result
but the range [first2, first2 + (last1  first1)
and range [result, result + (last1  first1))
shall not overlap otherwise.The following code snippet demonstrates how to use exclusive_scan_by_key
.
__host__ __device__ OutputIterator thrust::exclusive_scan_by_key  (  const thrust::detail::execution_policy_base< DerivedPolicy > &  exec, 
InputIterator1  first1,  
InputIterator1  last1,  
InputIterator2  first2,  
OutputIterator  result,  
T  init  
) 
exclusive_scan_by_key
computes an exclusive keyvalue or 'segmented' prefix sum operation. The term 'exclusive' means that each result does not include the corresponding input operand in the partial sum. The term 'segmented' means that the partial sums are broken into distinct segments. In other words, within each segment a separate exclusive scan operation is computed. Refer to the code sample below for example usage.
This version of exclusive_scan_by_key
uses the value init
to initialize the exclusive scan operation.
The algorithm's execution is parallelized as determined by exec
.
exec  The execution policy to use for parallelization. 
first1  The beginning of the key sequence. 
last1  The end of the key sequence. 
first2  The beginning of the input value sequence. 
result  The beginning of the output value sequence. 
init  The initial of the exclusive sum value. 
first1
may equal result
but the range [first1, last1)
and the range [result, result + (last1  first1))
shall not overlap otherwise. first2
may equal result
but the range [first2, first2 + (last1  first1)
and range [result, result + (last1  first1))
shall not overlap otherwise.The following code snippet demonstrates how to use exclusive_scan_by_key
using the thrust::host
execution policy for parallelization:
OutputIterator thrust::exclusive_scan_by_key  (  InputIterator1  first1, 
InputIterator1  last1,  
InputIterator2  first2,  
OutputIterator  result,  
T  init  
) 
exclusive_scan_by_key
computes an exclusive keyvalue or 'segmented' prefix sum operation. The term 'exclusive' means that each result does not include the corresponding input operand in the partial sum. The term 'segmented' means that the partial sums are broken into distinct segments. In other words, within each segment a separate exclusive scan operation is computed. Refer to the code sample below for example usage.
This version of exclusive_scan_by_key
uses the value init
to initialize the exclusive scan operation.
first1  The beginning of the key sequence. 
last1  The end of the key sequence. 
first2  The beginning of the input value sequence. 
result  The beginning of the output value sequence. 
init  The initial of the exclusive sum value. 
first1
may equal result
but the range [first1, last1)
and the range [result, result + (last1  first1))
shall not overlap otherwise. first2
may equal result
but the range [first2, first2 + (last1  first1)
and range [result, result + (last1  first1))
shall not overlap otherwise.The following code snippet demonstrates how to use exclusive_scan_by_key
__host__ __device__ OutputIterator thrust::exclusive_scan_by_key  (  const thrust::detail::execution_policy_base< DerivedPolicy > &  exec, 
InputIterator1  first1,  
InputIterator1  last1,  
InputIterator2  first2,  
OutputIterator  result,  
T  init,  
BinaryPredicate  binary_pred  
) 
exclusive_scan_by_key
computes an exclusive keyvalue or 'segmented' prefix sum operation. The term 'exclusive' means that each result does not include the corresponding input operand in the partial sum. The term 'segmented' means that the partial sums are broken into distinct segments. In other words, within each segment a separate exclusive scan operation is computed. Refer to the code sample below for example usage.
This version of exclusive_scan_by_key
uses the value init
to initialize the exclusive scan operation.
This version of exclusive_scan_by_key
uses the binary predicate binary_pred
to compare adjacent keys. Specifically, consecutive iterators i
and i+1
in the range [first1, last1)
belong to the same segment if binary_pred(*i, *(i+1))
is true, and belong to different segments otherwise.
The algorithm's execution is parallelized as determined by exec
.
exec  The execution policy to use for parallelization. 
first1  The beginning of the key sequence. 
last1  The end of the key sequence. 
first2  The beginning of the input value sequence. 
result  The beginning of the output value sequence. 
init  The initial of the exclusive sum value. 
binary_pred  The binary predicate used to determine equality of keys. 
first1
may equal result
but the range [first1, last1)
and the range [result, result + (last1  first1))
shall not overlap otherwise. first2
may equal result
but the range [first2, first2 + (last1  first1)
and range [result, result + (last1  first1))
shall not overlap otherwise.The following code snippet demonstrates how to use exclusive_scan_by_key
using the thrust::host
execution policy for parallelization:
OutputIterator thrust::exclusive_scan_by_key  (  InputIterator1  first1, 
InputIterator1  last1,  
InputIterator2  first2,  
OutputIterator  result,  
T  init,  
BinaryPredicate  binary_pred  
) 
exclusive_scan_by_key
computes an exclusive keyvalue or 'segmented' prefix sum operation. The term 'exclusive' means that each result does not include the corresponding input operand in the partial sum. The term 'segmented' means that the partial sums are broken into distinct segments. In other words, within each segment a separate exclusive scan operation is computed. Refer to the code sample below for example usage.
This version of exclusive_scan_by_key
uses the value init
to initialize the exclusive scan operation.
This version of exclusive_scan_by_key
uses the binary predicate binary_pred
to compare adjacent keys. Specifically, consecutive iterators i
and i+1
in the range [first1, last1)
belong to the same segment if binary_pred(*i, *(i+1))
is true, and belong to different segments otherwise.
first1  The beginning of the key sequence. 
last1  The end of the key sequence. 
first2  The beginning of the input value sequence. 
result  The beginning of the output value sequence. 
init  The initial of the exclusive sum value. 
binary_pred  The binary predicate used to determine equality of keys. 
first1
may equal result
but the range [first1, last1)
and the range [result, result + (last1  first1))
shall not overlap otherwise. first2
may equal result
but the range [first2, first2 + (last1  first1)
and range [result, result + (last1  first1))
shall not overlap otherwise.The following code snippet demonstrates how to use exclusive_scan_by_key
__host__ __device__ OutputIterator thrust::exclusive_scan_by_key  (  const thrust::detail::execution_policy_base< DerivedPolicy > &  exec, 
InputIterator1  first1,  
InputIterator1  last1,  
InputIterator2  first2,  
OutputIterator  result,  
T  init,  
BinaryPredicate  binary_pred,  
AssociativeOperator  binary_op  
) 
exclusive_scan_by_key
computes an exclusive keyvalue or 'segmented' prefix sum operation. The term 'exclusive' means that each result does not include the corresponding input operand in the partial sum. The term 'segmented' means that the partial sums are broken into distinct segments. In other words, within each segment a separate exclusive scan operation is computed. Refer to the code sample below for example usage.
This version of exclusive_scan_by_key
uses the value init
to initialize the exclusive scan operation.
This version of exclusive_scan_by_key
uses the binary predicate binary_pred
to compare adjacent keys. Specifically, consecutive iterators i
and i+1
in the range [first1, last1)
belong to the same segment if binary_pred(*i, *(i+1))
is true, and belong to different segments otherwise.
This version of exclusive_scan_by_key
uses the associative operator binary_op
to perform the prefix sum. When the input and output sequences are the same, the scan is performed inplace.
The algorithm's execution is parallelized as determined by exec
.
exec  The execution policy to use for parallelization. 
first1  The beginning of the key sequence. 
last1  The end of the key sequence. 
first2  The beginning of the input value sequence. 
result  The beginning of the output value sequence. 
init  The initial of the exclusive sum value. 
binary_pred  The binary predicate used to determine equality of keys. 
binary_op  The associatve operator used to 'sum' values. 
DerivedPolicy  The name of the derived execution policy. 
InputIterator1  is a model of Input Iterator 
InputIterator2  is a model of Input Iterator and InputIterator2's value_type is convertible to OutputIterator's value_type . 
OutputIterator  is a model of Output Iterator, and if x and y are objects of OutputIterator's value_type , then binary_op(x,y) is defined. 
T  is convertible to OutputIterator's value_type . 
BinaryPredicate  is a model of Binary Predicate. 
AssociativeOperator  is a model of Binary Function and AssociativeOperator's result_type is convertible to OutputIterator's value_type . 
first1
may equal result
but the range [first1, last1)
and the range [result, result + (last1  first1))
shall not overlap otherwise. first2
may equal result
but the range [first2, first2 + (last1  first1)
and range [result, result + (last1  first1))
shall not overlap otherwise.The following code snippet demonstrates how to use exclusive_scan_by_key
using the thrust::host
execution policy for parallelization:
OutputIterator thrust::exclusive_scan_by_key  (  InputIterator1  first1, 
InputIterator1  last1,  
InputIterator2  first2,  
OutputIterator  result,  
T  init,  
BinaryPredicate  binary_pred,  
AssociativeOperator  binary_op  
) 
exclusive_scan_by_key
computes an exclusive keyvalue or 'segmented' prefix sum operation. The term 'exclusive' means that each result does not include the corresponding input operand in the partial sum. The term 'segmented' means that the partial sums are broken into distinct segments. In other words, within each segment a separate exclusive scan operation is computed. Refer to the code sample below for example usage.
This version of exclusive_scan_by_key
uses the value init
to initialize the exclusive scan operation.
This version of exclusive_scan_by_key
uses the binary predicate binary_pred
to compare adjacent keys. Specifically, consecutive iterators i
and i+1
in the range [first1, last1)
belong to the same segment if binary_pred(*i, *(i+1))
is true, and belong to different segments otherwise.
This version of exclusive_scan_by_key
uses the associative operator binary_op
to perform the prefix sum. When the input and output sequences are the same, the scan is performed inplace.
first1  The beginning of the key sequence. 
last1  The end of the key sequence. 
first2  The beginning of the input value sequence. 
result  The beginning of the output value sequence. 
init  The initial of the exclusive sum value. 
binary_pred  The binary predicate used to determine equality of keys. 
binary_op  The associatve operator used to 'sum' values. 
InputIterator1  is a model of Input Iterator 
InputIterator2  is a model of Input Iterator and InputIterator2's value_type is convertible to OutputIterator's value_type . 
OutputIterator  is a model of Output Iterator, and if x and y are objects of OutputIterator's value_type , then binary_op(x,y) is defined. 
T  is convertible to OutputIterator's value_type . 
BinaryPredicate  is a model of Binary Predicate. 
AssociativeOperator  is a model of Binary Function and AssociativeOperator's result_type is convertible to OutputIterator's value_type . 
first1
may equal result
but the range [first1, last1)
and the range [result, result + (last1  first1))
shall not overlap otherwise. first2
may equal result
but the range [first2, first2 + (last1  first1)
and range [result, result + (last1  first1))
shall not overlap otherwise.The following code snippet demonstrates how to use exclusive_scan_by_key
__host__ __device__ OutputIterator thrust::inclusive_scan_by_key  (  const thrust::detail::execution_policy_base< DerivedPolicy > &  exec, 
InputIterator1  first1,  
InputIterator1  last1,  
InputIterator2  first2,  
OutputIterator  result  
) 
inclusive_scan_by_key
computes an inclusive keyvalue or 'segmented' prefix sum operation. The term 'inclusive' means that each result includes the corresponding input operand in the partial sum. The term 'segmented' means that the partial sums are broken into distinct segments. In other words, within each segment a separate inclusive scan operation is computed. Refer to the code sample below for example usage.
This version of inclusive_scan_by_key
assumes equal_to
as the binary predicate used to compare adjacent keys. Specifically, consecutive iterators i
and i+1
in the range [first1, last1)
belong to the same segment if *i == *(i+1)
, and belong to different segments otherwise.
This version of inclusive_scan_by_key
assumes plus
as the associative operator used to perform the prefix sum. When the input and output sequences are the same, the scan is performed inplace.
The algorithm's execution is parallelized as determined by exec
.
exec  The execution policy to use for parallelization. 
first1  The beginning of the key sequence. 
last1  The end of the key sequence. 
first2  The beginning of the input value sequence. 
result  The beginning of the output value sequence. 
DerivedPolicy  The name of the derived execution policy. 
InputIterator1  is a model of Input Iterator 
InputIterator2  is a model of Input Iterator and InputIterator2's value_type is convertible to OutputIterator's value_type . 
OutputIterator  is a model of Output Iterator, and if x and y are objects of OutputIterator's value_type , then binary_op(x,y) is defined. 
first1
may equal result
but the range [first1, last1)
and the range [result, result + (last1  first1))
shall not overlap otherwise. first2
may equal result
but the range [first2, first2 + (last1  first1)
and range [result, result + (last1  first1))
shall not overlap otherwise.The following code snippet demonstrates how to use inclusive_scan_by_key
using the thrust::host
execution policy for parallelization:
OutputIterator thrust::inclusive_scan_by_key  (  InputIterator1  first1, 
InputIterator1  last1,  
InputIterator2  first2,  
OutputIterator  result  
) 
inclusive_scan_by_key
computes an inclusive keyvalue or 'segmented' prefix sum operation. The term 'inclusive' means that each result includes the corresponding input operand in the partial sum. The term 'segmented' means that the partial sums are broken into distinct segments. In other words, within each segment a separate inclusive scan operation is computed. Refer to the code sample below for example usage.
This version of inclusive_scan_by_key
assumes equal_to
as the binary predicate used to compare adjacent keys. Specifically, consecutive iterators i
and i+1
in the range [first1, last1)
belong to the same segment if *i == *(i+1)
, and belong to different segments otherwise.
This version of inclusive_scan_by_key
assumes plus
as the associative operator used to perform the prefix sum. When the input and output sequences are the same, the scan is performed inplace.
first1  The beginning of the key sequence. 
last1  The end of the key sequence. 
first2  The beginning of the input value sequence. 
result  The beginning of the output value sequence. 
InputIterator1  is a model of Input Iterator 
InputIterator2  is a model of Input Iterator and InputIterator2's value_type is convertible to OutputIterator's value_type . 
OutputIterator  is a model of Output Iterator, and if x and y are objects of OutputIterator's value_type , then binary_op(x,y) is defined. 
first1
may equal result
but the range [first1, last1)
and the range [result, result + (last1  first1))
shall not overlap otherwise. first2
may equal result
but the range [first2, first2 + (last1  first1)
and range [result, result + (last1  first1))
shall not overlap otherwise.The following code snippet demonstrates how to use inclusive_scan_by_key
__host__ __device__ OutputIterator thrust::inclusive_scan_by_key  (  const thrust::detail::execution_policy_base< DerivedPolicy > &  exec, 
InputIterator1  first1,  
InputIterator1  last1,  
InputIterator2  first2,  
OutputIterator  result,  
BinaryPredicate  binary_pred  
) 
inclusive_scan_by_key
computes an inclusive keyvalue or 'segmented' prefix sum operation. The term 'inclusive' means that each result includes the corresponding input operand in the partial sum. The term 'segmented' means that the partial sums are broken into distinct segments. In other words, within each segment a separate inclusive scan operation is computed. Refer to the code sample below for example usage.
This version of inclusive_scan_by_key
uses the binary predicate pred
to compare adjacent keys. Specifically, consecutive iterators i
and i+1
in the range [first1, last1)
belong to the same segment if binary_pred(*i, *(i+1))
is true, and belong to different segments otherwise.
This version of inclusive_scan_by_key
assumes plus
as the associative operator used to perform the prefix sum. When the input and output sequences are the same, the scan is performed inplace.
The algorithm's execution is parallelized as determined by exec
.
exec  The execution policy to use for parallelization. 
first1  The beginning of the key sequence. 
last1  The end of the key sequence. 
first2  The beginning of the input value sequence. 
result  The beginning of the output value sequence. 
binary_pred  The binary predicate used to determine equality of keys. 
DerivedPolicy  The name of the derived execution policy. 
InputIterator1  is a model of Input Iterator 
InputIterator2  is a model of Input Iterator and InputIterator2's value_type is convertible to OutputIterator's value_type . 
OutputIterator  is a model of Output Iterator, and if x and y are objects of OutputIterator's value_type , then binary_op(x,y) is defined. 
BinaryPredicate  is a model of Binary Predicate. 
first1
may equal result
but the range [first1, last1)
and the range [result, result + (last1  first1))
shall not overlap otherwise. first2
may equal result
but the range [first2, first2 + (last1  first1)
and range [result, result + (last1  first1))
shall not overlap otherwise.The following code snippet demonstrates how to use inclusive_scan_by_key
using the thrust::host
execution policy for parallelization:
OutputIterator thrust::inclusive_scan_by_key  (  InputIterator1  first1, 
InputIterator1  last1,  
InputIterator2  first2,  
OutputIterator  result,  
BinaryPredicate  binary_pred  
) 
inclusive_scan_by_key
computes an inclusive keyvalue or 'segmented' prefix sum operation. The term 'inclusive' means that each result includes the corresponding input operand in the partial sum. The term 'segmented' means that the partial sums are broken into distinct segments. In other words, within each segment a separate inclusive scan operation is computed. Refer to the code sample below for example usage.
This version of inclusive_scan_by_key
uses the binary predicate pred
to compare adjacent keys. Specifically, consecutive iterators i
and i+1
in the range [first1, last1)
belong to the same segment if binary_pred(*i, *(i+1))
is true, and belong to different segments otherwise.
This version of inclusive_scan_by_key
assumes plus
as the associative operator used to perform the prefix sum. When the input and output sequences are the same, the scan is performed inplace.
first1  The beginning of the key sequence. 
last1  The end of the key sequence. 
first2  The beginning of the input value sequence. 
result  The beginning of the output value sequence. 
binary_pred  The binary predicate used to determine equality of keys. 
InputIterator1  is a model of Input Iterator 
InputIterator2  is a model of Input Iterator and InputIterator2's value_type is convertible to OutputIterator's value_type . 
OutputIterator  is a model of Output Iterator, and if x and y are objects of OutputIterator's value_type , then binary_op(x,y) is defined. 
BinaryPredicate  is a model of Binary Predicate. 
first1
may equal result
but the range [first1, last1)
and the range [result, result + (last1  first1))
shall not overlap otherwise. first2
may equal result
but the range [first2, first2 + (last1  first1)
and range [result, result + (last1  first1))
shall not overlap otherwise.The following code snippet demonstrates how to use inclusive_scan_by_key
__host__ __device__ OutputIterator thrust::inclusive_scan_by_key  (  const thrust::detail::execution_policy_base< DerivedPolicy > &  exec, 
InputIterator1  first1,  
InputIterator1  last1,  
InputIterator2  first2,  
OutputIterator  result,  
BinaryPredicate  binary_pred,  
AssociativeOperator  binary_op  
) 
inclusive_scan_by_key
computes an inclusive keyvalue or 'segmented' prefix sum operation. The term 'inclusive' means that each result includes the corresponding input operand in the partial sum. The term 'segmented' means that the partial sums are broken into distinct segments. In other words, within each segment a separate inclusive scan operation is computed. Refer to the code sample below for example usage.
This version of inclusive_scan_by_key
uses the binary predicate pred
to compare adjacent keys. Specifically, consecutive iterators i
and i+1
in the range [first1, last1)
belong to the same segment if binary_pred(*i, *(i+1))
is true, and belong to different segments otherwise.
This version of inclusive_scan_by_key
uses the associative operator binary_op
to perform the prefix sum. When the input and output sequences are the same, the scan is performed inplace.
The algorithm's execution is parallelized as determined by exec
.
exec  The execution policy to use for parallelization. 
first1  The beginning of the key sequence. 
last1  The end of the key sequence. 
first2  The beginning of the input value sequence. 
result  The beginning of the output value sequence. 
binary_pred  The binary predicate used to determine equality of keys. 
binary_op  The associatve operator used to 'sum' values. 
DerivedPolicy  The name of the derived execution policy. 
InputIterator1  is a model of Input Iterator 
InputIterator2  is a model of Input Iterator and InputIterator2's value_type is convertible to OutputIterator's value_type . 
OutputIterator  is a model of Output Iterator, and if x and y are objects of OutputIterator's value_type , then binary_op(x,y) is defined. 
BinaryPredicate  is a model of Binary Predicate. 
AssociativeOperator  is a model of Binary Function and AssociativeOperator's result_type is convertible to OutputIterator's value_type . 
first1
may equal result
but the range [first1, last1)
and the range [result, result + (last1  first1))
shall not overlap otherwise. first2
may equal result
but the range [first2, first2 + (last1  first1)
and range [result, result + (last1  first1))
shall not overlap otherwise.The following code snippet demonstrates how to use inclusive_scan_by_key
using the thrust::host
execution policy for parallelization:
OutputIterator thrust::inclusive_scan_by_key  (  InputIterator1  first1, 
InputIterator1  last1,  
InputIterator2  first2,  
OutputIterator  result,  
BinaryPredicate  binary_pred,  
AssociativeOperator  binary_op  
) 
inclusive_scan_by_key
computes an inclusive keyvalue or 'segmented' prefix sum operation. The term 'inclusive' means that each result includes the corresponding input operand in the partial sum. The term 'segmented' means that the partial sums are broken into distinct segments. In other words, within each segment a separate inclusive scan operation is computed. Refer to the code sample below for example usage.
This version of inclusive_scan_by_key
uses the binary predicate pred
to compare adjacent keys. Specifically, consecutive iterators i
and i+1
in the range [first1, last1)
belong to the same segment if binary_pred(*i, *(i+1))
is true, and belong to different segments otherwise.
This version of inclusive_scan_by_key
uses the associative operator binary_op
to perform the prefix sum. When the input and output sequences are the same, the scan is performed inplace.
first1  The beginning of the key sequence. 
last1  The end of the key sequence. 
first2  The beginning of the input value sequence. 
result  The beginning of the output value sequence. 
binary_pred  The binary predicate used to determine equality of keys. 
binary_op  The associatve operator used to 'sum' values. 
InputIterator1  is a model of Input Iterator 
InputIterator2  is a model of Input Iterator and InputIterator2's value_type is convertible to OutputIterator's value_type . 
OutputIterator  is a model of Output Iterator, and if x and y are objects of OutputIterator's value_type , then binary_op(x,y) is defined. 
BinaryPredicate  is a model of Binary Predicate. 
AssociativeOperator  is a model of Binary Function and AssociativeOperator's result_type is convertible to OutputIterator's value_type . 
first1
may equal result
but the range [first1, last1)
and the range [result, result + (last1  first1))
shall not overlap otherwise. first2
may equal result
but the range [first2, first2 + (last1  first1)
and range [result, result + (last1  first1))
shall not overlap otherwise.The following code snippet demonstrates how to use inclusive_scan_by_key