[mlpack-git] master: Fixed spacing and updated documentation. (3aee6e8)
gitdub at mlpack.org
gitdub at mlpack.org
Tue Aug 23 07:00:42 EDT 2016
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/1797a49c8f76d65814fec4a122d0d2fea01fc2d9...9e5cd0ac9c5cde9ac141bc84e7327bd11e19d42e
>---------------------------------------------------------------
commit 3aee6e807d45813411ac74b3294c2a20d40ab857
Author: Mikhail Lozhnikov <lozhnikovma at gmail.com>
Date: Tue Aug 23 14:00:42 2016 +0300
Fixed spacing and updated documentation.
>---------------------------------------------------------------
3aee6e807d45813411ac74b3294c2a20d40ab857
src/mlpack/core/tree/address.hpp | 50 +++++++++++++++++++++-
.../tree/binary_space_tree/binary_space_tree.hpp | 24 ++++++-----
.../binary_space_tree/binary_space_tree_impl.hpp | 19 +++++---
src/mlpack/core/tree/cellbound.hpp | 27 ++++++++++++
4 files changed, 101 insertions(+), 19 deletions(-)
diff --git a/src/mlpack/core/tree/address.hpp b/src/mlpack/core/tree/address.hpp
index 6f4bdd5..4d4520c 100644
--- a/src/mlpack/core/tree/address.hpp
+++ b/src/mlpack/core/tree/address.hpp
@@ -1,4 +1,28 @@
-
+/**
+ * @file address.hpp
+ * @author Mikhail Lozhnikov
+ *
+ * This file contains a series of functions for translating points to addresses
+ * and back and functions for comparing addresses.
+ *
+ * The notion of addresses is described in the following paper.
+ * @code
+ * @inproceedings{bayer1997,
+ * author = {Bayer, Rudolf},
+ * title = {The Universal B-Tree for Multidimensional Indexing: General
+ * Concepts},
+ * booktitle = {Proceedings of the International Conference on Worldwide
+ * Computing and Its Applications},
+ * series = {WWCA '97},
+ * year = {1997},
+ * isbn = {3-540-63343-X},
+ * pages = {198--209},
+ * numpages = {12},
+ * publisher = {Springer-Verlag},
+ * address = {London, UK, UK},
+ * }
+ * @endcode
+*/
#ifndef MLPACK_CORE_TREE_ADDRESS_HPP
#define MLPACK_CORE_TREE_ADDRESS_HPP
@@ -8,6 +32,14 @@ namespace bound {
namespace addr {
+/**
+ * Calculate the address of a point. Be careful, the point and the address
+ * variables should be equal-sized and the type of the address should correspond
+ * to the type of the vector.
+ *
+ * @param address The resulting address.
+ * @param point The point that is being translated to the address.
+ */
template<typename AddressType, typename VecType>
void PointToAddress(AddressType& address, const VecType& point)
{
@@ -85,6 +117,14 @@ void PointToAddress(AddressType& address, const VecType& point)
}
}
+/**
+ * Translate the address to the point. Be careful, the point and the address
+ * variables should be equal-sized and the type of the address should correspond
+ * to the type of the vector.
+ *
+ * @param address An address to translate.
+ * @param point The point that corresponds to the address.
+ */
template<typename AddressType, typename VecType>
void AddressToPoint(VecType& point, const AddressType& address)
{
@@ -153,6 +193,11 @@ void AddressToPoint(VecType& point, const AddressType& address)
}
}
+/**
+ * Compare two addresses. The function returns 1 if the first address is greater
+ * than the second one, -1 if the first address is less than the second one,
+ * otherwise the function returns 0.
+ */
template<typename AddressType1, typename AddressType2>
int CompareAddresses(const AddressType1& addr1, const AddressType2& addr2)
{
@@ -173,6 +218,9 @@ int CompareAddresses(const AddressType1& addr1, const AddressType2& addr2)
return 0;
}
+/**
+ * Returns true if an address is contained between two other addresses.
+ */
template<typename AddressType1, typename AddressType2, typename AddressType3>
bool Contains(const AddressType1& address, const AddressType2& loBound,
const AddressType3& hiBound)
diff --git a/src/mlpack/core/tree/binary_space_tree/binary_space_tree.hpp b/src/mlpack/core/tree/binary_space_tree/binary_space_tree.hpp
index 20f644d..bcbbbac 100644
--- a/src/mlpack/core/tree/binary_space_tree/binary_space_tree.hpp
+++ b/src/mlpack/core/tree/binary_space_tree/binary_space_tree.hpp
@@ -528,11 +528,12 @@ class BinarySpaceTree
* @param oldFromNew Vector which will be filled with the old positions for
* each new point.
*/
- size_t PerformSplit(MatType& data,
- const size_t begin,
- const size_t count,
- const typename UBTreeSplit<BoundType<MetricType>,
- MatType>::SplitInfo& splitInfo);
+ size_t PerformSplit(
+ MatType& data,
+ const size_t begin,
+ const size_t count,
+ const typename UBTreeSplit<BoundType<MetricType>,
+ MatType>::SplitInfo& splitInfo);
/**
* An overload for the universal B tree. For the first time the function
@@ -548,12 +549,13 @@ class BinarySpaceTree
* @param oldFromNew Vector which will be filled with the old positions for
* each new point.
*/
- size_t PerformSplit(MatType& data,
- const size_t begin,
- const size_t count,
- const typename UBTreeSplit<BoundType<MetricType>,
- MatType>::SplitInfo& splitInfo,
- std::vector<size_t>& oldFromNew);
+ size_t PerformSplit(
+ MatType& data,
+ const size_t begin,
+ const size_t count,
+ const typename UBTreeSplit<BoundType<MetricType>,
+ MatType>::SplitInfo& splitInfo,
+ std::vector<size_t>& oldFromNew);
/**
* Update the bound of the current node. This method does not take into
diff --git a/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp b/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
index b4e3904..f2d96e7 100644
--- a/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
+++ b/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
@@ -880,9 +880,12 @@ template<typename MetricType,
template<typename SplitBoundType, typename SplitMatType>
class SplitType>
size_t BinarySpaceTree<MetricType, StatisticType, MatType, BoundType,
- SplitType>::PerformSplit(MatType& data,
- const size_t begin, const size_t count,
- const typename UBTreeSplit<BoundType<MetricType>, MatType>::SplitInfo& splitInfo)
+ SplitType>::PerformSplit(
+ MatType& data,
+ const size_t begin,
+ const size_t count,
+ const typename UBTreeSplit<BoundType<MetricType>,
+ MatType>::SplitInfo& splitInfo)
{
return SplitType<BoundType<MetricType>, MatType>::PerformSplit(data, begin,
count, splitInfo);
@@ -895,9 +898,12 @@ template<typename MetricType,
template<typename SplitBoundType, typename SplitMatType>
class SplitType>
size_t BinarySpaceTree<MetricType, StatisticType, MatType, BoundType,
- SplitType>::PerformSplit(MatType& data,
- const size_t begin, const size_t count,
- const typename UBTreeSplit<BoundType<MetricType>, MatType>::SplitInfo& splitInfo,
+ SplitType>::PerformSplit(
+ MatType& data,
+ const size_t begin,
+ const size_t count,
+ const typename UBTreeSplit<BoundType<MetricType>,
+ MatType>::SplitInfo& splitInfo,
std::vector<size_t>& oldFromNew)
{
return SplitType<BoundType<MetricType>, MatType>::PerformSplit(data, begin,
@@ -910,7 +916,6 @@ template<typename MetricType,
template<typename BoundMetricType, typename...> class BoundType,
template<typename SplitBoundType, typename SplitMatType>
class SplitType>
-
template<typename BoundType2>
void BinarySpaceTree<MetricType, StatisticType, MatType, BoundType, SplitType>::
UpdateBound(BoundType2& boundToUpdate)
diff --git a/src/mlpack/core/tree/cellbound.hpp b/src/mlpack/core/tree/cellbound.hpp
index 1fa51a4..cd6a7da 100644
--- a/src/mlpack/core/tree/cellbound.hpp
+++ b/src/mlpack/core/tree/cellbound.hpp
@@ -38,6 +38,33 @@
namespace mlpack {
namespace bound {
+/**
+ * The CellBound class describes a bound that consists of a number of
+ * hyperrectangles. These hyperrectangles do not overlap each other. The bound
+ * is limited by an outer hyperrectangle and two addresses, the lower address
+ * and the high address. Thus, the bound contains all points included between
+ * the lower and the high addresses. The class caches the minimum bounding
+ * rectangle, the lower and the high addresses and the hyperrectangles
+ * that are described by the addresses.
+ *
+ * The notion of addresses is described in the following paper.
+ * @code
+ * @inproceedings{bayer1997,
+ * author = {Bayer, Rudolf},
+ * title = {The Universal B-Tree for Multidimensional Indexing: General
+ * Concepts},
+ * booktitle = {Proceedings of the International Conference on Worldwide
+ * Computing and Its Applications},
+ * series = {WWCA '97},
+ * year = {1997},
+ * isbn = {3-540-63343-X},
+ * pages = {198--209},
+ * numpages = {12},
+ * publisher = {Springer-Verlag},
+ * address = {London, UK, UK},
+ * }
+ * @endcode
+ */
template<typename MetricType = metric::LMetric<2, true>,
typename ElemType = double>
class CellBound
More information about the mlpack-git
mailing list