16 #ifndef MLPACK_CORE_TREE_PERFORM_SPLIT_HPP 17 #define MLPACK_CORE_TREE_PERFORM_SPLIT_HPP 35 template<
typename MatType,
typename SplitType>
39 const typename SplitType::SplitInfo& splitInfo)
44 size_t right = begin + count - 1;
48 while ((left <= right) &&
49 (SplitType::AssignToLeftNode(data.col(left), splitInfo)))
51 while ((!SplitType::AssignToLeftNode(data.col(right), splitInfo)) &&
52 (left <= right) && (right > 0))
56 if (left == right && right == 0)
62 data.swap_cols(left, right);
67 while (SplitType::AssignToLeftNode(data.col(left), splitInfo) &&
75 while ((!SplitType::AssignToLeftNode(data.col(right), splitInfo)) &&
100 template<
typename MatType,
typename SplitType>
104 const typename SplitType::SplitInfo& splitInfo,
105 std::vector<size_t>& oldFromNew)
110 size_t right = begin + count - 1;
114 while ((left <= right) &&
115 (SplitType::AssignToLeftNode(data.col(left), splitInfo)))
117 while ((!SplitType::AssignToLeftNode(data.col(right), splitInfo)) &&
118 (left <= right) && (right > 0))
122 if (left == right && right == 0)
125 while (left <= right)
128 data.swap_cols(left, right);
131 size_t t = oldFromNew[left];
132 oldFromNew[left] = oldFromNew[right];
133 oldFromNew[right] = t;
138 while (SplitType::AssignToLeftNode(data.col(left), splitInfo) &&
146 while ((!SplitType::AssignToLeftNode(data.col(right), splitInfo)) &&
160 #endif // MLPACK_CORE_TREE_BINARY_SPACE_TREE_PERFORM_SPLIT_HPP Linear algebra utility functions, generally performed on matrices or vectors.
static void Assert(bool condition, const std::string &message="Assert Failed.")
Checks if the specified condition is true.
size_t PerformSplit(MatType &data, const size_t begin, const size_t count, const typename SplitType::SplitInfo &splitInfo)
This function implements the default split behavior i.e.