[mlpack] 14/324: Remove HasParentDistance trait, becase it wasn't used anywhere.

Barak A. Pearlmutter barak+git at cs.nuim.ie
Sun Aug 17 08:21:51 UTC 2014


This is an automated email from the git hooks/post-receive script.

bap pushed a commit to branch svn-trunk
in repository mlpack.

commit ac788bb4f64752ce9c019f73927eac6b9e59f82c
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Wed May 21 22:51:45 2014 +0000

    Remove HasParentDistance trait, becase it wasn't used anywhere.
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16534 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 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.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git



More information about the debian-science-commits mailing list