本文整理汇总了C++中TreeType::Children方法的典型用法代码示例。如果您正苦于以下问题:C++ TreeType::Children方法的具体用法?C++ TreeType::Children怎么用?C++ TreeType::Children使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeType
的用法示例。
在下文中一共展示了TreeType::Children方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckContainment
void CheckContainment(const TreeType& tree)
{
if (tree.NumChildren() == 0)
{
for (size_t i = 0; i < tree.Count(); i++)
BOOST_REQUIRE(tree.Bound().Contains(
tree.Dataset().unsafe_col(tree.Points()[i])));
}
else
{
for (size_t i = 0; i < tree.NumChildren(); i++)
{
for (size_t j = 0; j < tree.Bound().Dim(); j++)
BOOST_REQUIRE(tree.Bound()[j].Contains(tree.Children()[i]->Bound()[j]));
CheckContainment(*(tree.Children()[i]));
}
}
}
示例2: GetMinLevel
int GetMinLevel(const TreeType& tree)
{
int min = 1;
if (!tree.IsLeaf())
{
int m = INT_MAX;
for (size_t i = 0; i < tree.NumChildren(); i++)
{
int n = GetMinLevel(*tree.Children()[i]);
if (n < m)
m = n;
}
min += m;
}
return min;
}
示例3: GetMaxLevel
int GetMaxLevel(const TreeType& tree)
{
int max = 1;
if (!tree.IsLeaf())
{
int m = 0;
for (size_t i = 0; i < tree.NumChildren(); i++)
{
int n = GetMaxLevel(*tree.Children()[i]);
if (n > m)
m = n;
}
max += m;
}
return max;
}
示例4: CheckFills
void CheckFills(const TreeType& tree)
{
if (tree.IsLeaf())
{
BOOST_REQUIRE(tree.Count() >= tree.MinLeafSize() || tree.Parent() == NULL);
BOOST_REQUIRE(tree.Count() <= tree.MaxLeafSize());
}
else
{
for (size_t i = 0; i < tree.NumChildren(); i++)
{
BOOST_REQUIRE(tree.NumChildren() >= tree.MinNumChildren() ||
tree.Parent() == NULL);
BOOST_REQUIRE(tree.NumChildren() <= tree.MaxNumChildren());
CheckFills(*tree.Children()[i]);
}
}
}
示例5: CheckSync
void CheckSync(const TreeType& tree)
{
if (tree.IsLeaf())
{
for (size_t i = 0; i < tree.Count(); i++)
{
for (size_t j = 0; j < tree.LocalDataset().n_rows; j++)
{
BOOST_REQUIRE_EQUAL(tree.LocalDataset().col(i)[j],
tree.Dataset().col(tree.Points()[i])[j]);
}
}
}
else
{
for (size_t i = 0; i < tree.NumChildren(); i++)
CheckSync(*tree.Children()[i]);
}
}
示例6: GetAllPointsInTree
std::vector<arma::vec*> GetAllPointsInTree(const TreeType& tree)
{
std::vector<arma::vec*> vec;
if (tree.NumChildren() > 0)
{
for (size_t i = 0; i < tree.NumChildren(); i++)
{
std::vector<arma::vec*> tmp = GetAllPointsInTree(*(tree.Children()[i]));
vec.insert(vec.begin(), tmp.begin(), tmp.end());
}
}
else
{
for (size_t i = 0; i < tree.Count(); i++)
{
arma::vec* c = new arma::vec(tree.Dataset().col(tree.Points()[i]));
vec.push_back(c);
}
}
return vec;
}