From d04d9a1192fd43b62da2cb7c72c900eee6a6646e Mon Sep 17 00:00:00 2001 From: Bernhard Manfred Gruber Date: Mon, 15 Jul 2024 09:42:20 +0200 Subject: [PATCH] Drop zipped_binary_op --- thrust/thrust/detail/internal_functional.h | 18 ------------------ .../system/detail/generic/inner_product.inl | 13 ++++--------- 2 files changed, 4 insertions(+), 27 deletions(-) diff --git a/thrust/thrust/detail/internal_functional.h b/thrust/thrust/detail/internal_functional.h index 2595d682024..346f4a6cd05 100644 --- a/thrust/thrust/detail/internal_functional.h +++ b/thrust/thrust/detail/internal_functional.h @@ -185,24 +185,6 @@ struct generate_functor thrust::detail::identity_>> {}; -template -struct zipped_binary_op -{ - using result_type = ResultType; - - _CCCL_HOST_DEVICE zipped_binary_op(BinaryFunction binary_op) - : m_binary_op(binary_op) - {} - - template - _CCCL_HOST_DEVICE inline result_type operator()(Tuple t) - { - return m_binary_op(thrust::get<0>(t), thrust::get<1>(t)); - } - - BinaryFunction m_binary_op; -}; - template struct is_non_const_reference : ::cuda::std::_And>, diff --git a/thrust/thrust/system/detail/generic/inner_product.inl b/thrust/thrust/system/detail/generic/inner_product.inl index 756d35955df..f1906ca9e5d 100644 --- a/thrust/thrust/system/detail/generic/inner_product.inl +++ b/thrust/thrust/system/detail/generic/inner_product.inl @@ -29,6 +29,7 @@ #include #include #include +#include THRUST_NAMESPACE_BEGIN namespace system @@ -66,15 +67,9 @@ _CCCL_HOST_DEVICE OutputType inner_product( BinaryFunction1 binary_op1, BinaryFunction2 binary_op2) { - using ZipIter = thrust::zip_iterator>; - - ZipIter first = thrust::make_zip_iterator(thrust::make_tuple(first1, first2)); - - // only the first iterator in the tuple is relevant for the purposes of last - ZipIter last = thrust::make_zip_iterator(thrust::make_tuple(last1, first2)); - - return thrust::transform_reduce( - exec, first, last, thrust::detail::zipped_binary_op(binary_op2), init, binary_op1); + const auto first = thrust::make_zip_iterator(first1, first2); + const auto last = thrust::make_zip_iterator(last1, first2); // only first iterator matters + return thrust::transform_reduce(exec, first, last, thrust::make_zip_function(binary_op2), init, binary_op1); } // end inner_product() } // namespace generic