[mlpack-svn] r16788 - mlpack/trunk/src/mlpack/core/tree/rectangle_tree

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Tue Jul 8 13:42:46 EDT 2014


Author: rcurtin
Date: Tue Jul  8 13:42:46 2014
New Revision: 16788

Log:
clang complains when default parameters aren't part of the original declaration.
Also vim removes trailing whitespaces, so this diff looks way longer and more
complex than it actually is...


Modified:
   mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp
   mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp

Modified: mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp	(original)
+++ mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp	Tue Jul  8 13:42:46 2014
@@ -16,7 +16,7 @@
 namespace tree /** Trees and tree-building procedures. */ {
 
 using bound::HRectBound;
-  
+
 /**
  * A rectangle type tree tree, such as an R-tree or X-tree.  Once the
  * bound and type of dataset is defined, the tree will construct itself.  Call
@@ -31,7 +31,7 @@
  * @tparam MatType The dataset class.
  * @tparam SplitType The type of split to use when inserting points.
  * @tparam DescentType The heuristic to use when descending the tree to insert points.
- */   
+ */
 
 template<typename SplitType,
 	 typename DescentType,
@@ -56,7 +56,7 @@
   //! REMOVED.
   size_t begin;
   //! The number of points in the dataset contained in this node (and its
-  //! children).  
+  //! children).
   size_t count;
   //! The max leaf size.
   size_t maxLeafSize;
@@ -74,7 +74,7 @@
   MatType& dataset;
   //! The mapping to the dataset
   std::vector<size_t> points;
-  
+
  public:
   //! So other classes can use TreeType::Mat.
   typedef MatType Mat;
@@ -96,17 +96,17 @@
    * @param minLeafSize Minimum size of each leaf in the tree.
    * @param maxNumChildren The maximum number of child nodes a non-leaf node may have.
    * @param minNumChildren The minimum number of child nodes a non-leaf node may have.
-   * @param firstDataIndex The index of the first data point.  UNUSED UNLESS WE ADD SUPPORT FOR HAVING A 
+   * @param firstDataIndex The index of the first data point.  UNUSED UNLESS WE ADD SUPPORT FOR HAVING A
    * "CENTERAL" DATA MATRIX.
    */
   RectangleTree(MatType& data,
-		const size_t maxLeafSize,
-		const size_t minLeafSize,
-		const size_t maxNumChildren,
-		const size_t minNumChildren,
-		const size_t firstDataIndex
+		const size_t maxLeafSize = 20,
+		const size_t minLeafSize = 6,
+		const size_t maxNumChildren = 4,
+		const size_t minNumChildren = 0,
+		const size_t firstDataIndex = 0
  	      );
-  
+
   /**
    * Construct this as an empty node with the specified parent.  Copying the parameters
    * (maxLeafSize, minLeafSize, maxNumChildren, minNumChildren, firstDataIndex) from the parent.
@@ -124,14 +124,14 @@
    * to any nodes which are children of this one.
    */
   ~RectangleTree();
-  
+
   /**
    * Delete this node of the tree, but leave the stuff contained in it intact.
    * This is used when splitting a node, where the data in this tree is moved to two
    * other trees.
    */
   void softDelete();
-  
+
   /**
    * Set dataset to null. Used for memory management.  Be cafeful.
    */
@@ -152,7 +152,7 @@
    * (ie. the point is not in the tree)
    */
   bool DeletePoint(const size_t point);
-  
+
   /**
    * Find a node in this tree by its begin and count (const).
    *
@@ -221,12 +221,12 @@
   const arma::mat& Dataset() const { return dataset; }
   //! Modify the dataset which the tree is built on.  Be careful!
   arma::mat& Dataset() { return dataset; }
-  
+
   //! Get the points vector for this node.
   const std::vector<size_t>& Points() const { return points; }
   //! Modify the points vector for this node.  Be careful!
   std::vector<size_t>& Points() { return points; }
-  
+
   //! Get the metric which the tree uses.
   typename HRectBound<>::MetricType Metric() const { return bound.Metric(); }
 
@@ -276,7 +276,7 @@
   {
     return children[child];
   }
-  
+
   /**
    * Modify the specified child.
     *
@@ -287,7 +287,7 @@
   {
     return children[child];
   }
-  
+
   //! Return the number of points in this node (returns 0 if this node is not a leaf).
   size_t NumPoints() const;
 

Modified: mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp	(original)
+++ mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp	Tue Jul  8 13:42:46 2014
@@ -23,11 +23,11 @@
          typename MatType>
 RectangleTree<SplitType, DescentType, StatisticType, MatType>::RectangleTree(
     MatType& data,
-    const size_t maxLeafSize = 20,
-    const size_t minLeafSize = 6,
-    const size_t maxNumChildren = 4,
-    const size_t minNumChildren = 0,
-    const size_t firstDataIndex = 0):
+    const size_t maxLeafSize,
+    const size_t minLeafSize,
+    const size_t maxNumChildren,
+    const size_t minNumChildren,
+    const size_t firstDataIndex):
     maxNumChildren(maxNumChildren),
     minNumChildren(minNumChildren),
     numChildren(0),
@@ -43,10 +43,10 @@
     points(maxLeafSize+1) // Add one to make splitting the node simpler.
 {
   stat = StatisticType(*this);
-  
+
   // For now, just insert the points in order.
   RectangleTree* root = this;
-  
+
   //for(int i = firstDataIndex; i < 57; i++) { // 56,57 are the bound for where it works/breaks
   for(size_t i = firstDataIndex; i < data.n_cols; i++) {
     root->InsertPoint(i);
@@ -97,7 +97,7 @@
 
 
 /**
-  * Deletes this node but leaves the children untouched.  Needed for when we 
+  * Deletes this node but leaves the children untouched.  Needed for when we
   * split nodes and remove nodes (inserting and deleting points).
   */
 template<typename SplitType,
@@ -111,10 +111,10 @@
     //dataset = NULL;
   parent = NULL;
   for(int i = 0; i < children.size(); i++) {
-    children[i] = NULL;    
+    children[i] = NULL;
   }
   numChildren = 0;
-  delete this;  
+  delete this;
 }
 
 /**
@@ -156,7 +156,7 @@
   // to which we recurse.
   double minScore = DescentType::EvalNode(children[0]->Bound(), dataset.col(point));
   int bestIndex = 0;
-  
+
   for(int i = 1; i < numChildren; i++) {
     double score = DescentType::EvalNode(children[i]->Bound(), dataset.col(point));
     if(score < minScore) {
@@ -212,12 +212,12 @@
       for(int i = 0; i < numChildren; i++) {
 	if(children[i].Bound().Contains(dataset.col(point))) {
 	  if(children[i].DeletePoint(dataset.col(point))) {
-	    
+
 	    return true;
 	  }
 	}
       }
-  } 
+  }
   return false;
 }
 
@@ -244,7 +244,7 @@
 size_t RectangleTree<SplitType, DescentType, StatisticType, MatType>::
     TreeDepth() const
 {
-  /* Because R trees are balanced, we could simplify this.  However, X trees are not 
+  /* Because R trees are balanced, we could simplify this.  However, X trees are not
      guaranteed to be balanced so I keep it as is: */
 
   // Recursively count the depth of each subtree.  The plus one is
@@ -401,7 +401,7 @@
   // Check to see if we are full.
   if(count < maxLeafSize)
     return; // We don't need to split.
-  
+
   // If we are full, then we need to split (or at least try).  The SplitType takes
   // care of this and of moving up the tree if necessary.
   SplitType::SplitLeafNode(this);



More information about the mlpack-svn mailing list