[mlpack-git] master: Minor style fixes. (448b5a8)
gitdub at mlpack.org
gitdub at mlpack.org
Thu Jul 7 17:38:27 EDT 2016
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/e0fd69006b17a845f066ea4de1e205fc0922739d...448b5a86904abd266316eecc72eadc860825799d
>---------------------------------------------------------------
commit 448b5a86904abd266316eecc72eadc860825799d
Author: Ryan Curtin <ryan at ratml.org>
Date: Thu Jul 7 17:38:27 2016 -0400
Minor style fixes.
>---------------------------------------------------------------
448b5a86904abd266316eecc72eadc860825799d
.../r_plus_plus_tree_auxiliary_information.hpp | 1 -
...r_plus_plus_tree_auxiliary_information_impl.hpp | 28 +++++++++++-----------
.../r_plus_plus_tree_descent_heuristic.hpp | 11 ++++-----
.../r_plus_plus_tree_descent_heuristic_impl.hpp | 7 +++---
.../r_plus_plus_tree_split_policy.hpp | 5 ++--
.../r_plus_tree_descent_heuristic.hpp | 7 +++---
.../r_plus_tree_descent_heuristic_impl.hpp | 15 ++++++------
.../core/tree/rectangle_tree/r_plus_tree_split.hpp | 20 +++++++---------
.../tree/rectangle_tree/r_plus_tree_split_impl.hpp | 14 ++++++-----
.../rectangle_tree/r_plus_tree_split_policy.hpp | 9 ++++---
10 files changed, 55 insertions(+), 62 deletions(-)
diff --git a/src/mlpack/core/tree/rectangle_tree/r_plus_plus_tree_auxiliary_information.hpp b/src/mlpack/core/tree/rectangle_tree/r_plus_plus_tree_auxiliary_information.hpp
index fbb82a6..aebd98f 100644
--- a/src/mlpack/core/tree/rectangle_tree/r_plus_plus_tree_auxiliary_information.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/r_plus_plus_tree_auxiliary_information.hpp
@@ -119,7 +119,6 @@ class RPlusPlusTreeAuxiliaryInformation
const size_t axis,
const ElemType cut);
-
/**
* Nullify the auxiliary information in order to prevent an invalid free.
*/
diff --git a/src/mlpack/core/tree/rectangle_tree/r_plus_plus_tree_auxiliary_information_impl.hpp b/src/mlpack/core/tree/rectangle_tree/r_plus_plus_tree_auxiliary_information_impl.hpp
index 683645d..534ad9a 100644
--- a/src/mlpack/core/tree/rectangle_tree/r_plus_plus_tree_auxiliary_information_impl.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/r_plus_plus_tree_auxiliary_information_impl.hpp
@@ -14,7 +14,7 @@
namespace mlpack {
namespace tree {
-template<typename TreeType>
+template<typename TreeType>
RPlusPlusTreeAuxiliaryInformation<TreeType>::
RPlusPlusTreeAuxiliaryInformation() :
outerBound(0)
@@ -22,7 +22,7 @@ RPlusPlusTreeAuxiliaryInformation() :
}
-template<typename TreeType>
+template<typename TreeType>
RPlusPlusTreeAuxiliaryInformation<TreeType>::
RPlusPlusTreeAuxiliaryInformation(const TreeType* tree) :
outerBound(tree->Parent() ?
@@ -38,7 +38,7 @@ RPlusPlusTreeAuxiliaryInformation(const TreeType* tree) :
}
}
-template<typename TreeType>
+template<typename TreeType>
RPlusPlusTreeAuxiliaryInformation<TreeType>::
RPlusPlusTreeAuxiliaryInformation(
const RPlusPlusTreeAuxiliaryInformation& other) :
@@ -47,14 +47,14 @@ RPlusPlusTreeAuxiliaryInformation(
}
-template<typename TreeType>
+template<typename TreeType>
bool RPlusPlusTreeAuxiliaryInformation<TreeType>::HandlePointInsertion(
TreeType* /* node */, const size_t /* point */)
{
return false;
}
-template<typename TreeType>
+template<typename TreeType>
bool RPlusPlusTreeAuxiliaryInformation<TreeType>::HandleNodeInsertion(
TreeType* /* node */,
TreeType* /* nodeToInsert */,
@@ -64,28 +64,28 @@ bool RPlusPlusTreeAuxiliaryInformation<TreeType>::HandleNodeInsertion(
return false;
}
-template<typename TreeType>
+template<typename TreeType>
bool RPlusPlusTreeAuxiliaryInformation<TreeType>::HandlePointDeletion(
TreeType* /* node */, const size_t /* localIndex */)
{
return false;
}
-template<typename TreeType>
+template<typename TreeType>
bool RPlusPlusTreeAuxiliaryInformation<TreeType>::HandleNodeRemoval(
TreeType* /* node */, const size_t /* nodeIndex */)
{
return false;
}
-template<typename TreeType>
+template<typename TreeType>
bool RPlusPlusTreeAuxiliaryInformation<TreeType>::UpdateAuxiliaryInfo(
TreeType* /* node */)
{
return false;
}
-template<typename TreeType>
+template<typename TreeType>
void RPlusPlusTreeAuxiliaryInformation<TreeType>::SplitAuxiliaryInfo(
TreeType* treeOne,
TreeType* treeTwo,
@@ -96,16 +96,16 @@ void RPlusPlusTreeAuxiliaryInformation<TreeType>::SplitAuxiliaryInfo(
Bound& treeOneBound = treeOne->AuxiliaryInfo().OuterBound();
Bound& treeTwoBound = treeTwo->AuxiliaryInfo().OuterBound();
- // Copy the maximum bounding rectangle
+ // Copy the maximum bounding rectangle.
treeOneBound = outerBound;
treeTwoBound = outerBound;
- // Set proper limits
+ // Set proper limits.
treeOneBound[axis].Hi() = cut;
treeTwoBound[axis].Lo() = cut;
}
-template<typename TreeType>
+template<typename TreeType>
void RPlusPlusTreeAuxiliaryInformation<TreeType>::NullifyData()
{
@@ -114,7 +114,7 @@ void RPlusPlusTreeAuxiliaryInformation<TreeType>::NullifyData()
/**
* Serialize the information.
*/
-template<typename TreeType>
+template<typename TreeType>
template<typename Archive>
void RPlusPlusTreeAuxiliaryInformation<TreeType>::
Serialize(Archive& ar, const unsigned int /* version */)
@@ -127,4 +127,4 @@ Serialize(Archive& ar, const unsigned int /* version */)
} // namespace tree
} // namespace mlpack
-#endif//MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_PLUS_TREE_AUXILIARY_INFORMATION_IMPL_HPP
+#endif // MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_PLUS_TREE_AUXILIARY_INFORMATION_IMPL_HPP
diff --git a/src/mlpack/core/tree/rectangle_tree/r_plus_plus_tree_descent_heuristic.hpp b/src/mlpack/core/tree/rectangle_tree/r_plus_plus_tree_descent_heuristic.hpp
index 18166f4..1f050bc 100644
--- a/src/mlpack/core/tree/rectangle_tree/r_plus_plus_tree_descent_heuristic.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/r_plus_plus_tree_descent_heuristic.hpp
@@ -2,8 +2,8 @@
* @file r_plus_plus_tree_descent_heuristic.hpp
* @author Mikhail Lozhnikov
*
- * Definition of RPlusPlusTreeDescentHeuristic, a class that chooses the best child of a
- * node in an R++ tree when inserting a new point.
+ * Definition of RPlusPlusTreeDescentHeuristic, a class that chooses the best
+ * child of a node in an R++ tree when inserting a new point.
*/
#ifndef MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_PLUS_TREE_DESCENT_HEURISTIC_HPP
#define MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_PLUS_TREE_DESCENT_HEURISTIC_HPP
@@ -38,12 +38,11 @@ class RPlusPlusTreeDescentHeuristic
template<typename TreeType>
static size_t ChooseDescentNode(const TreeType* node,
const TreeType* insertedNode);
-
};
-} // namespace tree
-} // namespace mlpack
+} // namespace tree
+} // namespace mlpack
#include "r_plus_plus_tree_descent_heuristic_impl.hpp"
-#endif // MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_PLUS_TREE_DESCENT_HEURISTIC_HPP
+#endif // MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_PLUS_TREE_DESCENT_HEURISTIC_HPP
diff --git a/src/mlpack/core/tree/rectangle_tree/r_plus_plus_tree_descent_heuristic_impl.hpp b/src/mlpack/core/tree/rectangle_tree/r_plus_plus_tree_descent_heuristic_impl.hpp
index eca2d0f..4e7142a 100644
--- a/src/mlpack/core/tree/rectangle_tree/r_plus_plus_tree_descent_heuristic_impl.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/r_plus_plus_tree_descent_heuristic_impl.hpp
@@ -42,8 +42,7 @@ size_t RPlusPlusTreeDescentHeuristic::ChooseDescentNode(
return 0;
}
+} // namespace tree
+} // namespace mlpack
-} // namespace tree
-} // namespace mlpack
-
-#endif //MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_PLUS_TREE_DESCENT_HEURISTIC_IMPL_HPP
+#endif // MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_PLUS_TREE_DESCENT_HEURISTIC_IMPL_HPP
diff --git a/src/mlpack/core/tree/rectangle_tree/r_plus_plus_tree_split_policy.hpp b/src/mlpack/core/tree/rectangle_tree/r_plus_plus_tree_split_policy.hpp
index d729153..3941d13 100644
--- a/src/mlpack/core/tree/rectangle_tree/r_plus_plus_tree_split_policy.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/r_plus_plus_tree_split_policy.hpp
@@ -55,7 +55,7 @@ class RPlusPlusTreeSplitPolicy
/**
* Return the maximum bounding rectangle of the node.
* This method should always return the bound that is used for the
- * desicion-making in GetSplitPolicy().
+ * decision-making in GetSplitPolicy().
*
* @param node The node whose bound is requested.
*/
@@ -70,6 +70,5 @@ class RPlusPlusTreeSplitPolicy
} // namespace tree
} // namespace mlpack
-#endif // MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_PLUS_TREE_SPLIT_POLICY_HPP
-
+#endif // MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_PLUS_TREE_SPLIT_POLICY_HPP
diff --git a/src/mlpack/core/tree/rectangle_tree/r_plus_tree_descent_heuristic.hpp b/src/mlpack/core/tree/rectangle_tree/r_plus_tree_descent_heuristic.hpp
index 219c85b..f27feca 100644
--- a/src/mlpack/core/tree/rectangle_tree/r_plus_tree_descent_heuristic.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/r_plus_tree_descent_heuristic.hpp
@@ -38,12 +38,11 @@ class RPlusTreeDescentHeuristic
template<typename TreeType>
static size_t ChooseDescentNode(const TreeType* /* node */,
const TreeType* /*insertedNode */);
-
};
-} // namespace tree
-} // namespace mlpack
+} // namespace tree
+} // namespace mlpack
#include "r_plus_tree_descent_heuristic_impl.hpp"
-#endif // MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_TREE_DESCENT_HEURISTIC_HPP
+#endif // MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_TREE_DESCENT_HEURISTIC_HPP
diff --git a/src/mlpack/core/tree/rectangle_tree/r_plus_tree_descent_heuristic_impl.hpp b/src/mlpack/core/tree/rectangle_tree/r_plus_tree_descent_heuristic_impl.hpp
index 77312ea..b951bed 100644
--- a/src/mlpack/core/tree/rectangle_tree/r_plus_tree_descent_heuristic_impl.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/r_plus_tree_descent_heuristic_impl.hpp
@@ -15,8 +15,8 @@ namespace mlpack {
namespace tree {
template<typename TreeType>
-size_t RPlusTreeDescentHeuristic::
-ChooseDescentNode(TreeType* node, const size_t point)
+size_t RPlusTreeDescentHeuristic::ChooseDescentNode(TreeType* node,
+ const size_t point)
{
typedef typename TreeType::ElemType ElemType;
size_t bestIndex = 0;
@@ -36,7 +36,7 @@ ChooseDescentNode(TreeType* node, const size_t point)
{
bound::HRectBound<metric::EuclideanDistance, ElemType> bound =
node->Child(bestIndex).Bound();
- bound |= node->Dataset().col(point);
+ bound |= node->Dataset().col(point);
success = true;
@@ -79,7 +79,7 @@ ChooseDescentNode(TreeType* node, const size_t point)
tree = child;
depth--;
}
- return node->NumChildren()-1;
+ return node->NumChildren() - 1;
}
assert(bestIndex < node->NumChildren());
@@ -97,8 +97,7 @@ size_t RPlusTreeDescentHeuristic::ChooseDescentNode(
return 0;
}
+} // namespace tree
+} // namespace mlpack
-} // namespace tree
-} // namespace mlpack
-
-#endif //MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_TREE_DESCENT_HEURISTIC_IMPL_HPP
+#endif // MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_TREE_DESCENT_HEURISTIC_IMPL_HPP
diff --git a/src/mlpack/core/tree/rectangle_tree/r_plus_tree_split.hpp b/src/mlpack/core/tree/rectangle_tree/r_plus_tree_split.hpp
index 8e5b8ce..f32803e 100644
--- a/src/mlpack/core/tree/rectangle_tree/r_plus_tree_split.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/r_plus_tree_split.hpp
@@ -2,8 +2,8 @@
* @file r_plus_tree_split.hpp
* @author Mikhail Lozhnikov
*
- * Defintion of the RPlusTreeSplit class, a class that splits the nodes of an R
- * tree, starting at a leaf node and moving upwards if necessary.
+ * Definition of the RPlusTreeSplit class, a class that splits the nodes of an
+ * R+ (or R++) tree, starting at a leaf node and moving upwards if necessary.
*/
#ifndef MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_TREE_SPLIT_HPP
#define MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_TREE_SPLIT_HPP
@@ -17,10 +17,10 @@ namespace tree /** Trees and tree-building procedures. */ {
* The RPlusTreeSplit class performs the split process of a node on overflow.
*
* @tparam SplitPolicyType The class that helps to determine the subtree into
- * which we should insert a child node.
- * @tparam SweepType The class that finds the partition of a node along a
- * given axis. The partition algorithm tries to find a partition along each
- * axis, evaluates each partition and chooses the best one.
+ * which we should insert a child node.
+ * @tparam SweepType The class that finds the partition of a node along a given
+ * axis. The partition algorithm tries to find a partition along each axis,
+ * evaluates each partition and chooses the best one.
*/
template<typename SplitPolicyType,
template<typename> class SweepType>
@@ -35,7 +35,7 @@ class RPlusTreeSplit
* @param relevels Not used.
*/
template<typename TreeType>
- static void SplitLeafNode(TreeType *tree,std::vector<bool>& relevels);
+ static void SplitLeafNode(TreeType* tree, std::vector<bool>& relevels);
/**
* Split a non-leaf node using the "default" algorithm. If this is a root
@@ -44,7 +44,7 @@ class RPlusTreeSplit
* @param relevels Not used.
*/
template<typename TreeType>
- static bool SplitNonLeafNode(TreeType *tree,std::vector<bool>& relevels);
+ static bool SplitNonLeafNode(TreeType* tree, std::vector<bool>& relevels);
private:
/**
@@ -118,7 +118,6 @@ class RPlusTreeSplit
*/
template<typename TreeType>
static void InsertNodeIntoTree(TreeType* destTree, TreeType* srcNode);
-
};
} // namespace tree
@@ -127,5 +126,4 @@ class RPlusTreeSplit
// Include implementation
#include "r_plus_tree_split_impl.hpp"
-#endif // MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_TREE_SPLIT_HPP
-
+#endif // MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_TREE_SPLIT_HPP
diff --git a/src/mlpack/core/tree/rectangle_tree/r_plus_tree_split_impl.hpp b/src/mlpack/core/tree/rectangle_tree/r_plus_tree_split_impl.hpp
index 6cb4d5c..8dfc2f2 100644
--- a/src/mlpack/core/tree/rectangle_tree/r_plus_tree_split_impl.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/r_plus_tree_split_impl.hpp
@@ -34,7 +34,7 @@ SplitLeafNode(TreeType* tree, std::vector<bool>& relevels)
if (node->NumChildren() == node->MaxNumChildren() + 1)
{
// Split the overflowed node.
- RPlusTreeSplit::SplitNonLeafNode(node,relevels);
+ RPlusTreeSplit::SplitNonLeafNode(node, relevels);
return;
}
node = node->Parent();
@@ -42,7 +42,10 @@ SplitLeafNode(TreeType* tree, std::vector<bool>& relevels)
return;
}
else if (tree->Count() <= tree->MaxLeafSize())
+ {
return;
+ }
+
// If we are splitting the root node, we need will do things differently so
// that the constructor and other methods don't confuse the end user by giving
// an address of another node.
@@ -57,7 +60,7 @@ SplitLeafNode(TreeType* tree, std::vector<bool>& relevels)
tree->children[(tree->NumChildren())++] = copy;
assert(tree->NumChildren() == 1);
- RPlusTreeSplit::SplitLeafNode(copy,relevels);
+ RPlusTreeSplit::SplitLeafNode(copy, relevels);
return;
}
@@ -65,7 +68,7 @@ SplitLeafNode(TreeType* tree, std::vector<bool>& relevels)
typename TreeType::ElemType cut;
// Try to find a partiotion of the node.
- if ( !PartitionNode(tree, cutAxis, cut))
+ if (!PartitionNode(tree, cutAxis, cut))
return;
// If we could not find a suitable partition.
@@ -329,7 +332,6 @@ PartitionNode(const TreeType* node, size_t& minCutAxis,
else
cost = SweepType<SplitPolicyType>::SweepNonLeafNode(k, node, cut);
-
if (cost < minCost)
{
minCost = cost;
@@ -337,6 +339,7 @@ PartitionNode(const TreeType* node, size_t& minCutAxis,
minCut = cut;
}
}
+
return true;
}
@@ -351,8 +354,7 @@ InsertNodeIntoTree(TreeType* destTree, TreeType* srcNode)
destTree->children[destTree->NumChildren()++] = srcNode;
}
-
} // namespace tree
} // namespace mlpack
-#endif // MLPACK_CORE_TREE_RECTANGLE_TREE_HILBERT_R_TREE_SPLIT_IMPL_HPP
+#endif // MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_TREE_SPLIT_IMPL_HPP
diff --git a/src/mlpack/core/tree/rectangle_tree/r_plus_tree_split_policy.hpp b/src/mlpack/core/tree/rectangle_tree/r_plus_tree_split_policy.hpp
index 1302dd3..31787b9 100644
--- a/src/mlpack/core/tree/rectangle_tree/r_plus_tree_split_policy.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/r_plus_tree_split_policy.hpp
@@ -55,7 +55,7 @@ class RPlusTreeSplitPolicy
/**
* Return the minimum bounding rectangle of the node.
* This method should always return the bound that is used for the
- * desicion-making in GetSplitPolicy().
+ * decision-making in GetSplitPolicy().
*
* @param node The node whose bound is requested.
*/
@@ -68,8 +68,7 @@ class RPlusTreeSplitPolicy
}
};
-} // namespace tree
-} // namespace mlpack
-#endif // MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_TREE_SPLIT_POLICY_HPP
-
+} // namespace tree
+} // namespace mlpack
+#endif // MLPACK_CORE_TREE_RECTANGLE_TREE_R_PLUS_TREE_SPLIT_POLICY_HPP
More information about the mlpack-git
mailing list