lion03 / thrust

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

Add transform_if flavor without stencil #335

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This seems to be a hole.

Add this if it's unambiguous and consistent with other algorithms.

Original issue reported on code.google.com by jaredhoberock on 3 May 2011 at 12:55

GoogleCodeExporter commented 8 years ago
What are the semantics of transform_if without stencil?

OutputIterator transform_if(InputIterator first, InputIterator last,
                            OutputIterator result,
                            UnaryFunction op,
                            Predicate pred)

is it

if(pred(*first)) *result = op(*first);

or

if(pred(op(*first)) *result = op(*first);

?

Original comment by jaredhoberock on 30 Aug 2011 at 7:28

GoogleCodeExporter commented 8 years ago
The first one.  If a user wanted the second one they could embed op in the 
predicate.

Original comment by wnbell on 30 Aug 2011 at 7:32

GoogleCodeExporter commented 8 years ago
Should we add binary transform_if without stencil?  It would look like:

ForwardIterator transform_if(InputIterator1 first1, InputIterator1 last1,
                             InputIterator2 first2,
                             ForwardIterator result,
                             BinaryFunction op,
                             BinaryPredicate pred)

Original comment by jaredhoberock on 30 Aug 2011 at 10:28

GoogleCodeExporter commented 8 years ago
Seems like that would be ambiguous with unary transform_if with stencil:

ForwardIterator transform_if(InputIterator1 first, InputIterator1 last,
                             InputIterator2 stencil,
                             ForwardIterator result,
                             UnaryFunction op,
                             Predicate pred)

If people want the binary version, they can use zip_iterator.

Original comment by jaredhoberock on 30 Aug 2011 at 10:31

GoogleCodeExporter commented 8 years ago
This issue was closed by revision f44edf6b5ccd.

Original comment by jaredhoberock on 31 Aug 2011 at 12:53