Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

♻️📝 Update mode example to use thrust::unique_count #1986

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions examples/mode.cu
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ int main(void)
std::cout << std::endl;

// count number of unique keys
size_t num_unique = thrust::inner_product(d_data.begin(), d_data.end() - 1,
d_data.begin() + 1,
0,
thrust::plus<int>(),
thrust::not_equal_to<int>()) + 1;
size_t num_unique = thrust::unique_count(d_data.begin(), d_data.end());

// count multiplicity of each key
thrust::device_vector<int> d_output_keys(num_unique);
Expand Down