boost-accumulators - 重置 Boost 参数化累加器
问题描述
如何重置使用参数创建的累加器?换句话说,我想清除添加到累加器中的所有值。这是使用参数创建的累加器的示例,
// https://www.boost.org/doc/libs/1_55_0/doc/html/accumulators/user_s_guide.html#accumulators.user_s_guide.the_statistical_accumulators_library.extended_p_square
using namespace boost::accumulators;
boost::array<double> probs = {0.001,0.01,0.1,0.25,0.5,0.75,0.9,0.99,0.999};
accumulator_set<double, stats<tag::extended_p_square> >
acc(tag::extended_p_square::probabilities = probs); // <--- this const parameter
还有另一个问题/答案与此类似,acc = {}
但仅适用于未使用参数创建的累加器。
重置升压累加器 C++
解决方案
选项之一是在重置累加器时创建包装类捕获和重用累加器参数
推荐阅读
- bash - 从 bash 脚本中触发通知
- asp.net-mvc - 如何在 Asp.NET Core 中将动态创建的 HTML 字符串呈现到剃刀视图中
- excel - 将列表传递给excel Powerquery中的函数
- php - 将 MS Access 连接到 codeigniter
- mingw-w64 - 尝试使用 msys2/mingw-w64 构建 GMP 时出现“libtool 错误:找不到库”
- apache-spark - 结构数组内数据帧结构的火花反序列化
- javascript - Bootstrap3 Toggle 仅作为 Toggle 出现一次
- input - 文本编辑器的键盘输入
- awk - awk:仅使用来自输入的文本块
- algorithm - “合作寻路”和“多智能体寻路”有什么区别?