|
4 | 4 | #include "../kd_tree.h" |
5 | 5 |
|
6 | 6 | namespace psi { |
7 | | -template <typename Point, typename SplitRule, typename LeafAugType, typename InteriorAugType, uint_fast8_t kSkHeight, |
| 7 | +template <typename Point, typename SplitRule, typename LeafAugType, |
| 8 | + typename InteriorAugType, uint_fast8_t kSkHeight, |
8 | 9 | uint_fast8_t kImbaRatio> |
9 | 10 | template <typename Range> |
10 | | -void KdTree<Point, SplitRule, LeafAugType, InteriorAugType, kSkHeight , kImbaRatio>::BatchDiff(Range&& In) { |
| 11 | +void KdTree<Point, SplitRule, LeafAugType, InteriorAugType, kSkHeight, |
| 12 | + kImbaRatio>::BatchDiff(Range&& In) { |
11 | 13 | static_assert(parlay::is_random_access_range_v<Range>); |
12 | 14 | static_assert( |
13 | 15 | parlay::is_less_than_comparable_v<parlay::range_reference_type_t<Range>>); |
14 | 16 | static_assert(std::is_constructible_v<parlay::range_value_type_t<Range>, |
15 | 17 | parlay::range_reference_type_t<Range>>); |
16 | 18 |
|
17 | | - Slice A = parlay::make_slice(In); |
| 19 | + auto aux = Points::uninitialized(parlay::size(In)); |
| 20 | + parlay::copy(In, parlay::make_slice(aux)); |
| 21 | + Slice A = parlay::make_slice(aux); |
18 | 22 | BatchDiff_(A); |
19 | 23 | return; |
20 | 24 | } |
21 | 25 |
|
22 | 26 | // NOTE: batch delete suitable for Points that are pratially covered in the tree |
23 | | -template <typename Point, typename SplitRule, typename LeafAugType, typename InteriorAugType, uint_fast8_t kSkHeight, |
| 27 | +template <typename Point, typename SplitRule, typename LeafAugType, |
| 28 | + typename InteriorAugType, uint_fast8_t kSkHeight, |
24 | 29 | uint_fast8_t kImbaRatio> |
25 | | -void KdTree<Point, SplitRule, LeafAugType, InteriorAugType, kSkHeight , kImbaRatio>::BatchDiff_(Slice A) { |
| 30 | +void KdTree<Point, SplitRule, LeafAugType, InteriorAugType, kSkHeight, |
| 31 | + kImbaRatio>::BatchDiff_(Slice A) { |
26 | 32 | Points B = Points::uninitialized(A.size()); |
27 | 33 | Node* T = this->root_; |
28 | 34 | Box box = this->tree_box_; |
@@ -55,13 +61,17 @@ void KdTree<Point, SplitRule, LeafAugType, InteriorAugType, kSkHeight , kImbaRat |
55 | 61 |
|
56 | 62 | // NOTE: only sieve the Points, without rebuilding the tree |
57 | 63 | // NOTE: the kdtree needs box since the box will be changed in batch diff |
58 | | -template <typename Point, typename SplitRule, typename LeafAugType, typename InteriorAugType, uint_fast8_t kSkHeight, |
| 64 | +template <typename Point, typename SplitRule, typename LeafAugType, |
| 65 | + typename InteriorAugType, uint_fast8_t kSkHeight, |
59 | 66 | uint_fast8_t kImbaRatio> |
60 | | -typename KdTree<Point, SplitRule, LeafAugType, InteriorAugType, kSkHeight , kImbaRatio>::NodeBox |
61 | | -KdTree<Point, SplitRule, LeafAugType, InteriorAugType, kSkHeight , kImbaRatio>::BatchDiffRecursive( |
62 | | - Node* T, |
63 | | - typename KdTree<Point, SplitRule, LeafAugType, InteriorAugType, kSkHeight , kImbaRatio>::Box const& box, |
64 | | - Slice In, Slice Out, DimsType d) { |
| 67 | +typename KdTree<Point, SplitRule, LeafAugType, InteriorAugType, kSkHeight, |
| 68 | + kImbaRatio>::NodeBox |
| 69 | +KdTree<Point, SplitRule, LeafAugType, InteriorAugType, kSkHeight, kImbaRatio>:: |
| 70 | + BatchDiffRecursive( |
| 71 | + Node* T, |
| 72 | + typename KdTree<Point, SplitRule, LeafAugType, InteriorAugType, |
| 73 | + kSkHeight, kImbaRatio>::Box const& box, |
| 74 | + Slice In, Slice Out, DimsType d) { |
65 | 75 | size_t n = In.size(); |
66 | 76 |
|
67 | 77 | if (n == 0) return NodeBox(T, box); |
|
0 commit comments