[mlpack-svn] r12598 - mlpack/trunk/src/mlpack/core/tree
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Wed May 2 11:17:44 EDT 2012
Author: rcurtin
Date: 2012-05-02 11:17:44 -0400 (Wed, 02 May 2012)
New Revision: 12598
Modified:
mlpack/trunk/src/mlpack/core/tree/binary_space_tree.hpp
mlpack/trunk/src/mlpack/core/tree/binary_space_tree_impl.hpp
Log:
Tabs to spaces, and return a reference, not a pointer.
Modified: mlpack/trunk/src/mlpack/core/tree/binary_space_tree.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/tree/binary_space_tree.hpp 2012-05-02 14:58:47 UTC (rev 12597)
+++ mlpack/trunk/src/mlpack/core/tree/binary_space_tree.hpp 2012-05-02 15:17:44 UTC (rev 12598)
@@ -237,11 +237,12 @@
size_t NumChildren() const;
/**
- * Return the specified child (0 will be left, 1 will be right).
+ * Return the specified child (0 will be left, 1 will be right). If the index
+ * is greater than 1, this will return the right child.
*
* @param child Index of child to return.
*/
- BinarySpaceTree* Child(const size_t child) const;
+ BinarySpaceTree& Child(const size_t child) const;
//! Return the number of points in this node (0 if not a leaf).
size_t NumPoints() const;
Modified: mlpack/trunk/src/mlpack/core/tree/binary_space_tree_impl.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/tree/binary_space_tree_impl.hpp 2012-05-02 14:58:47 UTC (rev 12597)
+++ mlpack/trunk/src/mlpack/core/tree/binary_space_tree_impl.hpp 2012-05-02 15:17:44 UTC (rev 12598)
@@ -355,7 +355,7 @@
template<typename BoundType, typename StatisticType, typename MatType>
inline size_t BinarySpaceTree<BoundType, StatisticType, MatType>::GetSplitDimension() const
{
- return splitDimension;
+ return splitDimension;
}
template<typename BoundType, typename StatisticType, typename MatType>
@@ -403,16 +403,14 @@
* Return the specified child.
*/
template<typename BoundType, typename StatisticType, typename MatType>
-inline BinarySpaceTree<BoundType, StatisticType, MatType>*
+inline BinarySpaceTree<BoundType, StatisticType, MatType>&
BinarySpaceTree<BoundType, StatisticType, MatType>::Child(
const size_t child) const
{
if (child == 0)
- return left;
- else if (child == 1)
- return right;
+ return *left;
else
- return NULL;
+ return *right;
}
/**
@@ -492,7 +490,7 @@
splitDim = d;
}
}
- splitDimension = splitDim;
+ splitDimension = splitDim;
// Split in the middle of that dimension.
double splitVal = bound[splitDim].Mid();
@@ -542,7 +540,7 @@
splitDim = d;
}
}
- splitDimension = splitDim;
+ splitDimension = splitDim;
// Split in the middle of that dimension.
double splitVal = bound[splitDim].Mid();
More information about the mlpack-svn
mailing list