本文整理汇总了C++中Evaluator::readFile方法的典型用法代码示例。如果您正苦于以下问题:C++ Evaluator::readFile方法的具体用法?C++ Evaluator::readFile怎么用?C++ Evaluator::readFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Evaluator
的用法示例。
在下文中一共展示了Evaluator::readFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: analyzeEvalBin
int analyzeEvalBin() {
Loggers::error.addStream(std::cerr, "\x1b[31m", "\x1b[39m");
Loggers::warning.addStream(std::cerr, "\x1b[33m", "\x1b[39m");
Loggers::message.addStream(std::cerr);
Loggers::send.addStream(std::cerr, true, true, "\x1b[34m", "\x1b[39m");
Loggers::receive.addStream(std::cerr, true, true, "\x1b[35m", "\x1b[39m");
#ifndef NDEBUG
Loggers::debug.addStream(std::cerr, "\x1b[36m", "\x1b[39m");
Loggers::develop.addStream(std::cerr, "\x1b[37m", "\x1b[39m");
#endif // NDEBUG
Evaluator eval;
eval.readFile();
Evaluator::ValueType max = 0;
int64_t magnitude = 0ll;
int32_t nonZero = 0;
auto func = [](const Evaluator::ValueType& e,
Evaluator::ValueType& max, int64_t& magnitude, int32_t& nonZero) {
max = std::max(max, (Evaluator::ValueType)std::abs(e));
magnitude += std::abs(e);
nonZero += e != 0 ? 1 : 0;
};
for (int i = 0; i < Evaluator::size(); i++) {
func(((Evaluator::ValueType*)eval.t_)[i], max, magnitude, nonZero);
}
Loggers::message << "max=" << max
<< "\tmagnitude=" << magnitude
<< "\tnonZero=" << nonZero
<< "\tzero=" << (Evaluator::size() - nonZero);
return 1;
}