dt_merge_0.cc

来自「这是处理语音信号的程序」· CC 代码 · 共 54 行

CC
54
字号
// file: dt_merge_0.cc//// isip include files//#include "decision_tree.h"#include "decision_tree_constants.h"// method: merge_nodes_cc//// arguments: none//    Dt_node* dt_node1_a: (input) the node to be merged//    Dt_node* dt_node2_a: (input) the node to be merged// // return: a logical_1 indicating status//// this method merges two nodes and create a new node//Dt_node* Decision_tree::merge_nodes_cc(Dt_node* dt_node1_a,				       Dt_node* dt_node2_a) {    // make sure memory is allocated for the new node  //  Dt_node* new_node = new Dt_node();  // get the number of states   //  int_4 num_states_1 = dt_node1_a->get_num_states_cc();  int_4 num_states_2 = dt_node2_a->get_num_states_cc();  int_4 num_states = num_states_1 + num_states_2;  // initialize a new state index array  //  int_4* states_ind = new int_4[num_states];  int_4* states_ind_1 = dt_node1_a->get_state_index_cc();  int_4* states_ind_2 = dt_node2_a->get_state_index_cc();    memcpy(states_ind, states_ind_1, num_states_1*sizeof(int_4));  memcpy(&states_ind[num_states_1], states_ind_2, num_states_2*sizeof(int_4));  // set the new node  //  new_node->set_states_cc(num_states, states_ind);  // free memory  //  delete [] states_ind;  // exit gracefully  //  return new_node;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?