[mlpack] 43/324: a few miscellanious small changes. Added to CMake.

Barak A. Pearlmutter barak+git at cs.nuim.ie
Sun Aug 17 08:21:54 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 ad27d448ef8616a2a7d596978a60696981e7f74e
Author: andrewmw94 <andrewmw94 at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Wed Jun 4 17:47:08 2014 +0000

    a few miscellanious small changes.  Added to CMake.
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16630 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 src/mlpack/core/tree/CMakeLists.txt                |  7 +++++
 .../core/tree/rectangle_tree/rectangle_tree.hpp    | 34 ++++++++++++++--------
 .../tree/rectangle_tree/rectangle_tree_impl.hpp    |  4 ++-
 3 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/src/mlpack/core/tree/CMakeLists.txt b/src/mlpack/core/tree/CMakeLists.txt
index 85c1d8d..8f60033 100644
--- a/src/mlpack/core/tree/CMakeLists.txt
+++ b/src/mlpack/core/tree/CMakeLists.txt
@@ -31,6 +31,13 @@ set(SOURCES
   mrkd_statistic.hpp
   mrkd_statistic_impl.hpp
   mrkd_statistic.cpp
+  rectangle_tree.hpp
+  rectangle_tree/rectangle_tree.hpp
+  rectangle_tree/rectangle_tree_impl.hpp
+  rectangle_tree/r_tree_split.hpp
+  rectangle_tree/r_tree_split_impl.hpp
+  rectangle_tree/r_tree_descent_heuristic.hpp
+  rectangle_tree/r_tree_descent_heuristic_impl.hpp
   statistic.hpp
   traversal_info.hpp
   tree_traits.hpp
diff --git a/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp b/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp
index b143311..45a729a 100644
--- a/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp
@@ -40,8 +40,8 @@ class RectangleTree
   //! The minimum number of child nodes a non-leaf node can have.
   size_t minNumChildren;
   //! The number of child nodes actually in use (0 if this is a leaf node).
-  size_t numOfChildren;
-  //! The child nodes (Starting at 0 and ending at (numOfChildren-1) ).
+  size_t numChildren;
+  //! The child nodes (Starting at 0 and ending at (numChildren-1) ).
   std::vector<RectangleTree*> children;
   //! The parent node (NULL if this is the root of the tree).
   RectangleTree* parent;
@@ -150,11 +150,26 @@ class RectangleTree
   //! Return whether or not this node is a leaf (true if it has no children).
   bool IsLeaf() const;
 
-  //! Return the max leaf size.
+  //! Return the maximum leaf size.
   size_t MaxLeafSize() const { return maxLeafSize; }
-  //! Modify the max leaf size.
+  //! Modify the maximum leaf size.
   size_t& MaxLeafSize() { return maxLeafSize; }
 
+  //! Return the minimum leaf size.
+  size_t MinLeafSize() const { return minLeafSize; }
+  //! Modify the minimum leaf size.
+  size_t& MinLeafSize() { return minLeafSize; }
+
+  //! Return the maximum number of children (in a non-leaf node).
+  size_t MaxNumChildren() const { return maxNumChildren; }
+  //! Modify the maximum number of children (in a non-leaf node).
+  size_t& MaxNumChildren() { return maxNumChildren; }
+
+  //! Return the minimum number of children (in a non-leaf node).
+  size_t MinNumChildren() const { return minNumChildren; }
+  //! Modify the minimum number of children (in a non-leaf node).
+  size_t& MinNumChildren() { return minNumChildren; }
+
   //! Gets the parent of this node.
   RectangleTree* Parent() const { return parent; }
   //! Modify the parent of this node.
@@ -171,15 +186,10 @@ class RectangleTree
   //! Get the centroid of the node and store it in the given vector.
   void Centroid(arma::vec& centroid) { bound.Centroid(centroid); }
 
-  // TODO.  Think of a better name that makes the difference here obvious.
-
-  //! Return the number of children in this node.
-  size_t NumChildren() const;
-
   //! Return the number of child nodes.  (One level beneath this one only.)
-  size_t getNumOfChildren() const { return numOfChildren; }
+  size_t NumChildren() const { return numChildren; }
   //! Modify the number of child nodes.  Be careful.
-  size_t& getNumOfChildren() { return numOfChildren; }
+  size_t& NumChildren() { return numChildren; }
 
   //! Get the children of this node.
   const std::vector<RectangleTree*>& Children() const { return children; }
@@ -215,7 +225,7 @@ class RectangleTree
    */
   RectangleTree& Child(const size_t child) const;
 
-  //! Return the number of points in this node (0 if not a leaf).
+  //! Return the number of points in this node (returns 0 if this node is not a leaf).
   size_t NumPoints() const;
 
   /**
diff --git a/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp b/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp
index 7059081..3737a3c 100644
--- a/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp
@@ -42,12 +42,14 @@ RectangleTree<StatisticType, MatType, SplitType, DescentType>::RectangleTree(
   this.parentDistance = 0.0;
   this.furthestDescendantDistance = 0.0;
   this.dataset = new MatType(maxLeafSize+1); // Add one to make splitting the node simpler
-
+  this.children = new std::vector<RectangleTree*>(maxNumChildren+1); // ibid.
+  
   // For now, just insert the points in order.
   // This won't actually work for any meaningful size of data since the root changes.
   for(int i = 0; i < n_cols; i++) {
     insertPoint(data.col(i));
   }
+  
 }
 
 /**

-- 
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