本文整理汇总了C++中symbol::get_sequential_code方法的典型用法代码示例。如果您正苦于以下问题:C++ symbol::get_sequential_code方法的具体用法?C++ symbol::get_sequential_code怎么用?C++ symbol::get_sequential_code使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类symbol
的用法示例。
在下文中一共展示了symbol::get_sequential_code方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
symbol_distribution::symbol_distribution(const symbol &s)
: total_frequencies(1) {
for (int i = 0; i < ARITHMETIC_SYMBOL_COUNT; i++) {
frequencies[i] = 0u;
}
frequencies[s.get_sequential_code()] = 1u;
}
示例2: get_accumulated_probability
double symbol_distribution::get_accumulated_probability(const symbol &s) const {
double result = 0.0;
for (unsigned int i = 0; i < s.get_sequential_code(); i++) {
result +=
static_cast<double>(frequencies[i]) /
static_cast<double>(total_frequencies);
}
return result;
}
示例3: get_emissions
unsigned int symbol_distribution::get_emissions(const symbol &s) const {
return frequencies[s.get_sequential_code()];
}
示例4: has_only_the_symbol
bool symbol_distribution::has_only_the_symbol(const symbol &s) const {
return frequencies[s.get_sequential_code()] == 1 && total_frequencies == 1;
}
示例5: get_probability_of
double symbol_distribution::get_probability_of(const symbol &s) const {
int index = s.get_sequential_code();
return
static_cast<double>(frequencies[index]) /
static_cast<double>(total_frequencies);
}
示例6: has_symbol
bool symbol_distribution::has_symbol(const symbol &s) const {
return 0 != frequencies[s.get_sequential_code()];
}
示例7: register_symbol_emision
void symbol_distribution::register_symbol_emision(const symbol &s) {
frequencies[s.get_sequential_code()]++;
total_frequencies++;
}