3#include <cuda/std/cstdint>
52 pack(uint32_t lower, uint32_t equal, uint32_t higher)
noexcept {
54 static_cast<uint64_t
>(lower) | (
static_cast<uint64_t
>(equal) << 21U) |
55 (
static_cast<uint64_t
>(higher) << 42U)
62 constexpr uint64_t field = (uint64_t{1} << 21U) - 1U;
63 auto const lower =
static_cast<uint32_t
>(
bits & field);
64 auto const equal =
static_cast<uint32_t
>((
bits >> 21U) & field);
65 auto const higher =
static_cast<uint32_t
>(
bits >> 42U);
70 .both_empty = bucket_count - lower - equal - higher,
88 if (divisor == 0U)
return 0.0F;
89 return static_cast<float>(
counts.equal) /
static_cast<float>(divisor < 6U ? 6U : divisor);
Batch operations over contiguous device rows.
@ counts
One 24-byte batch_search_result per pair: query ID, reference ID and the lower, equal,...
__host__ __device__ constexpr float weighted_kmer_identity(pairwise_counts const &counts) noexcept
Weighted k-mer identity of a pair, equal / max(equal + min(lower, higher), 6), as sketch::wkid comput...
One pair's exact bucket comparison counts in 64 bits, the storage and transfer form of batch-search r...
static __host__ __device__ constexpr packed_pairwise_counts pack(uint32_t lower, uint32_t equal, uint32_t higher) noexcept
__host__ __device__ constexpr pairwise_counts unpack(uint32_t bucket_count) const noexcept
friend bool operator==(packed_pairwise_counts const &, packed_pairwise_counts const &)=default
Raw per-bucket classification counts for one sketch pair comparison.
friend bool operator==(pairwise_counts const &, pairwise_counts const &)=default
uint32_t both_empty
Both registers are empty in that bucket.
__host__ __device__ constexpr pairwise_counts mirrored() const noexcept
The same comparison seen from the other sketch: lower and higher swap.
uint32_t equal
this register equals the other's in that bucket.
friend __host__ __device__ pairwise_counts operator+(pairwise_counts left, pairwise_counts const right) noexcept
Sums two count sets for device reductions.
uint32_t lower
this register is strictly lower than the other's in that bucket.
__host__ __device__ pairwise_counts & operator+=(pairwise_counts const other) noexcept
Accumulates other into this instance (used for device reductions).
uint32_t higher
this register is strictly higher than the other's in that bucket.
Pairwise counts with an optional compile-time cardinality field.
friend bool operator==(pairwise_summary const &, pairwise_summary const &)=default