bool Expression::eval_bool( const PHV &phv, const std::vector<Data> &locals ) const { bool result; eval_(phv, ExprType::EXPR_BOOL, locals, &result, nullptr); return result; }
matrix< double > &HessianEvaluator::operator()(const vector< double > &x, matrix< double > &H) const { if(evalCounting_ && !usesFiniteDifference()) evalCounter_++; return eval_(x, H); }
/// Perform the evaluation for a given iteration and a Particle<T> object /// /// \sa Monitor::eval() void eval (std::size_t iter, const Particle<T> &particle) { if (!recording_) return; VSMC_RUNTIME_ASSERT_CORE_PATH_FUNCTOR(eval_, eval, EVALUATION); if (record_only_) { double integrand = 0; double grid = eval_(iter, particle, &integrand); push_back(iter, grid, integrand); return; } const std::size_t N = static_cast<std::size_t>(particle.size()); buffer_.resize(N); double *const bptr = &buffer_[0]; const double *const wptr = particle.weight_set().weight_data(); double grid = eval_(iter, particle, bptr); double integrand = math::dot(N, wptr, bptr); push_back(iter, grid, integrand); }
double operator()(graph_t& graph, std::vector<vertex_type> vertexes) { std::shuffle(vertexes.begin(), vertexes.end(), engine_); // bestな構造を保持しておく sampling_.make_cpt(graph); double eval_now = eval_(graph); for(auto it = vertexes.begin(); it != vertexes.end();) { auto const child_iter = it; std::shuffle(++it, vertexes.end(), engine_); for(auto parent_iter = it; parent_iter != vertexes.end(); ++parent_iter) { if(auto edge = graph.add_edge(*parent_iter, *child_iter)) { // 辺を貼れたなら調べてみる sampling_.make_cpt(graph); auto const eval_next = eval_(graph); if(eval_next < eval_now) { // 良くなってる eval_now = eval_next; } else { // 変わらない,もしくは悪い == 元に戻す graph.erase_edge(edge); } } } } return eval_now; }
auto operator()(Xs && ... xs) const { constexpr size_t N = function_arity<F>::value - sizeof...(Ts); static_assert(N >= sizeof...(Xs), "Too many argument!"); return eval_(std::integral_constant<size_t, N - sizeof...(Xs)>(), std::make_index_sequence<sizeof...(Xs)>(), std::forward<Xs>(xs)...); }
~R() { if(!dismissed_ && eval_(42)) this->oops(42); }
std::string eval() const override { return eval_(); }
void Expression::eval_arith(const PHV &phv, Data *data, const std::vector<Data> &locals) const { eval_(phv, ExprType::EXPR_DATA, locals, nullptr, data); }
Data Expression::eval_arith(const PHV &phv, const std::vector<Data> &locals) const { Data result_ptr; eval_(phv, ExprType::EXPR_DATA, locals, nullptr, &result_ptr); return result_ptr; }