[mlpack-svn] r16534 - in mlpack/trunk/src/mlpack: core/tree core/tree/binary_space_tree core/tree/cover_tree core/tree/rectangle_tree tests

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Wed May 21 18:51:46 EDT 2014


Author: rcurtin
Date: Wed May 21 18:51:45 2014
New Revision: 16534

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


Modified:
   mlpack/trunk/src/mlpack/core/tree/binary_space_tree/traits.hpp
   mlpack/trunk/src/mlpack/core/tree/cover_tree/traits.hpp
   mlpack/trunk/src/mlpack/core/tree/rectangle_tree/traits.hpp
   mlpack/trunk/src/mlpack/core/tree/tree_traits.hpp
   mlpack/trunk/src/mlpack/tests/tree_traits_test.cpp

Modified: mlpack/trunk/src/mlpack/core/tree/binary_space_tree/traits.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/tree/binary_space_tree/traits.hpp	(original)
+++ mlpack/trunk/src/mlpack/core/tree/binary_space_tree/traits.hpp	Wed May 21 18:51:45 2014
@@ -25,12 +25,6 @@
 {
  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.

Modified: mlpack/trunk/src/mlpack/core/tree/cover_tree/traits.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/tree/cover_tree/traits.hpp	(original)
+++ mlpack/trunk/src/mlpack/core/tree/cover_tree/traits.hpp	Wed May 21 18:51:45 2014
@@ -26,13 +26,6 @@
 {
  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.
    */

Modified: mlpack/trunk/src/mlpack/core/tree/rectangle_tree/traits.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/tree/rectangle_tree/traits.hpp	(original)
+++ mlpack/trunk/src/mlpack/core/tree/rectangle_tree/traits.hpp	Wed May 21 18:51:45 2014
@@ -24,12 +24,6 @@
 {
  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;

Modified: mlpack/trunk/src/mlpack/core/tree/tree_traits.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/tree/tree_traits.hpp	(original)
+++ mlpack/trunk/src/mlpack/core/tree/tree_traits.hpp	Wed May 21 18:51:45 2014
@@ -39,17 +39,18 @@
  * 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 @@
 {
  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.
    */

Modified: mlpack/trunk/src/mlpack/tests/tree_traits_test.cpp
==============================================================================
--- mlpack/trunk/src/mlpack/tests/tree_traits_test.cpp	(original)
+++ mlpack/trunk/src/mlpack/tests/tree_traits_test.cpp	Wed May 21 18:51:45 2014
@@ -31,9 +31,7 @@
 {
   // 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 @@
 // 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 @@
 // 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-svn mailing list