这篇教程C++ update_tree函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中update_tree函数的典型用法代码示例。如果您正苦于以下问题:C++ update_tree函数的具体用法?C++ update_tree怎么用?C++ update_tree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了update_tree函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: update_treevoid update_tree (struct node*node, int old_value, int new_value) { if (node != null) { if (node->value == old_value) { node->value = new_value; } else { if (node->value > old_value) { update_tree (node->left, old_value, new_value); } else { update_tree (node->right, old_value, new_value); } } }}
开发者ID:ravifreek63,项目名称:memory_manager,代码行数:13,
示例2: update_tree void update_tree(int L, int R, int fn, int id){ if (L == R){ multiset<int>::reverse_iterator ptr=D[V[L]].rbegin(); tree[id].mxL = tree[id].mxR = tree[id].mx = *ptr; ptr++; tree[id].mx = max(-INF,tree[id].mx+(*ptr)); return ; } int M=(L+R)/2; if (fn <= M) update_tree(L,M,fn,id*2+1); else update_tree(M+1,R,fn,id*2+2); pushUp(L,R,id); }
开发者ID:CoderINusE,项目名称:bcw_codebook,代码行数:13,
示例3: update_treevoid update_tree(int node, int left, int right, int u, int v, long long val) { lazy_update(node); if (u > right || v < left) return; if (u <= left && v >= right) { nodes[node] += val; lazy[2*node] += val; lazy[2*node+1] += val; return; } int mid = (left+right)/2; update_tree(2*node, left, mid, u, v, val); update_tree(2*node+1, mid+1, right, u, v, val); nodes[node] = max(nodes[2*node], nodes[2*node+1]);}
开发者ID:quoctrong288,项目名称:acm_notebook_2016,代码行数:14,
示例4: toggle_sym_valuestatic void toggle_sym_value(struct menu *menu){ if (!menu->sym) return; sym_toggle_tristate_value(menu->sym); if (view_mode == FULL_VIEW) update_tree(&rootmenu, NULL); else if (view_mode == SPLIT_VIEW) { update_tree(browsed, NULL); display_list(); } else if (view_mode == SINGLE_VIEW) display_tree_part(); //fixme: keep exp/coll}
开发者ID:OpenHMR,项目名称:Open-HMR600,代码行数:15,
示例5: renderer_edited/* Change hex/int/string value in the cell */static void renderer_edited(GtkCellRendererText * cell, const gchar * path_string, const gchar * new_text, gpointer user_data){ GtkTreePath *path = gtk_tree_path_new_from_string(path_string); GtkTreeIter iter; const char *old_def, *new_def; struct menu *menu; struct symbol *sym; if (!gtk_tree_model_get_iter(model2, &iter, path)) return; gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1); sym = menu->sym; gtk_tree_model_get(model2, &iter, COL_VALUE, &old_def, -1); new_def = new_text; sym_set_string_value(sym, new_def); config_changed = TRUE; update_tree(&rootmenu, NULL); gtk_tree_path_free(path);}
开发者ID:OpenHMR,项目名称:Open-HMR600,代码行数:27,
示例6: ERR_FAIL_CONDvoid ConnectionsDialog::_connect() { TreeItem *it = tree->get_selected(); ERR_FAIL_COND(!it); String signal=it->get_metadata(0).operator Dictionary()["name"]; NodePath dst_path=connect_dialog->get_dst_path(); Node *target = node->get_node(dst_path); ERR_FAIL_COND(!target); StringName dst_method=connect_dialog->get_dst_method(); bool defer=connect_dialog->get_deferred(); Vector<Variant> binds = connect_dialog->get_binds(); StringArray args = it->get_metadata(0).operator Dictionary()["args"]; undo_redo->create_action("Connect '"+signal+"' to '"+String(dst_method)+"'"); undo_redo->add_do_method(node,"connect",signal,target,dst_method,binds,CONNECT_PERSIST | (defer?CONNECT_DEFERRED:0)); undo_redo->add_undo_method(node,"disconnect",signal,target,dst_method); undo_redo->add_do_method(this,"update_tree"); undo_redo->add_undo_method(this,"update_tree"); undo_redo->commit_action(); if (connect_dialog->get_make_callback()) { print_line("request connect"); editor->emit_signal("script_add_function_request",target,dst_method,args); hide(); } update_tree();}
开发者ID:Ranmus,项目名称:godot,代码行数:33,
示例7: ptree_periodicstatic void ptree_periodic(struct wdgt *w){ DBG("**** building process tree root %d *****", tree_root); update_tree(mark_del); delete_tree_lines(w); synchronize(w); ptreeinfo(w, 1);}
开发者ID:mtsuszycki,项目名称:whowatch,代码行数:8,
示例8: set_titlevoid CreateDialog::set_base_type(const String& p_base) { set_title(vformat("Create %s Type",p_base)); if (base==p_base) return; base=p_base; if (is_inside_scene()) update_tree();}
开发者ID:SasoriOlkof,项目名称:godot,代码行数:10,
示例9: set_titlevoid CreateDialog::set_base_type(const String& p_base) { set_title("Create "+p_base+" Type"); if (base==p_base) return; base=p_base; if (is_inside_scene()) update_tree(); }
开发者ID:AwsomeGameEngine,项目名称:godot,代码行数:10,
示例10: update int update(int x){ int u=V.back(); int p=fa[u]; if (p) D[p].erase(D[p].find(faW[u]+tree[0].mxR)); ans.erase(ans.find(tree[0].mx)); update_tree(0,n-1,at[x],0); ans.insert(tree[0].mx); if (p) D[p].insert(faW[u]+tree[0].mxR); return p; }
开发者ID:CoderINusE,项目名称:bcw_codebook,代码行数:10,
示例11: change_sym_value/* Change the value of a symbol and update the tree */static void change_sym_value(struct menu *menu, gint col){ struct symbol *sym = menu->sym; tristate oldval, newval; if (!sym) return; if (col == COL_NO) newval = no; else if (col == COL_MOD) newval = mod; else if (col == COL_YES) newval = yes; else return; switch (sym_get_type(sym)) { case S_BOOLEAN: case S_TRISTATE: oldval = sym_get_tristate_value(sym); if (!sym_tristate_within_range(sym, newval)) newval = yes; sym_set_tristate_value(sym, newval); config_changed = TRUE; if (view_mode == FULL_VIEW) update_tree(&rootmenu, NULL); else if (view_mode == SPLIT_VIEW) { update_tree(browsed, NULL); display_list(); } else if (view_mode == SINGLE_VIEW) display_tree_part(); //fixme: keep exp/coll break; case S_INT: case S_HEX: case S_STRING: default: break; }}
开发者ID:OpenHMR,项目名称:Open-HMR600,代码行数:42,
示例12: Dictionaryvoid ConnectionsDock::_connect_pressed() { TreeItem *item = tree->get_selected(); if (!item) { //no idea how this happened, but disable connect_button->set_disabled(true); return; } if (item->get_parent()==tree->get_root() || item->get_parent()->get_parent()==tree->get_root()) { //a signal - connect String signal=item->get_metadata(0).operator Dictionary()["name"]; String signalname=signal; String midname=node->get_name(); for(int i=0;i<midname.length();i++) { CharType c = midname[i]; if ((c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9') || c=='_') { //all good } else if (c==' ') { c='_'; } else { midname.remove(i); i--; continue; } midname[i]=c; } connect_dialog->edit(node); connect_dialog->popup_centered_ratio(); connect_dialog->set_title(TTR("Connecting Signal:")+" "+signalname); connect_dialog->set_dst_method("_on_"+midname+"_"+signal); connect_dialog->set_dst_node(node->get_owner()?node->get_owner():node); } else { //a slot- disconnect Connection c=item->get_metadata(0); ERR_FAIL_COND(c.source!=node); //shouldn't happen but...bugcheck undo_redo->create_action(TTR("Create Subscription")); undo_redo->add_do_method(node,"disconnect",c.signal,c.target,c.method); undo_redo->add_undo_method(node,"connect",c.signal,c.target,c.method,Vector<Variant>(),c.flags); undo_redo->add_do_method(this,"update_tree"); undo_redo->add_undo_method(this,"update_tree"); undo_redo->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(),"update_tree"); //to force redraw of scene tree undo_redo->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(),"update_tree"); //to force redraw of scene tree undo_redo->commit_action(); c.source->disconnect(c.signal,c.target,c.method); update_tree(); }}
开发者ID:baekdahl,项目名称:godot,代码行数:53,
示例13: connectvoid CreateDialog::_notification(int p_what) { if (p_what==NOTIFICATION_READY) { connect("confirmed",this,"_create"); update_tree(); } if (p_what==NOTIFICATION_DRAW) { //RID ci = get_canvas_item(); //get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size())); } }
开发者ID:AwsomeGameEngine,项目名称:godot,代码行数:12,
示例14: update_tree/* Update tree to be identical tree but with nodes reallocated * with probability pupdate. This avoids writing to vector slots * if unecessary. */static obj_t update_tree(mps_ap_t ap, obj_t oldtree, unsigned d) { obj_t tree; size_t i; if (oldtree == objNULL || d == 0) return oldtree; if (rnd_double() < pupdate) { tree = mkvector(ap, width); for (i = 0; i < width; ++i) { aset(tree, i, update_tree(ap, aref(oldtree, i), d - 1)); } } else { tree = oldtree; for (i = 0; i < width; ++i) { obj_t oldsubtree = aref(oldtree, i); obj_t subtree = update_tree(ap, oldsubtree, d - 1); if (subtree != oldsubtree) { aset(tree, i, subtree); } } } return tree;}
开发者ID:aseaday,项目名称:mps-temporary,代码行数:25,
示例15: _open_connection_dialogvoid ConnectionsDock::_connect_pressed() { TreeItem *item = tree->get_selected(); if (!item) { connect_button->set_disabled(true); return; } if (_is_item_signal(*item)) { _open_connection_dialog(*item); } else { _disconnect(*item); update_tree(); }}
开发者ID:93i,项目名称:godot,代码行数:15,
示例16: mktreestatic void *gc_tree(gcthread_t thread) { unsigned i, j; mps_ap_t ap = thread->ap; obj_t leaf = pinleaf ? mktree(ap, 1, objNULL) : objNULL; for (i = 0; i < niter; ++i) { obj_t tree = mktree(ap, depth, leaf); for (j = 0 ; j < npass; ++j) { if (preuse < 1.0) tree = new_tree(ap, tree, depth); if (pupdate > 0.0) tree = update_tree(ap, tree, depth); } } return NULL;}
开发者ID:aseaday,项目名称:mps-temporary,代码行数:15,
示例17: update_tree void update_tree (int tree_index,int curr_L,int curr_R,int L,int R,T value,Func f) { /* * Out Of Bounds Condition */ if ((curr_L > curr_R) || (curr_L > R) || (curr_R < L)) return; /* * Leaf Node Condition */ if (curr_L == curr_R) { /* * Modify Here To Get Other Update Functions */ tree[tree_index] += value; return; } /* * Recursively Update The Left Half And The Right Half */ update_tree (tree_index*2,curr_L,(curr_L+curr_R)/2,L,R,value,f); update_tree ((tree_index*2)+1,((curr_L+curr_R)/2)+1,curr_R,L,R,value,f); /* * After Completing Updating The Left And Right Subtree Update The Current Node */ tree[tree_index] = f(tree[tree_index*2],tree[(tree_index*2)+1]); }
开发者ID:MadaraUchiha-314,项目名称:Data-Structures-Library,代码行数:36,
示例18: ERR_FAIL_COND/*Post-ConnectDialog callback for creating/editing connections.Creates or edits connections based on state of the ConnectDialog when "Connect" is pressed.*/void ConnectionsDock::_make_or_edit_connection() { TreeItem *it = tree->get_selected(); ERR_FAIL_COND(!it); NodePath dst_path = connect_dialog->get_dst_path(); Node *target = selectedNode->get_node(dst_path); ERR_FAIL_COND(!target); Connection cToMake; cToMake.source = connect_dialog->get_source(); cToMake.target = target; cToMake.signal = connect_dialog->get_signal_name(); cToMake.method = connect_dialog->get_dst_method_name(); cToMake.binds = connect_dialog->get_binds(); bool defer = connect_dialog->get_deferred(); bool oshot = connect_dialog->get_oneshot(); cToMake.flags = CONNECT_PERSIST | (defer ? CONNECT_DEFERRED : 0) | (oshot ? CONNECT_ONESHOT : 0); //conditions to add function, must have a script and must have a method bool add_script_function = !target->get_script().is_null() && !ClassDB::has_method(target->get_class(), cToMake.method); PoolStringArray script_function_args; if (add_script_function) { // pick up args here before "it" is deleted by update_tree script_function_args = it->get_metadata(0).operator Dictionary()["args"]; for (int i = 0; i < cToMake.binds.size(); i++) { script_function_args.append("extra_arg_" + itos(i)); } } if (connect_dialog->is_editing()) { _disconnect(*it); _connect(cToMake); } else { _connect(cToMake); } // IMPORTANT NOTE: _disconnect and _connect cause an update_tree, // which will delete the object "it" is pointing to it = NULL; if (add_script_function) { editor->emit_signal("script_add_function_request", target, cToMake.method, script_function_args); hide(); } update_tree();}
开发者ID:Valentactive,项目名称:godot,代码行数:52,
示例19: switchvoid ConnectionsDock::_handle_slot_menu_option(int option) { TreeItem *item = tree->get_selected(); if (!item) return; switch (option) { case EDIT: { Connection c = item->get_metadata(0); _open_connection_dialog(c); } break; case GO_TO_SCRIPT: { _go_to_script(*item); } break; case DISCONNECT: { _disconnect(*item); update_tree(); } break; }}
开发者ID:93i,项目名称:godot,代码行数:21,
示例20: ERR_FAIL_CONDvoid ConnectionsDock::_connect() { TreeItem *it = tree->get_selected(); ERR_FAIL_COND(!it); String signal=it->get_metadata(0).operator Dictionary()["name"]; NodePath dst_path=connect_dialog->get_dst_path(); Node *target = node->get_node(dst_path); ERR_FAIL_COND(!target); StringName dst_method=connect_dialog->get_dst_method(); bool defer=connect_dialog->get_deferred(); bool oshot=connect_dialog->get_oneshot(); Vector<Variant> binds = connect_dialog->get_binds(); PoolStringArray args = it->get_metadata(0).operator Dictionary()["args"]; int flags = CONNECT_PERSIST | (defer?CONNECT_DEFERRED:0) | (oshot?CONNECT_ONESHOT:0); undo_redo->create_action(vformat(TTR("Connect '%s' to '%s'"),signal,String(dst_method))); undo_redo->add_do_method(node,"connect",signal,target,dst_method,binds,flags); undo_redo->add_undo_method(node,"disconnect",signal,target,dst_method); undo_redo->add_do_method(this,"update_tree"); undo_redo->add_undo_method(this,"update_tree"); undo_redo->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(),"update_tree"); //to force redraw of scene tree undo_redo->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(),"update_tree"); //to force redraw of scene tree undo_redo->commit_action(); if (connect_dialog->get_make_callback()) { print_line("request connect"); editor->emit_signal("script_add_function_request",target,dst_method,args); hide(); } update_tree();}
开发者ID:baekdahl,项目名称:godot,代码行数:38,
示例21: QDialognew_music_d::new_music_d(QWidget *parent) : QDialog(parent), ui(new Ui::new_music_d){ ui->setupUi(this); //CHECK DIR QDir dir = QDir::current(); if (!dir.exists("music")) if(!dir.mkdir("music")) QMessageBox::warning(this, tr("Dance class"), tr("Cannot create directory 'music'.")); model = new QFileSystemModel; model->setRootPath(dir.absoluteFilePath("music")); update_tree(); connect(ui->treeView, SIGNAL(clicked(QModelIndex)), this, SLOT(check_choice(QModelIndex))); connect(ui->treeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(add_choice(QModelIndex))); connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(create_music())); connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));}
开发者ID:lisitsynSA,项目名称:Dance,代码行数:24,
示例22: update_treevoid CreateDialog::_text_changed(String p_text) { update_tree();}
开发者ID:AwsomeGameEngine,项目名称:godot,代码行数:4,
示例23: switchvoid SceneTreeEditor::_subscene_option(int p_idx) { Object *obj = ObjectDB::get_instance(instance_node); if (!obj) return; Node *node = obj->cast_to<Node>(); if (!node) return; switch(p_idx) { case SCENE_MENU_EDITABLE_CHILDREN: { bool editable = EditorNode::get_singleton()->get_edited_scene()->is_editable_instance(node); editable = !editable; //node->set_instance_children_editable(editable); EditorNode::get_singleton()->get_edited_scene()->set_editable_instance(node,editable); instance_menu->set_item_checked(0,editable); if (editable) { node->set_scene_instance_load_placeholder(false); instance_menu->set_item_checked(1,false); } _update_tree(); } break; case SCENE_MENU_USE_PLACEHOLDER: { bool placeholder = node->get_scene_instance_load_placeholder(); placeholder = !placeholder; //node->set_instance_children_editable(editable); if (placeholder) { EditorNode::get_singleton()->get_edited_scene()->set_editable_instance(node,false); } node->set_scene_instance_load_placeholder(placeholder); instance_menu->set_item_checked(0,false); instance_menu->set_item_checked(1,placeholder); _update_tree(); } break; case SCENE_MENU_OPEN: { emit_signal("open",node->get_filename()); } break; case SCENE_MENU_CLEAR_INHERITANCE: { clear_inherit_confirm->popup_centered_minsize(); } break; case SCENE_MENU_CLEAR_INSTANCING: { Node*root=EditorNode::get_singleton()->get_edited_scene(); if (!root) break; ERR_FAIL_COND(node->get_filename()==String()); undo_redo->create_action("Discard Instancing"); undo_redo->add_do_method(node,"set_filename",""); undo_redo->add_undo_method(node,"set_filename",node->get_filename()); _node_replace_owner(node,node,root); undo_redo->add_do_method(this,"update_tree"); undo_redo->add_undo_method(this,"update_tree"); undo_redo->commit_action(); } break; case SCENE_MENU_OPEN_INHERITED: { if (node && node->get_scene_inherited_state().is_valid()) { emit_signal("open",node->get_scene_inherited_state()->get_path()); } } break; case SCENE_MENU_CLEAR_INHERITANCE_CONFIRM: { if (node && node->get_scene_inherited_state().is_valid()) { node->set_scene_inherited_state(Ref<SceneState>()); update_tree(); EditorNode::get_singleton()->get_property_editor()->update_tree(); } } break; }}
开发者ID:WalasPrime,项目名称:godot,代码行数:91,
示例24: assert/* ********************************************************************* Builds a new tree ******************************************************************* */void UniformCostSearch::build(ALEState & state) { assert(p_root == NULL); p_root = new TreeNode(NULL, state, NULL, UNDEFINED, 0); update_tree(); is_built = true; }
开发者ID:jinnaiyuu,项目名称:Atari-iterative-width,代码行数:9,
示例25: update_tree/* * Update the tree by adding/removing entries * Does not change other nodes */static void update_tree(struct menu *src, GtkTreeIter * dst){ struct menu *child1; GtkTreeIter iter, tmp; GtkTreeIter *child2 = &iter; gboolean valid; GtkTreeIter *sibling; struct symbol *sym; struct property *prop; struct menu *menu1, *menu2; if (src == &rootmenu) indent = 1; valid = gtk_tree_model_iter_children(model2, child2, dst); for (child1 = src->list; child1; child1 = child1->next) { prop = child1->prompt; sym = child1->sym; reparse: menu1 = child1; if (valid) gtk_tree_model_get(model2, child2, COL_MENU, &menu2, -1); else menu2 = NULL; // force adding of a first child#ifdef DEBUG printf("%*c%s | %s/n", indent, ' ', menu1 ? menu_get_prompt(menu1) : "nil", menu2 ? menu_get_prompt(menu2) : "nil");#endif if (!menu_is_visible(child1) && !show_all) { // remove node if (gtktree_iter_find_node(dst, menu1) != NULL) { memcpy(&tmp, child2, sizeof(GtkTreeIter)); valid = gtk_tree_model_iter_next(model2, child2); gtk_tree_store_remove(tree2, &tmp); if (!valid) return; // next parent else goto reparse; // next child } else continue; } if (menu1 != menu2) { if (gtktree_iter_find_node(dst, menu1) == NULL) { // add node if (!valid && !menu2) sibling = NULL; else sibling = child2; gtk_tree_store_insert_before(tree2, child2, dst, sibling); set_node(child2, menu1, fill_row(menu1)); if (menu2 == NULL) valid = TRUE; } else { // remove node memcpy(&tmp, child2, sizeof(GtkTreeIter)); valid = gtk_tree_model_iter_next(model2, child2); gtk_tree_store_remove(tree2, &tmp); if (!valid) return; // next parent else goto reparse; // next child } } else if (sym && (sym->flags & SYMBOL_CHANGED)) { set_node(child2, menu1, fill_row(menu1)); } indent++; update_tree(child1, child2); indent--; valid = gtk_tree_model_iter_next(model2, child2); }}
开发者ID:OpenHMR,项目名称:Open-HMR600,代码行数:85,
示例26: append_nodevoid append_node(char* window, struct node *tree, int *root, struct param p){ int start = p.start; int end = p.end; uint32_t n = p.n; uint16_t l = p.l; int offset = p.offset; int index; int w_pos; int w_offset; int diff_offset; int tmp_node; int tmp_father; int cmp = 0; w_offset = (offset % n); /* The tree is empty, append the ROOT node */ if(*root == UNUSED) { *root = w_offset; tree[w_offset].pos = offset; tree[w_offset].father = UNUSED; tree[w_offset].left = UNUSED; tree[w_offset].right = UNUSED; return; } /* The tree vector is full, delete the node with the 'w_offset' index and reorder the tree */ if(tree[w_offset].father != FREE) { update_tree(tree, root, w_offset); } /* Start from the ROOT */ index = *root; while(1) { diff_offset = offset - tree[index].pos; /* Properly set the window offset */ if(offset <= n) { w_pos = tree[index].pos; } else { w_pos = n - diff_offset; } cmp = memcmp(window + start + w_pos, window + end, l); /* Found the same node, so replace the node */ if(cmp == 0) { /* The found node is the ROOT node, so set the ROOT parameters */ if(index == *root) { *root = w_offset; tree[w_offset].father = UNUSED; } /* Set the node (that is not the ROOT node) parameters */ else { tmp_father = tree[index].father; if(tree[tmp_father].left == index) { tree[tmp_father].left = w_offset; // left son } else { tree[tmp_father].right = w_offset; // right son } } /********************************************** Replace the index node with the w_offset node **********************************************/ /* Update the hierarchy: father -> son */ if(tree[index].left != UNUSED) { tmp_node = tree[index].left; // left son tree[tmp_node].father = w_offset; } if(tree[index].right != UNUSED) { tmp_node = tree[index].right; // right son tree[tmp_node].father = w_offset; } /* Overwrite the replaced node */ tree[index].father = FREE; tree[w_offset] = tree[index]; tree[w_offset].pos = offset; break; } /* The new one is smaller than the current node..."enjoy the LEFT side of the tree, Luke!" */ if(cmp > 0) { tmp_father = index; index = tree[tmp_father].left; } /* The new one is greater than the current one..."enjoy the RIGHT side of the tree, Luke!" */ else { tmp_father = index; index = tree[tmp_father].right;//.........这里部分代码省略.........
开发者ID:neoben,项目名称:LZ77,代码行数:101,
示例27: on_show_debug_info1_activatevoidon_show_debug_info1_activate(GtkMenuItem * menuitem, gpointer user_data){ show_debug = GTK_CHECK_MENU_ITEM(menuitem)->active; update_tree(&rootmenu, NULL);}
开发者ID:OpenHMR,项目名称:Open-HMR600,代码行数:6,
示例28: mcmcbas//.........这里部分代码省略......... INTEGER(counts)[old_loc] += 1; for (i = 0; i < n; i++) { /* store in opposite order so nth variable is first */ real_model[n-1-i] = (double) modelold[vars[i].index]; REAL(MCMCprobs)[vars[i].index] += (double) modelold[vars[i].index]; } // Update SSgam = gamma gamma^T + SSgam F77_NAME(dsyr)("U", &n, &one, &real_model[0], &inc, &SSgam[0], &n); m++; } for (i = 0; i < n; i++) { REAL(MCMCprobs)[vars[i].index] /= (double) m; } // Rprintf("/n%d /n", nUnique);// Compute marginal probabilities mcurrent = nUnique; compute_modelprobs(modelprobs, logmarg, priorprobs,mcurrent); compute_margprobs(modelspace, modeldim, modelprobs, probs, mcurrent, p);// Now sample W/O Replacement// Rprintf("NumUnique Models Accepted %d /n", nUnique); INTEGER(NumUnique)[0] = nUnique; if (nUnique < k) { update_probs(probs, vars, mcurrent, k, p); update_tree(modelspace, tree, modeldim, vars, k,p,n,mcurrent, modelwork); for (m = nUnique; m < k; m++) { for (i = n; i < p; i++) { INTEGER(modeldim)[m] += model[vars[i].index]; } branch = tree; for (i = 0; i< n; i++) { pigamma[i] = 1.0; bit = withprob(branch->prob); /* branch->done += 1; */ if (bit == 1) { for (j=0; j<=i; j++) pigamma[j] *= branch->prob; if (i < n-1 && branch->one == NULL) branch->one = make_node(vars[i+1].prob); if (i == n-1 && branch->one == NULL) branch->one = make_node(0.0); branch = branch->one; } else { for (j=0; j<=i; j++) pigamma[j] *= (1.0 - branch->prob); if (i < n-1 && branch->zero == NULL) branch->zero = make_node(vars[i+1].prob); if (i == n-1 && branch->zero == NULL) branch->zero = make_node(0.0); branch = branch->zero; } model[vars[i].index] = bit; INTEGER(modeldim)[m] += bit; }
开发者ID:cran,项目名称:BAS,代码行数:67,
示例29: update_treevoid GroupsEditor::set_current(Node* p_node) { node=p_node; update_tree();}
开发者ID:03050903,项目名称:godot,代码行数:5,
注:本文中的update_tree函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ update_tri_layer函数代码示例 C++ update_stmt函数代码示例 |