/* [Note] node copying is not required here even in computation without * inter-goal sharing, but we need to declare it explicitly. */ int pc_compute_viterbi_5(void) { TERM p_goal_path,p_subpath_goal,p_subpath_sw; int goal_id; double viterbi_prob; goal_id = bpx_get_integer(bpx_get_call_arg(1,5)); initialize_egraph_index(); alloc_sorted_egraph(1); /* INIT_MIN_MAX_NODE_NOS; */ RET_ON_ERR(sort_one_egraph(goal_id,0,1)); if (verb_graph) print_egraph(0,PRINT_NEUTRAL); compute_max(); if (debug_level) print_egraph(1,PRINT_VITERBI); get_most_likely_path(goal_id,&p_goal_path,&p_subpath_goal, &p_subpath_sw,&viterbi_prob); return bpx_unify(bpx_get_call_arg(2,5), p_goal_path) && bpx_unify(bpx_get_call_arg(3,5), p_subpath_goal) && bpx_unify(bpx_get_call_arg(4,5), p_subpath_sw) && bpx_unify(bpx_get_call_arg(5,5), bpx_build_float(viterbi_prob)); }
void Expr::add(const Expr *c) { // Do not update fields until all computation is complete const char *external = compute_external(this, c); const char *expr = compute_expr(this, c); int min_value = compute_min (this, c); int max_value = compute_max (this, c); _external_name = external; _expr = expr; _min_value = min_value; _max_value = max_value; }
int pc_compute_probf_1(void) { EG_NODE_PTR eg_ptr; int prmode; prmode = bpx_get_integer(bpx_get_call_arg(1,1)); if (prmode == 3) { compute_max(); return BP_TRUE; } eg_ptr = expl_graph[roots[0]->id]; failure_root_index = -1; /* [31 Mar 2008, by yuizumi] * compute_outside_scaling_*() is needed to be called because * eg_ptr->outside computed by compute_expectation_scaling_*() * is different from the outside probability. */ if (log_scale) { RET_ON_ERR(compute_inside_scaling_log_exp()); if (prmode != 1) { RET_ON_ERR(compute_expectation_scaling_log_exp()); RET_ON_ERR(compute_outside_scaling_log_exp()); } } else { RET_ON_ERR(compute_inside_scaling_none()); if (prmode != 1) { RET_ON_ERR(compute_expectation_scaling_none()); RET_ON_ERR(compute_outside_scaling_none()); } } return BP_TRUE; }
static orcm_value_t* compute_agg(char* op, char* data_key, opal_list_t* compute, orcm_analytics_aggregate* aggregate) { orcm_value_t *temp = NULL; orcm_value_t *agg_value = NULL; if(NULL == compute || NULL == aggregate || NULL == data_key) { return NULL; } temp = (orcm_value_t*)opal_list_get_first(compute); ON_NULL_RETURN(temp); agg_value = orcm_util_load_orcm_value(data_key, &temp->value.data,OPAL_DOUBLE,temp->units); ON_NULL_RETURN(agg_value); if(0 == strncmp(op,"average", strlen(op))) { compute_average(agg_value, aggregate, compute); } else if (0 == strncmp(op, "min", strlen(op))){ compute_min(agg_value, aggregate, compute); } else if (0 == strncmp(op,"max", strlen(op))){ compute_max(agg_value, aggregate, compute); } else { SAFEFREE(agg_value); } return agg_value; }