allendaicool / thrust

Automatically exported from code.google.com/p/thrust
Apache License 2.0
0 stars 0 forks source link

implement unique_by_key, unique_copy, and unique_copy_by_key #59

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
template <typename InputIterator,
          typename OutputIterator,
          typename BinaryPredicate>
  OutputIterator unique_copy(InputIterator first, 
                             InputIterator last,
                             OutputIterator result,
                             BinaryPredicate binary_pred)

template <typename ForwardIterator1,
          typename ForwardIterator2,
          typename BinaryPredicate,
          typename BinaryFunction>
  ForwardIterator1 unique_by_key(ForwardIterator1 keys_first, 
                                 ForwardIterator1 keys_last,
                                 ForwardIterator2 values_first,
                                 BinaryPredicate binary_pred,
                                 BinaryFunction binary_op)

template <typename InputIterator1,
          typename InputIterator2,
          typename OutputIterator1,
          typename OutputIterator2,
          typename BinaryPredicate,
          typename BinaryFunction>
  OutputIterator unique_copy_by_key(InputIterator1 keys_first, 
                                    InputIterator1 keys_last,
                                    InputIterator2 values_first,
                                    OutputIterator1 keys_output,
                                    OutputIterator2 values_output,
                                    BinaryPredicate binary_pred,
                                    BinaryFunction binary_op)

BinaryPredicate defaults to equal_to<T>
BinaryFunction defaults to project1st<T>

BinaryFunction reduces adjacent values with the same key.  Must be
associative.  Could require commutativity like reduce() does.

Original issue reported on code.google.com by wnbell on 6 Dec 2009 at 1:59

GoogleCodeExporter commented 9 years ago
r669 provides a preliminary implementation of all three functions
no functions have been documented yet

Original comment by wnbell on 9 Dec 2009 at 12:51

GoogleCodeExporter commented 9 years ago
closing this in favor of issue #73 

Original comment by wnbell on 21 Jan 2010 at 10:22