summaryrefslogtreecommitdiffstats
path: root/include/shard
diff options
context:
space:
mode:
authorDouglas Rumbaugh <dbr4@psu.edu>2024-02-09 12:30:21 -0500
committerDouglas Rumbaugh <dbr4@psu.edu>2024-02-09 12:30:21 -0500
commit402fc269c0aaa671d84a6d15918735ad4b90e6b2 (patch)
tree145b1658f31a005eda33c9231b2b8ee7bab7915f /include/shard
parent711769574e647839677739192698e400529efe75 (diff)
downloaddynamic-extension-402fc269c0aaa671d84a6d15918735ad4b90e6b2.tar.gz
Comment updates/fixes
Diffstat (limited to 'include/shard')
-rw-r--r--include/shard/Alias.h1
-rw-r--r--include/shard/AugBTree.h2
-rw-r--r--include/shard/ISAMTree.h1
-rw-r--r--include/shard/PGM.h1
-rw-r--r--include/shard/TrieSpline.h1
-rw-r--r--include/shard/VPTree.h39
6 files changed, 29 insertions, 16 deletions
diff --git a/include/shard/Alias.h b/include/shard/Alias.h
index f0d1d59..9275952 100644
--- a/include/shard/Alias.h
+++ b/include/shard/Alias.h
@@ -10,6 +10,7 @@
* structure. Designed to be used along side the WSS
* query in include/query/wss.h
*
+ * TODO: The code in this file is very poorly commented.
*/
#pragma once
diff --git a/include/shard/AugBTree.h b/include/shard/AugBTree.h
index 58bd098..54931bd 100644
--- a/include/shard/AugBTree.h
+++ b/include/shard/AugBTree.h
@@ -10,6 +10,8 @@
* used along side the WIRS query in include/query/wirs.h, but
* also supports the necessary methods for other common query
* types.
+ *
+ * TODO: The code in this file is very poorly commented.
*/
#pragma once
diff --git a/include/shard/ISAMTree.h b/include/shard/ISAMTree.h
index 9458b1f..3763271 100644
--- a/include/shard/ISAMTree.h
+++ b/include/shard/ISAMTree.h
@@ -8,6 +8,7 @@
*
* A shard shim around an in-memory ISAM tree.
*
+ * TODO: The code in this file is very poorly commented.
*/
#pragma once
diff --git a/include/shard/PGM.h b/include/shard/PGM.h
index 8031870..e2752ef 100644
--- a/include/shard/PGM.h
+++ b/include/shard/PGM.h
@@ -9,6 +9,7 @@
* A shard shim around the static version of the PGM learned
* index.
*
+ * TODO: The code in this file is very poorly commented.
*/
#pragma once
diff --git a/include/shard/TrieSpline.h b/include/shard/TrieSpline.h
index f9fb3cb..2a432e8 100644
--- a/include/shard/TrieSpline.h
+++ b/include/shard/TrieSpline.h
@@ -7,6 +7,7 @@
*
* A shard shim around the TrieSpline learned index.
*
+ * TODO: The code in this file is very poorly commented.
*/
#pragma once
diff --git a/include/shard/VPTree.h b/include/shard/VPTree.h
index ba13a87..b342fe6 100644
--- a/include/shard/VPTree.h
+++ b/include/shard/VPTree.h
@@ -9,7 +9,7 @@
* search.
*
* FIXME: Does not yet support the tombstone delete policy.
- *
+ * TODO: The code in this file is very poorly commented.
*/
#pragma once
@@ -234,13 +234,15 @@ private:
}
vpnode *build_subtree(size_t start, size_t stop, gsl_rng *rng) {
- // base-case: sometimes happens (probably because of the +1 and -1
- // in the first recursive call)
+ /*
+ * base-case: sometimes happens (probably because of the +1 and -1
+ * in the first recursive call)
+ */
if (start > stop) {
return nullptr;
}
- // base-case: create a leaf node
+ /* base-case: create a leaf node */
if (stop - start <= LEAFSZ) {
vpnode *node = new vpnode();
node->start = start;
@@ -251,26 +253,30 @@ private:
return node;
}
- // select a random element to be the root of the
- // subtree
+ /*
+ * select a random element to be the root of the
+ * subtree
+ */
auto i = start + gsl_rng_uniform_int(rng, stop - start + 1);
swap(start, i);
- // partition elements based on their distance from the start,
- // with those elements with distance falling below the median
- // distance going into the left sub-array and those above
- // the median in the right. This is easily done using QuickSelect.
+ /*
+ * partition elements based on their distance from the start,
+ * with those elements with distance falling below the median
+ * distance going into the left sub-array and those above
+ * the median in the right. This is easily done using QuickSelect.
+ */
auto mid = (start + 1 + stop) / 2;
quickselect(start + 1, stop, mid, m_ptrs[start], rng);
- // Create a new node based on this partitioning
+ /* Create a new node based on this partitioning */
vpnode *node = new vpnode();
node->start = start;
- // store the radius of the circle used for partitioning the node.
+ /* store the radius of the circle used for partitioning the node. */
node->radius = m_ptrs[start]->rec.calc_distance(m_ptrs[mid]->rec);
- // recursively construct the left and right subtrees
+ /* recursively construct the left and right subtrees */
node->inside = build_subtree(start + 1, mid-1, rng);
node->outside = build_subtree(mid, stop, rng);
@@ -279,6 +285,8 @@ private:
return node;
}
+ // TODO: The quickselect code can probably be generalized and moved out
+ // to psudb-common instead.
void quickselect(size_t start, size_t stop, size_t k, Wrapped<R> *p, gsl_rng *rng) {
if (start == stop) return;
@@ -291,6 +299,8 @@ private:
}
}
+ // TODO: The quickselect code can probably be generalized and moved out
+ // to psudb-common instead.
size_t partition(size_t start, size_t stop, Wrapped<R> *p, gsl_rng *rng) {
auto pivot = start + gsl_rng_uniform_int(rng, stop - start);
double pivot_dist = p->rec.calc_distance(m_ptrs[pivot]->rec);
@@ -369,8 +379,5 @@ private:
}
}
}
-
-
};
-
}