[mlpack-git] master, mlpack-1.0.x: Remove HasParentDistance trait, becase it wasn't used anywhere. (390e7d6)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:47:30 EST 2015


Repository : https://github.com/mlpack/mlpack

On branches: master,mlpack-1.0.x
Link       : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40

>---------------------------------------------------------------

commit 390e7d62e3faa03fc5de5a4d33cbfd7aa1b42776
Author: Ryan Curtin <ryan at ratml.org>
Date:   Wed May 21 22:51:45 2014 +0000

    Remove HasParentDistance trait, becase it wasn't used anywhere.


>---------------------------------------------------------------

390e7d62e3faa03fc5de5a4d33cbfd7aa1b42776
 src/mlpack/core/tree/binary_space_tree/traits.hpp |  6 ------
 src/mlpack/core/tree/cover_tree/traits.hpp        |  7 -------
 src/mlpack/core/tree/rectangle_tree/traits.hpp    |  6 ------
 src/mlpack/core/tree/tree_traits.hpp              | 16 +++++-----------
 src/mlpack/tests/tree_traits_test.cpp             | 17 ++++-------------
 5 files changed, 9 insertions(+), 43 deletions(-)

diff --git a/src/mlpack/core/tree/binary_space_tree/traits.hpp b/src/mlpack/core/tree/binary_space_tree/traits.hpp
index 45d2e66..78aeba9 100644
--- a/src/mlpack/core/tree/binary_space_tree/traits.hpp
+++ b/src/mlpack/core/tree/binary_space_tree/traits.hpp
@@ -25,12 +25,6 @@ class TreeTraits<BinarySpaceTree<BoundType, StatisticType, MatType> >
 {
  public:
   /**
-   * The binary space tree cannot easily calculate the distance from a node to
-   * its parent; so BinarySpaceTree<...>::ParentDistance() does not exist.
-   */
-  static const bool HasParentDistance = false;
-
-  /**
    * Each binary space tree node has two children which represent
    * non-overlapping subsets of the space which the node represents.  Therefore,
    * children are not overlapping.
diff --git a/src/mlpack/core/tree/cover_tree/traits.hpp b/src/mlpack/core/tree/cover_tree/traits.hpp
index 4fe1eaf..6f78153 100644
--- a/src/mlpack/core/tree/cover_tree/traits.hpp
+++ b/src/mlpack/core/tree/cover_tree/traits.hpp
@@ -26,13 +26,6 @@ class TreeTraits<CoverTree<MetricType, RootPointPolicy, StatisticType> >
 {
  public:
   /**
-   * The cover tree calculates the distance between parent and child during
-   * construction, so that value is saved and CoverTree<...>::ParentDistance()
-   * does exist.
-   */
-  static const bool HasParentDistance = true;
-
-  /**
    * The cover tree (or, this implementation of it) does not require that
    * children represent non-overlapping subsets of the parent node.
    */
diff --git a/src/mlpack/core/tree/rectangle_tree/traits.hpp b/src/mlpack/core/tree/rectangle_tree/traits.hpp
index 59b4d29..46848b9 100644
--- a/src/mlpack/core/tree/rectangle_tree/traits.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/traits.hpp
@@ -24,12 +24,6 @@ class TreeTraits<RectangleTree<StatisticType, MatType> >
 {
  public:
   /**
-   * The R-tree cannot easily calculate the distance from a node to
-   * its parent; so RectangleTree<...>::ParentDistance() does not exist.
-   */
-  static const bool HasParentDistance = false;
-
-  /**
    * An R-tree can have overlapping children.
    */
   static const bool HasOverlappingChildren = true;
diff --git a/src/mlpack/core/tree/tree_traits.hpp b/src/mlpack/core/tree/tree_traits.hpp
index 770169b..77ac166 100644
--- a/src/mlpack/core/tree/tree_traits.hpp
+++ b/src/mlpack/core/tree/tree_traits.hpp
@@ -39,17 +39,18 @@ namespace tree {
  * template<typename TreeType>
  * void Compute(TreeType& node,
  *              boost::enable_if<
- *                  TreeTraits<TreeType>::HasParentDistance>::type*)
+ *                  TreeTraits<TreeType>::RearrangesDataset>::type*)
  * {
- *   // Computation with TreeType::ParentDistance().
+ *   // Computation where special dataset-rearranging tree constructor is
+ *   // called.
  * }
  *
  * template<typename TreeType>
  * void Compute(TreeType& node,
  *              boost::enable_if<
- *                  !TreeTraits<TreeType>::HasParentDistance>::type*)
+ *                  !TreeTraits<TreeType>::RearrangesDataset>::type*)
  * {
- *   // Computation without TreeType::ParentDistance().
+ *   // Computation where normal tree constructor is called.
  * }
  * @endcode
  *
@@ -73,13 +74,6 @@ class TreeTraits
 {
  public:
   /**
-   * This is true if TreeType::ParentDistance() exists and works.  The
-   * ParentDistance() function returns the distance between the center of a node
-   * and the center of its parent.
-   */
-  static const bool HasParentDistance = false;
-
-  /**
    * This is true if the subspaces represented by the children of a node can
    * overlap.
    */
diff --git a/src/mlpack/tests/tree_traits_test.cpp b/src/mlpack/tests/tree_traits_test.cpp
index 4dc0314..df220fc 100644
--- a/src/mlpack/tests/tree_traits_test.cpp
+++ b/src/mlpack/tests/tree_traits_test.cpp
@@ -31,9 +31,7 @@ BOOST_AUTO_TEST_CASE(DefaultsTraitsTest)
 {
   // An irrelevant non-tree type class is used here so that the default
   // implementation of TreeTraits is chosen.
-  bool b = TreeTraits<int>::HasParentDistance;
-  BOOST_REQUIRE_EQUAL(b, false);
-  b = TreeTraits<int>::HasOverlappingChildren;
+  bool b = TreeTraits<int>::HasOverlappingChildren;
   BOOST_REQUIRE_EQUAL(b, true);
   b = TreeTraits<int>::HasSelfChildren;
   BOOST_REQUIRE_EQUAL(b, false);
@@ -42,12 +40,9 @@ BOOST_AUTO_TEST_CASE(DefaultsTraitsTest)
 // Test the binary space tree traits.
 BOOST_AUTO_TEST_CASE(BinarySpaceTreeTraitsTest)
 {
-  // ParentDistance() is not available.
-  bool b = TreeTraits<BinarySpaceTree<LMetric<2, false> > >::HasParentDistance;
-  BOOST_REQUIRE_EQUAL(b, false);
-
   // Children are non-overlapping.
-  b = TreeTraits<BinarySpaceTree<LMetric<2, false> > >::HasOverlappingChildren;
+  bool b =
+      TreeTraits<BinarySpaceTree<LMetric<2, false> > >::HasOverlappingChildren;
   BOOST_REQUIRE_EQUAL(b, false);
 
   // Points are not contained at multiple levels.
@@ -58,12 +53,8 @@ BOOST_AUTO_TEST_CASE(BinarySpaceTreeTraitsTest)
 // Test the cover tree traits.
 BOOST_AUTO_TEST_CASE(CoverTreeTraitsTest)
 {
-  // ParentDistance() is available.
-  bool b = TreeTraits<CoverTree<> >::HasParentDistance;
-  BOOST_REQUIRE_EQUAL(b, true);
-
   // Children may be overlapping.
-  b = TreeTraits<CoverTree<> >::HasOverlappingChildren;
+  bool b = TreeTraits<CoverTree<> >::HasOverlappingChildren;
   BOOST_REQUIRE_EQUAL(b, true);
 
   // The cover tree has self-children.



More information about the mlpack-git mailing list