[mlpack-git] [mlpack/mlpack] Hilbert R tree (#664)
lozhnikov
notifications at github.com
Sun Jun 12 04:30:26 EDT 2016
I think I finished the refactoring. KFNTest, KNNTest, RangeSearchTest, AllkRANNTest and RectangleTreeTest are passed. But there are some minor issues:
1. The std::move constructor is weird:
```
MatType dataset(std::move(data));
stat = StatisticType(*this);
// For now, just insert the points in order.
RectangleTree* root = this;
for (size_t i = firstDataIndex; i < dataset.n_cols; i++)
root->InsertPoint(dataset.col(i),i);
```
Oh... I forgot to add a space between , and i. I just noticed that.
2. This code is slow (range_search_rules_impl.hpp):
```
if (tree::TreeTraits<TreeType>::HasDataset)
{
for (size_t i = 0; i < queryNode.NumDescendants(); ++i)
AddResult(queryNode.Descendant(i), referenceNode);
}
else
{
for (size_t i = 0; i < queryNode.NumDescendants(); ++i)
AddResult(queryNode.Descendant(i), queryNode.DescendantPoint(i),
referenceNode);
}
```
Why don't we use an iterator instead of `queryNode.Descendant(i)`? The iterator should be faster.
3. It seems the `arma::Mat::Col` and the `arma::Mat::unsafe_col` functions return a temporary object.
Is there any way to avoid copying in this code:
```
arma::Col<ElemType> DescendantPoint(const size_t index) const;
```
If we use an iterator we can avoid that:
```
for (TreeType::const_iterator it = queryNode.begin(); it != queryNode.end(); ++it)
AddResult(it.index(), it.node().Dataset().col(it.point()), referenceNode);
```
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/664#issuecomment-225416921
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160612/ff5e08fc/attachment.html>
More information about the mlpack-git
mailing list