本文整理汇总了C++中IntervalSet::end方法的典型用法代码示例。如果您正苦于以下问题:C++ IntervalSet::end方法的具体用法?C++ IntervalSet::end怎么用?C++ IntervalSet::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IntervalSet
的用法示例。
在下文中一共展示了IntervalSet::end方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: print_set
void print_set(const IntervalSet &s)
{
for(IntervalSet::const_iterator i=s.begin(); i!=s.end(); ++i)
{
printf("%i-%i ", (int)i->start, (int)i->end);
}
printf("\n");
}
示例2: make_pair
pair<DataType, DataType> get_range(IntervalSet& interval, int dimIndex)
{
assert(!interval.empty());
int beginIndex = *interval.begin();
IntervalSet::iterator end = interval.end();
--end;
int endIndex = *end;
assert(beginIndex >= 0 && beginIndex < (int)g_data.size());
assert(endIndex >= 0 && endIndex < (int)g_data.size());
return make_pair(
g_data[beginIndex].first[dimIndex],
g_data[endIndex].first[dimIndex]);
}
示例3: chisquared_interval
// Compute $\chi^2$ value for an interval
float chisquared_interval(IntervalSet& interval)
{
// Count instances of each class
map<ClassType, int> classCount;
IntervalSet::iterator it = interval.begin(),
end = interval.end();
for ( ; it != end; ++it) {
int index = *it;
ClassType classType = g_data[index].second;
classCount[classType]++;
}
// Keep track of summation
float chichiri = 0.0f;
set<ClassType>::iterator sit = g_classTypes.begin(),
send = g_classTypes.end();
for ( ; sit != send; ++sit) {
ClassType classType = *sit;
// Uses notation from section 4.2.1,
// "Discretization: An Enabling Technique" by H. Liu et al.
float A_ij = static_cast<float>(classCount[classType]);
float R_i = static_cast<float>(interval.size());
float C_j = static_cast<float>(g_globalClassCount[classType]);
float N = static_cast<float>(g_data.size());
float E_ij = (R_i * C_j) / N;
float top = (A_ij - E_ij);
chichiri += top*top / E_ij;
}
cout << "{" << chichiri << "} + ";
return chichiri;
}
示例4: print_interval_set
// Debugging -- print one interval
void print_interval_set(IntervalSet& indices)
{
copy(indices.begin(), indices.end(), ostream_iterator<int>(cout, ", "));
cout << endl;
}