-
Notifications
You must be signed in to change notification settings - Fork 757
Add unique_count algorithm #1612
Comments
CC @codereport on naming bikeshedding. I'd advocate for I suppose |
Long story short, I agree with @jrhemstad, More details: we sort of had the opposite issue at one point in RAPIDS. We had an algorithm/API called def unique_count(list):
return len(set(list)) We ended up changing the name to |
I will go with |
Add a counting equivalent to unique_* algorithms that can be used to allocate the correct amount of data before actually filling it. Addresses issue NVIDIA#1612
Add a counting equivalent to unique_* algorithms that can be used to allocate the correct amount of data before actually filling it. Addresses issue NVIDIA#1612
Add a counting equivalent to unique_* algorithms that can be used to allocate the correct amount of data before actually filling it. Addresses issue NVIDIA#1612
Add a counting equivalent to unique_* algorithms that can be used to allocate the correct amount of data before actually filling it. Addresses issue NVIDIA#1612
For the common count -> allocate -> fill pattern (e.g.
count_if
/copy_if
) there are some fill algorithms without a corresponding count algorithm, mainlyunique_copy
,unique_by_key_copy
andreduce_by_key
. So I want to suggest adding acount_unique
algorithm with basically the same interface asunique
save the return type:difference_type thrust::count_unique( Policy exec, ForwardIterator first, ForwardIterator last, BinaryPredicate binary_pred)
The name probably needs a bit of discussion, since it doesn't actually count unique elements, but runs of unique elements, but
unique
has the same issue, so there is some prior art for it.@allisonvacanti suggested using
cub::DeviceRunLengthEncode::Encode
to implement it, so I wanted to check whether there are any other approaches to consider before starting work on a PR. Another simple approach might beThe text was updated successfully, but these errors were encountered: