29 #include <tbb/parallel_for.h> 89 template <
class TIndex,
class TAttr>
91 const TAttr*
const inp_neighbors_attributes,
92 const int num_attributes_per_neighbor,
93 const int64_t*
const inp_neighbors_row_splits,
94 const size_t inp_num_queries,
95 TIndex* out_neighbors_index,
96 TAttr* out_neighbors_attributes,
97 const size_t index_size,
98 int64_t* out_neighbors_row_splits,
99 const size_t out_num_queries) {
102 std::vector<uint32_t> tmp_neighbors_count(out_num_queries + 1, 0);
105 tbb::parallel_for(tbb::blocked_range<size_t>(0, index_size),
106 [&](
const tbb::blocked_range<size_t>& r) {
107 for (
size_t i = r.begin(); i != r.end(); ++i) {
108 TIndex idx = inp_neighbors_index[i];
110 &tmp_neighbors_count[idx + 1], 1);
115 &tmp_neighbors_count[tmp_neighbors_count.size()],
116 out_neighbors_row_splits);
118 memset(tmp_neighbors_count.data(), 0,
119 sizeof(
uint32_t) * tmp_neighbors_count.size());
123 tbb::blocked_range<size_t>(0, inp_num_queries),
124 [&](
const tbb::blocked_range<size_t>& r) {
125 for (
size_t i = r.begin(); i != r.end(); ++i) {
126 TIndex query_idx = i;
128 size_t begin_idx = inp_neighbors_row_splits[i];
129 size_t end_idx = inp_neighbors_row_splits[i + 1];
130 for (
size_t j = begin_idx; j < end_idx; ++j) {
131 TIndex neighbor_idx = inp_neighbors_index[j];
134 out_neighbors_row_splits[neighbor_idx];
136 &tmp_neighbors_count[neighbor_idx], 1);
137 out_neighbors_index[list_offset + item_offset] =
140 if (inp_neighbors_attributes) {
142 out_neighbors_attributes +
143 num_attributes_per_neighbor *
144 (list_offset + item_offset);
146 attr_i < num_attributes_per_neighbor;
148 attr_ptr[attr_i] = inp_neighbors_attributes
149 [num_attributes_per_neighbor * j +
const char const char value recording_handle imu_sample recording_handle uint8_t size_t data_size k4a_record_configuration_t config target_format k4a_capture_t capture_handle k4a_imu_sample_t imu_sample playback_handle k4a_logging_message_cb_t void min_level device_handle k4a_imu_sample_t timeout_in_ms capture_handle capture_handle capture_handle image_handle temperature_c k4a_image_t image_handle uint8_t image_handle image_handle image_handle image_handle uint32_t
Definition: K4aPlugin.cpp:557
void InclusivePrefixSum(const Tin *first, const Tin *last, Tout *out)
Definition: ParallelScan.h:67
void InvertNeighborsListCPU(const TIndex *const inp_neighbors_index, const TAttr *const inp_neighbors_attributes, const int num_attributes_per_neighbor, const int64_t *const inp_neighbors_row_splits, const size_t inp_num_queries, TIndex *out_neighbors_index, TAttr *out_neighbors_attributes, const size_t index_size, int64_t *out_neighbors_row_splits, const size_t out_num_queries)
Definition: InvertNeighborsList.h:90
Definition: PinholeCameraIntrinsic.cpp:35
uint32_t AtomicFetchAddRelaxed(uint32_t *address, uint32_t val)
Definition: Atomic.h:40
Definition: Console.cpp:51