You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be useful to have a dedicated function in C++/R to make queries on trees that have already been computed. This would especially help when making many repeated queries and when we would prefer separate objects/processes for trees and queries.
We can query by doing, e.g., w1$query(q, 1, 0.0), which works well (and is very fast).
However, instead of using the above R5 class function, I would like to have a simpler function that can input the tree directly, as a separate object. So something like:
// [[Rcpp::export]]
List wann_query(?? kd_tree_object, NumericMatrix query, const int k) {
//Skip the tree-building process and proceed to calculate distances, as in nn.cpp
//WANN tree = WANN(data); -- This line would not be needed
return List::create(Rcpp::Named("nn.idx")=ridx, Rcpp::Named("nn.dists")=rdists);
}
The main challenges I'm facing are
How to extract the tree from the w1 WANN object?
How exactly can the tree object be passed into wann_query and used to calculate distances?
The end goal would be something like:
tree_out <- w1$tree
wann_query(tree_out, q, 1)
# Output identical to
w1$query(q, 1, 0.0)
The text was updated successfully, but these errors were encountered:
It would be useful to have a dedicated function in C++/R to make queries on trees that have already been computed. This would especially help when making many repeated queries and when we would prefer separate objects/processes for trees and queries.
For example:
We can query by doing, e.g.,
w1$query(q, 1, 0.0)
, which works well (and is very fast).However, instead of using the above R5 class function, I would like to have a simpler function that can input the tree directly, as a separate object. So something like:
The main challenges I'm facing are
The end goal would be something like:
The text was updated successfully, but these errors were encountered: