Template Function treeweave::guru::scatter
Defined in File guru.hpp
Function Documentation
-
template<std::ranges::contiguous_range In, std::ranges::contiguous_range Packed>
void treeweave::guru::scatter(std::span<const std::uint32_t> keys, In &&in, Packed &&packed, std::span<std::uint32_t> counts, std::span<std::uint32_t> rank) Place each
in[i]atpacked[counts[keys[i]]++]and record the packed slotrank[i](the INVERSE permutation —gatherconsumes it directly).countsmust hold bin start offsets (output ofexclusive_scan) and is consumed into ending offsets. Stable within a bin (the sweep walks i in order), so per-bin runs keep input order. The name is the literature’s (the counting sort’s placement pass); unlikethrust::scatter, the destination map is computed fromkeys+counts, not caller-supplied.